diff --git a/fileformats/core/mixin.py b/fileformats/core/mixin.py index 4e4802f..5bfdbc2 100644 --- a/fileformats/core/mixin.py +++ b/fileformats/core/mixin.py @@ -183,12 +183,8 @@ def nested_types(cls) -> ty.Tuple[ty.Type[Classifier], ...]: def header(self) -> "fileformats.core.FileSet": return self.header_type(self.select_by_ext(self.header_type)) # type: ignore[attr-defined] - def read_metadata( - self, selected_keys: ty.Optional[ty.Collection[str]] = None - ) -> ty.Mapping[str, ty.Any]: + def read_metadata(self, **kwargs: ty.Any) -> ty.Mapping[str, ty.Any]: header: ty.Dict[str, ty.Any] = self.header.load() - if selected_keys: - header = {k: v for k, v in header.items() if k in selected_keys} return header @@ -221,10 +217,8 @@ class MyFileFormatWithSideCars(WithSideCars, MyFileFormat): def side_cars(self) -> ty.Tuple["fileformats.core.FileSet", ...]: return tuple(tp(self.select_by_ext(tp)) for tp in self.side_car_types) # type: ignore[attr-defined] - def read_metadata( - self, selected_keys: ty.Optional[ty.Collection[str]] = None - ) -> ty.Mapping[str, ty.Any]: - metadata: ty.Dict[str, ty.Any] = dict(self.primary_type.read_metadata(self, selected_keys=selected_keys)) # type: ignore[arg-type] + def read_metadata(self, **kwargs: ty.Any) -> ty.Mapping[str, ty.Any]: + metadata: ty.Dict[str, ty.Any] = dict(self.primary_type.read_metadata(self, **kwargs)) # type: ignore[arg-type] for side_car in self.side_cars: try: side_car_metadata: ty.Dict[str, ty.Any] = side_car.load() diff --git a/fileformats/core/tests/test_general.py b/fileformats/core/tests/test_general.py index f9ebf3b..d38f4b2 100644 --- a/fileformats/core/tests/test_general.py +++ b/fileformats/core/tests/test_general.py @@ -132,9 +132,7 @@ class ImageWithInlineHeader(File): header_separator = b"---END HEADER---" - def read_metadata( - self, selected_keys: ty.Optional[ty.Collection[str]] = None - ) -> ty.Mapping[str, ty.Any]: + def read_metadata(self, **kwargs: ty.Any) -> ty.Mapping[str, ty.Any]: hdr = self.contents.split(self.header_separator)[0].decode("utf-8") return {k: int(v) for k, v in (ln.split(":") for ln in hdr.splitlines())} diff --git a/fileformats/core/tests/test_mixin.py b/fileformats/core/tests/test_mixin.py index b15f904..dde47fe 100644 --- a/fileformats/core/tests/test_mixin.py +++ b/fileformats/core/tests/test_mixin.py @@ -107,9 +107,7 @@ class ImageWithInlineHeader(File): header_separator = b"---END HEADER---" - def read_metadata( - self, selected_keys: ty.Optional[ty.Collection[str]] = None - ) -> ty.Mapping[str, ty.Any]: + def read_metadata(self, **kwargs: ty.Any) -> ty.Mapping[str, ty.Any]: hdr = self.contents.split(self.header_separator)[0].decode("utf-8") return dict(ln.split(":") for ln in hdr.splitlines())