Skip to content

Commit

Permalink
chore(mypy): enable possibly-undefined error code (#3818)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Oct 16, 2024
1 parent 50e1ad2 commit 682e4c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions litestar/contrib/sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def __getattr__(attr_name: str) -> object:
)

value = globals()[attr_name] = getattr(exceptions, attr_name)

else: # pragma: no cover
raise RuntimeError(f"Unhandled module attribute: {attr_name!r}")

warn_deprecation(
deprecated_name=f"litestar.contrib.sqlalchemy.{attr_name}",
version="2.12",
Expand Down
3 changes: 3 additions & 0 deletions litestar/contrib/sqlalchemy/repository/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def __getattr__(attr_name: str) -> object:
wrap_sqlalchemy_exception, # type: ignore[import-not-found] # pyright: ignore[reportMissingImport]
)

else: # pragma: no cover
raise RuntimeError(f"Unhandled module attribute: {attr_name!r}")

value = globals()[attr_name] = locals()[attr_name]
warn_deprecation(
deprecated_name=f"litestar.contrib.sqlalchemy.repository.{attr_name}",
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ enable_error_code = [
"truthy-iterable",
"unused-awaitable",
"ignore-without-code",
"possibly-undefined",
"redundant-self",
]
python_version = "3.8"
Expand Down

0 comments on commit 682e4c7

Please sign in to comment.