Skip to content
Snippets Groups Projects
Verified Commit 5f0ad95d authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: Linting

parent 6cda8781
No related branches found
No related tags found
1 merge request!100WIP: Filling XLSX: Seems to be working.
Pipeline #49437 passed with warnings
...@@ -41,6 +41,9 @@ class AnalysisCFood(AbstractFileCFood, WithREADME): ...@@ -41,6 +41,9 @@ class AnalysisCFood(AbstractFileCFood, WithREADME):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
WithREADME.__init__(self) WithREADME.__init__(self)
self.analysis = None
self.people = None
self.project = None
def collect_information(self): def collect_information(self):
self.find_referenced_files([RESULTS, SOURCES, SCRIPTS]) self.find_referenced_files([RESULTS, SOURCES, SCRIPTS])
......
...@@ -16,17 +16,14 @@ ...@@ -16,17 +16,14 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import os
from itertools import chain
import caosdb as db import caosdb as db
from caosadvancedtools.cfood import (AbstractFileCFood, assure_has_parent, from caosadvancedtools.cfood import (AbstractFileCFood,
assure_has_property, assure_has_property,
assure_object_is_in_list, get_entity) assure_object_is_in_list,
from caosadvancedtools.read_md_header import get_header )
from .generic_pattern import full_pattern from .generic_pattern import full_pattern
from .utils import (get_files_referenced_by_field, parse_responsibles, from .utils import (parse_responsibles,
reference_records_corresponding_to_files) reference_records_corresponding_to_files)
from .withreadme import DATAMODEL as dm from .withreadme import DATAMODEL as dm
from .withreadme import (RESULTS, REVISIONOF, SCRIPTS, SOURCES, WithREADME, from .withreadme import (RESULTS, REVISIONOF, SCRIPTS, SOURCES, WithREADME,
...@@ -42,6 +39,9 @@ class SimulationCFood(AbstractFileCFood, WithREADME): ...@@ -42,6 +39,9 @@ class SimulationCFood(AbstractFileCFood, WithREADME):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
WithREADME.__init__(self) WithREADME.__init__(self)
self.people = None
self.project = None
self.simulation = None
def collect_information(self): def collect_information(self):
self.find_referenced_files([RESULTS, SOURCES, SCRIPTS]) self.find_referenced_files([RESULTS, SOURCES, SCRIPTS])
......
...@@ -17,20 +17,16 @@ ...@@ -17,20 +17,16 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import os
from itertools import chain
import caosdb as db import caosdb as db
from caosadvancedtools.cfood import (AbstractFileCFood, assure_has_parent, from caosadvancedtools.cfood import (AbstractFileCFood,
assure_has_property, assure_name_is, assure_has_property, assure_name_is,
assure_object_is_in_list, get_entity) assure_object_is_in_list,
)
from caosadvancedtools.guard import global_guard as guard from caosadvancedtools.guard import global_guard as guard
from caosadvancedtools.read_md_header import get_header
from .generic_pattern import full_pattern from .generic_pattern import full_pattern
from .utils import get_files_referenced_by_field, parse_responsibles from .utils import parse_responsibles
from .withreadme import BINARIES from .withreadme import BINARIES
from .withreadme import DATAMODEL as dm
from .withreadme import SOURCECODE, WithREADME from .withreadme import SOURCECODE, WithREADME
......
...@@ -26,7 +26,6 @@ import pandas as pd ...@@ -26,7 +26,6 @@ import pandas as pd
from caosadvancedtools.cfood import assure_object_is_in_list, fileguide from caosadvancedtools.cfood import assure_object_is_in_list, fileguide
from caosadvancedtools.utils import (find_records_that_reference_ids, from caosadvancedtools.utils import (find_records_that_reference_ids,
read_field_as_list, read_field_as_list,
return_field_or_property,
string_to_person) string_to_person)
logger = logging.getLogger("caosadvancedtools") logger = logging.getLogger("caosadvancedtools")
......
...@@ -26,8 +26,7 @@ import caosdb as db ...@@ -26,8 +26,7 @@ import caosdb as db
from caosadvancedtools.cfood import (assure_has_description, assure_has_parent, from caosadvancedtools.cfood import (assure_has_description, assure_has_parent,
assure_object_is_in_list, fileguide) assure_object_is_in_list, fileguide)
from caosadvancedtools.read_md_header import get_header as get_md_header from caosadvancedtools.read_md_header import get_header as get_md_header
from caosadvancedtools.table_importer import (win_path_converter, from caosadvancedtools.table_importer import (win_path_converter)
win_path_list_converter)
from caosadvancedtools.utils import return_field_or_property from caosadvancedtools.utils import return_field_or_property
from .utils import (get_entity_ids_from_include_file, from .utils import (get_entity_ids_from_include_file,
...@@ -236,7 +235,7 @@ class WithREADME(object): ...@@ -236,7 +235,7 @@ class WithREADME(object):
generic_references, generic_references,
record, record,
prop_name, prop_name,
to_be_updated=self.to_be_updated, to_be_updated=self.to_be_updated, # pylint: disable=no-member
datatype=db.LIST(db.REFERENCE), datatype=db.LIST(db.REFERENCE),
) )
......
...@@ -223,6 +223,7 @@ def init_data_model(entities): ...@@ -223,6 +223,7 @@ def init_data_model(entities):
"be a {}.".format(e.role, local_role)) "be a {}.".format(e.role, local_role))
raise DataModelError(e.name, info) raise DataModelError(e.name, info)
except db.exceptions.EntityDoesNotExistError: except db.exceptions.EntityDoesNotExistError:
# pylint: disable=raise-missing-from
raise DataModelError(e.name, "This entity does not exist.") raise DataModelError(e.name, "This entity does not exist.")
return True return True
...@@ -246,7 +247,7 @@ def get_data(filename, default=None): ...@@ -246,7 +247,7 @@ def get_data(filename, default=None):
Data from the given file. Data from the given file.
""" """
result = default.copy() if default is not None else {} result = default.copy() if default is not None else {}
with open(filename, 'r') as fi: with open(filename, mode="r", encoding="utf-8") as fi:
data = json.load(fi) data = json.load(fi)
result.update(data) result.update(data)
......
...@@ -269,8 +269,8 @@ class TableTemplateGenerator(ABC): ...@@ -269,8 +269,8 @@ class TableTemplateGenerator(ABC):
class XLSXTemplateGenerator(TableTemplateGenerator): class XLSXTemplateGenerator(TableTemplateGenerator):
"""Class for generating XLSX tables from json schema definitions.""" """Class for generating XLSX tables from json schema definitions."""
def __init__(self): # def __init__(self):
pass # super().__init__()
def generate(self, schema: dict, foreign_keys: dict, filepath: str) -> None: def generate(self, schema: dict, foreign_keys: dict, filepath: str) -> None:
"""Generate a sheet definition from a given JSON schema. """Generate a sheet definition from a given JSON schema.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment