atomicshop 3.1.12__py3-none-any.whl → 3.1.14__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.12'
4
+ __version__ = '3.1.14'
@@ -362,12 +362,6 @@ def thread_worker_main(
362
362
  # logger_method='info')
363
363
  # else:
364
364
 
365
- # TODO
366
- # if config_static.MainConfig.offline:
367
- # if side == 'Client':
368
- # # If we're in offline mode, then we'll use the offline queue to put the data for the service socket.
369
- # offline_client_service_queue.put()
370
-
371
365
  network_logger.info(
372
366
  f"Initializing Receiver for {side} cycle: {str(current_count)}")
373
367
 
@@ -404,6 +398,14 @@ def thread_worker_main(
404
398
  if side == 'Client':
405
399
  # Send to requester.
406
400
  bytes_to_send_list: list[bytes] = create_requester_request(client_message)
401
+
402
+ # If we're in offline mode, then we'll put the request to the responder right away.
403
+ if config_static.MainConfig.offline:
404
+ print_api("Offline Mode, sending to responder directly.", logger=network_logger,
405
+ logger_method='info')
406
+ process_client_raw_data(bytes_to_send_list[0], error_message, client_message)
407
+ client_message.action = 'client_responder'
408
+ bytes_to_send_list = create_responder_response(client_message)
407
409
  elif side == 'Service':
408
410
  bytes_to_send_list: list[bytes] = create_responder_response(client_message)
409
411
  print_api(f"Got responses from responder, count: [{len(bytes_to_send_list)}]",
@@ -430,9 +432,16 @@ def thread_worker_main(
430
432
 
431
433
  record_and_statistics_write(client_message)
432
434
 
433
- error_on_send: str = sender.Sender(
434
- ssl_socket=sending_socket, class_message=bytes_to_send_single,
435
- logger=network_logger).send()
435
+ # If we're in offline mode, it means we're in the client thread, and we'll send the
436
+ # bytes back to the client socket.
437
+ if config_static.MainConfig.offline:
438
+ error_on_send: str = sender.Sender(
439
+ ssl_socket=receiving_socket, class_message=bytes_to_send_single,
440
+ logger=network_logger).send()
441
+ else:
442
+ error_on_send: str = sender.Sender(
443
+ ssl_socket=sending_socket, class_message=bytes_to_send_single,
444
+ logger=network_logger).send()
436
445
 
437
446
  if error_on_send:
438
447
  client_message.reinitialize_dynamic_vars()
@@ -599,20 +608,25 @@ def thread_worker_main(
599
608
  client_thread = threading.Thread(
600
609
  target=receive_send_start,
601
610
  args=(client_socket, service_socket_instance, client_exception_queue, None),
602
- name=f"Thread-{thread_id}-Client")
603
- client_thread.daemon = True
611
+ name=f"Thread-{thread_id}-Client",
612
+ daemon=True)
604
613
  client_thread.start()
605
614
 
606
615
  service_exception_queue: queue.Queue = queue.Queue()
607
- service_thread = threading.Thread(
608
- target=receive_send_start,
609
- args=(service_socket_instance, client_socket, service_exception_queue, client_message_connection),
610
- name=f"Thread-{thread_id}-Service")
611
- service_thread.daemon = True
612
- service_thread.start()
616
+ if not config_static.MainConfig.offline:
617
+ service_thread = threading.Thread(
618
+ target=receive_send_start,
619
+ args=(service_socket_instance, client_socket, service_exception_queue, client_message_connection),
620
+ name=f"Thread-{thread_id}-Service",
621
+ daemon=True)
622
+ service_thread.start()
613
623
 
614
624
  client_thread.join()
615
- service_thread.join()
625
+ # If we're in offline mode, then there is no service thread.
626
+ if not config_static.MainConfig.offline:
627
+ # If we're not in offline mode, then we'll wait for the service thread to finish.
628
+ # noinspection PyUnboundLocalVariable
629
+ service_thread.join()
616
630
 
617
631
  # If there was an exception in any of the threads, then we'll raise it here.
618
632
  if not client_exception_queue.empty():
@@ -1,3 +1,5 @@
1
+ import threading
2
+
1
3
  import docker
2
4
  from docker.models.containers import Container
3
5
  from docker import DockerClient
@@ -177,14 +179,31 @@ def stop_remove_containers_by_image_name(image_name: str):
177
179
  :param image_name: str, the name of the image.
178
180
  :return:
179
181
  """
182
+
183
+ def stop_remove_containers(container_instance: Container):
184
+ """
185
+ Stop and remove a container instance.
186
+ :param container_instance: Container, the docker container object.
187
+ """
188
+ if container_instance.status == "running":
189
+ print_api(f"Stopping container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
190
+ container_instance.stop()
191
+ print_api(f"Removing container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
192
+ container_instance.remove()
193
+ print_api(f"Container removed: [{container_instance.name}]. Short ID: [{container_instance.short_id}]", color='blue')
194
+
195
+
180
196
  client = docker.from_env()
181
197
  all_containers = client.containers.list(all=True)
198
+
199
+ containers_to_remove: list[Container] = []
182
200
  for container in all_containers:
183
201
  if any(image_name in tag for tag in container.image.tags):
184
- if container.status == "running":
185
- print_api(f"Stopping container: [{container.name}]. Short ID: [{container.short_id}]")
186
- container.stop()
187
- container.remove()
202
+ containers_to_remove.append(container)
203
+
204
+ for removing_container in containers_to_remove:
205
+ threading.Thread(target=stop_remove_containers, args=(removing_container,), daemon=True).start()
206
+
188
207
  client.close()
189
208
 
190
209
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.1.12
3
+ Version: 3.1.14
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=c8m_Gh0h9hfNm9ePH6o00XYoYEtAE6ZAFRagc98X2aE,123
1
+ atomicshop/__init__.py,sha256=51cQhVAb57yTXRlohpUAwbJggyE5xJPvP9tWPDiTCP8,123
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
@@ -136,7 +136,7 @@ atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,21
136
136
  atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
137
  atomicshop/mitm/config_static.py,sha256=N3D06C_wUytwm80PQCL90ZGHLMHeQlCcI2XQQU2FZ1I,8145
138
138
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
139
- atomicshop/mitm/connection_thread_worker.py,sha256=r3yKhT96oh_vyFIi858gYrpFyqIpoDwxIMAOo2S8Jl4,29385
139
+ atomicshop/mitm/connection_thread_worker.py,sha256=Fqb2OfhM0GVpPSV-6luba4eaMQ68VqwFb0eB2vrtE4E,30477
140
140
  atomicshop/mitm/import_config.py,sha256=gCH1hV-CxBAdwjeFJu1I5ntbm5hqzcB0y0vzRPkzra0,16936
141
141
  atomicshop/mitm/initialize_engines.py,sha256=Pj9k3iLdoE0KAl3QWG1Z10LHUHY8WQivSPFnQLhCWrc,7385
142
142
  atomicshop/mitm/message.py,sha256=CDhhm4BTuZE7oNZCjvIZ4BuPOW4MuIzQLOg91hJaxDI,3065
@@ -224,7 +224,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
224
224
  atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
225
225
  atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
226
226
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
- atomicshop/wrappers/dockerw/dockerw.py,sha256=mwQT8d1aUrn8FbMCwcmUjoP35UWexl8DztNSuJAHJQo,9865
227
+ atomicshop/wrappers/dockerw/dockerw.py,sha256=GgPSvXxJj15kZ-LPiaHLl8aekof53sSP_U-vUMUe7_8,10639
228
228
  atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
229
229
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
230
230
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
@@ -337,8 +337,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
337
337
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
338
338
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
339
339
  atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
340
- atomicshop-3.1.12.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
- atomicshop-3.1.12.dist-info/METADATA,sha256=CML7ZknJI9npNHvo4ZJ7XE9sb2xMKnhoQUREbKqIvx0,10671
342
- atomicshop-3.1.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
- atomicshop-3.1.12.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
344
- atomicshop-3.1.12.dist-info/RECORD,,
340
+ atomicshop-3.1.14.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
+ atomicshop-3.1.14.dist-info/METADATA,sha256=lhw9Eozk9CfUi_0d053WbgebwXaDpZq1gfNAqaEvmUU,10671
342
+ atomicshop-3.1.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
+ atomicshop-3.1.14.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
344
+ atomicshop-3.1.14.dist-info/RECORD,,