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

add type annotations to kombu/transport/azurestoragequeues #1632

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

jasonwbarnett
Copy link
Contributor

@jasonwbarnett jasonwbarnett commented Dec 18, 2022

This isn't complete, but at least it's a start. I'm open to any feedback.

@jasonwbarnett jasonwbarnett force-pushed the annotate/azure-storage-queue branch 4 times, most recently from 9cbb53e to 73bca59 Compare December 18, 2022 00:58
Copy link
Member

@thedrow thedrow left a comment

Choose a reason for hiding this comment

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

I have one thing I need you to change and then we can merge this PR

no_ack = True
_noack_queues = set()
domain_format: str = 'kombu%(vhost)s'
_queue_service: QueueServiceClient | 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.

Shouldn't _queue_service be Optional?

Copy link
Contributor Author

@jasonwbarnett jasonwbarnett Dec 26, 2022

Choose a reason for hiding this comment

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

@thedrow I agree, but the pre-commit.ci automatically corrected it and switched it from Optional[QueueServiceClient] to this. I just assumed this was an alternative way to declare the same thing, but outside of this project I would always use the Optional[QueueServiceClient] notation.

The docs you linked also mention this is an alternative syntax and that the two are equivalent.

Optional[X] is equivalent to X | None (or Union[X, None]).

What should I do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the updates, and I assume pre-commit.ci will add a commit correcting it, but we'll see.

Copy link
Contributor Author

@jasonwbarnett jasonwbarnett Dec 26, 2022

Choose a reason for hiding this comment

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

Yeah, pre-commit.ci corrected it so I just re-pushed the original content that you commented on. Should I try to update the pre-commit.ci configuration or merge as is?

Copy link
Member

Choose a reason for hiding this comment

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

If you can update the pre-commit config that would be great but I wouldn't block merging this PR without that config change.

default_port = None
can_parse_url = True
polling_interval: int = 1
default_port: int | 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.

The type here is Optional too

@jasonwbarnett jasonwbarnett force-pushed the annotate/azure-storage-queue branch 2 times, most recently from 864c0bf to 73bca59 Compare December 26, 2022 15:24
@jasonwbarnett
Copy link
Contributor Author

jasonwbarnett commented Dec 26, 2022

I have one thing I need you to change and then we can merge this PR

@thedrow I reviewed the inline comments and responded with why I didn't do that. Please let me know how you would like me to proceed.

@jasonwbarnett
Copy link
Contributor Author

jasonwbarnett commented Dec 26, 2022

@thedrow I ended up finding the root cause of this. It turns out pyupgrade is responsible for making this change, see: https://github.com/asottile/pyupgrade#pep-604-typing-rewrites

PEP 604 docs: https://peps.python.org/pep-0604/

If you'd like to keep pyupgrade from updating this, we could use the following argument; --keep-runtime-typing

Standing by waiting for your input.

@jasonwbarnett
Copy link
Contributor Author

I just rebased this PR off of main.

@thedrow
Copy link
Member

thedrow commented Jan 2, 2023

Yeah let's configure pyupdate to keep Optional.

jasonwbarnett added a commit to jasonwbarnett/kombu that referenced this pull request Jan 2, 2023
Per celery#1632 @thedrow asked to add this argument so `Optional` is still used.
Nusnus pushed a commit that referenced this pull request Jan 2, 2023
Per #1632 @thedrow asked to add this argument so `Optional` is still used.
@jasonwbarnett
Copy link
Contributor Author

jasonwbarnett commented Jan 2, 2023

@thedrow @Nusnus I believe this PR is ready to be merged now.

@Nusnus
Copy link
Member

Nusnus commented Jan 2, 2023

LGTM but I'll let @thedrow have the final word here

@auvipy auvipy merged commit 54cd277 into celery:main Jan 3, 2023
@jasonwbarnett jasonwbarnett deleted the annotate/azure-storage-queue branch January 3, 2023 12:14
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.

4 participants