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

Add limits+coredis to mypy #537

Merged
merged 2 commits into from
Oct 6, 2024
Merged

Add limits+coredis to mypy #537

merged 2 commits into from
Oct 6, 2024

Conversation

mskarlin
Copy link
Collaborator

@mskarlin mskarlin commented Oct 6, 2024

I forgot to add to mypy, not it's added. It revealed a couple of type signatures to clean up.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Oct 6, 2024
Copy link
Collaborator

@jamesbraza jamesbraza left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@@ -301,7 +310,7 @@ async def try_acquire(
"""Returns when the limit is satisfied for the namespace_and_key.

Args:
namespace_and_key (:obj:`tuple[str, str | MatchAllInputs]`): is
namespace_and_key (:obj:`tuple[str, str]`): is
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this :obj: syntax here? Normally it's good to not restate types if they're in the docstring already

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's in the style guide for the google doc strings, I think for sphinx compatibility

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fwiw, either Sphinx autodoc or napoleon (I can't remember which) will pull in type hints if they are there

https://google.github.io/styleguide/pyguide.html#383-functions-and-methods note that it does not restate type hints in Args or Returns

https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html in this one, note there's not type hints at all

Anyways, moral of the story I have seen it where people later update or expand type hints, but then don't update the repeated version in the docstring Args or Returns

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 6, 2024
@mskarlin mskarlin merged commit e67a9b3 into main Oct 6, 2024
5 checks passed
@mskarlin mskarlin deleted the add-limits-to-mypy branch October 6, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants