Skip to content
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

Merged
merged 3 commits into from Jan 2, 2024
Merged

Improve type hint #45

merged 3 commits into from Jan 2, 2024

Conversation

tkrtmy
Copy link
Contributor

@tkrtmy tkrtmy commented Dec 24, 2023

Hello! I'd like to benefit from a type hint.
This is a trivial change for that purpose.

@@ -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:
Copy link
Contributor Author

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lua_sha: Optional[str] = None
identifier: Optional[Callable] = None
http_callback: Optional[Callable] = None
ws_callback: Optional[Callable] = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Optional

@tkrtmy
Copy link
Contributor Author

tkrtmy commented Jan 2, 2024

@long2ice It would be great if you could review this Pull Request.

@long2ice
Copy link
Owner

long2ice commented Jan 2, 2024

Looks like CI failed, I will fix it later.

@long2ice long2ice merged commit f6c214a into long2ice:master Jan 2, 2024
1 check failed
@tkrtmy
Copy link
Contributor Author

tkrtmy commented Jan 2, 2024

Looks like CI failed, I will fix it later.

Thank you!

@tkrtmy tkrtmy deleted the improve-type-hint branch January 2, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants