From: Roland Häder Date: Sat, 27 May 2023 07:44:48 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d67637477d76fc9276ad6c33cedf3e22a1f9e268;p=fba.git Continued: - better only temporary split semicolon off, not from input variable --- diff --git a/fba.py b/fba.py index 1bddacd..b5d536e 100644 --- a/fba.py +++ b/fba.py @@ -107,21 +107,22 @@ def remove_version(software: str) -> str: print(f"WARNING: software='{software}' does not contain a version number.") return software + temp = software if ";" in software: - software = software.split(";")[0] + temp = software.split(";")[0] elif "," in software: - software = software.split(",")[0] + temp = software.split(",")[0] elif " - " in software: - software = software.split(" - ")[0] + temp = software.split(" - ")[0] # NOISY-DEBUG: print(f"DEBUG: software='{software}'") version = None if " " in software: - version = software.split(" ")[-1] + version = temp.split(" ")[-1] elif "/" in software: - version = software.split("/")[-1] + version = temp.split("/")[-1] elif "-" in software: - version = software.split("-")[-1] + version = temp.split("-")[-1] else: # NOISY-DEBUG: print(f"DEBUG: Was not able to find common seperator, returning untouched software='{software}'") return software @@ -143,10 +144,10 @@ def remove_version(software: str) -> str: return software # NOISY-DEBUG: print(f"DEBUG: Found valid version number: '{version}', removing it ...") - end = len(software) - len(version) - 1 + end = len(temp) - len(version) - 1 # NOISY-DEBUG: print(f"DEBUG: end[{type(end)}]={end}") - software = software[0:end].strip() + software = temp[0:end].strip() if " version" in software: # NOISY-DEBUG: print(f"DEBUG: software='{software}' contains word ' version'") software = strip_until(software, " version")