atomicshop 2.6.2__py3-none-any.whl → 2.6.4__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.6.2'
4
+ __version__ = '2.6.4'
atomicshop/filesystem.py CHANGED
@@ -59,6 +59,28 @@ FILE_NAME_REPLACEMENT_DICT: dict = {
59
59
  }
60
60
 
61
61
 
62
+ def get_linux_home() -> str:
63
+ """
64
+ The function will return the home directory of the user on Linux.
65
+
66
+ :return: string, home directory of the user on Linux.
67
+ """
68
+
69
+ return os.path.expanduser('~')
70
+
71
+
72
+ def create_empty_file(file_path: str) -> None:
73
+ """
74
+ The function creates an empty file.
75
+
76
+ :param file_path: string, full path to file.
77
+ :return: None.
78
+ """
79
+
80
+ # Create empty file.
81
+ Path(file_path).touch()
82
+
83
+
62
84
  def get_working_directory() -> str:
63
85
  """
64
86
  The function returns working directory of called script file.
atomicshop/process.py CHANGED
@@ -36,8 +36,8 @@ def process_execution_decorator(function_name):
36
36
  @process_execution_decorator
37
37
  def execute_with_live_output(
38
38
  cmd: Union[list, str],
39
- print_empty_lines: bool = False,
40
- verbose: bool = False,
39
+ print_empty_lines: bool = True,
40
+ verbose: bool = True,
41
41
  output_strings: list = None,
42
42
  wsl: bool = False,
43
43
  **kwargs
@@ -54,7 +54,7 @@ def execute_with_live_output(
54
54
  :param verbose: boolean.
55
55
  'True': Print all output lines of the process.
56
56
  'False': Don't print any lines of output.
57
- :param output_strings: list, of strings. If output line contains any of the strings it will be outputted to console.
57
+ :param output_strings: list, of strings. Only lines that contain any of the strings in this list will be printed.
58
58
  :param wsl: boolean, that sets if the command is executed with WSL.
59
59
  :return: Boolean, If execution was successful, return True, if not - False.
60
60
  """
@@ -35,7 +35,7 @@ def find_and_replace_in_file(
35
35
 
36
36
  if file_sha256 is not None:
37
37
  file_hash: str = hashing.hash_file(file_path)
38
- if file_hash != file_sha256:
38
+ if file_hash.lower() != file_sha256.lower():
39
39
  raise ResourceWarning(
40
40
  f"File's SHA256 hash is not the same as specified. Nothing was changed.\n"
41
41
  f"File path: {file_path}\n"
@@ -1,8 +1,7 @@
1
1
  from typing import Union, Literal
2
2
  from pathlib import Path
3
- import subprocess
4
3
 
5
- from .... import permissions
4
+ from .... import permissions, process, filesystem
6
5
  from .. import config_install
7
6
 
8
7
 
@@ -23,16 +22,14 @@ def install_after_restart(
23
22
  --db: Distributed setup, Install the FACT_core database.
24
23
  :return:
25
24
  """
26
- if not permissions.is_admin():
27
- print("This script requires root privileges. Please enter your password for sudo access.")
28
- permissions.run_as_root(['-v'])
29
25
 
30
- install_command: str = 'python3 ' + str(Path(installation_directory, config_install.INSTALL_FILE_PATH))
26
+ install_command: str = 'python3 "' + str(Path(installation_directory, config_install.INSTALL_FILE_PATH)) + '"'
31
27
 
32
28
  if install_type:
33
29
  install_command = install_command + ' --' + install_type
34
30
 
35
31
  # Install the FACT_core repo.
36
- subprocess.run(install_command)
32
+ process.execute_with_live_output(cmd=install_command, verbose=True)
37
33
  # Remove the FACT_core installation log.
38
- # filesystem.remove_file(config_static_install.FACT_CORE_INSTALL_LOG_FILE_PATH)
34
+ working_directory_path: str = filesystem.get_working_directory()
35
+ filesystem.remove_file(str(Path(working_directory_path, config_install.INSTALL_LOG_FILE_NAME)))
@@ -1,11 +1,13 @@
1
1
  import subprocess
2
2
  from pathlib import Path
3
+ import sys
3
4
 
4
- from .... import permissions, filesystem
5
+ from .... import permissions, filesystem, process
5
6
  from ... import githubw
6
7
  from .. import config_install
7
8
 
8
9
 
10
+
9
11
  def install_before_restart(installation_directory: str):
10
12
  """
11
13
  This function will install the FACT_core before the restart of the computer.
@@ -14,14 +16,16 @@ def install_before_restart(installation_directory: str):
14
16
  """
15
17
 
16
18
  if not permissions.is_admin():
17
- print("This script requires root privileges. Please enter your password for sudo access.")
18
- permissions.run_as_root(['-v'])
19
+ print("This script requires root privileges...")
20
+ sys.exit(0)
19
21
 
20
22
  docker_keyring_file_path: str = "/etc/apt/keyrings/docker.gpg"
23
+ nodesource_keyring_file_path: str = "/etc/apt/keyrings/nodesource.gpg"
21
24
  fact_core_pre_install_file_path = str(Path(installation_directory, config_install.PRE_INSTALL_FILE_PATH))
22
25
 
23
- # Remove the docker keyring, so we will not be asked to overwrite it if it exists.
26
+ # Remove the existing keyrings, so we will not be asked to overwrite it if it exists.
24
27
  filesystem.remove_file(docker_keyring_file_path)
28
+ filesystem.remove_file(nodesource_keyring_file_path)
25
29
 
26
30
  with permissions.temporary_regular_permissions():
27
31
  # Create the FACT_core directory.
@@ -40,4 +44,3 @@ def install_before_restart(installation_directory: str):
40
44
 
41
45
  # Run the shell script
42
46
  subprocess.run(['bash', fact_core_pre_install_file_path])
43
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.6.2
3
+ Version: 2.6.4
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=daVa-vD7XmQMWZ84ohrQ5EVjNn0OcxdQ2BepW6dMlLo,122
1
+ atomicshop/__init__.py,sha256=rgcFnkoZb5QOXNED5nID13Ev6vETh2KbA2y_y2S1gmM,122
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
3
  atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
4
4
  atomicshop/appointment_management.py,sha256=N3wVGJgrqJfsj_lqiRfaL3FxMEe57by5Stzanh189mk,7263
@@ -13,7 +13,7 @@ atomicshop/diff_check.py,sha256=RON9cSTgy3jAnwUmAUkOyfF6bgrBKOq9Sbgyl3RYodw,1235
13
13
  atomicshop/dns.py,sha256=bNZOo5jVPzq7OT2qCPukXoK3zb1oOsyaelUwQEyK1SA,2500
14
14
  atomicshop/domains.py,sha256=Rxu6JhhMqFZRcoFs69IoEd1PtYca0lMCG6F1AomP7z4,3197
15
15
  atomicshop/emails.py,sha256=I0KyODQpIMEsNRi9YWSOL8EUPBiWyon3HRdIuSj3AEU,1410
16
- atomicshop/filesystem.py,sha256=a1anVYpBoUPqucAjA3E7W0jTqSJWizhI_keJkIT4lYY,32162
16
+ atomicshop/filesystem.py,sha256=ZIVmZ3Zfq4U3gJ7Bta6wPnHSNJMwpyC1CoJcgTDxKUg,32624
17
17
  atomicshop/functions.py,sha256=pK8hoCE9z61PtWCxQJsda7YAphrLH1wxU5x-1QJP-sY,499
18
18
  atomicshop/hashing.py,sha256=Le8qGFyt3_wX-zGTeQShz7L2HL_b6nVv9PnawjglyHo,3474
19
19
  atomicshop/http_parse.py,sha256=nrf2rZcprLqtW8HVrV7TCZ1iTBcWRRy-mXIlAOzcaJs,9703
@@ -23,10 +23,10 @@ atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,
23
23
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
24
24
  atomicshop/permissions.py,sha256=uuMLDWOKmpZIVE_SacwDg7Si4R0Bg8fgbXv_6vSvtPg,2124
25
25
  atomicshop/print_api.py,sha256=3n1CoiXvDcDGg00n5gEmQYInHryIhWbcpNjVobO1Gao,11468
26
- atomicshop/process.py,sha256=i_25PrSqSBbTcstCi_8rWVXAEYco81l6b9x1l_egTOY,14193
26
+ atomicshop/process.py,sha256=5lqepm1psRbz66J4MB43ou6HHyac9F34QJedGukwAnk,14188
27
27
  atomicshop/process_name_cmd.py,sha256=TNAK6kQZm5JKWzEW6QLqVHEG98ZLNDQiSS4YwDk8V8c,3830
28
28
  atomicshop/process_poller.py,sha256=t79SwTX_4scH2WIH_ziw27aodG1ibhEFWbsVsmTyOVA,10846
29
- atomicshop/python_file_patcher.py,sha256=f7BJkTEbsKKv_Hx_Ni_mzbkF59OdJy3NRdp6a0PITpg,5061
29
+ atomicshop/python_file_patcher.py,sha256=au12o_fkWS9j4Z0gI_Z2V1mfw2S2buj72F2Eh88d18Q,5077
30
30
  atomicshop/python_functions.py,sha256=zJg4ogUwECxrDD7xdDN5JikIUctITM5lsyabr_ZNsRw,4435
31
31
  atomicshop/question_answer_engine.py,sha256=DuOn7QEgKKfqZu2cR8mVeFIfFgayfBHiW-jY2VPq_Fo,841
32
32
  atomicshop/queues.py,sha256=Al0fdC3ZJmdKfv-PyBeIck9lnfLr82BYchvzr189gsI,640
@@ -153,8 +153,8 @@ atomicshop/wrappers/factw/fact_extractor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
153
153
  atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=d2QLX0zTmJubzyvegf_SJK4yT7Ml2Aw_VlCSzZINFVs,2080
154
154
  atomicshop/wrappers/factw/fact_extractor/get_extractor.py,sha256=2mfOAftHIlCcGt1s7MWdq7DsDCuI6wX3MtvcEZ4SK-0,756
155
155
  atomicshop/wrappers/factw/install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
- atomicshop/wrappers/factw/install/install_after_restart.py,sha256=Qf0_CUsoJ8oyirPfnGeN0uSfMVIo3rfKmEgFW3rgewg,1617
157
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=ajEnHGRxor5uxAu5vVfsvC3zL0hzd_Kh5sMikJJg8ng,1746
156
+ atomicshop/wrappers/factw/install/install_after_restart.py,sha256=Wixuc-foMA0qGjzypbbQ5sdE-F72yIKmrI9c6xwLY-g,1571
157
+ atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=GrwbK1aYXFvET3ePS3dV9audb4ksMGeOqz-l64a7QHQ,1842
158
158
  atomicshop/wrappers/factw/postgresql/__init__.py,sha256=xMBn2d3Exo23IPP2F_9-SXmOlhFbwWDgS9KwozSTjA0,162
159
159
  atomicshop/wrappers/factw/postgresql/analysis.py,sha256=2Rxzy2jyq3zEKIo53z8VkjuslKE_i5mq2ZpmJAvyd6U,716
160
160
  atomicshop/wrappers/factw/postgresql/file_object.py,sha256=VRiCXnsd6yDbnsE-TEKYPC-gkAgFVkE6rygRrJLQShI,713
@@ -203,8 +203,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
203
203
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
204
204
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
205
205
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
206
- atomicshop-2.6.2.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
207
- atomicshop-2.6.2.dist-info/METADATA,sha256=nFxAG_5gm2nDLon7cTxF_7oQfSi5thaLTTAJH1699LQ,10267
208
- atomicshop-2.6.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
209
- atomicshop-2.6.2.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
210
- atomicshop-2.6.2.dist-info/RECORD,,
206
+ atomicshop-2.6.4.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
207
+ atomicshop-2.6.4.dist-info/METADATA,sha256=smQDv30aFWsIuv-IZWv8EPcTwtVDwT9zXf2Xl4chI0U,10267
208
+ atomicshop-2.6.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
209
+ atomicshop-2.6.4.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
210
+ atomicshop-2.6.4.dist-info/RECORD,,