ScriptCollection 3.5.61__py3-none-any.whl → 3.5.62__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.
@@ -937,3 +937,16 @@ class GeneralUtilities:
937
937
  GeneralUtilities.assert_condition(not (amount_of_attempts < amount_of_fails))
938
938
  if amount_of_fails == amount_of_attempts:
939
939
  raise
940
+
941
+ @staticmethod
942
+ @check_arguments
943
+ def int_to_string(number: int, leading_zeroplaces: int, trailing_zeroplaces: int) -> str:
944
+ return GeneralUtilities.float_to_string(float(number), leading_zeroplaces, trailing_zeroplaces)
945
+
946
+ @staticmethod
947
+ @check_arguments
948
+ def float_to_string(number: float, leading_zeroplaces: int, trailing_zeroplaces: int) -> str:
949
+ plain_str = str(number)
950
+ GeneralUtilities.assert_condition("." in plain_str)
951
+ splitted: list[str] = plain_str.split(".")
952
+ return splitted[0].zfill(leading_zeroplaces)+"."+splitted[1].ljust(trailing_zeroplaces, '0')
@@ -31,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
31
31
  from .ProgramRunnerPopen import ProgramRunnerPopen
32
32
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
33
33
 
34
- version = "3.5.61"
34
+ version = "3.5.62"
35
35
  __version__ = version
36
36
 
37
37
 
@@ -1291,7 +1291,7 @@ class ScriptCollectionCore:
1291
1291
  return False
1292
1292
 
1293
1293
  @staticmethod
1294
- def __read_popen_pipes(p: Popen):
1294
+ def __read_popen_pipes(p: Popen) -> tuple[list[str], list[str]]:
1295
1295
  p_id = p.pid
1296
1296
  with ThreadPoolExecutor(2) as pool:
1297
1297
  q_stdout = Queue()
@@ -1301,28 +1301,33 @@ class ScriptCollectionCore:
1301
1301
  pool.submit(ScriptCollectionCore.__enqueue_output, p.stderr, q_stderr)
1302
1302
  reading_stdout_last_time_resulted_in_exception: bool = False
1303
1303
  reading_stderr_last_time_resulted_in_exception: bool = False
1304
+
1305
+ stdout_result: list[str] = []
1306
+ stderr_result: list[str] = []
1307
+
1304
1308
  while (ScriptCollectionCore.__continue_process_reading(p_id, p, q_stdout, q_stderr, reading_stdout_last_time_resulted_in_exception, reading_stderr_last_time_resulted_in_exception)):
1305
- out_line = None
1306
- err_line = None
1309
+
1307
1310
  try:
1308
- out_line = q_stdout.get_nowait() # TODO read all avaliable lines
1309
- reading_stdout_last_time_resulted_in_exception = False
1311
+ while not q_stdout.empty():
1312
+ stdout_result.append(q_stdout.get_nowait())
1313
+ reading_stdout_last_time_resulted_in_exception = False
1310
1314
  except Empty:
1311
1315
  reading_stdout_last_time_resulted_in_exception = True
1312
1316
 
1313
1317
  try:
1314
- err_line = q_stderr.get_nowait() # TODO read all avaliable lines
1315
- reading_stderr_last_time_resulted_in_exception = False
1318
+ while not q_stderr.empty():
1319
+ stderr_result.append(q_stderr.get_nowait())
1320
+ reading_stderr_last_time_resulted_in_exception = False
1316
1321
  except Empty:
1317
1322
  reading_stderr_last_time_resulted_in_exception = True
1318
1323
 
1319
1324
  time.sleep(0.01) # this is required to not finish too early
1320
1325
 
1321
- yield (out_line, err_line)
1326
+ return (stdout_result, stderr_result)
1322
1327
 
1323
- # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
1324
1328
  @GeneralUtilities.check_arguments
1325
1329
  def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, verbosity: int = 1, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = 600, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False) -> tuple[int, str, str, int]:
1330
+ # Return-values program_runner: Exitcode, StdOut, StdErr, Pid
1326
1331
  # verbosity 1: No output will be logged.
1327
1332
  # verbosity 2: If the exitcode of the executed program is not 0 then the StdErr will be logged. This is supposed to be the default verbosity-level.
1328
1333
  # verbosity 3: Logs and prints StdOut and StdErr of the executed program in realtime.
@@ -1363,8 +1368,10 @@ class ScriptCollectionCore:
1363
1368
  if log_file is not None:
1364
1369
  GeneralUtilities.ensure_file_exists(log_file)
1365
1370
  pid = process.pid
1366
- for out_line_plain, err_line_plain in ScriptCollectionCore.__read_popen_pipes(process): # see https://stackoverflow.com/a/57084403/3905529
1367
1371
 
1372
+ outputs: tuple[list[str], list[str]] = ScriptCollectionCore.__read_popen_pipes(process)
1373
+
1374
+ for out_line_plain in outputs[0]:
1368
1375
  if out_line_plain is not None:
1369
1376
  out_line: str = None
1370
1377
  if isinstance(out_line_plain, str):
@@ -1385,6 +1392,7 @@ class ScriptCollectionCore:
1385
1392
  if log_file is not None:
1386
1393
  GeneralUtilities.append_line_to_file(log_file, out_line)
1387
1394
 
1395
+ for err_line_plain in outputs[1]:
1388
1396
  if err_line_plain is not None:
1389
1397
  err_line: str = None
1390
1398
  if isinstance(err_line_plain, str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ScriptCollection
3
- Version: 3.5.61
3
+ Version: 3.5.62
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -28,14 +28,14 @@ Requires-Dist: cyclonedx-bom>=5.1.2
28
28
  Requires-Dist: defusedxml>=0.7.1
29
29
  Requires-Dist: keyboard>=0.13.5
30
30
  Requires-Dist: lcov-cobertura>=2.0.2
31
- Requires-Dist: lxml>=5.3.0
31
+ Requires-Dist: lxml>=5.3.1
32
32
  Requires-Dist: ntplib>=0.4.0
33
33
  Requires-Dist: Pillow>=11.1.0
34
34
  Requires-Dist: pycdlib>=1.14.0
35
35
  Requires-Dist: Pygments>=2.19.1
36
36
  Requires-Dist: pylint>=3.3.4
37
37
  Requires-Dist: pyOpenSSL>=25.0.0
38
- Requires-Dist: PyPDF>=5.2.0
38
+ Requires-Dist: PyPDF>=5.3.0
39
39
  Requires-Dist: pytest>=8.3.4
40
40
  Requires-Dist: PyYAML>=6.0.2
41
41
  Requires-Dist: qrcode>=8.0
@@ -1,16 +1,16 @@
1
1
  ScriptCollection/Executables.py,sha256=kON_jatJe84iCJj60uUjA-Aj0ytERRe0FUDWbOWUe6s,28089
2
- ScriptCollection/GeneralUtilities.py,sha256=nlSZSsQVHWxf0Yzz4PjgZm39rgvIltVof8gL2YPgR7s,38805
2
+ ScriptCollection/GeneralUtilities.py,sha256=Ah-quoBRLNO3iTCfZaAlN0fhOC42b-UEGYRMW_XxgO0,39438
3
3
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
4
4
  ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
5
5
  ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
6
6
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
7
7
  ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
8
- ScriptCollection/ScriptCollectionCore.py,sha256=gmFAw9p9gVi4Z4vCtAsCS7bQUDLVMHJ66AEtuoaLx1o,111227
8
+ ScriptCollection/ScriptCollectionCore.py,sha256=TN3Crb86-lU9YrHV9XFDUUNtX3KhT0Gq9WHyjt2XeKI,111409
9
9
  ScriptCollection/TasksForCommonProjectStructure.py,sha256=B3-KSAZOR_UKSeLsdAxyZu2ylsRSjDvlj0272TXSEfA,213090
10
10
  ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
11
11
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- ScriptCollection-3.5.61.dist-info/METADATA,sha256=lrV7TcbmII8Mz2Bd7CFXv46tw-XIr8YozP5sfDCOgbk,7664
13
- ScriptCollection-3.5.61.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- ScriptCollection-3.5.61.dist-info/entry_points.txt,sha256=wspYVXWH8kon-wRQTAFEO11JoLJ0fEnOIG7tE7R-xtQ,3502
15
- ScriptCollection-3.5.61.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
- ScriptCollection-3.5.61.dist-info/RECORD,,
12
+ ScriptCollection-3.5.62.dist-info/METADATA,sha256=zPOBDBekOQ2rDLHvgehw8cB3gWbJUeSWIZbCdZehZJE,7664
13
+ ScriptCollection-3.5.62.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ ScriptCollection-3.5.62.dist-info/entry_points.txt,sha256=wspYVXWH8kon-wRQTAFEO11JoLJ0fEnOIG7tE7R-xtQ,3502
15
+ ScriptCollection-3.5.62.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
16
+ ScriptCollection-3.5.62.dist-info/RECORD,,