-
Notifications
You must be signed in to change notification settings - Fork 296
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
fix: Typing hint for builder decorator #740
Conversation
8c65843
to
caaa531
Compare
Could you elaborate on this change a little bit more? I don't fully get it |
@AzisK The previous type hints suggested that the The change I'm proposing says that the Callable returned is that of the same type as the input received - which is of a query builder type that implements the accessed methods. Type checkers understand this and the consequence is that your IDE provides appropriate type hints as highlighted in the "After" section. The example is usage from Frappe's codebase. |
Interesting. Okay, thanks for the explanation as well as for your work |
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.
Looks good
We need to lint the code as well as fix the unit test runners |
I agree about the pre-commit hook. I just created an issue #748 I believe we can drop support for Python3.6, I am just not sure what to do with the version of the library. Do we have to bump the major version in this case? |
@gavindsouza could you update this PR with the newest CI code from master? |
Maintain that the Callable type received is the same as the Callable returned
0ce7015
to
cc2d25b
Compare
Done 😄 |
Good job. I am merging this but new version and release will be coming later |
Maintain that the Callable type received is the same as the Callable returned.
Additional Context for the screenshots: tbl is a
Table
object,frappe.qb
is a namespace that has typeMySQLQuery | PostgreSQLQuery
Before
After