abstract-utilities 0.2.2.492__py3-none-any.whl → 0.2.2.493__py3-none-any.whl
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.
- abstract_utilities/read_write_utils.py +37 -20
- {abstract_utilities-0.2.2.492.dist-info → abstract_utilities-0.2.2.493.dist-info}/METADATA +1 -1
- {abstract_utilities-0.2.2.492.dist-info → abstract_utilities-0.2.2.493.dist-info}/RECORD +5 -5
- {abstract_utilities-0.2.2.492.dist-info → abstract_utilities-0.2.2.493.dist-info}/WHEEL +0 -0
- {abstract_utilities-0.2.2.492.dist-info → abstract_utilities-0.2.2.493.dist-info}/top_level.txt +0 -0
|
@@ -250,27 +250,44 @@ def read_from_file(file_path,**kwargs):
|
|
|
250
250
|
with open(file_path, "r", encoding="utf-8") as f:
|
|
251
251
|
return f.read()
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
|
|
254
|
+
def copy_dirs(dirs, dst_root, src_rel=None, **kwargs):
|
|
255
|
+
"""
|
|
256
|
+
Recursively copy directory structures (without files) from dirs → dst_root.
|
|
257
|
+
"""
|
|
254
258
|
for src in dirs:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
make_path(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
else
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
259
|
+
# build destination path preserving relative structure
|
|
260
|
+
dst_path = make_relative_path(src, src_rel, dst_root, **kwargs) if src_rel else dst_root
|
|
261
|
+
make_path(dst_path, **kwargs) # ensures directory exists
|
|
262
|
+
print(f"✅ created directory: {dst_path}")
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def copy_file(src, dst_root, src_rel=None, **kwargs):
|
|
266
|
+
"""
|
|
267
|
+
Copy a single file to dst_root, preserving relative structure if src_rel provided.
|
|
268
|
+
Supports remote copy via read/write.
|
|
269
|
+
"""
|
|
270
|
+
# derive destination file path
|
|
271
|
+
dst_path = make_relative_path(src, src_rel, dst_root, **kwargs) if src_rel else os.path.join(dst_root, os.path.basename(src))
|
|
272
|
+
make_path(dst_path, **kwargs)
|
|
273
|
+
|
|
274
|
+
if get_user_pass_host_key(**kwargs): # remote mode
|
|
275
|
+
contents = read_from_file(src, **kwargs)
|
|
276
|
+
write_to_file(contents=contents, file_path=dst_path, **kwargs)
|
|
277
|
+
else: # local
|
|
278
|
+
os.makedirs(os.path.dirname(dst_path), exist_ok=True)
|
|
279
|
+
shutil.copy2(src, dst_path)
|
|
280
|
+
|
|
281
|
+
print(f"📄 copied {src} → {dst_path}")
|
|
282
|
+
return dst_path
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def copy_files(files, dst_root, src_rel=None, **kwargs):
|
|
286
|
+
"""
|
|
287
|
+
Copy a list of files to dst_root.
|
|
288
|
+
"""
|
|
289
|
+
for src in files:
|
|
290
|
+
copy_file(src=src, dst_root=dst_root, src_rel=src_rel, **kwargs)
|
|
274
291
|
|
|
275
292
|
def create_and_read_file(*args, **kwargs):
|
|
276
293
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abstract_utilities
|
|
3
|
-
Version: 0.2.2.
|
|
3
|
+
Version: 0.2.2.493
|
|
4
4
|
Summary: abstract_utilities is a collection of utility modules providing a variety of functions to aid in tasks such as data comparison, list manipulation, JSON handling, string manipulation, mathematical computations, and time operations.
|
|
5
5
|
Home-page: https://github.com/AbstractEndeavors/abstract_utilities
|
|
6
6
|
Author: putkoff
|
|
@@ -14,7 +14,7 @@ abstract_utilities/log_utils.py,sha256=W74Y-CmdQP4Kj88HmAgejVxWgyWlvgCKMwLvOfyFf
|
|
|
14
14
|
abstract_utilities/math_utils.py,sha256=0o1ls1En03UAkYmxTBildCCJDfHygmNuvVnrNrLYtK0,6578
|
|
15
15
|
abstract_utilities/parse_utils.py,sha256=Z5OGRwHuzCzY91fz0JJojk1BPAo1XF2quNNLuBF4_Vk,18602
|
|
16
16
|
abstract_utilities/path_utils.py,sha256=X_U9cPBbNu5Wi0F3hQE0gXQX1gfhzxhxALbairTEOZU,19252
|
|
17
|
-
abstract_utilities/read_write_utils.py,sha256=
|
|
17
|
+
abstract_utilities/read_write_utils.py,sha256=vhJ4E6LXruNyNtYs54j8r9UVYYl8TTkgnV2vScdSTmg,10897
|
|
18
18
|
abstract_utilities/safe_utils.py,sha256=_uoZny6dJjopVakOiaf0UIZcvRRXMh51FpfDUooe0xY,3733
|
|
19
19
|
abstract_utilities/string_clean.py,sha256=oQv85J-mA4sP2NJwbTI-1k0RXw7V0AmqZolYaAZvex4,6916
|
|
20
20
|
abstract_utilities/string_utils.py,sha256=PnII0wFQBchVzFjhvEHP9ej1zxLehsRKodtc8Qol4-8,1645
|
|
@@ -86,7 +86,7 @@ abstract_utilities/ssh_utils/classes.py,sha256=3Q9BfLpyagNFYyiF4bt-5UCezeUJv9NK9
|
|
|
86
86
|
abstract_utilities/ssh_utils/imports.py,sha256=oX8WAv-pkhizzko_h3fIUp9Vhsse4nR7RN2vwONxIx0,317
|
|
87
87
|
abstract_utilities/ssh_utils/pexpect_utils.py,sha256=JBdOIXBTXAqE5TrsFjmPWJgwSaWyRJN8rbJ6y3_zKPY,10556
|
|
88
88
|
abstract_utilities/ssh_utils/utils.py,sha256=smUWAx3nW1h0etTndJ_te9bkUX5YzQ8kYd9_gD1TXLk,4882
|
|
89
|
-
abstract_utilities-0.2.2.
|
|
90
|
-
abstract_utilities-0.2.2.
|
|
91
|
-
abstract_utilities-0.2.2.
|
|
92
|
-
abstract_utilities-0.2.2.
|
|
89
|
+
abstract_utilities-0.2.2.493.dist-info/METADATA,sha256=5fonFmKwTqHgagaRcRtNHytPy7ZT9K2X9Cq03iWpjbw,28108
|
|
90
|
+
abstract_utilities-0.2.2.493.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
91
|
+
abstract_utilities-0.2.2.493.dist-info/top_level.txt,sha256=BF0GZ0xVFfN1K-hFIWPO3viNsOs1sSF86n1vHBg39FM,19
|
|
92
|
+
abstract_utilities-0.2.2.493.dist-info/RECORD,,
|
|
File without changes
|
{abstract_utilities-0.2.2.492.dist-info → abstract_utilities-0.2.2.493.dist-info}/top_level.txt
RENAMED
|
File without changes
|