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

Include missing typehints (mostly function return value typehints) #99

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jonded94
Copy link

Hey! Thank you very much for creating this library. I'd like to start using this library productively, but unfortunately, for quite a lot of functions, a return value type hint seems to be missing, especially when it's None.

Note that although pyright will assume None as the return type hint when the function is missing one, mypy will assume (more rightly, if I may add) Any, but also throw you an error if you're using mypy in "strict" mode (which one should, IMHO).

For example, this code

import portalocker

lock = portalocker.RedisLock("test123")
lock.acquire()
name = lock.client_name
lock.release()

will lead to mypy errors such as:

prtlck.py:6: error: Call to untyped function "release" in typed context  [no-untyped-call]

In this PR, I added function return value typehints to all functions I could find where this is missing.

@jonded94 jonded94 force-pushed the include-missing-typehints branch from 75e0cb9 to 8d4ea12 Compare December 17, 2024 14:09
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.

1 participant