atomicshop 2.16.18__py3-none-any.whl → 2.16.20__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.
Potentially problematic release.
This version of atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/file_io/file_io.py +2 -1
- atomicshop/filesystem.py +74 -29
- atomicshop/mitm/recs_files.py +1 -1
- atomicshop/wrappers/loggingw/reading.py +1 -2
- {atomicshop-2.16.18.dist-info → atomicshop-2.16.20.dist-info}/METADATA +1 -1
- {atomicshop-2.16.18.dist-info → atomicshop-2.16.20.dist-info}/RECORD +10 -10
- {atomicshop-2.16.18.dist-info → atomicshop-2.16.20.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.16.18.dist-info → atomicshop-2.16.20.dist-info}/WHEEL +0 -0
- {atomicshop-2.16.18.dist-info → atomicshop-2.16.20.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/file_io/file_io.py
CHANGED
|
@@ -21,7 +21,8 @@ def write_file_decorator(function_name):
|
|
|
21
21
|
|
|
22
22
|
print_api(message=f"Writing file: {kwargs['file_path']}", **kwargs)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
enable_long_file_path = kwargs.get('enable_long_file_path', False)
|
|
25
|
+
if enable_long_file_path:
|
|
25
26
|
# A simpler string method would be to add '\\?\' to the beginning of the file path.
|
|
26
27
|
# kwargs['file_path'] = rf"\\?\{kwargs['file_path']}"
|
|
27
28
|
|
atomicshop/filesystem.py
CHANGED
|
@@ -422,17 +422,33 @@ def temporary_change_working_directory(new_working_directory: str) -> None:
|
|
|
422
422
|
os.chdir(original_working_directory)
|
|
423
423
|
|
|
424
424
|
|
|
425
|
-
def move_file(source_file_path: str,
|
|
425
|
+
def move_file(source_file_path: str, target_directory: str, overwrite: bool = True) -> None:
|
|
426
426
|
"""
|
|
427
427
|
The function moves file from source to target.
|
|
428
428
|
|
|
429
429
|
:param source_file_path: string, full path to source file.
|
|
430
|
-
:param
|
|
430
|
+
:param target_directory: string, full path to target directory.
|
|
431
431
|
:param overwrite: boolean, if 'False', then the function will not overwrite the file if it exists.
|
|
432
432
|
|
|
433
|
+
Example:
|
|
434
|
+
Before move:
|
|
435
|
+
Source file = 'C:/Users/user1/Downloads/file-to-move.txt'
|
|
436
|
+
Move to directory = 'C:/Users/user1/Documents'
|
|
437
|
+
|
|
438
|
+
Move:
|
|
439
|
+
source_file_path = 'C:/Users/user1/Downloads/file-to-move.txt'
|
|
440
|
+
target_directory = 'C:/Users/user1/Documents'
|
|
441
|
+
move_file(source_file_path, target_file_path)
|
|
442
|
+
|
|
443
|
+
After move:
|
|
444
|
+
'C:/Users/user1/Downloads'
|
|
445
|
+
'C:/Users/user1/Documents/file-to-move.txt'
|
|
446
|
+
|
|
433
447
|
:return: None
|
|
434
448
|
"""
|
|
435
449
|
|
|
450
|
+
target_file_path = target_directory + os.sep + Path(source_file_path).name
|
|
451
|
+
|
|
436
452
|
# Check if 'no_overwrite' is set to 'True' and if the file exists.
|
|
437
453
|
if not overwrite:
|
|
438
454
|
if is_file_exists(target_file_path):
|
|
@@ -455,12 +471,17 @@ def move_folder(source_directory: str, target_directory: str, overwrite: bool =
|
|
|
455
471
|
------------------------------
|
|
456
472
|
|
|
457
473
|
Example:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
474
|
+
Before move:
|
|
475
|
+
Source folder = 'C:/Users/user1/Downloads/folder-to-move'
|
|
476
|
+
Move to directory = 'C:/Users/user1/Documents'
|
|
477
|
+
|
|
478
|
+
Move:
|
|
479
|
+
source_directory = 'C:/Users/user1/Downloads/folder-to-move'
|
|
480
|
+
target_directory = 'C:/Users/user1/Documents'
|
|
481
|
+
move_folder(source_directory, target_directory)
|
|
461
482
|
|
|
462
|
-
|
|
463
|
-
|
|
483
|
+
Result path of the 'folder-to-move' will be:
|
|
484
|
+
'C:/Users/user1/Documents/folder-to-move'
|
|
464
485
|
|
|
465
486
|
"""
|
|
466
487
|
|
|
@@ -473,14 +494,14 @@ def move_folder(source_directory: str, target_directory: str, overwrite: bool =
|
|
|
473
494
|
shutil.move(source_directory, target_directory)
|
|
474
495
|
|
|
475
496
|
|
|
476
|
-
def
|
|
497
|
+
def move_top_level_files_from_folder_to_folder(
|
|
477
498
|
source_directory: str,
|
|
478
499
|
target_directory: str,
|
|
479
500
|
overwrite: bool = True
|
|
480
501
|
):
|
|
481
502
|
"""
|
|
482
|
-
The function is
|
|
483
|
-
|
|
503
|
+
The function is non-recursive to move only top level files from source directory to target directory
|
|
504
|
+
overwriting existing files.
|
|
484
505
|
|
|
485
506
|
:param source_directory: string, full path to source directory.
|
|
486
507
|
:param target_directory: string, full path to target directory.
|
|
@@ -488,26 +509,50 @@ def move_files_from_folder_to_folder(
|
|
|
488
509
|
"""
|
|
489
510
|
|
|
490
511
|
# Iterate over each item in the source directory
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
source_item = os.path.join(source_directory, item)
|
|
494
|
-
destination_item = os.path.join(target_directory, item)
|
|
512
|
+
top_level_files: list[str] = get_paths_from_directory(
|
|
513
|
+
directory_path=source_directory, get_file=True, recursive=False, simple_list=True)
|
|
495
514
|
|
|
515
|
+
for source_item in top_level_files:
|
|
496
516
|
# Move each item to the destination directory
|
|
497
|
-
move_file(source_file_path=source_item,
|
|
517
|
+
move_file(source_file_path=source_item, target_directory=target_directory, overwrite=overwrite)
|
|
498
518
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
519
|
+
|
|
520
|
+
def move_folder_contents_to_folder(
|
|
521
|
+
source_directory: str,
|
|
522
|
+
target_directory: str,
|
|
523
|
+
overwrite: bool = True
|
|
524
|
+
):
|
|
525
|
+
"""
|
|
526
|
+
The function moves all the contents of the source directory to the target directory.
|
|
527
|
+
If target directory is inside the source directory, this folder will be skipped.
|
|
528
|
+
|
|
529
|
+
:param source_directory: string, full path to source directory.
|
|
530
|
+
:param target_directory: string, full path to target directory.
|
|
531
|
+
:param overwrite: boolean, if 'True', then the function will overwrite the files if they exist.
|
|
532
|
+
"""
|
|
533
|
+
|
|
534
|
+
# Make sure the destination directory exists, if not create it
|
|
535
|
+
os.makedirs(target_directory, exist_ok=True)
|
|
536
|
+
|
|
537
|
+
# Move contents of the source directory to the destination directory
|
|
538
|
+
for item in os.listdir(source_directory):
|
|
539
|
+
s = os.path.join(source_directory, item)
|
|
540
|
+
d = os.path.join(target_directory, item)
|
|
541
|
+
|
|
542
|
+
# if the target directory is inside the source directory, skip it
|
|
543
|
+
if os.path.abspath(target_directory).startswith(os.path.abspath(s)):
|
|
544
|
+
continue
|
|
545
|
+
|
|
546
|
+
if os.path.isdir(s):
|
|
547
|
+
if os.path.exists(d) and not overwrite:
|
|
548
|
+
print(f"Directory {d} already exists. Skipping due to overwrite=False.")
|
|
549
|
+
else:
|
|
550
|
+
shutil.move(s, d)
|
|
551
|
+
else:
|
|
552
|
+
if os.path.exists(d) and not overwrite:
|
|
553
|
+
print(f"File {d} already exists. Skipping due to overwrite=False.")
|
|
554
|
+
else:
|
|
555
|
+
shutil.move(s, d)
|
|
511
556
|
|
|
512
557
|
|
|
513
558
|
def copy_file(
|
|
@@ -681,7 +726,7 @@ def get_paths_from_directory(
|
|
|
681
726
|
sort_by_last_modified_time: bool = False,
|
|
682
727
|
add_file_binary: bool = False,
|
|
683
728
|
add_file_hash: bool = False,
|
|
684
|
-
) -> list[AtomicPath]:
|
|
729
|
+
) -> Union[list[AtomicPath], list[str]]:
|
|
685
730
|
"""
|
|
686
731
|
Recursive, by option.
|
|
687
732
|
The function receives a filesystem directory as string, scans it recursively for files and returns list of
|
|
@@ -1524,7 +1569,7 @@ def backup_file(
|
|
|
1524
1569
|
else:
|
|
1525
1570
|
file_name: str = f"{file_name_no_extension}_{timestamp}{file_extension}"
|
|
1526
1571
|
backup_file_path: str = str(Path(backup_directory) / file_name)
|
|
1527
|
-
move_file(file_path,
|
|
1572
|
+
move_file(file_path, backup_directory)
|
|
1528
1573
|
|
|
1529
1574
|
return backup_file_path
|
|
1530
1575
|
else:
|
atomicshop/mitm/recs_files.py
CHANGED
|
@@ -51,7 +51,7 @@ def recs_archiver(recs_directory: str) -> list:
|
|
|
51
51
|
target_directory_path: str = f"{directory_path.path}{os.sep}{recs_atomic_path.datetime_string}"
|
|
52
52
|
filesystem.create_directory(target_directory_path)
|
|
53
53
|
filesystem.move_file(
|
|
54
|
-
recs_atomic_path.path,
|
|
54
|
+
recs_atomic_path.path, target_directory_path)
|
|
55
55
|
|
|
56
56
|
# Archive directories.
|
|
57
57
|
archive_directories: list = filesystem.get_paths_from_directory(
|
|
@@ -207,8 +207,7 @@ def get_all_log_files_into_list(
|
|
|
207
207
|
filesystem.create_directory(move_to_path_with_timestamp)
|
|
208
208
|
# Move the statistics files.
|
|
209
209
|
for single_file in logs_files:
|
|
210
|
-
|
|
211
|
-
filesystem.move_file(single_file.path, move_to_path_with_file)
|
|
210
|
+
filesystem.move_file(single_file.path, move_to_path_with_timestamp)
|
|
212
211
|
|
|
213
212
|
return logs_content
|
|
214
213
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=glTwF3AaXumcMYRK9aEiKxF7orYtHdc0gWXmh8wXceg,124
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
|
|
4
4
|
atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
|
|
@@ -14,7 +14,7 @@ atomicshop/dns.py,sha256=J4yX6vCaRdL0McYWnlJ9arCDKW-yRui7Y5WyL5BoD6M,6391
|
|
|
14
14
|
atomicshop/domains.py,sha256=Rxu6JhhMqFZRcoFs69IoEd1PtYca0lMCG6F1AomP7z4,3197
|
|
15
15
|
atomicshop/emails.py,sha256=I0KyODQpIMEsNRi9YWSOL8EUPBiWyon3HRdIuSj3AEU,1410
|
|
16
16
|
atomicshop/file_types.py,sha256=-0jzQMRlmU1AP9DARjk-HJm1tVE22E6ngP2mRblyEjY,763
|
|
17
|
-
atomicshop/filesystem.py,sha256=
|
|
17
|
+
atomicshop/filesystem.py,sha256=XPrOjqxQRP3fa01QztDvuDUpiFjCYtpPUC0KhaGHxqs,60222
|
|
18
18
|
atomicshop/functions.py,sha256=pK8hoCE9z61PtWCxQJsda7YAphrLH1wxU5x-1QJP-sY,499
|
|
19
19
|
atomicshop/get_process_list.py,sha256=8cxb7gKe9sl4R6H2yMi8J6oe-RkonTvCdKjRFqi-Fs4,6075
|
|
20
20
|
atomicshop/get_process_name_cmd_dll.py,sha256=CtaSp3mgxxJKCCVW8BLx6BJNx4giCklU_T7USiCEwfc,5162
|
|
@@ -116,7 +116,7 @@ atomicshop/etws/traces/trace_sysmon_process_creation.py,sha256=OM-bkK38uYMwWLZKN
|
|
|
116
116
|
atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
117
|
atomicshop/file_io/csvs.py,sha256=oZiaIEd1q50ypNdd9mlHWb-f7HAdGa_D6jLd3T_4sWU,8777
|
|
118
118
|
atomicshop/file_io/docxs.py,sha256=ffJhnmM_WyD8mCoq2dGdpfahdIrGTPy96QVlH5EWjeI,5754
|
|
119
|
-
atomicshop/file_io/file_io.py,sha256=
|
|
119
|
+
atomicshop/file_io/file_io.py,sha256=IVqs0Kd7PV8O-NH9321hK_IvPqWx2z_45zdDtqgw4II,7113
|
|
120
120
|
atomicshop/file_io/jsons.py,sha256=q9ZU8slBKnHLrtn3TnbK1qxrRpj5ZvCm6AlsFzoANjo,5303
|
|
121
121
|
atomicshop/file_io/tomls.py,sha256=ol8EvQPf9sryTmZUf1v55BYSUQ6ml7HVVBHpNKbsIlA,9768
|
|
122
122
|
atomicshop/file_io/xlsxs.py,sha256=v_dyg9GD4LqgWi6wA1QuWRZ8zG4ZwB6Dz52ytdcmmmI,2184
|
|
@@ -129,7 +129,7 @@ atomicshop/mitm/import_config.py,sha256=_nu8mgA-M4s6dZ8_QWx3x0aVb75upvsCuX_PIUg4
|
|
|
129
129
|
atomicshop/mitm/initialize_engines.py,sha256=kBG8TBnyFuwlJ1uKaWDzc5AiZNpwdvouq2pr-PYrdEA,8349
|
|
130
130
|
atomicshop/mitm/message.py,sha256=d_sm3O_aoZf87dDQP44xOMNEG-uZBN1ZecQgMCacbZs,1814
|
|
131
131
|
atomicshop/mitm/mitm_main.py,sha256=CdCv4nYt_jwd23AI14v6lC2H8SZeIZqsXjFhwq61UtM,21285
|
|
132
|
-
atomicshop/mitm/recs_files.py,sha256=
|
|
132
|
+
atomicshop/mitm/recs_files.py,sha256=B8fSuvYXlh50LWfwLRw_bYswreTjmdZLuHJzbDC5Gss,2930
|
|
133
133
|
atomicshop/mitm/shared_functions.py,sha256=hplm98tz8pgJ4WHUVI9sf_oVqUM2KJ1Y2pD6EFSb8P0,1879
|
|
134
134
|
atomicshop/mitm/statistic_analyzer.py,sha256=AzL9rQhg0tLJj33gZfxdwWghmbXGLh_HyMBDpzuBmsQ,24709
|
|
135
135
|
atomicshop/mitm/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -250,7 +250,7 @@ atomicshop/wrappers/loggingw/formatters.py,sha256=7XUJvlB0CK4DCkEp8NTL0S0dkyrZD0
|
|
|
250
250
|
atomicshop/wrappers/loggingw/handlers.py,sha256=hAPFJQ-wFoNO8QzGrJRSvyuP09Q1F0Dl9_w7zzlgcW0,18155
|
|
251
251
|
atomicshop/wrappers/loggingw/loggers.py,sha256=QH5QainlGLyrDpsDu4T1C8-WQQau3JW2OS5RgC-kXpM,2677
|
|
252
252
|
atomicshop/wrappers/loggingw/loggingw.py,sha256=6HUn2z4ZW8PgakPscosKx23qYwHlBQcLiZGw-VZHi-k,12374
|
|
253
|
-
atomicshop/wrappers/loggingw/reading.py,sha256=
|
|
253
|
+
atomicshop/wrappers/loggingw/reading.py,sha256=ERBSiQbEksySKpXpu2E_6k9dZ6MPH95ZIsmdjWW9MUE,16436
|
|
254
254
|
atomicshop/wrappers/mongodbw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
255
255
|
atomicshop/wrappers/mongodbw/install_mongodb.py,sha256=3ZPqrXxj3lC-PnAKGXclylLuOqsbyXYeUpb5iGjdeUU,6626
|
|
256
256
|
atomicshop/wrappers/mongodbw/mongo_infra.py,sha256=IjEF0jPzQz866MpTm7rnksnyyWQeUT_B2h2DA9ryAio,2034
|
|
@@ -309,8 +309,8 @@ atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0L
|
|
|
309
309
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=V_m1D0KpizQox3IEWp2AUcncwWy5kG25hbFrc-mBSJE,3029
|
|
310
310
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
311
311
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=bQ8Jql8bVGBJ0dt3VQ56lga_1LBOMLI3Km_otvvbU6c,7138
|
|
312
|
-
atomicshop-2.16.
|
|
313
|
-
atomicshop-2.16.
|
|
314
|
-
atomicshop-2.16.
|
|
315
|
-
atomicshop-2.16.
|
|
316
|
-
atomicshop-2.16.
|
|
312
|
+
atomicshop-2.16.20.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
313
|
+
atomicshop-2.16.20.dist-info/METADATA,sha256=_6DtjLTOAPxjimk_EMT_AWrtPUCkdYItaZUWlrTRqDE,10473
|
|
314
|
+
atomicshop-2.16.20.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
315
|
+
atomicshop-2.16.20.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
316
|
+
atomicshop-2.16.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|