-
Notifications
You must be signed in to change notification settings - Fork 3.3k
move config into kwargs #7734
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
Merged
Merged
move config into kwargs #7734
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dd69576
move config into kwargs
xiangyan99 be32df4
use pop to avoid dup values for kw arguement 'config'
xiangyan99 65e5f6a
update doc
xiangyan99 9e54a6d
fix cosmos client
xiangyan99 e0a66b5
pylint fix
xiangyan99 bc50ec9
remove config
xiangyan99 4809fad
fix typo
xiangyan99 11a5ec2
Get latest master (#7770)
xiangyan99 f3a0790
pylint fix
xiangyan99 bdec916
Merge branch 'master' into MoveConfigIntoKwargs
xiangyan99 60e1ba2
update history.md
xiangyan99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| # -------------------------------------------------------------------------- | ||
|
|
||
| import logging | ||
| from .configuration import Configuration | ||
| from .pipeline import AsyncPipeline | ||
| from .pipeline.transport.base import PipelineClientBase | ||
| from .pipeline.policies import ContentDecodePolicy | ||
|
|
@@ -58,20 +59,13 @@ class AsyncPipelineClient(PipelineClientBase): | |
| Builds an AsyncPipeline client. | ||
|
|
||
| :param str base_url: URL for the request. | ||
| :param config: Service configuration. This is a required parameter. | ||
| :type config: ~azure.core.Configuration | ||
| :param kwargs: keyword arguments. | ||
| :keyword Configuration config: If omitted, the standard configuration is used. | ||
| :keyword Pipeline pipeline: If omitted, a Pipeline object is created and returned. | ||
| :keyword list[policy] policies: If omitted, the standard policies of the configuration object is used. | ||
| :keyword HttpTranpost transport: If omitted, RequestsTransport is used for synchronous transport. | ||
|
Contributor
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. Transpost
Member
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. Good catch! |
||
| :return: An async pipeline object. | ||
| :rtype: ~azure.core.pipeline.AsyncPipeline | ||
|
|
||
| **Keyword arguments:** | ||
|
|
||
| *pipeline* - A Pipeline object. If omitted, an AsyncPipeline is created and returned. | ||
|
|
||
| *policies* - A list of policies object. If omitted, the standard policies of the configuration object is used. | ||
|
|
||
| *transport* - The HTTP Transport instance. If omitted, AioHttpTransport is use for asynchronous transport. | ||
|
|
||
| .. admonition:: Example: | ||
|
|
||
| .. literalinclude:: ../examples/test_example_async.py | ||
|
|
@@ -82,16 +76,14 @@ class AsyncPipelineClient(PipelineClientBase): | |
| :caption: Builds the async pipeline client. | ||
| """ | ||
|
|
||
| def __init__(self, base_url, config, **kwargs): | ||
| def __init__(self, base_url, **kwargs): | ||
| super(AsyncPipelineClient, self).__init__(base_url) | ||
| if config is None: | ||
| raise ValueError("Config is a required parameter") | ||
| self._config = config | ||
| self._config = kwargs.pop("config", None) or Configuration(**kwargs) | ||
| self._base_url = base_url | ||
| if kwargs.get("pipeline"): | ||
| self._pipeline = kwargs["pipeline"] | ||
| else: | ||
| self._pipeline = self._build_pipeline(config, **kwargs) | ||
| self._pipeline = self._build_pipeline(self._config, **kwargs) | ||
|
bryevdv marked this conversation as resolved.
|
||
|
|
||
| async def __aenter__(self): | ||
| await self._pipeline.__aenter__() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
HttpTranpost -> HttpTranport