-
Notifications
You must be signed in to change notification settings - Fork 61
fix default polling method listed in docstring #830
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
Changes from 2 commits
00f718f
85e12d5
fbd7e91
4176c7c
538f120
36404a2
f0b7b03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,13 +71,39 @@ def _convert_extensions(operation: Dict[str, Any]) -> None: | |
| "x-python-custom-pager-async", "azure.core.async_paging.AsyncItemPaged" | ||
| ) | ||
| if operation_extensions.get("x-ms-long-running-operation"): | ||
| # poller | ||
| operation["extensions"]["poller-sync"] = operation_extensions.get( | ||
| "x-python-custom-poller-sync", "azure.core.polling.LROPoller" | ||
| ) | ||
| operation["extensions"]["poller-async"] = operation_extensions.get( | ||
| "x-python-custom-poller-async", "azure.core.polling.AsyncLROPoller" | ||
| ) | ||
|
|
||
| # polling methods | ||
| sync_polling_method_directive = "x-python-custom-default-polling-method-sync" | ||
| operation["extensions"]["default-polling-method-sync"] = { | ||
| "azure-arm": operation_extensions.get( | ||
| sync_polling_method_directive, "azure.mgmt.core.polling.arm_polling.ARMPolling" | ||
| ), | ||
| "data-plane": operation_extensions.get( | ||
| sync_polling_method_directive, "azure.core.polling.base_polling.LROBasePolling" | ||
| ), | ||
| } | ||
| async_polling_method_directive = "x-python-custom-default-polling-method-async" | ||
| operation["extensions"]["default-polling-method-async"] = { | ||
| "azure-arm": operation_extensions.get( | ||
| async_polling_method_directive, "azure.mgmt.core.polling.async_arm_polling.AsyncARMPolling" | ||
| ), | ||
| "data-plane": operation_extensions.get( | ||
| async_polling_method_directive, "azure.core.polling.async_base_polling.AsyncLROBasePolling" | ||
| ), | ||
| } | ||
|
|
||
| operation["extensions"]["default-no-polling-method-sync"] = "azure.core.polling.NoPolling" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added the default no polling, and the base polling method. to the namer as well. I'm not exposing a directive to override these (at least not yet, there seems to be no use case for it). But I wanted all of the LRO paths to be in one area, and it cleaned up the code in the LROOperation model class |
||
| operation["extensions"]["default-no-polling-method-async"] = "azure.core.polling.AsyncNoPolling" | ||
| operation["extensions"]["base-polling-method-sync"] = "azure.core.polling.PollingMethod" | ||
| operation["extensions"]["base-polling-method-async"] = "azure.core.polling.AsyncPollingMethod" | ||
|
|
||
| @staticmethod | ||
| def _convert_schemas(schemas: Dict[str, Any]) -> None: | ||
| for enum in schemas.get("sealedChoices", []) + schemas.get("choices", []): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really improve the readability? :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made some fixes for readability