Skip to content

Commit

Permalink
RF: remove dance of str/Path while passing file_path into _pydantic_e…
Browse files Browse the repository at this point in the history
…rrors_to_validation_results

Thanks @jwodder for the review
  • Loading branch information
yarikoptic committed Feb 8, 2023
1 parent 59cc420 commit b6f8180
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dandi/files/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_validation_errors(
if devel_debug:
raise
return _pydantic_errors_to_validation_results(
[e], str(self.filepath), scope=Scope.DANDISET
[e], self.filepath, scope=Scope.DANDISET
)
return []

Expand Down Expand Up @@ -186,7 +186,7 @@ def get_validation_errors(
if devel_debug:
raise
return _pydantic_errors_to_validation_results(
e, str(self.filepath), scope=Scope.FILE
e, self.filepath, scope=Scope.FILE
)
except Exception as e:
if devel_debug:
Expand Down Expand Up @@ -535,7 +535,7 @@ def get_validation_errors(
raise
# TODO: might reraise instead of making it into an error
return _pydantic_errors_to_validation_results(
[e], str(self.filepath), scope=Scope.FILE
[e], self.filepath, scope=Scope.FILE
)

from .bids import NWBBIDSAsset
Expand Down Expand Up @@ -740,7 +740,7 @@ def _get_nwb_inspector_version():

def _pydantic_errors_to_validation_results(
errors: list[dict | Exception] | ValidationError,
file_path: str,
file_path: Path,
scope: Scope,
) -> list[ValidationResult]:
"""Convert list of dict from pydantic into our custom object."""
Expand Down Expand Up @@ -773,7 +773,7 @@ def _pydantic_errors_to_validation_results(
severity=Severity.ERROR,
id=id,
scope=scope,
path=Path(file_path),
path=file_path,
message=message,
# TODO? dataset_path=dataset_path,
# TODO? dandiset_path=dandiset_path,
Expand Down

0 comments on commit b6f8180

Please sign in to comment.