Skip to content

Commit f01d8c4

Browse files
committed
refactor: replace TYPE_CHECKING import and add type casting for blocked file types
1 parent 015fdce commit f01d8c4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/lettermint/lettermint.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from __future__ import annotations
44

55
import sys
6-
from typing import TYPE_CHECKING, Any
6+
from typing import Any, cast
77

88
if sys.version_info >= (3, 11):
99
from typing import Self
1010
else:
1111
from typing_extensions import Self
1212

13+
from . import types as lm_types
1314
from .client import AsyncLettermintClient, LettermintClient
1415
from .endpoints.api import (
1516
AsyncDomainsEndpoint,
@@ -31,9 +32,6 @@
3132
)
3233
from .endpoints.email import AsyncEmailEndpoint, EmailEndpoint
3334

34-
if TYPE_CHECKING:
35-
from . import types as lm_types
36-
3735

3836
class _EmailAccessor:
3937
def __get__(self, instance: Lettermint | None, owner: type[Lettermint]) -> Any:
@@ -91,7 +89,10 @@ def ping(self) -> str:
9189
return self._client.get_raw("/ping").strip()
9290

9391
def blocked_file_types(self) -> lm_types.BlockedFileTypesResponse:
94-
return self._client.get("/blocked-file-types")
92+
return cast(
93+
lm_types.BlockedFileTypesResponse,
94+
self._client.get("/blocked-file-types"),
95+
)
9596

9697

9798
class AsyncApiClient:
@@ -132,7 +133,10 @@ async def ping(self) -> str:
132133
return (await self._client.get_raw("/ping")).strip()
133134

134135
async def blocked_file_types(self) -> lm_types.BlockedFileTypesResponse:
135-
return await self._client.get("/blocked-file-types")
136+
return cast(
137+
lm_types.BlockedFileTypesResponse,
138+
await self._client.get("/blocked-file-types"),
139+
)
136140

137141

138142
class Lettermint:

0 commit comments

Comments
 (0)