atomicshop 2.10.8__py3-none-any.whl → 2.11.1__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.

@@ -1,3 +1,4 @@
1
+ import os
1
2
  import sys
2
3
  import subprocess
3
4
  import shutil
@@ -48,10 +49,25 @@ def upgrade_system_packages():
48
49
  subprocess.check_call(['sudo', 'apt-get', 'upgrade', '-y'])
49
50
 
50
51
 
51
- def is_service_running(service_name: str, return_false_on_error: bool = False) -> bool:
52
+ def is_service_running(service_name: str, user_mode: bool = False, return_false_on_error: bool = False) -> bool:
53
+ """
54
+ Function checks if a service is running.
55
+ :param service_name: str, the service name.
56
+ :param user_mode: bool, if True, the service will be checked in user mode.
57
+ :param return_false_on_error: bool, if True, the function will return False if an error occurs.
58
+ :return:
59
+ """
60
+
61
+ command: list = ['systemctl']
62
+
63
+ if user_mode:
64
+ command.append('--user')
65
+
66
+ command.extend(['is-active', service_name])
67
+
52
68
  try:
53
69
  # Use subprocess to run 'systemctl is-active' and capture its output
54
- status = subprocess.check_output(['systemctl', 'is-active', service_name], text=True).strip()
70
+ status = subprocess.check_output(command, text=True).strip()
55
71
  except subprocess.CalledProcessError as e:
56
72
  if return_false_on_error:
57
73
  # Handle error if systemctl command fails
@@ -66,22 +82,52 @@ def is_service_running(service_name: str, return_false_on_error: bool = False) -
66
82
  return False
67
83
 
68
84
 
69
- def enable_service(service_name: str):
85
+ def enable_service(service_name: str, sudo: bool = True, user_mode: bool = False):
70
86
  """
71
87
  Function enables a service.
72
88
  :param service_name: str, the service name.
89
+ :param sudo: bool, if True, the command will be executed with sudo.
90
+ :param user_mode: bool, if True, the service will be enabled in user mode.
73
91
  :return:
74
92
  """
75
- subprocess.check_call(['sudo', 'systemctl', 'enable', service_name])
76
93
 
94
+ command: list = []
95
+
96
+ if sudo:
97
+ command.append('sudo')
98
+
99
+ command.append('systemctl')
77
100
 
78
- def start_service(service_name: str):
101
+ if user_mode:
102
+ command.append('--user')
103
+
104
+ command.extend(['enable', service_name])
105
+
106
+ subprocess.check_call(command)
107
+
108
+
109
+ def start_service(service_name: str, sudo: bool = True, user_mode: bool = False):
79
110
  """
80
111
  Function starts a service.
81
112
  :param service_name: str, the service name.
113
+ :param sudo: bool, if True, the command will be executed with sudo.
114
+ :param user_mode: bool, if True, the service will be started in user mode.
82
115
  :return:
83
116
  """
84
- subprocess.check_call(['sudo', 'systemctl', 'start', service_name])
117
+
118
+ command: list = []
119
+
120
+ if sudo:
121
+ command.append('sudo')
122
+
123
+ command.append('systemctl')
124
+
125
+ if user_mode:
126
+ command.append('--user')
127
+
128
+ command.extend(['start', service_name])
129
+
130
+ subprocess.check_call(command)
85
131
 
86
132
 
87
133
  def start_enable_service_check_availability(
@@ -91,6 +137,8 @@ def start_enable_service_check_availability(
91
137
  start_service_bool: bool = True,
92
138
  enable_service_bool: bool = True,
93
139
  check_service_running: bool = True,
140
+ user_mode: bool = False,
141
+ sudo: bool = True,
94
142
  print_kwargs: dict = None
95
143
  ):
96
144
  """
@@ -103,6 +151,8 @@ def start_enable_service_check_availability(
103
151
  :param start_service_bool: bool, if True, the service will be started.
104
152
  :param enable_service_bool: bool, if True, the service will be enabled.
105
153
  :param check_service_running: bool, if True, the function will check if the service is running.
154
+ :param user_mode: bool, if True, the service will be started and enabled in user mode.
155
+ :param sudo: bool, if True, the command will be executed with sudo.
106
156
  :param print_kwargs: dict, the print arguments.
107
157
  :return:
108
158
  """
@@ -112,9 +162,9 @@ def start_enable_service_check_availability(
112
162
 
113
163
  # Start and enable the service.
114
164
  if start_service_bool:
115
- start_service(service_name)
165
+ start_service(service_name, user_mode=user_mode, sudo=sudo)
116
166
  if enable_service_bool:
117
- enable_service(service_name)
167
+ enable_service(service_name, user_mode=user_mode,sudo=sudo)
118
168
 
119
169
  if check_service_running:
120
170
  print_api(
@@ -122,10 +172,23 @@ def start_enable_service_check_availability(
122
172
  **(print_kwargs or {}))
123
173
  time.sleep(wait_time_seconds)
124
174
 
125
- if not is_service_running(service_name):
175
+ if not is_service_running(service_name, user_mode=user_mode):
126
176
  print_api(
127
177
  f"[{service_name}] service failed to start.", color='red', error_type=True, **(print_kwargs or {}))
128
178
  if exit_on_error:
129
179
  sys.exit(1)
130
180
  else:
131
181
  print_api(f"[{service_name}] service is running.", color='green', **(print_kwargs or {}))
182
+
183
+
184
+ def add_path_to_bashrc():
185
+ """Add $HOME/bin to the PATH in .bashrc if it's not already present."""
186
+ bashrc_path = os.path.expanduser("~/.bashrc")
187
+ new_path = 'export PATH=$PATH:$HOME/bin\n'
188
+ with open(bashrc_path, 'r+') as bashrc:
189
+ content = bashrc.read()
190
+ if "$HOME/bin" not in content:
191
+ bashrc.write(new_path)
192
+ print("Added $HOME/bin to .bashrc")
193
+ else:
194
+ print("$HOME/bin already in .bashrc")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.10.8
3
+ Version: 2.11.1
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -39,6 +39,7 @@ Requires-Dist: dnspython
39
39
  Requires-Dist: docker
40
40
  Requires-Dist: elasticsearch
41
41
  Requires-Dist: numpy
42
+ Requires-Dist: olefile
42
43
  Requires-Dist: openpyxl
43
44
  Requires-Dist: pandas
44
45
  Requires-Dist: paramiko
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=jLebawbp1INbR4X9mVO70IY6_95wF8u3eJf77Id2Cis,123
1
+ atomicshop/__init__.py,sha256=m5isGWCdh1ohe2ybTN5N1f4aFi-1EX_3JLu-T9zcTHQ,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
@@ -24,7 +24,7 @@ atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,
24
24
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
25
25
  atomicshop/permissions.py,sha256=y63kcxU6GAmnVXqWhs_N29XorOD2xYWlK_CjZ1PpHgA,2897
26
26
  atomicshop/print_api.py,sha256=DhbCQd0MWZZ5GYEk4oTu1opRFC-b31g1VWZgTGewG2Y,11568
27
- atomicshop/process.py,sha256=SXaqG8pzNkHvppPhuhixEIXSaqbeDlTUFLaS5bYSp54,14176
27
+ atomicshop/process.py,sha256=iP9H9Tr51o98REVjcFJ8D0BJUcjRpOVsD9yaEWoJ_h4,14686
28
28
  atomicshop/process_name_cmd.py,sha256=TNAK6kQZm5JKWzEW6QLqVHEG98ZLNDQiSS4YwDk8V8c,3830
29
29
  atomicshop/process_poller.py,sha256=WfmwCLALfTYOq8ri0vkPeqq8ruEyA_43DaN--CU2_XY,10854
30
30
  atomicshop/python_file_patcher.py,sha256=kd3rBWvTcosLEk-7TycNdfKW9fZbe161iVwmH4niUo0,5515
@@ -49,8 +49,9 @@ atomicshop/addons/PlayWrightCodegen.cmd,sha256=Z5cnllsyXD4F1W2h-WLEnyFkg5nZy0-hT
49
49
  atomicshop/addons/ScriptExecution.cmd,sha256=8iC-uHs9MX9qUD_C2M7n9Xw4MZvwOfxT8H5v3hluVps,93
50
50
  atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh,sha256=lM7LkXQ2AxfFzDGyzSOfIS_zpg9bAD1k3JJ-qu5CdH8,81
51
51
  atomicshop/addons/a_setup_scripts/install_pywintrace_0.3.cmd,sha256=lEP_o6rWcBFUyup6_c-LTL3Q2LRMqryLuG3mJw080Zc,115
52
- atomicshop/addons/mains/install_docker_ubuntu_main_sudo.py,sha256=3VDGDO41Vubzf64DaBapLlFYX52dEdyPBNfolSsbGcM,161
52
+ atomicshop/addons/mains/install_docker_ubuntu_main_sudo.py,sha256=MZy2DQXRndjCSiZEXweDiSbZtsY9WmDyuxOdKUO8TK8,256
53
53
  atomicshop/addons/mains/install_wsl_ubuntu_lts_admin.py,sha256=PrvZ4hMuadzj2GYKRZSwyNayJUuaSnCF9nV6ORqoPdo,123
54
+ atomicshop/addons/mains/msi_unpacker.py,sha256=XAJdEqs-3s9JqIgHpGRL-HxLKpFMXdrlXmq2Is2Pyfk,164
54
55
  atomicshop/addons/mains/search_for_hyperlinks_in_docx.py,sha256=HkIdo_Sz9nPbbbJf1mwfwFkyI7vkvpH8qiIkuYopN4w,529
55
56
  atomicshop/addons/mains/FACT/factw_fact_extractor_docker_image_main_sudo.py,sha256=DDKX3Wp2SmzMCEtCIEOUbEKMob2ZQ7VEQGLEf9uYXrs,320
56
57
  atomicshop/addons/mains/FACT/update_extract.py,sha256=H3VsdhlA7xxK5lI_nyrWUdk8GNZXbEUVR_K9cJ4ECAw,506
@@ -68,6 +69,7 @@ atomicshop/archiver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
68
69
  atomicshop/archiver/_search_in_zip.py,sha256=dd8qFSvIhcKmtnPj_uYNJFPmMwZp4tZys0kKgTw_ACw,8385
69
70
  atomicshop/archiver/archiver.py,sha256=BomnK7zT-nQXA1z0i2R2aTv8eu88wPx7tf2HtOdbmEc,1280
70
71
  atomicshop/archiver/search_in_archive.py,sha256=kui33oobL2F3VLgAE8L037rHR8Ud3HpXz_E0tbuiDD4,10473
72
+ atomicshop/archiver/sevenz_app_w.py,sha256=TEOhlZPzKqQPStmyIq5E_yP98brj1t_GuoBgeLXA4dA,3019
71
73
  atomicshop/archiver/sevenzs.py,sha256=5i_C50-deC1Cz_GQdMGofV2jeMPbbGWAvih-QnA72cg,1370
72
74
  atomicshop/archiver/zips.py,sha256=k742K1bEDtc_4N44j_Waebi-uOkxxavqltvV6q-BLW4,14402
73
75
  atomicshop/basics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -145,17 +147,24 @@ atomicshop/wrappers/cryptographyw.py,sha256=H5NaHHDkr97QYhUrHFO9vY218u8k3N3Zgh6b
145
147
  atomicshop/wrappers/ffmpegw.py,sha256=wcq0ZnAe0yajBOuTKZCCaKI7CDBjkq7FAgdW5IsKcVE,6031
146
148
  atomicshop/wrappers/githubw.py,sha256=mQGtj6up1HIvjOD2t0bmOWjLooJLYvuIa7d7H-tknrw,9998
147
149
  atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc,1025
150
+ atomicshop/wrappers/olefilew.py,sha256=biD5m58rogifCYmYhJBrAFb9O_Bn_spLek_9HofLeYE,2051
148
151
  atomicshop/wrappers/pipw.py,sha256=iq4pDhmrHqKbcRi3Y6_v2PQSdb4fqfAx79rsX7JEmXo,801
149
152
  atomicshop/wrappers/process_wrapper_pbtk.py,sha256=ycPmBRnv627RWks6N8OhxJQe8Gu3h3Vwj-4HswPOw0k,599
150
153
  atomicshop/wrappers/pyopensslw.py,sha256=OBWxA6EJ2vU_Qlf4M8m6ilcG3hyYB4yB0EsXUf7NhEU,6804
151
- atomicshop/wrappers/ubuntu_terminal.py,sha256=1CcTXASzxdFFFJTf3G1OtHcs8abbn_jgkPsY0OzEs1w,4132
154
+ atomicshop/wrappers/ubuntu_terminal.py,sha256=Ykt3vSkvS2IddjRfZqwDbW98g4E1cServj6iUhg0n30,6121
152
155
  atomicshop/wrappers/wslw.py,sha256=AKphiHLSddL7ErevUowr3f9Y1AgGz_R3KZ3NssW07h8,6959
153
156
  atomicshop/wrappers/certauthw/certauth.py,sha256=hKedW0DOWlEigSNm8wu4SqHkCQsGJ1tJfH7s4nr3Bk0,12223
154
157
  atomicshop/wrappers/certauthw/certauthw.py,sha256=4WvhjANI7Kzqrr_nKmtA8Kf7B6rute_5wfP65gwQrjw,8082
158
+ atomicshop/wrappers/ctyping/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
159
  atomicshop/wrappers/ctyping/process_winapi.py,sha256=QcXL-ETtlSSkoT8F7pYle97ubGWsjYp8cx8HxkVMgAc,2762
160
+ atomicshop/wrappers/ctyping/msi_windows_installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
+ atomicshop/wrappers/ctyping/msi_windows_installer/base.py,sha256=Uu9SlWLsQQ6mjE-ek-ptHcmgiI3Ruah9bdZus70EaVY,4884
162
+ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc82xApStckPS2yCcoyaw32yC15KROs,3285
163
+ atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=eyFAD1itG0UClPs92GFefIWTccRgRF55KVLKl1pugGw,5402
164
+ atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=ajiFiLXl1prg2kOhatfT8E2RKX7F8JjUJpwkVuKu1GY,16263
156
165
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
166
  atomicshop/wrappers/dockerw/dockerw.py,sha256=w8zSJr5C7cbvbuG09ORCpAe0BOcibqqL_Z2EKEBHYK4,6266
158
- atomicshop/wrappers/dockerw/install_docker.py,sha256=glX5UKReRc8rUrBQUKqIQb7HnLiG2QlPXxC-qemNpAc,5133
167
+ atomicshop/wrappers/dockerw/install_docker.py,sha256=QNKLgm_UVpwN63D8v8k8FhOyEwA9XjHi0CT5f1FfEhA,6846
159
168
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
169
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
161
170
  atomicshop/wrappers/elasticsearchw/elasticsearchw.py,sha256=7TqFdEFznO8NlligJhEKk1vm641ALpCYdaRl1uoXdzM,9768
@@ -178,7 +187,7 @@ atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=jJAoJNQ4aoATjn3x
178
187
  atomicshop/wrappers/factw/fact_extractor/get_extractor.py,sha256=2mfOAftHIlCcGt1s7MWdq7DsDCuI6wX3MtvcEZ4SK-0,756
179
188
  atomicshop/wrappers/factw/install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
189
  atomicshop/wrappers/factw/install/install_after_restart.py,sha256=-VXC3KDX2BzF0oi0ELCmfch55vLk-3t16KxlmYyUGD8,1560
181
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=7Yk1xZXFXoPZVsSvgZzOLMoZza9OFIB5HplLQxY-7Bs,4251
190
+ atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=nJEJbmSICktNoDoNLfhbMj4Vr4eY7CtR80RfJvbEM68,4442
182
191
  atomicshop/wrappers/factw/postgresql/__init__.py,sha256=xMBn2d3Exo23IPP2F_9-SXmOlhFbwWDgS9KwozSTjA0,162
183
192
  atomicshop/wrappers/factw/postgresql/analysis.py,sha256=2Rxzy2jyq3zEKIo53z8VkjuslKE_i5mq2ZpmJAvyd6U,716
184
193
  atomicshop/wrappers/factw/postgresql/file_object.py,sha256=VRiCXnsd6yDbnsE-TEKYPC-gkAgFVkE6rygRrJLQShI,713
@@ -233,8 +242,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
233
242
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
234
243
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
235
244
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
236
- atomicshop-2.10.8.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
237
- atomicshop-2.10.8.dist-info/METADATA,sha256=35z6a8qlF_O0hPLHYCDfdrqRN_5nx52xrhoaQ0BbCqk,10423
238
- atomicshop-2.10.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
239
- atomicshop-2.10.8.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
240
- atomicshop-2.10.8.dist-info/RECORD,,
245
+ atomicshop-2.11.1.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
246
+ atomicshop-2.11.1.dist-info/METADATA,sha256=FiG_HsaXXg-WVQNYXwiPOth_zRUliMT2l9dKt1qhJ2Q,10447
247
+ atomicshop-2.11.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
248
+ atomicshop-2.11.1.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
249
+ atomicshop-2.11.1.dist-info/RECORD,,