atomicshop 2.18.15__py3-none-any.whl → 2.18.17__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.15'
4
+ __version__ = '2.18.17'
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
@@ -1,6 +1,8 @@
1
1
  import logging
2
2
  import socket
3
3
  import ssl
4
+ import time
5
+
4
6
  import select
5
7
  from pathlib import Path
6
8
 
@@ -120,9 +122,19 @@ class Receiver:
120
122
  # We'll skip the 'is_socket_ready_for_read' check on the first run, since we want to read the data anyway,
121
123
  # to leave the socket in the blocking mode.
122
124
  first_run: bool = True
125
+ no_data_first_cycle: bool = True
123
126
  while True:
124
127
  # Check if there is data to be read from the socket.
125
128
  is_there_data: bool = is_socket_ready_for_read(self.ssl_socket, timeout=0)
129
+
130
+ # If there is no data to be read from the socket, and it is the first cycle, wait for a bit and try again.
131
+ if no_data_first_cycle and not is_there_data:
132
+ no_data_first_cycle = False
133
+ sleep_time: float = 0.5
134
+ self.logger.info(f"First time socket not ready. Waiting {str(sleep_time)} seconds before trying last time.")
135
+ time.sleep(sleep_time)
136
+ continue
137
+
126
138
  # noinspection PyTypeChecker
127
139
  if is_there_data or first_run:
128
140
  first_run = False
@@ -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.15
3
+ Version: 2.18.17
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=vstlzMgTlldbG9H3C83VSdSji8vg9G7YehtjazP1weg,124
1
+ atomicshop/__init__.py,sha256=ivNsScemzv9LXI2vGUWebHrEcNi81OytLwrD-3BCUm4,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
@@ -309,7 +309,7 @@ atomicshop/wrappers/socketw/creator.py,sha256=aSwfN_IwXXf4Hob35vHXUxD_OPeshZcRDZ
309
309
  atomicshop/wrappers/socketw/dns_server.py,sha256=RklzINNuoMQn4PGGQEI5hiAldprbVwwvikY6u9X-jTY,49067
310
310
  atomicshop/wrappers/socketw/exception_wrapper.py,sha256=B-X5SHLSUIWToihH2MKnOB1F4A81_X0DpLLfnYKYbEc,7067
311
311
  atomicshop/wrappers/socketw/get_process.py,sha256=aJC-_qFUv3NgWCSUzDI72E4z8_-VTZE9NVZ0CwUoNlM,5698
312
- atomicshop/wrappers/socketw/receiver.py,sha256=LRQO-RIY0ZRjSMGVHLVJAXFTVO1zvjgIKSefEngPFfc,8186
312
+ atomicshop/wrappers/socketw/receiver.py,sha256=Fj5bP_A7frvXrRMNw4k-ArGenzxfWVysBJSEOZ8ohdY,8704
313
313
  atomicshop/wrappers/socketw/sender.py,sha256=aX_K8l_rHjd5AWb8bi5mt8-YTkMYVRDB6DnPqK_XDUE,4754
314
314
  atomicshop/wrappers/socketw/sni.py,sha256=T9PXROiTYYxrd_7X4Hoj9hoNPXXTQpa2HdvmBJJIoeA,17607
315
315
  atomicshop/wrappers/socketw/socket_client.py,sha256=oa3GwS4OPgokrJE5_Oc4-5_wlXHxSH9J5f2DKebms8k,22035
@@ -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.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,,
323
+ atomicshop-2.18.17.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
324
+ atomicshop-2.18.17.dist-info/METADATA,sha256=7FKQflXFEbWNBjy0Z9OwLWbgKASXvOKsPWf5a5o8L-Q,10577
325
+ atomicshop-2.18.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
326
+ atomicshop-2.18.17.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
327
+ atomicshop-2.18.17.dist-info/RECORD,,