atomicshop 3.1.6__py3-none-any.whl → 3.1.8__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__ = '3.1.6'
4
+ __version__ = '3.1.8'
atomicshop/networks.py CHANGED
@@ -273,6 +273,9 @@ def generate_unused_ipv4_addresses_from_ip(
273
273
  if not skip_ips:
274
274
  skip_ips = []
275
275
 
276
+ # Remove duplicate IPs from the skip_ips list, loses order.
277
+ skip_ips = list(set(skip_ips))
278
+
276
279
  # Add the IP address to the list of IPs to skip.
277
280
  if ip_address not in skip_ips:
278
281
  skip_ips = [ip_address] + skip_ips
@@ -356,6 +359,9 @@ def add_virtual_ips_to_default_adapter_by_current_setting(
356
359
  will be generated from it. Unused addresses decided by pinging them.
357
360
  Same for the subnet mask.
358
361
 
362
+ While generating the IPs, the function will skip the already existing IPs in the adapter, like default gateway
363
+ and DNS servers.
364
+
359
365
  :param number_of_ips: int, number of IPs to generate in addition to the IPv4s that already exist in the adapter.
360
366
  Or you add the IPs and masks to the adapter with the parameters virtual_ipv4s_to_add and virtual_ipv4_masks_to_add.
361
367
 
@@ -409,7 +415,7 @@ def add_virtual_ips_to_default_adapter_by_current_setting(
409
415
  ip_address=current_ipv4s[0],
410
416
  mask=current_ipv4_masks[0],
411
417
  number_of_ips=number_of_ips,
412
- skip_ips=current_ipv4s
418
+ skip_ips=current_ipv4s + default_adapter_info['default_gateways'] + default_adapter_info['dns_gateways']
413
419
  )
414
420
  elif virtual_ipv4s_to_add and virtual_ipv4_masks_to_add:
415
421
  ips_to_assign = virtual_ipv4s_to_add
@@ -3,6 +3,7 @@ import socket
3
3
  import time
4
4
 
5
5
  from win32com.client import CDispatch
6
+ import pywintypes
6
7
 
7
8
  from . import wmi_helpers, win32networkadapter
8
9
  from ...psutilw import psutil_networks
@@ -137,7 +138,18 @@ def set_static_ips(
137
138
  if not masks or len(ips) != len(masks):
138
139
  raise ValueError("ipv4 and masks must be lists of equal length")
139
140
 
140
- in_params = network_config.Methods_("EnableStatic").InParameters.SpawnInstance_()
141
+ # # refresh the instance – state may have changed after the previous call
142
+ # network_config = network_config.Path_.GetObject_()
143
+
144
+ try:
145
+ in_params = network_config.Methods_("EnableStatic").InParameters.SpawnInstance_()
146
+ except pywintypes.com_error as e:
147
+ if e.excepinfo[1] == 'SWbemMethodSet' and 'Not found' in e.excepinfo[2]:
148
+ raise RuntimeError(f"Probably the adapter is already set to static non-DHCP.\n"
149
+ f"Failed to get [EnableStatic] method parameters: {e}\n")
150
+ else:
151
+ raise
152
+
141
153
  in_params.IPAddress = ips
142
154
  in_params.SubnetMask = masks
143
155
 
@@ -142,7 +142,8 @@ def call_method(
142
142
  :return: WMI method object.
143
143
  """
144
144
 
145
- if not (isinstance(value, EmptyValue) and isinstance(value, tuple) and isinstance(value, dict)):
145
+ # Assign the single value to a tuple if it is not already a tuple or dict and not an EmptyValue.
146
+ if not isinstance(value, EmptyValue) and not (isinstance(value, tuple) and isinstance(value, dict)):
146
147
  value = (value,)
147
148
 
148
149
  # Get the method instance out of the WMI object.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.1.6
3
+ Version: 3.1.8
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -52,7 +52,7 @@ Requires-Dist: playwright
52
52
  Requires-Dist: playwright-stealth
53
53
  Requires-Dist: protobuf
54
54
  Requires-Dist: psutil
55
- Requires-Dist: py7zr
55
+ Requires-Dist: py7zr ==0.22.0
56
56
  Requires-Dist: pyautogui
57
57
  Requires-Dist: pymongo
58
58
  Requires-Dist: pyopenssl
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=lgJ4Y2cZjapTRcmtqh6h2LaQj-h7MwBqzq-fHO09skc,122
1
+ atomicshop/__init__.py,sha256=EsaT4vSXGAXzBfTEAtjwOzP6zvlGXekljCTQOrMqSTA,122
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
@@ -23,7 +23,7 @@ atomicshop/http_parse.py,sha256=1Tna9YbOM0rE3t6i_M-klBlwd1KNSA9skA_BqKGXDFc,1186
23
23
  atomicshop/inspect_wrapper.py,sha256=sGRVQhrJovNygHTydqJj0hxES-aB2Eg9KbIk3G31apw,11429
24
24
  atomicshop/ip_addresses.py,sha256=penRFeJ1-LDVTko4Q0EwK4JiN5cU-KzCBR2VXg9qbUY,1238
25
25
  atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
26
- atomicshop/networks.py,sha256=OSFaEUu8otxCkNq9oMbYQpj5SLzHie2r5uJDiyLR19U,18685
26
+ atomicshop/networks.py,sha256=xOU_lDf6Rct178W7EB80-AFMgu9Nnh6l7GgjA9z9Jtg,19010
27
27
  atomicshop/on_exit.py,sha256=9XlOnzoAG8zlI8wBF4AB8hyrC6Q1b84gkhqpAhhdN9g,6977
28
28
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
29
29
  atomicshop/print_api.py,sha256=SJNQIMqSLlYaPtjHnALySAI-jQYuYHOCGgfP7oe96fU,10957
@@ -313,10 +313,10 @@ atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_terminate.py,sha25
313
313
  atomicshop/wrappers/pywin32w/win_event_log/subscribes/schannel_logging.py,sha256=8nxIcNcbeEuvoBwhujgh7-oIpL9A6J-gg1NM8hOGAVA,3442
314
314
  atomicshop/wrappers/pywin32w/wmis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
315
315
  atomicshop/wrappers/pywin32w/wmis/msft_netipaddress.py,sha256=Kn2gQsyEquM5QQkdF2Vtr1MqK5D7uo6EFi-cxt52Q0g,4800
316
- atomicshop/wrappers/pywin32w/wmis/win32_networkadapterconfiguration.py,sha256=Iz-p--cE2iP6wyD9ceSF3scMMvdXC5fF-VKP1v-iIDo,10813
316
+ atomicshop/wrappers/pywin32w/wmis/win32_networkadapterconfiguration.py,sha256=CnHFac1FT6cnH1VwHUyD6vZr6FKPxY8fpbj-1s2_Mzg,11327
317
317
  atomicshop/wrappers/pywin32w/wmis/win32networkadapter.py,sha256=iao4OK6u097uRacw6vQuya1kOtJzLA1IM4cgo6UCWLM,3941
318
318
  atomicshop/wrappers/pywin32w/wmis/win32process.py,sha256=qMzXtJ5hBZ5ydAyqpDbSx0nO2RJQL95HdmV5SzNKMhk,6826
319
- atomicshop/wrappers/pywin32w/wmis/wmi_helpers.py,sha256=H8QIiHlm9ei8GSudKECFpEc1qny_1PNnVxZuIDK9xfU,8604
319
+ atomicshop/wrappers/pywin32w/wmis/wmi_helpers.py,sha256=3SA6hNgw-iBWYl3l1t3RBxRYB4BH-FbTs9gzmcg_Q8w,8710
320
320
  atomicshop/wrappers/socketw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
321
321
  atomicshop/wrappers/socketw/accepter.py,sha256=4I9ORugRDvwaqSzm_gWSjZnRwQGY8hDTlCdsYHwH_ZE,2377
322
322
  atomicshop/wrappers/socketw/base.py,sha256=EcosGkD8VzgBY3GeIHDSG29ThQfXwg3-GQPmBTAqTdw,3048
@@ -336,8 +336,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
336
336
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
338
338
  atomicshop/wrappers/winregw/winreg_network.py,sha256=3Ts1sVqSUiCDsHRHwJCbiZ9EYvv2ELGxF0Y_pibGU4k,9596
339
- atomicshop-3.1.6.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
- atomicshop-3.1.6.dist-info/METADATA,sha256=nOFaTyw74lY191rFSACO5nChQHK6jRcTq4yPfbvOj2A,10653
341
- atomicshop-3.1.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
- atomicshop-3.1.6.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
- atomicshop-3.1.6.dist-info/RECORD,,
339
+ atomicshop-3.1.8.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
+ atomicshop-3.1.8.dist-info/METADATA,sha256=evAROFKYJtONn4b-_ij9PzDB6jKZW3hMlXGRHP_j4Gk,10662
341
+ atomicshop-3.1.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
+ atomicshop-3.1.8.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
+ atomicshop-3.1.8.dist-info/RECORD,,