Skip to content

Commit bee7346

Browse files
committed
refactor: ♻️ revise from review comments
1 parent 8665c71 commit bee7346

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/check_datapackage/read_json.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def read_json(path: Path) -> dict[str, Any]:
1919
dictionary.
2020
"""
2121
try:
22-
properties: dict[str, Any] = loads(path.read_text())
22+
properties: Any = loads(path.read_text())
2323
except JSONDecodeError as error:
2424
raise JSONDecodeError(
2525
f"The path {path} couldn't be parsed as JSON. Is there a typo or other "
@@ -28,11 +28,13 @@ def read_json(path: Path) -> dict[str, Any]:
2828
pos=error.pos,
2929
) from None # To hide the original traceback
3030

31-
if not isinstance(properties, dict): # pyright: ignore
31+
if not isinstance(properties, dict):
3232
raise TypeError(
3333
f"The file {path} should parse into a Python dictionary (`dict`) "
3434
f"but it converts to the type `{type(properties)}`. Is the file "
3535
"missing a curly bracket `{` at the beginning or `}` at the end?"
3636
) from None # To hide the original traceback
3737

38-
return properties
38+
# Can't determine type at end from the above input and processing,
39+
# so ignore the pyright/pylance warning.
40+
return properties # pyright: ignore[reportUnknownVariableType]

0 commit comments

Comments
 (0)