]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 27 May 2023 07:44:48 +0000 (09:44 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 27 May 2023 07:59:40 +0000 (09:59 +0200)
- better only temporary split semicolon off, not from input variable

fba.py

diff --git a/fba.py b/fba.py
index 1bddacd8d273a7cf5f343cbbe2445c1d94a66e9c..b5d536e8bf7d9a2b02517eb6ebbabc4440e75e0f 100644 (file)
--- 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")