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

Typing-only Mixin Class for Type Checking #2015

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

H00N24
Copy link

@H00N24 H00N24 commented Mar 27, 2024

What does this change

While debugging a typing-related bug in my tests I created a small mixin of some Faker providers for mypy type checking, unfortunately when I added all of them for the future checks I noticed a type/name conflict between address and bank/date_time providers.

What was wrong

As Faker proxy is dynamically gathering methods from locals, mypy cannot determine the correct types.

How this fixes it

This PR adds a typing-only class that is a mixture of all available providers thus giving mypy and IDEs enough information for type checking/completion (potentially fixing #1604).

Problems

As some providers have common attributes with different datatypes direct mixing was not possible which makes this change backward incompatible. I would love to hear your thoughts on this approach. Thanks.

@H00N24 H00N24 marked this pull request as ready for review March 28, 2024 07:00
@fcurella
Copy link
Collaborator

fcurella commented Apr 5, 2024

Hi @H00N24

With #1939 merged in, is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants