Skip to content

Conversation

@iscai-msft
Copy link
Contributor

fixes #782

@iscai-msft iscai-msft requested a review from lmazuel November 18, 2020 16:06
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.{{ "Async" if async_mode else "" }}PollingMethod
{% set default_polling_method = "ARMPolling"if code_model.options['azure_arm'] else "LROBasePolling" %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main point of this PR (sorry there's a lot of fluff where I add a keyword to dedup code in the LRO world). Before, we would always generate ARMPolling as the default polling method, even when arm flag wasn't set

Copy link
Member

@lmazuel lmazuel left a comment

Choose a reason for hiding this comment

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

Make this with a default, directive and namer

…into improve_lro_docstrings

* 'autorestv3' of https://github.com/Azure/autorest.python:
  add typing imports to multiapi client and config (#794)
  deduplicate model serialization code (#828)
  remove azure-arm flag when generating paging (#829)
  clean up tasks file (#827)
),
}

operation["extensions"]["default-no-polling-method-sync"] = "azure.core.polling.NoPolling"
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'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

@iscai-msft iscai-msft requested a review from lmazuel November 25, 2020 18:30

def get_poller_path(self, async_mode: bool) -> str:
extension_name = "poller-async" if async_mode else "poller-sync"
extension_name = "poller-{}sync".format("a" if async_mode else "")
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

@lmazuel lmazuel left a comment

Choose a reason for hiding this comment

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

Sounds fair

…into improve_lro_docstrings

* 'autorestv3' of https://github.com/Azure/autorest.python:
  add enum description son top of declaration, wrap comments (#844)
  add default value 'api-key' for `--credential-key-header-name` (#840)
  update head-as-boolean spec
@iscai-msft iscai-msft merged commit 2db8958 into autorestv3 Jan 4, 2021
@iscai-msft iscai-msft deleted the improve_lro_docstrings branch January 4, 2021 18:50
iscai-msft added a commit that referenced this pull request Jan 5, 2021
…into black_plugin

* 'autorestv3' of https://github.com/Azure/autorest.python:
  fix default polling method listed in docstring (#830)
  add enum description son top of declaration, wrap comments (#844)
  add default value 'api-key' for `--credential-key-header-name` (#840)
  update head-as-boolean spec
iscai-msft added a commit that referenced this pull request Jan 7, 2021
…into docs

* 'autorestv3' of https://github.com/Azure/autorest.python:
  add black flag (#836)
  fix default polling method listed in docstring (#830)
  add enum description son top of declaration, wrap comments (#844)
iscai-msft added a commit that referenced this pull request Jan 14, 2021
…into paging_separate_operations

* 'autorestv3' of https://github.com/Azure/autorest.python:
  add black flag (#836)
  fix default polling method listed in docstring (#830)
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.

improve docstring in basic case for lro pollers

3 participants