atomicshop 2.18.14__py3-none-any.whl → 2.18.16__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.14'
4
+ __version__ = '2.18.16'
@@ -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
@@ -383,22 +383,35 @@ def rename_file(file_path: str, new_file_name: str) -> None:
383
383
  os.rename(file_path, renamed_file_path)
384
384
 
385
385
 
386
- def rename_file_with_special_characters(file_path: str) -> str:
386
+ def rename_file_with_special_characters(
387
+ file_path: str,
388
+ rename_dictionary: dict = None,
389
+ ) -> str:
387
390
  """
388
391
  The function will rename the file to replace special characters from the file name with '_'.
389
392
  If the file already exists, then the function will add a number to the end of the file name.
390
393
 
391
394
  :param file_path: string, full path to file.
395
+ :param rename_dictionary: dictionary, with special characters to replace.
396
+ If not specified, the default dictionary will be used: FILE_NAME_REPLACEMENT_DICT.
397
+ Example:
398
+ rename_dictionary = {
399
+ '$': '_',
400
+ ' ': '_'
401
+ }
392
402
  :return: string, full path to file with special characters renamed.
393
403
  """
394
404
 
405
+ if rename_dictionary is None:
406
+ rename_dictionary = FILE_NAME_REPLACEMENT_DICT
407
+
395
408
  # Get the file name without extension
396
409
  file_stem: str = str(Path(file_path).stem)
397
410
  file_extension: str = str(Path(file_path).suffix)
398
411
 
399
412
  # Remove special characters from the file name
400
413
  new_file_stem = strings.replace_strings_with_values_from_dict(
401
- string_to_replace=file_stem, dictionary=FILE_NAME_REPLACEMENT_DICT)
414
+ string_to_replace=file_stem, dictionary=rename_dictionary)
402
415
 
403
416
  # Rename the file
404
417
  renamed_file_path = str(Path(file_path).parent) + os.sep + new_file_stem + file_extension
@@ -417,21 +430,35 @@ def rename_file_with_special_characters(file_path: str) -> str:
417
430
  return renamed_file_path
418
431
 
419
432
 
420
- def rename_files_and_directories_with_special_characters(base_path: str) -> None:
433
+ def rename_files_and_directories_with_special_characters(
434
+ base_path: str,
435
+ rename_dictionary: dict = None
436
+ ) -> None:
421
437
  """
422
438
  Recursively renames all files and directories in the given directory to rename special characters.
423
439
 
424
440
  :param base_path: str, the base directory to start processing.
441
+ :param rename_dictionary: dictionary, with special characters to replace.
442
+ If not specified, the default dictionary will be used: FILE_NAME_REPLACEMENT_DICT.
443
+ Example:
444
+ rename_dictionary = {
445
+ '$': '_',
446
+ ' ': '_'
447
+ }
425
448
  """
426
449
 
427
450
  def sanitize_name(name: str) -> str:
451
+ nonlocal rename_dictionary
428
452
  """
429
453
  Helper function to replace special characters in a string using a dictionary.
430
454
  """
431
- for key, value in FILE_NAME_REPLACEMENT_DICT.items():
455
+ for key, value in rename_dictionary.items():
432
456
  name = name.replace(key, value)
433
457
  return name
434
458
 
459
+ if rename_dictionary is None:
460
+ rename_dictionary = FILE_NAME_REPLACEMENT_DICT
461
+
435
462
  # Walk through the directory tree in reverse to ensure we rename files before directories
436
463
  for root, dirs, files in os.walk(base_path, topdown=False):
437
464
  # Rename files in the current directory
@@ -31,12 +31,24 @@ def get_installed_software() -> list[dict]:
31
31
  except FileNotFoundError:
32
32
  install_date = "N/A"
33
33
 
34
+ try:
35
+ install_location, _ = winreg.QueryValueEx(subkey, "InstallLocation")
36
+ except FileNotFoundError:
37
+ install_location = "N/A"
38
+
39
+ try:
40
+ install_source, _ = winreg.QueryValueEx(subkey, "InstallSource")
41
+ except FileNotFoundError:
42
+ install_source = "N/A"
43
+
34
44
  if display_name != "N/A":
35
45
  data.append({
36
46
  "DisplayName": display_name,
37
47
  "DisplayVersion": display_version,
38
48
  "InstallDate": install_date,
39
- "SubkeyName": subkey_name
49
+ "SubkeyName": subkey_name,
50
+ "InstallLocation": install_location,
51
+ "InstallSource": install_source
40
52
  })
41
53
  except OSError:
42
54
  break # No more subkeys
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.18.14
3
+ Version: 2.18.16
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=iHkJnN-sgfMa_LmJTJIrfBMcqKRYbUYo7065JWRf6cM,124
1
+ atomicshop/__init__.py,sha256=IuIxKU_I3diwNIyJXcznjnX1iBeIXM6M3uCnXlhfTRQ,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=1m-_cDiio6f4KnyHNdn2NhS60RneB-jcmc4Tdc5RlU8,62368
17
+ atomicshop/filesystem.py,sha256=StVeiGCjlpvMOmB-4SW-s7eR_qxYofW9jsfh1ewpaG4,63263
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
@@ -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
@@ -318,10 +318,10 @@ atomicshop/wrappers/socketw/socket_wrapper.py,sha256=WtylpezgIIBuz-A6PfM0hO1sm9E
318
318
  atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0LxIwBA4iVvU,2275
319
319
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=fgMzDXI0cybwUEqAxprRmY3lqbh30KAV-jOpoFKT-m8,3395
320
320
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
321
- atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=on99OTT1_0g4KITAW5mSugUYgCAdVikhWjJ78a7JVIQ,1785
321
+ atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
322
322
  atomicshop/wrappers/winregw/winreg_network.py,sha256=AENV88H1qDidrcpyM9OwEZxX5svfi-Jb4N6FkS1xtqA,8851
323
- atomicshop-2.18.14.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
324
- atomicshop-2.18.14.dist-info/METADATA,sha256=X2ETn4vvALQe0wRjZMQDSXT_yLd6WEL05seJ6cJpB_I,10577
325
- atomicshop-2.18.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
326
- atomicshop-2.18.14.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
327
- atomicshop-2.18.14.dist-info/RECORD,,
323
+ atomicshop-2.18.16.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
324
+ atomicshop-2.18.16.dist-info/METADATA,sha256=p1cdNLaZYCYiSGZSoa9sZ1memPijaEHHRRfBCppKa2A,10577
325
+ atomicshop-2.18.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
326
+ atomicshop-2.18.16.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
327
+ atomicshop-2.18.16.dist-info/RECORD,,