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

[SB] Update API type hints for methods that accept dicts #17000

Closed
swathipil opened this issue Mar 2, 2021 · 2 comments
Closed

[SB] Update API type hints for methods that accept dicts #17000

swathipil opened this issue Mar 2, 2021 · 2 comments
Assignees
Milestone

Comments

@swathipil
Copy link
Member

Complete after : #14807

In the above PR, changes were made to SB so that dict representations of the following objects are
now accepted and can be sent:

  • ServiceBusMessage
  • QueueProperties
  • TopicProperties
  • SubscriptionProperties
  • RuleProperties

The API type hints that now accept dict representations of these objects should be updated to reflect the change. The type hint should show that an object of type typing.Mapping is accepted, NOT AN OBJECT OF TYPE Dict. Discussion for this update here: https://github.com/Azure/azure-sdk-for-python/pull/14807/files#r579153824.

The type hints for the following methods should be updated:

  • _from_list in message.py
  • add_message in message.py
  • schedule_messages in _servicebus_sender.py
  • send_messages in _servicebus_sender.py
  • schedule_messages in _servicebus_sender_async.py
  • send_messages in _servicebus_sender_async.py
  • update_queue, update_topic, update_subscription, update_rule in management/_management_client.py
    • update_queue, update_topic, update_subscription, update_rule in aio/management/_management_client_async.py
@swathipil
Copy link
Member Author

need to update all the isinstance(x, dict) to some sort of validation that the dict is of type Mapping and conforms to the Mapping protocol. Below is a prototype of that check from Anna:

def _check_instance(input):
    if isinstance(input, ServiceBusMessage):
        return True
    try:
        dict_message = dict(intput)
        dict['body]  # Check that a required key is present
        return True
    except (ValueError, TypeError, KeyError):
        raise ValueError("Message must be an instance of ServiceBusMessage or Mapping")
    return False
  • add a test to check non-SBMessage-non-Mappable inputs raises an error as expected

@swathipil
Copy link
Member Author

Merged: #17080

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Dec 10, 2021
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 5, 2022
[Go] Track2 modify readme.go.md 9 (Azure#17000)

* [Go] Track2 modify readme.go.md 9

* fix
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant