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

Improve Public Interface Types #172

Merged
merged 4 commits into from
Sep 8, 2024
Merged

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented Sep 8, 2024

Some minor improvements to the public interface types. The main QoL improvement is probably going to be fixing type-checking when passing in unioned/intersected pgtrigger.Q instances.

@max-muoto max-muoto marked this pull request as ready for review September 8, 2024 17:13
@@ -187,9 +190,9 @@ class Timing(_Primitive):
class Condition:
"""For specifying free-form SQL in the condition of a trigger."""

sql: str = None
sql: str | None = None
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming you'll need to use Union for 3.8 compat, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, since I added from __future__ import annotations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can use it in earlier versions when type annotations are stringified.

Copy link
Member

Choose a reason for hiding this comment

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

Oh nice, I should convert this elsewhere. I do believe there is a py3.8 bug if you check circle though

  File "/code/pgtrigger/runtime.py", line 154, in <module>
    def ignore(*uris: str, databases: Union[List[str], None] = None) -> Generator[None]:
TypeError: 'ABCMeta' object is not subscriptable```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, had to add a future imports for that.

@wesleykendall wesleykendall self-requested a review September 8, 2024 17:26
Copy link
Member

@wesleykendall wesleykendall left a comment

Choose a reason for hiding this comment

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

looks good once tests pass

@max-muoto max-muoto merged commit 487ba68 into main Sep 8, 2024
4 checks passed
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