atomicshop 2.18.13__py3-none-any.whl → 2.18.15__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.18.13'
4
+ __version__ = '2.18.15'
@@ -13,7 +13,8 @@ SUPPORTED_ARCHIVE_MIMES: list = [
13
13
  'application/x-7z-compressed',
14
14
  'application/zip',
15
15
  'application/x-dosexec', # SFX zip files.
16
- 'application/octet-stream' # There are some non-standard zip files that are not recognized by magic.
16
+ 'application/octet-stream', # There are some non-standard zip files that are not recognized by magic.
17
+ 'application/vnd.microsoft.portable-executable' # PE files. Some self extracting archives are PE files, But the zip module can handle them.
17
18
  ]
18
19
 
19
20
 
@@ -102,7 +102,8 @@ def read_csv_to_list_of_lists(
102
102
  def write_list_to_csv(
103
103
  content_list: list,
104
104
  file_path: str,
105
- mode: str = 'w'
105
+ mode: str = 'w',
106
+ encoding: str = None
106
107
  ) -> None:
107
108
  """
108
109
  This function got dual purpose:
@@ -114,10 +115,12 @@ def write_list_to_csv(
114
115
  :param content_list: List object that each iteration contains dictionary with same keys and different values.
115
116
  :param file_path: Full file path to CSV file.
116
117
  :param mode: String, file writing mode. Default is 'w'.
118
+ :param encoding: String, encoding of the file. Default is 'None'.
119
+ Example: 'utf-8', 'utf-16', 'cp1252'.
117
120
  :return: None.
118
121
  """
119
122
 
120
- with open(file_path, mode=mode, newline='') as csv_file:
123
+ with open(file_path, mode=mode, newline='', encoding=encoding) as csv_file:
121
124
  if len(content_list) > 0 and isinstance(content_list[0], dict):
122
125
  # Treat the list as list of dictionaries.
123
126
  header = content_list[0].keys()
atomicshop/filesystem.py CHANGED
@@ -329,6 +329,36 @@ def remove_directory(directory_path: str, force_readonly: bool = False, print_kw
329
329
  return False
330
330
 
331
331
 
332
+ def remove_empty_directories(directory_path: str) -> list[str]:
333
+ """
334
+ Recursively removes empty directories in the given path, including the given path if it is empty.
335
+
336
+ :param directory_path: The starting directory path to check and remove empty directories.
337
+ """
338
+ if not os.path.isdir(directory_path):
339
+ # print(f"Path '{directory_path}' is not a directory or does not exist.")
340
+ return []
341
+
342
+ removed_directories: list = []
343
+ # Iterate through the directory contents
344
+ for root, dirs, files in os.walk(directory_path, topdown=False):
345
+ for directory in dirs:
346
+ dir_path = os.path.join(root, directory)
347
+ # Check if the directory is empty
348
+ if not os.listdir(dir_path):
349
+ os.rmdir(dir_path)
350
+ removed_directories.append(dir_path)
351
+ # print(f"Removed empty directory: {dir_path}")
352
+
353
+ # Finally, check if the top-level directory is empty
354
+ if not os.listdir(directory_path):
355
+ os.rmdir(directory_path)
356
+ removed_directories.append(directory_path)
357
+ # print(f"Removed top-level empty directory: {path}")
358
+
359
+ return removed_directories
360
+
361
+
332
362
  def create_directory(directory_fullpath: str):
333
363
  # Create directory if non-existent.
334
364
  # The library is used to create folder if it doesn't exist and won't raise exception if it does
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.18.13
3
+ Version: 2.18.15
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=5pTnN5bNMJA67RrDEqtb62Sy0aI4w2T53yo9d-LxiwE,124
1
+ atomicshop/__init__.py,sha256=vstlzMgTlldbG9H3C83VSdSji8vg9G7YehtjazP1weg,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=5Gimq_WY2arqg7BeGmR7P--fGfnH0Dsh8lrOt_H0jRY,6817
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=Tr5Z3LRwW_u7i8JmAHmkicqdEGEJF9Ldz47A9mc-9r8,61169
17
+ atomicshop/filesystem.py,sha256=1m-_cDiio6f4KnyHNdn2NhS60RneB-jcmc4Tdc5RlU8,62368
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
@@ -77,7 +77,7 @@ atomicshop/addons/process_list/compiled/Win10x64/process_list.exp,sha256=cbvukIT
77
77
  atomicshop/addons/process_list/compiled/Win10x64/process_list.lib,sha256=T2Ncs0MwKlAaCq8UKFMvfQAfcJdDx-nWiHVBfglrLIU,2112
78
78
  atomicshop/archiver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
79
  atomicshop/archiver/_search_in_zip.py,sha256=dd8qFSvIhcKmtnPj_uYNJFPmMwZp4tZys0kKgTw_ACw,8385
80
- atomicshop/archiver/search_in_archive.py,sha256=EmWif1EmIy-IpOLgcj-y-Sqrh2M3MtLN94aNQzUhrrQ,12300
80
+ atomicshop/archiver/search_in_archive.py,sha256=iDIWS9G2pdz6QxGawGQJ1RSl33gdIRjpYrnP0brIDgU,12450
81
81
  atomicshop/archiver/sevenz_app_w.py,sha256=BWcJb4f7jZEiETDBKyNLE0f5YLFPQx6B91_ObEIXWf8,3007
82
82
  atomicshop/archiver/sevenzs.py,sha256=b9rI-nF36ZNawwKsPWOgsnm0p-jYDfD1NYV3eA8LoQ0,2491
83
83
  atomicshop/archiver/shutils.py,sha256=BomnK7zT-nQXA1z0i2R2aTv8eu88wPx7tf2HtOdbmEc,1280
@@ -117,7 +117,7 @@ atomicshop/etws/traces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
117
117
  atomicshop/etws/traces/trace_dns.py,sha256=WvOZm7KNdP4r6ofkZhUGi9WjtYlkV3mUp_yxita3Qg4,6399
118
118
  atomicshop/etws/traces/trace_sysmon_process_creation.py,sha256=OM-bkK38uYMwWLZKNOTDa0Xdk3sO6sqsxoMUIiPvm5g,4656
119
119
  atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
- atomicshop/file_io/csvs.py,sha256=jBdm3_z5cMyvxLxJnGcybUAptHAbyL0r0tlLqY0sdTQ,9327
120
+ atomicshop/file_io/csvs.py,sha256=zv0kKjRT-ZWRi0WpMIUQ_FKyP9Dt0f5Bc98Qsj6ClPU,9495
121
121
  atomicshop/file_io/docxs.py,sha256=Nyt3hSpzwqUKZEP5p5efqNpjFs9XqkK40Kp7BbbPo7E,6245
122
122
  atomicshop/file_io/file_io.py,sha256=5Kl0P6vF4GQVdwew1lzHLb-db9qiMvDjTgccbi5P-zk,7167
123
123
  atomicshop/file_io/jsons.py,sha256=q9ZU8slBKnHLrtn3TnbK1qxrRpj5ZvCm6AlsFzoANjo,5303
@@ -320,8 +320,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=fgMzDXI0cybwUEqAxprRmY3lqbh
320
320
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
321
321
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=on99OTT1_0g4KITAW5mSugUYgCAdVikhWjJ78a7JVIQ,1785
322
322
  atomicshop/wrappers/winregw/winreg_network.py,sha256=AENV88H1qDidrcpyM9OwEZxX5svfi-Jb4N6FkS1xtqA,8851
323
- atomicshop-2.18.13.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
324
- atomicshop-2.18.13.dist-info/METADATA,sha256=4SnW9QOBmr-koBAhc-X3XWJsGvfIDKajOMNHaSJRihk,10577
325
- atomicshop-2.18.13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
326
- atomicshop-2.18.13.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
327
- atomicshop-2.18.13.dist-info/RECORD,,
323
+ atomicshop-2.18.15.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
324
+ atomicshop-2.18.15.dist-info/METADATA,sha256=4YuwMJ1ZIag4xchzKo-YpwzPYsL1TrrNrWD2SnBENG0,10577
325
+ atomicshop-2.18.15.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
326
+ atomicshop-2.18.15.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
327
+ atomicshop-2.18.15.dist-info/RECORD,,