atomicshop 2.12.16__py3-none-any.whl → 2.12.18__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/timer.py CHANGED
@@ -7,7 +7,10 @@ class TimerError(Exception):
7
7
 
8
8
  class Timer:
9
9
  """ Custom timer class to measure elapsed time. Returns time in seconds (float) or nanoseconds with setting. """
10
- def __init__(self, nanoseconds: bool = False):
10
+ def __init__(
11
+ self,
12
+ nanoseconds: bool = False
13
+ ):
11
14
  """
12
15
  Set up timer in seconds or nanoseconds
13
16
  Seconds are returned as float, nanoseconds as int.
@@ -17,6 +20,9 @@ class Timer:
17
20
  self._start_time = None
18
21
  self._nanoseconds: bool = nanoseconds
19
22
 
23
+ self.running: bool = False
24
+ self.last_measure = None
25
+
20
26
  def start(self):
21
27
  """Start a new timer"""
22
28
 
@@ -28,6 +34,8 @@ class Timer:
28
34
  else:
29
35
  self._start_time = time.perf_counter()
30
36
 
37
+ self.running = True
38
+
31
39
  def restart(self):
32
40
  """Reset the timer"""
33
41
 
@@ -37,20 +45,31 @@ class Timer:
37
45
  def measure(self):
38
46
  """Measure the elapsed time"""
39
47
 
40
- if self._start_time is None:
41
- raise TimerError(f"Timer is not running. Use .start() to start it")
48
+ # if self._start_time is None and self.last_measure is None:
49
+ # raise TimerError(f"Timer is not running. Use .start() to start it")
42
50
 
43
- if self._nanoseconds:
44
- elapsed_time = time.perf_counter_ns() - self._start_time
45
- else:
46
- elapsed_time = time.perf_counter() - self._start_time
51
+ # If the timer is running, measure the elapsed time. If not, return the last measured time.
52
+ if self.running:
53
+ if self._nanoseconds:
54
+ self.last_measure = time.perf_counter_ns() - self._start_time
55
+ else:
56
+ self.last_measure = time.perf_counter() - self._start_time
47
57
 
48
- return elapsed_time
58
+ return self.last_measure
59
+
60
+ def stop(self, measure: bool = True):
61
+ """
62
+ Stop the timer, and report the elapsed time
63
+
64
+ :param measure: True to measure the elapsed time, False to stop the timer without measuring.
65
+ Measuring, means that the timer will return the elapsed time and 'self.last_measure' will be updated.
66
+ """
49
67
 
50
- def stop(self):
51
- """Stop the timer, and report the elapsed time"""
68
+ elapsed_time = None
69
+ if measure:
70
+ elapsed_time = self.measure()
52
71
 
53
- elapsed_time = self.measure()
54
72
  self._start_time = None
73
+ self.running = False
55
74
 
56
75
  return elapsed_time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.12.16
3
+ Version: 2.12.18
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=Z-gJW-h7oTdZn_6KXbNYPQPfdC6kDWJvf5xxT1uoArA,124
1
+ atomicshop/__init__.py,sha256=PD75VCFr3_YvRyoE_p4WvyJhHypr_m2Q5Dxpw6mO7F8,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
@@ -9,7 +9,7 @@ atomicshop/config_init.py,sha256=z2RXD_mw9nQlAOpuGry1h9QT-2LhNscXgGAktN3dCVQ,249
9
9
  atomicshop/console_output.py,sha256=AOSJjrRryE97PAGtgDL03IBtWSi02aNol8noDnW3k6M,4667
10
10
  atomicshop/console_user_response.py,sha256=31HIy9QGXa7f-GVR8MzJauQ79E_ZqAeagF3Ks4GGdDU,3234
11
11
  atomicshop/datetimes.py,sha256=olsL01S5tkXk4WPzucxujqgLOh198BLgJntDnGYukRU,15533
12
- atomicshop/diff_check.py,sha256=nT67QKIz6Kjx4lUhER_3OAafasp_K8ZpT3tIKwcHr44,24298
12
+ atomicshop/diff_check.py,sha256=0H4OeRxJodFIubpAoy2dFY9hixzLbkJ8NNlH6K3Xdus,27033
13
13
  atomicshop/dns.py,sha256=bNZOo5jVPzq7OT2qCPukXoK3zb1oOsyaelUwQEyK1SA,2500
14
14
  atomicshop/domains.py,sha256=Rxu6JhhMqFZRcoFs69IoEd1PtYca0lMCG6F1AomP7z4,3197
15
15
  atomicshop/emails.py,sha256=I0KyODQpIMEsNRi9YWSOL8EUPBiWyon3HRdIuSj3AEU,1410
@@ -40,7 +40,7 @@ atomicshop/sys_functions.py,sha256=MTBxRve5bh58SPvhX3gMiGqHlSBuI_rdNN1NnnBBWqI,9
40
40
  atomicshop/system_resource_monitor.py,sha256=ilA3wEUJfBjQhRsHDXGH7Q05mYr5KarPjRWP8S6pCTw,13681
41
41
  atomicshop/system_resources.py,sha256=0mhDZBEcMzToCOw5ArJhtqYjktOW6iJGdyRkJ01Cpwk,9272
42
42
  atomicshop/tempfiles.py,sha256=uq1ve2WlWehZ3NOTXJnpBBMt6HyCdBufqedF0HyzA6k,2517
43
- atomicshop/timer.py,sha256=KxBBgVM8po6pUJDW8TgY1UXj0iiDmRmL5XDCq0VHAfU,1670
43
+ atomicshop/timer.py,sha256=7Zw1KRV0acHCRATMnanyX2MLBb63Hc-6us3rCZ9dNlY,2345
44
44
  atomicshop/urls.py,sha256=CQl1j1kjEVDlAuYJqYD9XxPF1SUSgrmG8PjlcXNEKsQ,597
45
45
  atomicshop/uuids.py,sha256=JSQdm3ZTJiwPQ1gYe6kU0TKS_7suwVrHc8JZDGYlydM,2214
46
46
  atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
@@ -132,15 +132,15 @@ atomicshop/mitm/engines/__reference_general/parser___reference_general.py,sha256
132
132
  atomicshop/mitm/engines/__reference_general/recorder___reference_general.py,sha256=KENDVf9OwXD9gwSh4B1XxACCe7iHYjrvnW1t6F64wdE,695
133
133
  atomicshop/mitm/engines/__reference_general/responder___reference_general.py,sha256=1AM49UaFTKA0AHw-k3SV3uH3QbG-o6ux0c-GoWkKNU0,6993
134
134
  atomicshop/monitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
- atomicshop/monitor/change_monitor.py,sha256=FUAolHTWVFfC14K2cTMK1NE6ORp37A0fCrfwNbxmbIs,12221
135
+ atomicshop/monitor/change_monitor.py,sha256=ySfFCtsCFG3irV6gKr43DbbyQgmTwzG5m3FkCWDa8UI,9246
136
136
  atomicshop/monitor/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
- atomicshop/monitor/checks/dns.py,sha256=wX53eGX2F5_lBDLL5D6dFb3XThdt3iwoYKnP05WZKfc,4870
138
- atomicshop/monitor/checks/hash.py,sha256=A6bJ7F5Qv_brdEh3sGhOyfviab2dsnvbXUufyBk5C1U,1951
139
- atomicshop/monitor/checks/network.py,sha256=I9f3KyNnlx97E8igGZXpVJl4MlUp9iU6aSbILCKqbA0,3820
140
- atomicshop/monitor/checks/process_running.py,sha256=948Sify4P2KFTE1ZrLHKLwd1B1HOgWmC11x3b6MCvz0,1892
137
+ atomicshop/monitor/checks/dns.py,sha256=8ZkJ-YKh53sZuSjzvT7ZwhZvq8Kym7GsIsTZX7TL1tE,5858
138
+ atomicshop/monitor/checks/hash.py,sha256=f719jU1A_rJi1ixGEHzWIZEoqpHJq4znabZnq4in9IM,2202
139
+ atomicshop/monitor/checks/network.py,sha256=i2jc5LRKeQJRNtOrSbkZQQCMy33No_X-SjMcXDmIh1E,3753
140
+ atomicshop/monitor/checks/process_running.py,sha256=pvSTa3nHDy1YH-35QkFxBUsqnCnfU5PBA_NNjp9iUNg,1889
141
141
  atomicshop/monitor/checks/hash_checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
- atomicshop/monitor/checks/hash_checks/file.py,sha256=UDHrUphYSKeH4KJR5pC3ilPAGxX0oXTu3UD8ndnR5WU,2733
143
- atomicshop/monitor/checks/hash_checks/url.py,sha256=aNAL1bIeks6xsRDk-5arGy4rhzrJkJ4ZRCqCQTi4n3U,3237
142
+ atomicshop/monitor/checks/hash_checks/file.py,sha256=o80UpjPNx9-AF5fYkZaP-ASHcBCE2zwGKUVRtDYKQyI,2402
143
+ atomicshop/monitor/checks/hash_checks/url.py,sha256=XxBNjhQZO_JlicgadqBblvt6sIRizerwM-LVCOgMCQU,3020
144
144
  atomicshop/ssh_scripts/process_from_ipv4.py,sha256=uDBKZ2Ds20614JW1xMLr4IPB-z1LzIwy6QH5-SJ4j0s,1681
145
145
  atomicshop/ssh_scripts/process_from_port.py,sha256=uDTkVh4zc3HOTTGv1Et3IxM3PonDJCPuFRL6rnZDQZ4,1389
146
146
  atomicshop/wrappers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -251,8 +251,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
251
251
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
252
252
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
253
253
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
254
- atomicshop-2.12.16.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
255
- atomicshop-2.12.16.dist-info/METADATA,sha256=Sxe0EOSeHGX8jfjldfji7N3m_tORqIzRpxLiy7npPCY,10479
256
- atomicshop-2.12.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
257
- atomicshop-2.12.16.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
258
- atomicshop-2.12.16.dist-info/RECORD,,
254
+ atomicshop-2.12.18.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
255
+ atomicshop-2.12.18.dist-info/METADATA,sha256=4E-r6t0g9HkY20OK3Lku2kubU9gIgrt-etS18Ms37Ig,10479
256
+ atomicshop-2.12.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
257
+ atomicshop-2.12.18.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
258
+ atomicshop-2.12.18.dist-info/RECORD,,