Skip to content

Commit 2f40702

Browse files
committed
linter
1 parent 5689eee commit 2f40702

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

infrahub_sdk/store.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,23 @@ def _get(self, key: str, kind: str | type[SchemaType] | None = None, raise_when_
4949
if kind_name:
5050
if kind_name in self._store and key in self._store[kind_name]: # type: ignore[attr-defined]
5151
return self._store[kind_name][key] # type: ignore[attr-defined]
52-
else:
53-
if not raise_when_missing:
54-
return None
55-
raise NodeNotFoundError(
56-
node_type=kind_name,
57-
identifier={"key": [key]},
58-
message="Unable to find the node in the Store for the specified kind",
59-
)
60-
else:
61-
# If no kind is provided, search all kinds.
62-
for item in self._store.values(): # type: ignore[attr-defined]
63-
if key in item:
64-
return item[key]
6552
if not raise_when_missing:
6653
return None
6754
raise NodeNotFoundError(
68-
node_type="n/a",
55+
node_type=kind_name,
6956
identifier={"key": [key]},
70-
message=f"Unable to find the node {key!r} in the store",
57+
message="Unable to find the node in the Store for the specified kind",
7158
)
59+
for item in self._store.values(): # type: ignore[attr-defined]
60+
if key in item:
61+
return item[key]
62+
if not raise_when_missing:
63+
return None
64+
raise NodeNotFoundError(
65+
node_type="n/a",
66+
identifier={"key": [key]},
67+
message=f"Unable to find the node {key!r} in the store",
68+
)
7269

7370
def _get_by_hfid(self, key: str, raise_when_missing: bool = True): # type: ignore[no-untyped-def]
7471
try:

0 commit comments

Comments
 (0)