-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve type hint #45
Conversation
@@ -85,5 +85,5 @@ async def init( | |||
cls.lua_sha = await redis.script_load(cls.lua_script) | |||
|
|||
@classmethod | |||
async def close(cls): | |||
async def close(cls) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my project mypy says...
error: Call to untyped function "close" of "FastAPILimiter" in typed context [no-untyped-call]
milliseconds: Annotated[int, Field(ge=-1)] = 0, | ||
seconds: Annotated[int, Field(ge=-1)] = 0, | ||
minutes: Annotated[int, Field(ge=-1)] = 0, | ||
hours: Annotated[int, Field(ge=-1)] = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I migrated according to this
https://github.com/pydantic/pydantic/blob/19fa86cbfcc7b64c5d59c04c38fa80b497f275a2/pydantic/types.py#L157-L182
lua_sha: Optional[str] = None | ||
identifier: Optional[Callable] = None | ||
http_callback: Optional[Callable] = None | ||
ws_callback: Optional[Callable] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Optional
@long2ice It would be great if you could review this Pull Request. |
Looks like CI failed, I will fix it later. |
Thank you! |
Hello! I'd like to benefit from a type hint.
This is a trivial change for that purpose.