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

fix: allow union typing for supported bindings #239

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Aug 21, 2024

todo: support built-in collection types (list) after Bill's PR is merged

Python 3.10 and above allow for ABCMeta | _GenericAlias type hinting syntax.
(For example: event: func.EventHubEvent | List[func.EventHubEvent])

For bindings that allow List[<type>] type hints, this allows for the new syntax.

This is accomplished by:
- Adding a new method as part of the type checking process
- The new method will parse the individual types in the Union and determine if all of the types are supported
- If any of the types in the Union aren't supported, indexing will fail
- As this new method is part of an or statement in type checking, it won't affect any currently supported type hints

Bindings that can now support this syntax:
- EventHub
- Kafka
- ServiceBus

Fixes: Azure/azure-functions-python-worker#1524

@hallvictoria hallvictoria changed the title fix: allow union typing for EventHub and ServiceBus fix: allow union typing for supported bindings Aug 22, 2024
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.

[Bug] Testing Batched Event Hub Trigger
1 participant