Skip to content

Commit

Permalink
Merge pull request #92 from ArcanaFramework/touch-ups
Browse files Browse the repository at this point in the history
Minor touch  ups
  • Loading branch information
tclose authored Oct 16, 2024
2 parents b54e9df + 10729bd commit 2d4116a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ repos:
args:
- --ignore-words=.codespell-ignorewords
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
args: [--strict, --install-types, --non-interactive, --no-warn-unused-ignores]
args:
[
--strict,
--install-types,
--non-interactive,
--no-warn-unused-ignores,
]
exclude: tests
additional_dependencies: [pytest, attrs, imageio, pydicom]
3 changes: 2 additions & 1 deletion fileformats/core/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def _validate_required_content_types(self) -> None:
return
assert not_found
raise FormatMismatchError(
f"Did not find the required content types, {not_found}, in {self}"
f"Did not find the required content types, {not_found}, in {self}, paths: "
f"{[str(p) for p in self.content_fspaths]}"
)

@classproperty
Expand Down
4 changes: 3 additions & 1 deletion fileformats/core/fileset.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def __init__(
metadata: ty.Optional[ty.Dict[str, ty.Any]] = None,
**load_kwargs: ty.Any,
):
if not fspaths:
raise ValueError("No file-system paths provided to FileSet")
self._explicit_metadata = metadata
self._load_kwargs = load_kwargs
self._validate_class()
Expand Down Expand Up @@ -800,7 +802,7 @@ def byte_chunks(
rel_path: str
relative path to either 'relative_to' arg or common base path for each file
in the file set
byte_iter : Generator[bytes]
byte_iter : Generator[bytes, None, None]
an iterator over the bytes contents of the file, chunked into 'chunk_len'
chunks
"""
Expand Down
6 changes: 6 additions & 0 deletions fileformats/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ def __init__(self, imported: bool, pkg: ty.Optional[str], pypi: ty.Optional[str]
self.pkg = pkg
self.pypi = pypi

def __repr__(self) -> str:
return (
f"{type(self).__name__}(pkg={self.pkg}, pypi={self.pypi}, "
f"imported={self.imported})"
)


def import_extras_module(klass: ty.Type["fileformats.core.DataType"]) -> ExtrasModule:
"""Attempt to load extras module corresponding to the provided class's module
Expand Down

0 comments on commit 2d4116a

Please sign in to comment.