]> git.mxchange.org Git - fba.git/blobdiff - fba/cache.py
Fixed some issues found by pylint:
[fba.git] / fba / cache.py
index 22c2b00ba2ae725d4416d08b5f40f624fb5c4cfc..71ca8223a74a38c6706a66629441d21c98ca3d16 100644 (file)
@@ -24,7 +24,7 @@ def key_exists(key: str) -> bool:
 
 def set_all(key: str, rows: list, value: any):
     # DEBUG: print(f"DEBUG: key='{key}',rows()={len(rows)},value[]={type(value)} - CALLED!")
-    if type(key) != str:
+    if not isinstance(key, str):
         raise ValueError("Parameter key[]='{type(key)}' is not 'str'")
     elif not key_exists(key):
         # DEBUG: print(f"DEBUG: Cache for key='{key}' not initialized.")
@@ -41,9 +41,9 @@ def set_all(key: str, rows: list, value: any):
     # DEBUG: print("DEBUG: EXIT!")
 
 def set_sub_key(key: str, sub: str, value: any):
-    if type(key) != str:
+    if not isinstance(key, str):
         raise ValueError("Parameter key[]='{type(key)}' is not 'str'")
-    elif type(sub) != str:
+    elif not isinstance(sub, str):
         raise ValueError("Parameter sub[]='{type(sub)}' is not 'str'")
     elif not key_exists(key):
         print(f"WARNING: Bad method call, key='{key}' is not initialized yet.")
@@ -52,9 +52,9 @@ def set_sub_key(key: str, sub: str, value: any):
     _cache[key][sub] = value
 
 def sub_key_exists(key: str, sub: str) -> bool:
-    if type(key) != str:
+    if not isinstance(key, str):
         raise ValueError("Parameter key[]='{type(key)}' is not 'str'")
-    elif type(sub) != str:
+    elif not isinstance(sub, str):
         raise ValueError("Parameter sub[]='{type(sub)}' is not 'str'")
     elif not key_exists(key):
         print(f"WARNING: Bad method call, key='{key}' is not initialized yet.")