Skip to content
Snippets Groups Projects
Commit 9c6a6f52 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'logging-setup' into tmp

parents 60796afd 9af4f269
No related branches found
No related tags found
No related merge requests found
...@@ -15,10 +15,10 @@ RUN apt-get update && \ ...@@ -15,10 +15,10 @@ RUN apt-get update && \
libxml2 \ libxml2 \
-y -y
COPY .docker/wait-for-it.sh /wait-for-it.sh COPY .docker/wait-for-it.sh /wait-for-it.sh
ADD https://gitlab.com/api/v4/projects/13656973/repository/branches/master \ ADD https://gitlab.com/api/v4/projects/13656973/repository/branches/dev \
pylib_version.json pylib_version.json
RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \ RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \
cd caosdb-pylib && pip3 install . cd caosdb-pylib && git checkout dev && pip3 install .
ADD https://gitlab.com/api/v4/projects/13656965/repository/branches/master \ ADD https://gitlab.com/api/v4/projects/13656965/repository/branches/master \
model_version.json model_version.json
RUN git clone https://gitlab.com/caosdb/caosdb-models.git && \ RUN git clone https://gitlab.com/caosdb/caosdb-models.git && \
......
__pycache__ __pycache__
.tox .tox
.eggs
.coverage .coverage
*cache.db *cache.db
*.egg-info *.egg-info
.docker/cert .docker/cert
src/caosadvancedtools/version.py
...@@ -16,8 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -16,8 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### ### Changed ###
- The suppression module is now a logging filter
- The WebUIHandler is now a python logging formatter. - The WebUIHandler is now a python logging formatter.
- the suppression module is now a logging filter
- instead of `get_entity`, type-specific functions are used in - instead of `get_entity`, type-specific functions are used in
`cfood.py` when the type of the entity in question is known. `cfood.py` when the type of the entity in question is known.
- Logger is used instead of `print` for errors in `crawler.py`. - Logger is used instead of `print` for errors in `crawler.py`.
......
...@@ -75,7 +75,8 @@ class TSV_Importer(object): ...@@ -75,7 +75,8 @@ class TSV_Importer(object):
class XLS_Importer(object): 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 converters: dict with column names as keys and converter functions as
values values
...@@ -89,8 +90,8 @@ class XLS_Importer(object): ...@@ -89,8 +90,8 @@ class XLS_Importer(object):
""" """
self.sup = SuppressKnown() self.sup = SuppressKnown()
self.required_columns = list(converters.keys()) self.required_columns = list(converters.keys())
self.obligatory_columns = obligatory_columns self.obligatory_columns = [] if obligatory_columns is None else obligatory_columns
self.unique_columns = unique_columns self.unique_columns = [] if unique_columns is None else unique_columns
self.converters = converters self.converters = converters
def read_xls(self, filename): def read_xls(self, filename):
...@@ -111,9 +112,8 @@ class XLS_Importer(object): ...@@ -111,9 +112,8 @@ class XLS_Importer(object):
if len(xls_file.sheet_names) > 1: if len(xls_file.sheet_names) > 1:
# Multiple sheets is the default now. Only show in debug # Multiple sheets is the default now. Only show in debug
logger.debug( logger.debug("Excel file %s contains multiple sheets. "
"Excel file {} contains multiple sheets. " "All but the first are being ignored.", filename)
"All but the first are being ignored.".format(filename))
try: try:
df = xls_file.parse(converters=self.converters) df = xls_file.parse(converters=self.converters)
...@@ -161,9 +161,9 @@ class XLS_Importer(object): ...@@ -161,9 +161,9 @@ class XLS_Importer(object):
df = df.copy() df = df.copy()
uniques = [] uniques = []
for index, row in df.iterrows(): subtable = df[list(self.unique_columns)]
element = tuple(row.loc[key] for key in self.unique_columns) for index, row in subtable.iterrows():
element = tuple(row)
if element in uniques: if element in uniques:
errmsg = ( errmsg = (
"The {}. row contains the values '{}'.\nThis value " "The {}. row contains the values '{}'.\nThis value "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment