Skip to content

Commit a44f7f1

Browse files
committed
Fix type-checking error
1 parent ca0f21a commit a44f7f1

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

hydra/_internal/core_plugins/importlib_resources_config_source.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
from hydra.core.object_type import ObjectType
1010
from hydra.plugins.config_source import ConfigLoadError, ConfigResult, ConfigSource
1111

12-
# Relevant issue: https://github.com/python/mypy/issues/1153
13-
# Python 3.9+ has importlib.resources in the standard library
14-
1512

1613
class ImportlibResourcesConfigSource(ConfigSource):
1714
def __init__(self, provider: str, path: str) -> None:
@@ -51,7 +48,7 @@ def _read_config(self, res: Any) -> ConfigResult:
5148
def load_config(self, config_path: str) -> ConfigResult:
5249
normalized_config_path = self._normalize_file_name(config_path)
5350
res = resources.files(self.path).joinpath(normalized_config_path)
54-
if not res.exists():
51+
if not (res.is_file() or res.is_dir()):
5552
raise ConfigLoadError(f"Config not found : {normalized_config_path}")
5653

5754
return self._read_config(res)
@@ -70,7 +67,7 @@ def is_group(self, config_path: str) -> bool:
7067
return False
7168

7269
res = files.joinpath(config_path)
73-
ret = res.exists() and res.is_dir()
70+
ret = res.is_dir()
7471
assert isinstance(ret, bool)
7572
return ret
7673

@@ -81,7 +78,7 @@ def is_config(self, config_path: str) -> bool:
8178
except (ValueError, ModuleNotFoundError, TypeError):
8279
return False
8380
res = files.joinpath(config_path)
84-
ret = res.exists() and res.is_file()
81+
ret = res.is_file()
8582
assert isinstance(ret, bool)
8683
return ret
8784

0 commit comments

Comments
 (0)