Skip to content

Commit

Permalink
fix: make Engine.recognizes static and pass MPIService comm as attrib…
Browse files Browse the repository at this point in the history
…ute.
  • Loading branch information
drodarie committed Dec 16, 2024
1 parent 357aac5 commit 5289acd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bsb/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def open_storage(root, comm=None):
"""
engines = get_engines()
for name, engine in engines.items():
if engine.peek_exists(root) and engine.recognizes(root):
if engine.peek_exists(root) and engine.recognizes(root, MPIService(comm)):
return Storage(name, root, comm, missing_ok=False)
else:
for name, engine in engines.items():
Expand Down Expand Up @@ -417,7 +417,7 @@ def view_support(engine=None):
"""
if engine is None:
return {
# Loop over all enginges
# Loop over all engines
engine_name: {
# Loop over all features, check whether they're supported
feature_name: not isinstance(feature, NotSupported)
Expand Down
4 changes: 2 additions & 2 deletions bsb/storage/fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def versions(self):
path = Path(self._root) / "versions.txt"
return json.loads(path.read_text())

@classmethod
def recognizes(cls, root):
@staticmethod
def recognizes(root, comm):
try:
return os.path.exists(root) and os.path.isdir(root)
except Exception:
Expand Down
3 changes: 2 additions & 1 deletion bsb/storage/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def root_slug(self):
"""
pass

@staticmethod
@abc.abstractmethod
def recognizes(self, root):
def recognizes(root, comm):
"""
Must return whether the given argument is recognized as a valid storage object.
"""
Expand Down

0 comments on commit 5289acd

Please sign in to comment.