diff --git a/pylintrc b/pylintrc index 1be7cd8dffb322170d0c793a44ae43f98744be5e..e95afc90a55d72129f1c89ece4b935f40296989b 100644 --- a/pylintrc +++ b/pylintrc @@ -19,4 +19,5 @@ init-hook= disable= fixme, logging-format-interpolation, + logging-fstring-interpolation, logging-not-lazy, diff --git a/src/caosadvancedtools/cache.py b/src/caosadvancedtools/cache.py index 4656439374353035618d64c23677ff7c174fbf84..5fc1ec3c22fbee0096a9167ea35e0bc59bfb0665 100644 --- a/src/caosadvancedtools/cache.py +++ b/src/caosadvancedtools/cache.py @@ -94,7 +94,6 @@ class AbstractCache(ABC): Increase this variable, when changes to the cache tables are made. """ - pass @abstractmethod def create_cache(self): @@ -102,14 +101,12 @@ class AbstractCache(ABC): Provide an overloaded function here that creates the cache in the most recent version. """ - pass @abstractmethod def get_default_file_name(self): """ Supply a default file name for the cache here. """ - pass def check_cache(self): """ @@ -192,9 +189,6 @@ class IdentifiableCache(AbstractCache): def get_default_file_name(self): return "caosdb_identifiable_cache.db" - def __init__(self, db_file=None, force_creation=False): - super().__init__(db_file, force_creation) - def create_cache(self): """ Create a new SQLITE cache file in self.db_file. diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index 8ae016326b745f2da8debbafe06c7a6d4e07e34a..4647a576751c686cacc3628e0a6735b6adce5ded 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -208,7 +208,6 @@ class AbstractCFood(object, metaclass=ABCMeta): To be overwritten by subclasses """ - pass def attach(self, item): self.attached_items.append(item) diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index 9b960d5755bed693f18a381033e94aa3d6503df1..dfc5351c251cb209f4e9a5b28a8caa72934d7a02 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -487,8 +487,8 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) logger.error(err_msg) logger.error('Crawler finished with Datamodel Errors') elif errors_occured: - msg = "There were fatal errors during execution, please " - "contact the system administrator!" + msg = ("There were fatal errors during execution, please contact " + "the system administrator!") if self.debug_file: msg += "\nPlease provide the following path:\n{}".format( diff --git a/src/caosadvancedtools/import_from_xml.py b/src/caosadvancedtools/import_from_xml.py index 4f9bba991affe449508c7b641003d2e44f93df55..540091b039798ed0e1f61f56a634871e977daf71 100755 --- a/src/caosadvancedtools/import_from_xml.py +++ b/src/caosadvancedtools/import_from_xml.py @@ -94,7 +94,7 @@ def import_xml(filename, rerun=False, interactive=True): if not rerun: for _, el in enumerate(files.values()): - r = el.insert(unique=False) + el.insert(unique=False) else: for _, el in enumerate(files.values()): el.id = None diff --git a/src/caosadvancedtools/loadFiles.py b/src/caosadvancedtools/loadFiles.py index 8e3b466fa20fd20a981ed899b3be5ba3282517fc..56d50e4dd28df2098c6bc16b5300731948b076ac 100755 --- a/src/caosadvancedtools/loadFiles.py +++ b/src/caosadvancedtools/loadFiles.py @@ -122,7 +122,7 @@ def compile_file_list(caosdbignore: str, localpath: str) -> list[str]: current_ignore = caosdbignore non_ignored_files = [] ignore_files: list[tuple[str, str]] = [] - for root, dirs, files in os.walk(localpath): + for root, _, files in os.walk(localpath): # remove local ignore files that do no longer apply to the current subtree (branch switch) while len(ignore_files) > 0 and not root.startswith(ignore_files[-1][0]): os.remove(ignore_files[-1][1]) diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index f6e142db5c1fa9aefaceb033dc4725fcfeee5d4a..1cd1fe6ecabbbee4143c7c9c1b5326639c6baf50 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -633,7 +633,7 @@ debug : bool, optional """ - for key, value in self.model.items(): + for _, value in self.model.items(): if isinstance(value, db.Property): dtype = value.datatype diff --git a/src/caosadvancedtools/scifolder/withreadme.py b/src/caosadvancedtools/scifolder/withreadme.py index 94280b8068d36c0117681b50270f819c7ceb0c8b..faab94cbafb18e1b28e7fc71f1d30eba7325e6f1 100644 --- a/src/caosadvancedtools/scifolder/withreadme.py +++ b/src/caosadvancedtools/scifolder/withreadme.py @@ -156,8 +156,8 @@ class WithREADME(object): for f in sublist] if len(flat_list) == 0: - LOGGER.warn("ATTENTION: the field {} does not reference any " - "known files".format(field.key)) + LOGGER.warning(f"ATTENTION: the field {field.key} does not" + " reference any known files") self.attached_filenames.extend(flat_list) # pylint: disable=no-member diff --git a/src/caosadvancedtools/table_converter.py b/src/caosadvancedtools/table_converter.py index c5fcb969ae94801c1fc2641b776e9fb2134c41f1..16f274769bb246566570c8f2f2888f2077441c30 100644 --- a/src/caosadvancedtools/table_converter.py +++ b/src/caosadvancedtools/table_converter.py @@ -73,7 +73,7 @@ def from_table(spreadsheet, recordtype): """ parses a pandas DataFrame to a list of records """ records = db.Container() - for idx, row in spreadsheet.iterrows(): + for _, row in spreadsheet.iterrows(): rec = db.Record() rec.add_parent(name=recordtype) diff --git a/src/caosadvancedtools/utils.py b/src/caosadvancedtools/utils.py index 3e1e6992d0dcc23d6de04e6753bd322f72728d65..0d73f9628a9f3b5d73360b692f5cbb2e9394de79 100644 --- a/src/caosadvancedtools/utils.py +++ b/src/caosadvancedtools/utils.py @@ -235,7 +235,6 @@ def find_records_that_reference_ids(referenced_ids, rt="", step_size=50): record_ids.update([exp.id for exp in exps]) except Exception as e: print(e) - pass index += step_size diff --git a/src/caosadvancedtools/webui_formatter.py b/src/caosadvancedtools/webui_formatter.py index c3c5381d96e86a2698cc16d1bf1a2726566dcd7b..43ebbe061cccc2aec2c12f9193731017bad5e156 100644 --- a/src/caosadvancedtools/webui_formatter.py +++ b/src/caosadvancedtools/webui_formatter.py @@ -92,4 +92,4 @@ class WebUI_Formatter(logging.Formatter): return wrap_bootstrap_alert("<b>CRITICAL ERROR:</b> " + text, kind="danger") else: - raise Exception("unknown level") + raise RuntimeError("unknown level")