diff --git a/.gitignore b/.gitignore index 30f02d1c5af28706cb5c6e661bbaba59c5bf937e..a87719155a81c2d1398130f803674726ec831865 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ __pycache__ .tox +.eggs .coverage *cache.db *.egg-info .docker/cert +src/caosadvancedtools/version.py diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8cbece6ec4ae2c25b238f5d69467e545354f6c..40876727ad764f515cbf8e9c4a1036de25a57802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### -- the suppression module is now a logging filter +- The suppression module is now a logging filter - The WebUIHandler is now a python logging formatter. - instead of `get_entity`, type-specific functions are used in `cfood.py` when the type of the entity in question is known. diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index e29a544c46c7cd257e1d9b6bc784af79c5900009..e1d9901c60620b2d858f5f8bb54d346d1e87fe8d 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -225,7 +225,7 @@ class Crawler(object): "ignoring:\n{}".format(item)) logger.warning(msg, extra={"identifier": str(item), - 'category': "matches"}) + 'category': "matches"}) if len(matches[idx]) > 1: msg = ("Attention: More than one matching cfood!\n" @@ -234,7 +234,7 @@ class Crawler(object): matches[idx])+"\n") logger.warning(msg, extra={"identifier": str(item), - 'category': "matches"}) + 'category': "matches"}) def cached_find_identifiables(self, identifiables): if self.use_cache: diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py index 13305ac01f83c979c8bcdfcd268756774e89e9cb..7b5f67a4d5dbd6d8ede00c2e781bf426bb004b8e 100755 --- a/src/caosadvancedtools/table_importer.py +++ b/src/caosadvancedtools/table_importer.py @@ -48,7 +48,8 @@ def yes_no_converter(val): class XLS_Importer(object): - def __init__(self, converters, obligatory_columns=[], unique_columns=[]): + + def __init__(self, converters, obligatory_columns=None, unique_columns=None): """ converters: dict with column names as keys and converter functions as @@ -63,8 +64,8 @@ class XLS_Importer(object): """ self.sup = SuppressKnown() self.required_columns = list(converters.keys()) - self.obligatory_columns = obligatory_columns - self.unique_columns = unique_columns + self.obligatory_columns = [] if obligatory_columns is None else obligatory_columns + self.unique_columns = [] if unique_columns is None else unique_columns self.converters = converters def read_xls(self, filename): @@ -72,10 +73,8 @@ class XLS_Importer(object): if len(xls_file .sheet_names) > 1: # Multiple sheets is the default now. Only show in debug - logger.debug("Excel file {} contains multiple sheets. " - "All but the first are being ignored.".format( - filename - )) + logger.debug("Excel file %s contains multiple sheets. " + "All but the first are being ignored.", filename) df = xls_file.parse(converters=self.converters) self.check_columns(df, filename=filename) @@ -97,9 +96,9 @@ class XLS_Importer(object): df = df.copy() uniques = [] - for index, row in df.iterrows(): - element = tuple(row.loc[key] for key in self.unique_columns) - + subtable = df[list(self.unique_columns)] + for index, row in subtable.iterrows(): + element = tuple(row) if element in uniques: errmsg = ( "The {}. row contains the values '{}'.\nThis value "