Skip to content

Commit

Permalink
Add flake8 C901 noqas for following methods/functions:
Browse files Browse the repository at this point in the history
TOSImporter._process_data
TOSImporter.import_attributes
get_attribute_json_schema

Errors:
./metarecord/importer/tos.py:322:5: C901 'TOSImporter._process_data' is too complex (21)
./metarecord/importer/tos.py:431:5: C901 'TOSImporter.import_attributes' is too complex (15)
./metarecord/models/structural_element.py:214:1: C901 'get_attribute_json_schema' is too complex (16)
  • Loading branch information
danipran committed Feb 23, 2023
1 parent bafdd82 commit 0b7a68b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions metarecord/importer/tos.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _save_function(self, function):
function_obj.error_count = function.get("error_count", 0)
function_obj.save()

def _process_data(self, sheet, function_obj):
def _process_data(self, sheet, function_obj): # noqa: C901
data = self._get_data(sheet)

if not data:
Expand Down Expand Up @@ -428,7 +428,7 @@ def _process_data(self, sheet, function_obj):
child_list.append(target)
self._save_function(function)

def import_attributes(self):
def import_attributes(self): # noqa: C901
self.logger.info("Importing attributes...")

try:
Expand Down
2 changes: 1 addition & 1 deletion metarecord/models/structural_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _get_conditionally_required_schema(
}


def get_attribute_json_schema(**kwargs):
def get_attribute_json_schema(**kwargs): # noqa: C901
if (
"allowed" not in kwargs or kwargs["allowed"] is None
): # None means the validation isn't enabled
Expand Down
2 changes: 1 addition & 1 deletion metarecord/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_valid_attribute_dict(self):
}
return self._valid_attribute_dict

def get_attribute_validation_errors(self, instance, recursive=True):
def get_attribute_validation_errors(self, instance, recursive=True): # noqa: C901
"""
Check allowed and required attributes, and verify choice attributes have valid values.
Expand Down

0 comments on commit 0b7a68b

Please sign in to comment.