kkpyutil 1.30.0__tar.gz → 1.32.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/PKG-INFO +1 -1
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/kkpyutil.py +9 -6
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/pyproject.toml +1 -1
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/LICENSE +0 -0
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/README.md +0 -0
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/kkpyutil_helper/windows/kkttssave.ps1 +0 -0
- {kkpyutil-1.30.0 → kkpyutil-1.32.0}/kkpyutil_helper/windows/kkttsspeak.ps1 +0 -0
|
@@ -521,11 +521,11 @@ def save_plist(path, my_map, binary=False):
|
|
|
521
521
|
plistlib.dump(my_map, fp, fmt=fmt)
|
|
522
522
|
|
|
523
523
|
|
|
524
|
-
def substitute_keywords_in_file(file, str_map, useliteral=False):
|
|
525
|
-
with open(file) as f:
|
|
524
|
+
def substitute_keywords_in_file(file, str_map, useliteral=False, encoding=TXT_CODEC):
|
|
525
|
+
with open(file, encoding=encoding) as f:
|
|
526
526
|
original = f.read()
|
|
527
527
|
updated = substitute_keywords(original, str_map, useliteral)
|
|
528
|
-
with open(file, 'w') as f:
|
|
528
|
+
with open(file, 'w', encoding=encoding) as f:
|
|
529
529
|
f.write(updated)
|
|
530
530
|
|
|
531
531
|
|
|
@@ -2772,14 +2772,17 @@ def collect_file_tree(root):
|
|
|
2772
2772
|
return [file for file in glob.glob(osp.join(root, '**'), recursive=True) if osp.isfile(file)]
|
|
2773
2773
|
|
|
2774
2774
|
|
|
2775
|
-
def merge_namespaces(to_ns: types.SimpleNamespace, from_ns: types.SimpleNamespace):
|
|
2775
|
+
def merge_namespaces(to_ns: types.SimpleNamespace, from_ns: types.SimpleNamespace, trim_from=False):
|
|
2776
2776
|
"""
|
|
2777
2777
|
- merge from_ns into to_ns
|
|
2778
2778
|
- to_ns must be a namespace
|
|
2779
2779
|
- from_ns can be a dict or a namespace
|
|
2780
2780
|
"""
|
|
2781
|
-
|
|
2782
|
-
|
|
2781
|
+
from_ = vars(from_ns)
|
|
2782
|
+
to_ = vars(to_ns)
|
|
2783
|
+
from_keys = [key for key in from_ if key in to_] if trim_from else list(from_.keys())
|
|
2784
|
+
for k in from_keys:
|
|
2785
|
+
setattr(to_ns, k, from_[k])
|
|
2783
2786
|
return to_ns
|
|
2784
2787
|
|
|
2785
2788
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|