Skip to content

Commit

Permalink
PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
netsettler committed Oct 25, 2023
1 parent 46a2c09 commit 263ce0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dcicutils/bundle_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ def load_items(filename: str, tab_name: Optional[str] = None, escaping: Optional
# but for production use maybe should not be? -kmp 25-Oct-2023
validate: bool = False,
**kwargs):
annotated_data = TableSetManager.load_annotated(filename=filename, tab_name=tab_name, escaping=escaping, prefer_number=False,
**kwargs)
annotated_data = TableSetManager.load_annotated(filename=filename, tab_name=tab_name, escaping=escaping,
prefer_number=False, **kwargs)
tabbed_rows = annotated_data['content']
flattened = annotated_data['flattened']
if flattened:
Expand Down
25 changes: 16 additions & 9 deletions dcicutils/validation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def fetch_schema(self, schema_name: str):
self.SCHEMA_CACHE[schema_name] = schema
return schema

# Should not be needed given SCHEMA_CACHE is an instance variable.
# Should not be needed, given that SCHEMA_CACHE is an instance variable.
#
# @classmethod
# def clear_schema_cache(cls):
Expand Down Expand Up @@ -238,9 +238,9 @@ def extract_single_quoted_strings(message: str) -> List[str]:

def summary_of_data_validation_errors(data_validation_errors: Dict,
# These next three items are available from a portal's SubmissionFolio
data_file_name: str,
s3_data_file_location: str,
s3_details_location: str) -> List[str]:
data_file_name: Optional[str] = None,
s3_data_file_location: Optional[str] = None,
s3_details_location: Optional[str] = None) -> List[str]:
"""
Summarize the given data validation errors into a simple short list of English phrases;
this will end up going into the additional_properties of the IngestionSubmission object
Expand Down Expand Up @@ -269,14 +269,21 @@ def summary_of_data_validation_errors(data_validation_errors: Dict,
if error.get("exception"):
exception_count += 1

return [
f"Ingestion data validation error summary:",
f"Data file: {data_file_name}",
f"Data file in S3: {s3_data_file_location}",
result = [
f"Ingestion data validation error summary:"
]
if data_file_name:
result.append(f"Data file: {data_file_name}")
if s3_data_file_location:
result.append(f"Data file in S3: {s3_data_file_location}")
result = result + [
f"Items unidentified: {unidentified_count}",
f"Items missing properties: {missing_properties_count}",
f"Items with extraneous properties: {extraneous_properties_count}",
f"Other errors: {unclassified_error_count}",
f"Exceptions: {exception_count}",
f"Details: {s3_details_location}"
]
if s3_details_location:
result.append(f"Details: {s3_details_location}")

return result

0 comments on commit 263ce0a

Please sign in to comment.