Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Commit 65000ee

Browse files
committed
fix: PluginConfig.type_encoders forward ref.
Importing `TypeEncodersMap` in `if TYPE_CHECKING` block means that pydantic doesn't resolve the type before we want to use it.
1 parent 2bf6921 commit 65000ee

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/starlite_saqlalchemy/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def example_handler() -> dict:
3838
service,
3939
settings,
4040
sqlalchemy_plugin,
41+
type_encoders,
4142
worker,
4243
)
4344
from .init_plugin import ConfigureApp, PluginConfig
@@ -61,6 +62,7 @@ def example_handler() -> dict:
6162
"service",
6263
"settings",
6364
"sqlalchemy_plugin",
65+
"type_encoders",
6466
"worker",
6567
]
6668

src/starlite_saqlalchemy/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Definition of extra HTTP exceptions that aren't included in `Starlite`.
1+
"""Starlite-saqlalchemy exception types.
22
33
Also, defines functions that translate service and repository exceptions
44
into HTTP exceptions.

src/starlite_saqlalchemy/init_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def example_handler() -> dict:
3535
from pydantic import BaseModel
3636
from starlite.app import DEFAULT_CACHE_CONFIG, DEFAULT_OPENAPI_CONFIG
3737
from starlite.plugins.sql_alchemy import SQLAlchemyPlugin
38+
from starlite.types import TypeEncodersMap # noqa: TC002
3839
from structlog.types import Processor # noqa: TC002
3940

4041
from starlite_saqlalchemy import (
@@ -65,7 +66,6 @@ def example_handler() -> dict:
6566

6667
if TYPE_CHECKING:
6768
from starlite.config.app import AppConfig
68-
from starlite.types import TypeEncodersMap
6969

7070

7171
T = TypeVar("T")
@@ -292,13 +292,13 @@ def configure_health_check(self, app_config: AppConfig) -> None:
292292
app_config: The Starlite application config object.
293293
"""
294294
if self.config.do_health_check:
295-
healt_checks: list[AbstractHealthCheck] = []
295+
health_checks: list[AbstractHealthCheck] = []
296296
for health_check in self.config.health_checks:
297297
health_check_instance = health_check()
298298
if not health_check_instance.name:
299299
raise HealthCheckConfigurationError(f"{health_check}.name must be set.")
300-
healt_checks.append(health_check_instance)
301-
HealthController.health_checks = healt_checks
300+
health_checks.append(health_check_instance)
301+
HealthController.health_checks = health_checks
302302
app_config.route_handlers.append(HealthController)
303303

304304
def configure_logging(self, app_config: AppConfig) -> None:

0 commit comments

Comments
 (0)