Skip to content

Commit

Permalink
fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasha10 committed Feb 22, 2024
1 parent cd55e17 commit b0d3138
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def _read_config(self, res: Any) -> ConfigResult:
header_text = f.read(512)
if isinstance(header_text, bytes):
# if header is bytes, utf-8 decode (zipfile path)
header_text = header_text.decode("utf-8")
header = ConfigSource._get_header_dict(header_text)
header_text_str = header_text.decode("utf-8")
else:
header_text_str = header_text
header = ConfigSource._get_header_dict(header_text_str)
f.seek(0)
cfg = OmegaConf.load(f)
return ConfigResult(
Expand Down
5 changes: 1 addition & 4 deletions tests/test_config_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ def test_restore_singleton_state_hack() -> None:
def test_importlib_resource_load_zip_path() -> None:
config_source = ImportlibResourcesConfigSource(provider="foo", path="pkg://bar")
conf = config_source._read_config(
zipfile.Path( # type: ignore
"hydra/test_utils/configs/conf.zip",
"config.yaml",
)
zipfile.Path("hydra/test_utils/configs/conf.zip", "config.yaml")
)
assert conf.config == {"foo": "bar"}
assert conf.header == {"package": None}

0 comments on commit b0d3138

Please sign in to comment.