ScriptCollection 4.4.42__py3-none-any.whl → 4.4.44__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.
Files changed (26) hide show
  1. ScriptCollection/ArbTranslationsOrganizer.py +5 -5
  2. ScriptCollection/CertificateUpdater.py +2 -2
  3. ScriptCollection/Executables.py +24 -24
  4. ScriptCollection/GeneralUtilities.py +13 -15
  5. ScriptCollection/OCIImages/OCIImageManager.py +3 -3
  6. ScriptCollection/ProcessesRunner.py +2 -2
  7. ScriptCollection/ProgramRunnerSudo.py +1 -1
  8. ScriptCollection/RepositoryHistoryAnalyzer.py +6 -3
  9. ScriptCollection/Resources/CultureChooser/CultureChooser.js +0 -0
  10. ScriptCollection/Resources/CultureChooser/index.html +0 -0
  11. ScriptCollection/Resources/Dependencies/JRE/Version.txt +0 -0
  12. ScriptCollection/Resources/Dependencies/OpenAPIGenerator/Version.txt +0 -0
  13. ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html +0 -0
  14. ScriptCollection/ScriptCollectionCore.py +84 -45
  15. ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +10 -6
  16. ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +3 -2
  17. ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +2 -2
  18. ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +10 -10
  19. ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +24 -4
  20. ScriptCollection/TFCPS/TFCPS_CreateRelease.py +2 -2
  21. ScriptCollection/TFCPS/TFCPS_Tools_General.py +20 -42
  22. {scriptcollection-4.4.42.dist-info → scriptcollection-4.4.44.dist-info}/METADATA +23 -21
  23. {scriptcollection-4.4.42.dist-info → scriptcollection-4.4.44.dist-info}/RECORD +21 -21
  24. {scriptcollection-4.4.42.dist-info → scriptcollection-4.4.44.dist-info}/entry_points.txt +1 -3
  25. {scriptcollection-4.4.42.dist-info → scriptcollection-4.4.44.dist-info}/WHEEL +0 -0
  26. {scriptcollection-4.4.42.dist-info → scriptcollection-4.4.44.dist-info}/top_level.txt +0 -0
@@ -114,8 +114,8 @@ class ArbTranslationsOrganizer:
114
114
  BaseLanguage="en"#"en" means en-US; this is also why "en-GB" is allowed to be contained in "languages" further down.
115
115
 
116
116
  def organize_translations(self,sc:ScriptCollectionCore,arb_folder:str,xlf_folder:str,languages:list[str])->dict[str,dict[int,float]]:#languages look like ["fr","de","es","de-CH","en-GB"]; "en" is not contained because en is always the default language.
117
- #after this functions all texts in the arb files should be in the xlf files, and all texts in the xlf files should be in the arb files. see algorithm below
118
- #in general: arb_en.arb is the source of the truth regarding to which texts exist and the source of truh for the english texts.
117
+ #after this function all texts in the arb files should be in the xlf files, and all texts in the xlf files should be in the arb files. see algorithm below
118
+ #in general: arb_en.arb is the source of the truth regarding to which texts exist and the source of truth for the english texts.
119
119
  #returns the translation-state-statistics of the xlf-files (not of the arb-files), see ScriptCollectionCore.sync_xlf2_files.
120
120
  GeneralUtilities.assert_folder_exists(arb_folder)
121
121
  GeneralUtilities.ensure_directory_exists(xlf_folder)
@@ -129,14 +129,14 @@ class ArbTranslationsOrganizer:
129
129
  return statistics
130
130
 
131
131
  def __ensure_arb_files_exist(self,arb_folder:str,languages:list[str]):
132
- #after this function in arb_folder should be a arb-file for each language in languages. create the file if not already exist.
132
+ #after this function in arb_folder should be an arb-file for each language in languages. create the file if it does not already exist.
133
133
  for language in languages:
134
134
  arb_file=ARBTranslationHelper.arb_file_path(arb_folder,language)
135
135
  if not os.path.isfile(arb_file):
136
136
  ARBTranslationHelper.write_arb_messages(arb_file,language,[],{})
137
137
 
138
138
  def __ensure_xlf_files_exist(self,arb_folder:str,xlf_folder:str,languages:list[str]):
139
- #after this function in xlf_folder should be a xlf-file for each language in languages. create the file if not already exist.
139
+ #after this function in xlf_folder should be a xlf-file for each language in languages. create the file if it does not already exist.
140
140
  #a newly created file is bootstrapped from the language's current arb-translations (not left empty/untranslated), so translation-work already done directly in the arb-file (as it is right now for de/fr/es) is not discarded once that language starts taking part in the xlf-side of the sync.
141
141
  english_messages=ARBTranslationHelper.read_arb_messages(ARBTranslationHelper.arb_file_path(arb_folder,self.BaseLanguage))
142
142
  for language in languages:
@@ -155,7 +155,7 @@ class ArbTranslationsOrganizer:
155
155
  ARBTranslationHelper.write_arb_messages(arb_file,language,template_keys,ARBTranslationHelper.read_arb_messages(arb_file))
156
156
 
157
157
  def __write_arb_entries_to_xlf_files(self,arb_folder:str,xlf_folder:str):
158
- #after this function all texts from arb_en.arb should be in messages.xlf (do not touch other files than this both in the other steps) replace the entire message content of all entries in xlf. arb_en.arb defines all "true" entries and this is the only source of truth. so messages.xlf should contain these and only these entries. simple algorithm: remove the entire content from messages.xlf, then for each entry in arb_en.arb create a new entry in messages.xlf with the same message-key and the same message-value.
158
+ #after this function all texts from arb_en.arb should be in messages.xlf (do not touch other files than these two in the other steps) replace the entire message content of all entries in xlf. arb_en.arb defines all "true" entries and this is the only source of truth. so messages.xlf should contain these and only these entries. simple algorithm: remove the entire content from messages.xlf, then for each entry in arb_en.arb create a new entry in messages.xlf with the same message-key and the same message-value.
159
159
  english_messages=ARBTranslationHelper.read_arb_messages(ARBTranslationHelper.arb_file_path(arb_folder,self.BaseLanguage))
160
160
  units=[ARBTranslationHelper.build_unit(key,value,None) for key,value in english_messages.items()]
161
161
  ARBTranslationHelper.write_xliff2_file(ARBTranslationHelper.base_xlf_file_path(xlf_folder),self.BaseLanguage,None,units)
@@ -58,7 +58,7 @@ class CertificateUpdater:
58
58
 
59
59
  @GeneralUtilities.check_arguments
60
60
  def __replace_symlink_by_file(self, domain: str, filename: str, index: int) -> None:
61
- # ".../live/example.com/cert.pem" is a symlink but should replaced by a copy of ".../archive/example.com/cert.42pem"
61
+ # ".../live/example.com/cert.pem" is a symlink but should be replaced by a copy of ".../archive/example.com/cert42.pem"
62
62
  archive_file = os.path.join(self.__letsencrypt_archive_folder, domain, filename+str(index)+".pem")
63
63
  live_folder = os.path.join(self.__letsencrypt_live_folder, domain)
64
64
  live_filename = filename+".pem"
@@ -68,7 +68,7 @@ class CertificateUpdater:
68
68
 
69
69
  @GeneralUtilities.check_arguments
70
70
  def __replace_file_by_symlink(self, domain: str, filename: str, index: int) -> None:
71
- # new ".../live/example.com/cert.pem" is a file but should replaced by a symlink which points to ".../archive/example.com/cert42.pem"
71
+ # new ".../live/example.com/cert.pem" is a file but should be replaced by a symlink which points to ".../archive/example.com/cert42.pem"
72
72
  live_folder = os.path.join(self.__letsencrypt_live_folder, domain)
73
73
  live_filename = filename+".pem"
74
74
  self.__sc.run_program("rm", live_filename, live_folder, throw_exception_if_exitcode_is_not_zero=True)
@@ -23,7 +23,7 @@ Caution: This script can cause harm if you pass a wrong inputfolder-argument.'''
23
23
  parser.add_argument('--printtableheadline', type=GeneralUtilities.string_to_boolean, const=True, default=True, nargs='?', help='Prints column-titles in the name-mapping-csv-file')
24
24
  parser.add_argument('--namemappingfile', default="NameMapping.csv", help='Specifies the file where the name-mapping will be written to')
25
25
  parser.add_argument('--extensions', default="exe,py,sh", help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
26
- parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored whose names should be obfuscated', required=True)
26
+ parser.add_argument('--inputfolder', help='Specifies the folder where the files are stored whose names should be obfuscated', required=True)
27
27
 
28
28
  args = parser.parse_args()
29
29
  ScriptCollectionCore().filenameObfuscator(args.inputfolder, args.printtableheadline, args.namemappingfile, args.extensions)
@@ -34,7 +34,7 @@ def CreateISOFileWithObfuscatedFiles() -> int:
34
34
  parser = argparse.ArgumentParser(description='''Creates an iso file with the files in the given folder and changes their names and hash-values.
35
35
  This script does not process subfolders transitively.''')
36
36
 
37
- parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored which should be added to the iso-file', required=True)
37
+ parser.add_argument('--inputfolder', help='Specifies the folder where the files are stored which should be added to the iso-file', required=True)
38
38
  parser.add_argument('--outputfile', default="files.iso", help='Specifies the output-iso-file and its location')
39
39
  parser.add_argument('--printtableheadline', default=False, action='store_true', help='Prints column-titles in the name-mapping-csv-file')
40
40
  parser.add_argument('--createnoisofile', default=False, action='store_true', help="Create no iso file")
@@ -73,12 +73,12 @@ def Show2FAAsQRCode():
73
73
  parser = argparse.ArgumentParser(description="""Always when you use 2-factor-authentication you have the problem:
74
74
  Where to backup the secret-key so that it is easy to re-setup them when you have a new phone?
75
75
  Using this script is a solution. Always when you setup a 2fa you copy and store the secret in a csv-file.
76
- It should be obviously that this csv-file must be stored encrypted!
76
+ It should be obvious that this csv-file must be stored encrypted!
77
77
  Now if you want to move your 2fa-codes to a new phone you simply call "SCShow2FAAsQRCode 2FA.csv"
78
78
  Then the qr-codes will be displayed in the console and you can scan them on your new phone.
79
- This script does not saving the any data anywhere.
79
+ This script does not save any data anywhere.
80
80
 
81
- The structure of the csv-file can be viewd here:
81
+ The structure of the csv-file can be viewed here:
82
82
  Displayname;Website;Email-address;Secret;Period;
83
83
  Amazon;Amazon.de;myemailaddress@example.com;QWERTY;30;
84
84
  Google;Google.de;myemailaddress@example.com;ASDFGH;30;
@@ -93,7 +93,7 @@ Hints:
93
93
 
94
94
 
95
95
  def SearchInFiles() -> int:
96
- parser = argparse.ArgumentParser(description='''Searchs for the given searchstrings in the content of all files in the given folder.
96
+ parser = argparse.ArgumentParser(description='''Searches for the given searchstrings in the content of all files in the given folder.
97
97
  This program prints all files where the given searchstring was found to the console''')
98
98
 
99
99
  parser.add_argument('folder', help='Folder for search')
@@ -110,7 +110,7 @@ def ReplaceSubstringsInFilenames() -> int:
110
110
  parser.add_argument('folder', help='Folder where the files are stored which should be renamed')
111
111
  parser.add_argument('substringInFilename', help='String to be replaced')
112
112
  parser.add_argument('newSubstringInFilename', help='new string value for filename')
113
- parser.add_argument('conflictResolveMode', help='''Set a method how to handle cases where a file with the new filename already exits and
113
+ parser.add_argument('conflictResolveMode', help='''Set a method how to handle cases where a file with the new filename already exists and
114
114
  the files have not the same content. Possible values are: ignore, preservenewest, merge''')
115
115
 
116
116
  args = parser.parse_args()
@@ -138,8 +138,8 @@ def OrganizeLinesInFile() -> int:
138
138
  parser.add_argument("--sort", help="Sort lines", action='store_true')
139
139
  parser.add_argument("--remove_duplicated_lines", help="Remove duplicate lines", action='store_true')
140
140
  parser.add_argument("--ignore_first_line", help="Ignores the first line in the file", action='store_true')
141
- parser.add_argument("--remove_empty_lines", help="Removes lines which are empty or contains only whitespaces", action='store_true')
142
- parser.add_argument('--ignored_start_character', default="", help='Characters which should not be considered at the begin of a line')
141
+ parser.add_argument("--remove_empty_lines", help="Removes lines which are empty or contain only whitespaces", action='store_true')
142
+ parser.add_argument('--ignored_start_character', default="", help='Characters which should not be considered at the beginning of a line')
143
143
 
144
144
  args = parser.parse_args()
145
145
  ScriptCollectionCore().organize_lines_in_file(args.file, args.encoding, args.sort, args.remove_duplicated_lines, args.ignore_first_line, args.remove_empty_lines, list(args.ignored_start_character))
@@ -208,7 +208,7 @@ def MergePDFs() -> int:
208
208
 
209
209
 
210
210
  def KeyboardDiagnosis() -> None:
211
- """Caution: This function does usually never terminate"""
211
+ """Caution: This function usually never terminates"""
212
212
  keyboard.hook(__keyhook)
213
213
  while True:
214
214
  time.sleep(10)
@@ -219,7 +219,7 @@ def __keyhook(self, event) -> None:
219
219
 
220
220
 
221
221
  def GenerateThumbnail() -> int:
222
- parser = argparse.ArgumentParser(description='Generate thumpnails for video-files')
222
+ parser = argparse.ArgumentParser(description='Generate thumbnails for video-files')
223
223
  parser.add_argument('file', help='Input-videofile for thumbnail-generation')
224
224
  parser.add_argument('framerate', help='', default="16")
225
225
  args = parser.parse_args()
@@ -270,7 +270,7 @@ def BuildCodeUnits() -> int:
270
270
  if args.runincontainer:
271
271
  base_mount_folder:str=args.basemountfolder
272
272
  if base_mount_folder is None:
273
- base_mount_folder=repo
273
+ base_mount_folder=t.get_default_base_mount_folder()
274
274
  base_mount_folder:str=GeneralUtilities.resolve_relative_path(base_mount_folder,os.getcwd())
275
275
  success, _ = t.build_codeunits_in_container(base_mount_folder)
276
276
  return 0 if success else 1
@@ -297,11 +297,11 @@ def BuildCodeUnitsC() -> int:
297
297
  GeneralUtilities.reconfigure_standard_input_and_outputs()
298
298
  repo:str=GeneralUtilities.resolve_relative_path(args.repositoryfolder,os.getcwd())
299
299
  verbosity=LogLevel(int(args.verbosity))
300
+ t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repo,verbosity,args.targetenvironment,args.additionalargumentsfile,not args.nocache,args.ispremerge,args.assertnonewchanges,args.addreadytomergeflag,args.fastlane)
300
301
  base_mount_folder:str=args.basemountfolder
301
302
  if base_mount_folder is None:
302
- base_mount_folder=repo
303
+ base_mount_folder=t.get_default_base_mount_folder()
303
304
  base_mount_folder:str=GeneralUtilities.resolve_relative_path(base_mount_folder,os.getcwd())
304
- t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repo,verbosity,args.targetenvironment,args.additionalargumentsfile,not args.nocache,args.ispremerge,args.assertnonewchanges,args.addreadytomergeflag,args.fastlane)
305
305
  success, _ = t.build_codeunits_in_container(base_mount_folder)
306
306
  return 0 if success else 1
307
307
 
@@ -323,7 +323,7 @@ def UpdateDependencies() -> int:
323
323
  if args.runincontainer:
324
324
  base_mount_folder:str=args.basemountfolder
325
325
  if base_mount_folder is None:
326
- base_mount_folder=repo
326
+ base_mount_folder=t.get_default_base_mount_folder()
327
327
  base_mount_folder:str=GeneralUtilities.resolve_relative_path(base_mount_folder,os.getcwd())
328
328
  success, _ = t.update_dependencies_in_container(base_mount_folder)
329
329
  return 0 if success else 1
@@ -366,11 +366,11 @@ def UpdateDependenciesC() -> int:
366
366
  GeneralUtilities.reconfigure_standard_input_and_outputs()
367
367
  repo:str=GeneralUtilities.resolve_relative_path(args.repositoryfolder,os.getcwd())
368
368
  verbosity=LogLevel(int(args.verbosity))
369
+ t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repo,verbosity,args.targetenvironment,args.additionalargumentsfile,not args.nocache,False,False)
369
370
  base_mount_folder:str=args.basemountfolder
370
371
  if base_mount_folder is None:
371
- base_mount_folder=repo
372
+ base_mount_folder=t.get_default_base_mount_folder()
372
373
  base_mount_folder:str=GeneralUtilities.resolve_relative_path(base_mount_folder,os.getcwd())
373
- t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repo,verbosity,args.targetenvironment,args.additionalargumentsfile,not args.nocache,False,False)
374
374
  success, _ = t.update_dependencies_in_container(base_mount_folder)
375
375
  return 0 if success else 1
376
376
 
@@ -478,7 +478,7 @@ def CreateChangelogEntry() -> int:
478
478
 
479
479
 
480
480
  def FileExists() -> int:
481
- parser = argparse.ArgumentParser(description="This function returns 0 if the given file exists. Otherwise this function returns 2. If an error occurrs the exitcode is 1.")
481
+ parser = argparse.ArgumentParser(description="This function returns 0 if the given file exists. Otherwise this function returns 2. If an error occurs the exitcode is 1.")
482
482
  parser.add_argument('-p', '--path', required=True)
483
483
  args = parser.parse_args()
484
484
  if os.path.isfile(args.path):
@@ -506,7 +506,7 @@ def CheckPythonAst() -> int:
506
506
 
507
507
 
508
508
  def FolderExists() -> int:
509
- parser = argparse.ArgumentParser(description="This function returns 0 if the given folder exists. Otherwise this function returns 2. If an error occurrs the exitcode is 1.")
509
+ parser = argparse.ArgumentParser(description="This function returns 0 if the given folder exists. Otherwise this function returns 2. If an error occurs the exitcode is 1.")
510
510
  parser.add_argument('-p', '--path', required=True)
511
511
  args = parser.parse_args()
512
512
  if os.path.isdir(args.path):
@@ -912,7 +912,7 @@ def CurrentUserHasElevatedPrivileges() -> int:
912
912
 
913
913
 
914
914
  def Espoc() -> int:
915
- parser = argparse.ArgumentParser(description="Espoc (appreviation for 'exit started programs on close') is a tool to ensure the started processes of your program will also get terminated when the execution of your program is finished.")
915
+ parser = argparse.ArgumentParser(description="Espoc (abbreviation for 'exit started programs on close') is a tool to ensure the started processes of your program will also get terminated when the execution of your program is finished.")
916
916
  parser.add_argument('-p', '--processid', required=True)
917
917
  parser.add_argument('-f', '--file', required=True, help='Specifies the file where the process-ids of the started processes are stored (line by line). This file will be deleted when all started processes are terminated.')
918
918
  parser.add_argument('-l', '--logfile', required=False,default=None)
@@ -1294,7 +1294,7 @@ def ShowVersion() -> int:
1294
1294
 
1295
1295
 
1296
1296
  def ShowProjectVersion() -> int:
1297
- parser = argparse.ArgumentParser(description="Prints the semver-version of a project as calculated by gitversion.")
1297
+ parser = argparse.ArgumentParser(description="Prints the semver-version of a project, calculated from the latest git-tag (\"v<major>.<minor>.<patch>\") and the name of the current branch.")
1298
1298
  parser.add_argument('-r', '--repository', required=False, default=None, help="Path to the repository. Defaults to the current working directory.")
1299
1299
  args = parser.parse_args()
1300
1300
  repository = GeneralUtilities.resolve_relative_path(args.repository, os.getcwd()) if args.repository is not None else os.getcwd()
@@ -1304,12 +1304,12 @@ def ShowProjectVersion() -> int:
1304
1304
 
1305
1305
 
1306
1306
  def RunCommandInFolder() -> int:
1307
- parser = argparse.ArgumentParser(description="Runs a command in a folder if (and only if) the folder is located inside the allowed folder.")
1308
- parser.add_argument('-b', '--basefolder', required=True, help="Folder in which the command is executed in.")
1307
+ parser = argparse.ArgumentParser(description="Runs a command in the base-folder if (and only if) the actual folder is located inside the base-folder and not inside an excluded folder. The command is always executed in the base-folder; the actual folder is only passed to the command by using the placeholder \"{actual_folder}\" in the arguments (for example: -c git -a \"-C {actual_folder} status\").")
1308
+ parser.add_argument('-b', '--basefolder', required=True, help="Folder in which the command is executed.")
1309
1309
  parser.add_argument('-c', '--command', required=True, help="Command which should be executed.")
1310
1310
  parser.add_argument('-a', '--arguments', required=False, default="", help="Arguments which should be passed to the command.")
1311
1311
  parser.add_argument('-e', '--excludedfolder', action='append', default=[], help="A folder (relative to basefolder) which is not allowed even if it lies inside basefolder. Can be specified multiple times. Example: --excludedfolder .git --excludedfolder .claude --excludedfolder Other/Secrets")
1312
- parser.add_argument('-f', '--actualfolder', required=True, help="Folder-argument.")
1312
+ parser.add_argument('-f', '--actualfolder', required=True, help="Folder which is checked against the base-folder and the excluded folders and which replaces the placeholder \"{actual_folder}\" in the arguments. A relative path is resolved against the base-folder.")
1313
1313
  args = parser.parse_args()
1314
1314
  sc = ScriptCollectionCore()
1315
1315
  return sc.run_command_in_folder(args.basefolder, args.command, args.arguments, args.actualfolder, args.excludedfolder)
@@ -71,6 +71,10 @@ class GeneralUtilities:
71
71
 
72
72
  @staticmethod
73
73
  def check_arguments(function):
74
+ """Decorator which checks at runtime that the arguments passed to the decorated function match the type-hints of its
75
+ parameters and raises a TypeError otherwise. None is accepted for every parameter. Parameters without a type-hint and
76
+ parameters whose type-hint is a generic type (for example list[str] or dict[str, str]) are not checked.
77
+ The docstring of the decorated function is kept."""
74
78
  def __check_function(*args, **named_args):
75
79
  # "signature" is used instead of "getfullargspec", because it follows the "__wrapped__"-chain which
76
80
  # "functools.wraps" sets. Without that this decorator would only see the wrapper when it is applied
@@ -91,7 +95,7 @@ class GeneralUtilities:
91
95
  # regular TypeError of python, whose message names the expected and the given amount.
92
96
  break
93
97
  if argument is not None: # Check type of None is not possible. None is always a valid argument-value
94
- if parameters[index] in function.__annotations__: # Check if a type-hint for parameter exist. If not, no parameter-type available for argument-type-check
98
+ if parameters[index] in function.__annotations__: # Check if a type-hint for parameter exists. If not, no parameter-type available for argument-type-check
95
99
  # Check type of arguments if the type is a generic type seems to be impossible.
96
100
  if not GeneralUtilities.is_generic(function.__annotations__[parameters[index]]):
97
101
  if not isinstance(argument, function.__annotations__[parameters[index]]):
@@ -108,6 +112,8 @@ class GeneralUtilities:
108
112
 
109
113
  @staticmethod
110
114
  def deprecated(reason: str=None):
115
+ """Decorator which marks a function or a class as deprecated: every call of the function (respectively every instantiation
116
+ of the class) emits a DeprecationWarning which contains the optional reason. The behavior of the target is not changed."""
111
117
  def decorator(target):
112
118
  if isinstance(target, type):
113
119
  # target is a class: wrap its __init__ so the warning is emitted on instantiation while target stays a class.
@@ -1098,6 +1104,11 @@ class GeneralUtilities:
1098
1104
  @staticmethod
1099
1105
  @check_arguments
1100
1106
  def read_csv_file(file: str, ignore_first_line: bool = False, treat_number_sign_at_begin_of_line_as_comment: bool = True, trim_values: bool = True, encoding="utf-8", ignore_empty_lines: bool = True, separator_character: str = ";", values_are_surrounded_by_quotes: bool = False) -> list[list[str]]:
1107
+ """Reads a simple csv-file and returns one list of values per used line. ignore_first_line skips the header-line.
1108
+ This is not a full csv-parser: every line is split at every occurrence of separator_character, so a value must not contain
1109
+ the separator (even if it is quoted) and a value can not span several lines. With values_are_surrounded_by_quotes the first
1110
+ and the last character of every value are removed and doubled quotes are unescaped, without checking that they are quotes.
1111
+ By default lines starting with "#" are treated as comments and empty lines are skipped."""
1101
1112
  lines = GeneralUtilities.read_lines_from_file(file, encoding)
1102
1113
 
1103
1114
  if ignore_first_line:
@@ -1319,7 +1330,7 @@ class GeneralUtilities:
1319
1330
 
1320
1331
  @staticmethod
1321
1332
  @check_arguments
1322
- def input(prompt: str, print_result: bool) -> str: # This function is a workaround for usescases like python scripts which calls input(...) using epew because then the prompt is not printed by the built-in-input-function.
1333
+ def input(prompt: str, print_result: bool) -> str: # This function is a workaround for use cases like python scripts which call input(...) using epew because then the prompt is not printed by the built-in-input-function.
1323
1334
  GeneralUtilities.write_message_to_stdout(prompt)
1324
1335
  result: str = input()
1325
1336
  if print_result:
@@ -1715,16 +1726,3 @@ class GeneralUtilities:
1715
1726
  else:
1716
1727
  result = "python"
1717
1728
  return result
1718
-
1719
- @staticmethod
1720
- @check_arguments
1721
- def get_docker_executable() -> str:
1722
- configured_file = os.path.join(GeneralUtilities.get_scriptcollection_configuration_folder(), "DockerExecutable.txt")
1723
- if os.path.isfile(configured_file):
1724
- result = GeneralUtilities.read_text_from_file(configured_file).strip()
1725
- GeneralUtilities.assert_condition(os.path.isfile(result), f"Docker executable does not exist: '{result}'")
1726
- elif GeneralUtilities.string_has_content(sys.executable):
1727
- result = sys.executable
1728
- else:
1729
- result = "docker"
1730
- return result
@@ -286,18 +286,18 @@ class OCIImageManager:
286
286
 
287
287
  @GeneralUtilities.check_arguments
288
288
  def get_available_tags_of_image(self,image_name:str,registry_address:str)->list[str]:
289
- """registry_address must have one of theese formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian".
289
+ """registry_address must have one of these formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian".
290
290
  returns something like ["13.2-slim", "13.2", "13.3-slim", "13.3"]."""
291
291
  return self.get_image_handler(image_name).get_available_tags_of_image(image_name,registry_address)
292
292
 
293
293
  @GeneralUtilities.check_arguments
294
294
  def tag_to_version(self,image_name:str,tag:str)->Version:
295
- """registry_address must have one of theese formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian"."""
295
+ """registry_address must have one of these formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian"."""
296
296
  return self.get_image_handler(image_name).tag_to_version(image_name, tag)
297
297
 
298
298
  @GeneralUtilities.check_arguments
299
299
  def version_to_tag(self,image_name:str,version:Version)->str:
300
- """registry_address must have one of theese formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian".
300
+ """registry_address must have one of these formats: "myregistry.example.com/debian" or "docker.io/debian" or "docker.io/myuser/debian".
301
301
  returns something like "13.3-slim".
302
302
  If there are multiple tags available for a certain version then the image-handler decides which one will be returned."""
303
303
  return self.get_image_handler(image_name).version_to_tag(image_name,version)
@@ -2,7 +2,7 @@ import psutil
2
2
  from .GeneralUtilities import GeneralUtilities
3
3
  from .ScriptCollectionCore import ScriptCollectionCore
4
4
 
5
- # runs multiple processes in parallel and terminate all if at least one is terminated
5
+ # runs multiple processes in parallel and terminates all if at least one is terminated
6
6
 
7
7
 
8
8
  class ProcessStartInformation:
@@ -34,7 +34,7 @@ class ProcessesRunner:
34
34
  for pid in pids:
35
35
  if not psutil.pid_exists(pid):
36
36
  enabled = False
37
- # one program terminate so exit and terminate all now
37
+ # one program terminated so exit and terminate all now
38
38
  processes = psutil.process_iter()
39
39
  for pid in pids:
40
40
  if psutil.pid_exists(pid):
@@ -55,7 +55,7 @@ class ProgramRunnerSudo(ProgramRunnerBase):
55
55
 
56
56
  @GeneralUtilities.check_arguments
57
57
  def __init__(self,user_password:str):
58
- GeneralUtilities.assert_condition(GeneralUtilities.current_system_is_linux(), "SudoRunner can only be only executed on Linux.")
58
+ GeneralUtilities.assert_condition(GeneralUtilities.current_system_is_linux(), "SudoRunner can only be executed on Linux.")
59
59
  self.__sc = ScriptCollectionCore()
60
60
  self.__password = user_password
61
61
 
@@ -63,9 +63,12 @@ class RepositoryHistoryAnalyzer:
63
63
 
64
64
  @GeneralUtilities.check_arguments
65
65
  def __get_commits(self, repository_path: str) -> list:
66
- """Returns a list of (committer-name, committer-date)-tuples for all commits, in the committer-date's
67
- own recorded utc-offset."""
68
- result = self.sc.run_program_argsasarray("git", ["log", "--pretty=format:%cI%x09%cn"], repository_path)
66
+ """Returns a list of (committer-name, date)-tuples for all commits, with the date in its own recorded utc-offset.
67
+ The name is taken with "%aN" (author-name with .mailmap applied) because that is exactly the identity which
68
+ "git shortlog" (used by get_committers) groups by; "%cn" (the git-committer) would introduce identities like
69
+ "GitHub" for commits merged via the web-interface which do not appear in the committer-list. The date is the
70
+ author-date for the same reason."""
71
+ result = self.sc.run_program_argsasarray("git", ["log", "--pretty=format:%aI%x09%aN", "HEAD"], repository_path)
69
72
  commits = []
70
73
  for line in result[1].splitlines():
71
74
  if not GeneralUtilities.string_has_content(line):
File without changes
File without changes