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

wrap_json and wrap_constant type fixes #21

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

henadzit
Copy link
Contributor

@henadzit henadzit commented Dec 4, 2024

  • Removed unused ignores for wrap_constant
  • Simplify typing of wrap_json
  • Make Interval a subclass of Term. It doesn't seem like there is reason it should be a subclass of Node. This helps with simplifying typing.
  • Set warn_unused_ignores = true for mypy and remove unused ignores

@henadzit henadzit marked this pull request as ready for review December 4, 2024 15:49
@henadzit henadzit requested a review from waketzheng December 4, 2024 15:49
@waketzheng
Copy link
Contributor

Great! Looks nice, the only thing is that Interval is not a subclass of Term, please check it.

@henadzit
Copy link
Contributor Author

henadzit commented Dec 5, 2024

Great! Looks nice, the only thing is that Interval is not a subclass of Term, please check it.

Could you please elaborate on what you mean? I couldn't figure out why the Interval should be a subclass of Node in particular. It seems to work just fine with it being a subclass of Term.

@waketzheng
Copy link
Contributor

https://github.com/tortoise/pypika-tortoise/pull/21/files#diff-54340751c88780ef96f3ba11bb105a16d92a43a583141992cc7e4162507ac013L107

You change if isinstance(val, (Term, QueryBuilder, Interval)): to if isinstance(val, Term):
QueryBuilder is subclass of Term, while Interval is not. So these two line have different logic.

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.

2 participants