diff --git a/sdk/core/azure-core/azure/core/async_paging.py b/sdk/core/azure-core/azure/core/async_paging.py index dc7c62a0150d..4a4af4d28cc5 100644 --- a/sdk/core/azure-core/azure/core/async_paging.py +++ b/sdk/core/azure-core/azure/core/async_paging.py @@ -31,7 +31,9 @@ class AsyncPagedMixin(AsyncIterator): """Bring async to Paging. - :param async_command: Mandatory keyword argument for this mixin to work. + **Keyword argument:** + + *async_command* - Mandatory keyword argument for this mixin to work. """ def __init__(self, *args, **kwargs): # pylint: disable=unused-argument self._async_get_next = kwargs.get("async_command") diff --git a/sdk/core/azure-core/azure/core/configuration.py b/sdk/core/azure-core/azure/core/configuration.py index 88fda748dcc5..62b40bbae6cd 100644 --- a/sdk/core/azure-core/azure/core/configuration.py +++ b/sdk/core/azure-core/azure/core/configuration.py @@ -50,7 +50,7 @@ class Configuration(object): TrioRequestsTransport, AioHttpTransport. Example: - .. literalinclude:: ../../examples/examples_config.py + .. literalinclude:: ../examples/examples_config.py :start-after: [START configuration] :end-before: [END configuration] :language: python @@ -92,7 +92,7 @@ def __init__(self, transport=None, **kwargs): class ConnectionConfiguration(object): """HTTP transport connection configuration settings. - Common properies that can be configured on all transports. Found in the + Common properties that can be configured on all transports. Found in the Configuration object. :param int connection_timeout: The connect and read timeout value. Defaults to 100 seconds. @@ -103,7 +103,7 @@ class ConnectionConfiguration(object): :param int connection_data_block_size: The block size of data sent over the connection. Defaults to 4096 bytes. Example: - .. literalinclude:: ../../examples/examples_config.py + .. literalinclude:: ../examples/examples_config.py :start-after: [START connection_configuration] :end-before: [END connection_configuration] :language: python diff --git a/sdk/core/azure-core/azure/core/exceptions.py b/sdk/core/azure-core/azure/core/exceptions.py index e09a301ce446..66b0b00ab1ff 100644 --- a/sdk/core/azure-core/azure/core/exceptions.py +++ b/sdk/core/azure-core/azure/core/exceptions.py @@ -36,11 +36,14 @@ def raise_with_traceback(exception, *args, **kwargs): # type: (Callable, Any, Any) -> None """Raise exception with a specified traceback. This MUST be called inside a "except" clause. + :param Exception exception: Error type to be raised. :param args: Any additional args to be included with exception. :param kwargs: Keyword arguments to include with the exception. - Keyword arguments: - message Message to be associated with the exception. If omitted, defaults to an empty string. + + **Keyword argument:** + + *message (str)* - Message to be associated with the exception. If omitted, defaults to an empty string. """ message = kwargs.pop('message', '') exc_type, exc_value, exc_traceback = sys.exc_info() @@ -95,8 +98,9 @@ class ServiceResponseError(AzureError): class HttpResponseError(AzureError): """A request was made, and a non-success status code was received from the service. - :ivar status_code: HttpResponse's status code - :ivar response: The response that triggered the exception. + + :param status_code: HttpResponse's status code + :param response: The response that triggered the exception. """ def __init__(self, message=None, response=None, **kwargs): diff --git a/sdk/core/azure-core/azure/core/paging.py b/sdk/core/azure-core/azure/core/paging.py index 871730360e92..9a04250dc932 100644 --- a/sdk/core/azure-core/azure/core/paging.py +++ b/sdk/core/azure-core/azure/core/paging.py @@ -46,7 +46,8 @@ class AsyncPagedMixin(object): # type: ignore class Paged(AsyncPagedMixin, Iterator): """A container for paged REST responses. - :param HttpResponse response: server response object. + :param response: server response object. + :type response: ~azure.core.pipeline.transport.HttpResponse :param callable command: Function to retrieve the next page of items. :param Deserializer deserializer: a Deserializer instance to use """ diff --git a/sdk/core/azure-core/azure/core/pipeline/__init__.py b/sdk/core/azure-core/azure/core/pipeline/__init__.py index e004df81fbd0..2df1fbfea898 100644 --- a/sdk/core/azure-core/azure/core/pipeline/__init__.py +++ b/sdk/core/azure-core/azure/core/pipeline/__init__.py @@ -50,8 +50,7 @@ def __exit__(self, exc_type, exc_value, traceback): class PipelineContext(dict): - """A context object carried by the pipeline request and - response containers. + """A context object carried by the pipeline request and response containers. This is transport specific and can contain data persisted between pipeline requests (for example reusing an open connection pool or "session"), @@ -77,12 +76,22 @@ def __delitem__(self, key): return super(PipelineContext, self).__delitem__(key) def clear(self): + """Context objects cannot be cleared. + + :raises: TypeError + """ raise TypeError("Context objects cannot be cleared.") def update(self, *args, **kwargs): + """Context objects cannot be updated. + + :raises: TypeError + """ raise TypeError("Context objects cannot be updated.") def pop(self, *args): + """Removes specified key and returns the value. + """ if args and args[0] in self._protected: raise ValueError('Context value {} cannot be popped.'.format(args[0])) return super(PipelineContext, self).pop(*args) diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/base.py b/sdk/core/azure-core/azure/core/pipeline/policies/base.py index 8379aba001bc..bb017e9836b3 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/base.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/base.py @@ -46,7 +46,7 @@ class HTTPPolicy(ABC, Generic[HTTPRequestType, HTTPResponseType]): # type: ignor :param next: Use to process the next policy in the pipeline. Set when pipeline is instantiated and all policies chained. - :type next: HTTPPolicy or HTTPTransport + :type next: ~azure.core.pipeline.policies.HTTPPolicy or ~azure.core.pipeline.transport.HTTPTransport """ def __init__(self): self.next = None @@ -108,7 +108,7 @@ def on_exception(self, _request, **kwargs): #pylint: disable=unused-argument :rtype: bool Example: - .. literalinclude:: ../../../../examples/examples_sansio.py + .. literalinclude:: ../examples/examples_sansio.py :start-after: [START on_exception] :end-before: [END on_exception] :language: python diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/base_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/base_async.py index 85d2d3aac0a8..e77a76fd33d9 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/base_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/base_async.py @@ -56,7 +56,7 @@ class AsyncHTTPPolicy(abc.ABC, Generic[HTTPRequestType, AsyncHTTPResponseType]): :param next: Use to process the next policy in the pipeline. Set when pipeline is instantiated and all policies chained. - :type next: AsyncHTTPPolicy or AsyncHttpTransport + :type next: ~azure.core.pipeline.policies.AsyncHTTPPolicy or ~azure.core.pipeline.transport.AsyncHttpTransport """ def __init__(self) -> None: # next will be set once in the pipeline diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/custom_hook.py b/sdk/core/azure-core/azure/core/pipeline/policies/custom_hook.py index 2874596fa520..6119d623cfbc 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/custom_hook.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/custom_hook.py @@ -33,8 +33,9 @@ class CustomHookPolicy(SansIOHTTPPolicy): """A simple policy that enable the given callback with the response. - Keyword argument: - :param raw_response_hook: Callback function. Will be invoked on response. + **Keyword argument:** + + *raw_response_hook* - Callback function. Will be invoked on response. """ def __init__(self, **kwargs): # pylint: disable=unused-argument self._callback = None diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/redirect.py b/sdk/core/azure-core/azure/core/pipeline/policies/redirect.py index d0c5d1c2fa4a..32a40c3d64c5 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/redirect.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/redirect.py @@ -47,12 +47,14 @@ class RedirectPolicy(HTTPPolicy): A redirect policy in the pipeline can be configured directly or per operation. - Keyword arguments: - :param redirects_allow: Whether the client allows redirects. Defaults to True. - :param redirect_max: The maximum allowed redirects. Defaults to 30. + **Keyword arguments:** + + *redirects_allow (int)* - Whether the client allows redirects. Defaults to True. + + *redirect_max (int)* - The maximum allowed redirects. Defaults to 30. Example: - .. literalinclude:: ../../../../examples/examples_sync.py + .. literalinclude:: ../examples/examples_sync.py :start-after: [START redirect_policy] :end-before: [END redirect_policy] :language: python @@ -142,8 +144,8 @@ def increment(self, settings, response, redirect_location): return settings['redirects'] > 0 or not settings['allow'] def send(self, request): - """Sends the PipelineRequest object to the next policy. Uses redirect settings - to send request to redirect endpoint if necessary. + """Sends the PipelineRequest object to the next policy. + Uses redirect settings to send request to redirect endpoint if necessary. :param request: The PipelineRequest object :type request: ~azure.core.pipeline.PipelineRequest diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/redirect_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/redirect_async.py index 6d2c742dbc0a..e60916ced80b 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/redirect_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/redirect_async.py @@ -35,12 +35,14 @@ class AsyncRedirectPolicy(RedirectPolicy, AsyncHTTPPolicy): # type: ignore An async redirect policy in the pipeline can be configured directly or per operation. - Keyword arguments: - :param redirects_allow: Whether the client allows redirects. Defaults to True. - :param redirect_max: The maximum allowed redirects. Defaults to 30. + **Keyword arguments:** + + *redirects_allow (int)* - Whether the client allows redirects. Defaults to True. + + *redirect_max (int)* - The maximum allowed redirects. Defaults to 30. Example: - .. literalinclude:: ../../../../examples/examples_async.py + .. literalinclude:: ../examples/examples_async.py :start-after: [START async_redirect_policy] :end-before: [END async_redirect_policy] :language: python @@ -49,8 +51,8 @@ class AsyncRedirectPolicy(RedirectPolicy, AsyncHTTPPolicy): # type: ignore """ async def send(self, request): - """Sends the PipelineRequest object to the next policy. Uses redirect settings - to send the request to redirect endpoint if necessary. + """Sends the PipelineRequest object to the next policy. + Uses redirect settings to send the request to redirect endpoint if necessary. :param request: The PipelineRequest object :type request: ~azure.core.pipeline.PipelineRequest diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/retry.py b/sdk/core/azure-core/azure/core/pipeline/policies/retry.py index 75091e90df0c..bb1bfa645582 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/retry.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/retry.py @@ -50,25 +50,31 @@ class RetryPolicy(HTTPPolicy): The retry policy in the pipeline can be configured directly, or tweaked on a per-call basis. - Keyword arguments: - :param int retry_total: Total number of retries to allow. Takes precedence over other counts. - Default value is 10. - :param int retry_connect: How many connection-related errors to retry on. - These are errors raised before the request is sent to the remote server, - which we assume has not triggered the server to process the request. Default value is 3. - :param int retry_read: How many times to retry on read errors. - These errors are raised after the request was sent to the server, so the - request may have side-effects. Default value is 3. - :param int retry_status: How many times to retry on bad status codes. Default value is 3. - :param int retry_backoff_factor: A backoff factor to apply between attempts after the second try - (most errors are resolved immediately by a second try without a delay). - Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` - seconds. If the backoff_factor is 0.1, then the retry will sleep - for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8. - :param int retry_backoff_max: The maximum back off time. Default value is 120 seconds (2 minutes). + **Keyword arguments:** + + *retry_total (int)* - Total number of retries to allow. Takes precedence over other counts. + Default value is 10. + + *retry_connect (int)* - How many connection-related errors to retry on. + These are errors raised before the request is sent to the remote server, + which we assume has not triggered the server to process the request. Default value is 3. + + *retry_read (int)* - How many times to retry on read errors. + These errors are raised after the request was sent to the server, so the + request may have side-effects. Default value is 3. + + *retry_status (int)* - How many times to retry on bad status codes. Default value is 3. + + *retry_backoff_factor (float)* - A backoff factor to apply between attempts after the second try + (most errors are resolved immediately by a second try without a delay). + Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` + seconds. If the backoff_factor is 0.1, then the retry will sleep + for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8. + + *retry_backoff_max (int)* - The maximum back off time. Default value is 120 seconds (2 minutes). Example: - .. literalinclude:: ../../../../examples/examples_sync.py + .. literalinclude:: ../examples/examples_sync.py :start-after: [START retry_policy] :end-before: [END retry_policy] :language: python @@ -252,7 +258,7 @@ def is_retry(self, settings, response): :param dict settings: The retry settings. :param response: The PipelineResponse object - :type response: ~azure.core.pipeline.PipelineResponse. + :type response: ~azure.core.pipeline.PipelineResponse :return: True if method/status code is retryable. False if not retryable. :rtype: bool """ @@ -325,8 +331,7 @@ def update_context(self, context, retry_settings): context['history'] = retry_settings['history'] def send(self, request): - """Sends the PipelineRequest object to the next policy. - Uses retry settings if necessary. + """Sends the PipelineRequest object to the next policy. Uses retry settings if necessary. :param request: The PipelineRequest object :type request: ~azure.core.pipeline.PipelineRequest diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/retry_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/retry_async.py index 2d95cb542a98..449ec67f1adf 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/retry_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/retry_async.py @@ -44,25 +44,31 @@ class AsyncRetryPolicy(RetryPolicy, AsyncHTTPPolicy): # type: ignore The async retry policy in the pipeline can be configured directly, or tweaked on a per-call basis. - Keyword arguments: - :param int retry_total: Total number of retries to allow. Takes precedence over other counts. - Default value is 10. - :param int retry_connect: How many connection-related errors to retry on. - These are errors raised before the request is sent to the remote server, - which we assume has not triggered the server to process the request. Default value is 3. - :param int retry_read: How many times to retry on read errors. - These errors are raised after the request was sent to the server, so the - request may have side-effects. Default value is 3. - :param int retry_status: How many times to retry on bad status codes. Default value is 3. - :param int retry_backoff_factor: A backoff factor to apply between attempts after the second try - (most errors are resolved immediately by a second try without a delay). - Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` - seconds. If the backoff_factor is 0.1, then the retry will sleep - for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8. - :param int retry_backoff_max: The maximum back off time. Default value is 120 seconds (2 minutes). + **Keyword arguments:** + + *retry_total (int)* - Total number of retries to allow. Takes precedence over other counts. + Default value is 10. + + *retry_connect (int)* - How many connection-related errors to retry on. + These are errors raised before the request is sent to the remote server, + which we assume has not triggered the server to process the request. Default value is 3. + + *retry_read (int)* - How many times to retry on read errors. + These errors are raised after the request was sent to the server, so the + request may have side-effects. Default value is 3. + + *retry_status (int)* - How many times to retry on bad status codes. Default value is 3. + + *retry_backoff_factor (float)* - A backoff factor to apply between attempts after the second try + (most errors are resolved immediately by a second try without a delay). + Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))` + seconds. If the backoff_factor is 0.1, then the retry will sleep + for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8. + + *retry_backoff_max (int)* - The maximum back off time. Default value is 120 seconds (2 minutes). Example: - .. literalinclude:: ../../../../examples/examples_async.py + .. literalinclude:: ../examples/examples_async.py :start-after: [START async_retry_policy] :end-before: [END async_retry_policy] :language: python @@ -114,14 +120,13 @@ async def sleep(self, settings, transport, response=None): await self._sleep_backoff(settings, transport) async def send(self, request): - """Uses the configured retry policy to send the request - to the next policy in the pipeline. + """Uses the configured retry policy to send the request to the next policy in the pipeline. :param request: The PipelineRequest object :type request: ~azure.core.pipeline.PipelineRequest :return: Returns the PipelineResponse or raises error if maximum retries exceeded. :rtype: ~azure.core.pipeline.PipelineResponse - :raises: ~azure.core.exceptions.AzureError if maximum retries exceeded. + :raise: ~azure.core.exceptions.AzureError if maximum retries exceeded. """ retry_active = True response = None diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/universal.py b/sdk/core/azure-core/azure/core/pipeline/policies/universal.py index ccf4520cab0c..bfead15a5526 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/universal.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/universal.py @@ -61,7 +61,7 @@ class HeadersPolicy(SansIOHTTPPolicy): :param dict base_headers: Headers to send with the request. Example: - .. literalinclude:: ../../../../examples/examples_sansio.py + .. literalinclude:: ../examples/examples_sansio.py :start-after: [START headers_policy] :end-before: [END headers_policy] :language: python @@ -103,11 +103,15 @@ class UserAgentPolicy(SansIOHTTPPolicy): """User-Agent Policy. Allows custom values to be added to the User-Agent header. :param str base_user_agent: Sets the base user agent value. - :param bool user_agent_overwrite: Keyword argument that overwrites User-Agent when True. Defaults to False. - :param bool user_agent_use_env: Keyword argument that gets user-agent from environment. Defaults to True. + + **Keyword arguments:** + + *user_agent_overwrite (bool)* - Overwrites User-Agent when True. Defaults to False. + + *user_agent_use_env (bool)* - Gets user-agent from environment. Defaults to True. Example: - .. literalinclude:: ../../../../examples/examples_sansio.py + .. literalinclude:: ../examples/examples_sansio.py :start-after: [START user_agent_policy] :end-before: [END user_agent_policy] :language: python @@ -175,12 +179,9 @@ class NetworkTraceLoggingPolicy(SansIOHTTPPolicy): This accepts both global configuration, and per-request level with "enable_http_logger" :param bool logging_enable: Use to enable per operation. Defaults to False. - Keyword argument. - :param bool enable_http_logger: Enables network trace logging at DEBUG level. - Defaults to False. Example: - .. literalinclude:: ../../../../examples/examples_sansio.py + .. literalinclude:: ../examples/examples_sansio.py :start-after: [START network_trace_logging_policy] :end-before: [END network_trace_logging_policy] :language: python @@ -278,6 +279,7 @@ def deserialize_from_text(cls, response, content_type=None): """Decode response data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. If no content-type, will return the string version (not bytes, not stream) + :param response: The HTTP response. :type response: ~azure.core.pipeline.transport.HttpResponse :param str content_type: The content type. @@ -385,11 +387,13 @@ class ProxyPolicy(SansIOHTTPPolicy): :param dict proxies: Maps protocol or protocol and hostname to the URL of the proxy. - :param bool proxies_use_env_settings: Keyword argument that uses proxy settings - from environment. Defaults to True. + + **Keyword argument:** + + *proxies_use_env_settings (bool)* - Uses proxy settings from environment. Defaults to True. Example: - .. literalinclude:: ../../../../examples/examples_sansio.py + .. literalinclude:: ../examples/examples_sansio.py :start-after: [START proxy_policy] :end-before: [END proxy_policy] :language: python diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py b/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py index 4ec352d6de20..74fadeec74e5 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py @@ -117,7 +117,7 @@ async def send(self, request: HttpRequest, **config: Any) -> Optional[AsyncHttpR """Send the request using this HTTP sender. Will pre-load the body into memory to be available with a sync method. - pass stream=True to avoid this behavior. + Pass stream=True to avoid this behavior. :param request: The HttpRequest object :type request: ~azure.core.pipeline.transport.HttpRequest @@ -125,8 +125,9 @@ async def send(self, request: HttpRequest, **config: Any) -> Optional[AsyncHttpR :return: The AsyncHttpResponse :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse - Keyword arguments: - stream - Defaults to False. + **Keyword argument:** + + *stream (bool)* - Defaults to False. """ await self.open() error = None diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/base.py b/sdk/core/azure-core/azure/core/pipeline/transport/base.py index be359d9db47b..027560c490ac 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/base.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/base.py @@ -288,6 +288,7 @@ def _request( ): # type: (...) -> HttpRequest """Create HttpRequest object. + :param str method: HTTP method (GET, HEAD, etc.) :param str url: URL for the request. :param dict params: URL query parameters. @@ -336,6 +337,7 @@ def format_url(self, url_template, **kwargs): # type: (str, Any) -> str """Format request URL with the client base URL, unless the supplied URL is already absolute. + :param str url_template: The request URL to be formatted if necessary. """ url = self._format_url_section(url_template, **kwargs) @@ -358,6 +360,7 @@ def get( ): # type: (...) -> HttpRequest """Create a GET request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -379,6 +382,7 @@ def put( ): # type: (...) -> HttpRequest """Create a PUT request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -399,6 +403,7 @@ def post( ): # type: (...) -> HttpRequest """Create a POST request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -419,6 +424,7 @@ def head( ): # type: (...) -> HttpRequest """Create a HEAD request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -439,6 +445,7 @@ def patch( ): # type: (...) -> HttpRequest """Create a PATCH request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -452,6 +459,7 @@ def patch( def delete(self, url, params=None, headers=None, content=None, form_content=None): # type: (str, Optional[Dict[str, str]], Optional[Dict[str, str]], Any, Optional[Dict[str, Any]]) -> HttpRequest """Create a DELETE request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers @@ -465,6 +473,7 @@ def delete(self, url, params=None, headers=None, content=None, form_content=None def merge(self, url, params=None, headers=None, content=None, form_content=None): # type: (str, Optional[Dict[str, str]], Optional[Dict[str, str]], Any, Optional[Dict[str, Any]]) -> HttpRequest """Create a MERGE request object. + :param str url: The request URL. :param dict params: Request URL parameters. :param dict headers: Headers diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/requests_basic.py b/sdk/core/azure-core/azure/core/pipeline/transport/requests_basic.py index 031b463583f7..4e93a9048578 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/requests_basic.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/requests_basic.py @@ -192,14 +192,15 @@ def send(self, request, **kwargs): # type: ignore # type: (HttpRequest, Any) -> HttpResponse """Send request object according to configuration. - Allowed kwargs are: - - session : will override the driver session and use yours. Should NOT be done unless really required. - - anything else is sent straight to requests. - :param request: The request object to be sent. :type request: ~azure.core.pipeline.transport.HttpRequest :return: An HTTPResponse object. :rtype: ~azure.core.pipeline.transport.HttpResponse + + **Keyword arguments:** + + *session* - will override the driver session and use yours. Should NOT be done unless really required. + Anything else is sent straight to requests. """ self.open() response = None diff --git a/sdk/core/azure-core/azure/core/pipeline_client.py b/sdk/core/azure-core/azure/core/pipeline_client.py index f2d63facb971..a076e8671acc 100644 --- a/sdk/core/azure-core/azure/core/pipeline_client.py +++ b/sdk/core/azure-core/azure/core/pipeline_client.py @@ -48,14 +48,14 @@ class PipelineClient(PipelineClientBase): :return: A pipeline object. :rtype: ~azure.core.pipeline.Pipeline - Keyword arguments: - pipeline - A Pipeline object. If omitted, a Pipeline object is created - and returned. - transport - The HTTP Transport type. If omitted, RequestsTransport is used - for synchronous transport. + **Keyword arguments:** + + *pipeline* - A Pipeline object. If omitted, a Pipeline object is created and returned. + + *transport* - The HTTP Transport type. If omitted, RequestsTransport is used for synchronous transport. Example: - .. literalinclude:: ../../examples/examples_sync.py + .. literalinclude:: ../examples/examples_sync.py :start-after: [START build_pipeline_client] :end-before: [END build_pipeline_client] :language: python diff --git a/sdk/core/azure-core/azure/core/pipeline_client_async.py b/sdk/core/azure-core/azure/core/pipeline_client_async.py index f24145ec5861..82ec943a10f4 100644 --- a/sdk/core/azure-core/azure/core/pipeline_client_async.py +++ b/sdk/core/azure-core/azure/core/pipeline_client_async.py @@ -48,14 +48,14 @@ class AsyncPipelineClient(PipelineClientBase): :return: An async pipeline object. :rtype: ~azure.core.pipeline.AsyncPipeline - Keyword arguments: - pipeline - A Pipeline object. If omitted, an AsyncPipeline is created - and returned. - transport - The HTTP Transport type. If omitted, AioHttpTransport is used - for asynchronous transport. + **Keyword arguments:** + + *pipeline* - A Pipeline object. If omitted, an AsyncPipeline is created and returned. + + *transport* - The HTTP Transport type. If omitted, AioHttpTransport is use for asynchronous transport. Example: - .. literalinclude:: ../../examples/examples_async.py + .. literalinclude:: ../examples/examples_async.py :start-after: [START build_async_pipeline_client] :end-before: [END build_async_pipeline_client] :language: python diff --git a/sdk/core/azure-core/azure/core/polling/async_poller.py b/sdk/core/azure-core/azure/core/polling/async_poller.py index de749f1abf86..17e89acb4fb3 100644 --- a/sdk/core/azure-core/azure/core/polling/async_poller.py +++ b/sdk/core/azure-core/azure/core/polling/async_poller.py @@ -55,15 +55,16 @@ async def run(self): async def async_poller(client, initial_response, deserialization_callback, polling_method): """Async Poller for long running operations. + :param client: A pipeline service client. - :type client: azure.core.pipeline.PipelineClient + :type client: ~azure.core.pipeline.PipelineClient :param initial_response: The initial call response - :type initial_response: azure.core.pipeline.HttpResponse + :type initial_response: ~azure.core.pipeline.HttpResponse :param deserialization_callback: A callback that takes a Response and return a deserialized object. If a subclass of Model is given, this passes "deserialize" as callback. :type deserialization_callback: callable or msrest.serialization.Model :param polling_method: The polling strategy to adopt - :type polling_method: msrest.polling.PollingMethod + :type polling_method: ~msrest.polling.PollingMethod """ # This implicit test avoids bringing in an explicit dependency on Model directly diff --git a/sdk/core/azure-core/azure/core/polling/poller.py b/sdk/core/azure-core/azure/core/polling/poller.py index 91dc9747c430..7c92d09f3fa5 100644 --- a/sdk/core/azure-core/azure/core/polling/poller.py +++ b/sdk/core/azure-core/azure/core/polling/poller.py @@ -82,6 +82,7 @@ def run(self): def status(self): # type: () -> str """Return the current status as a string. + :rtype: str """ return "succeeded" @@ -89,6 +90,7 @@ def status(self): def finished(self): # type: () -> bool """Is this polling finished? + :rtype: bool """ return True @@ -100,15 +102,16 @@ def resource(self): class LROPoller(object): """Poller for long running operations. + :param client: A pipeline service client - :type client: azure.core.pipeline.PipelineClient + :type client: ~azure.core.pipeline.PipelineClient :param initial_response: The initial call response - :type initial_response: azure.core.pipeline.HttpResponse + :type initial_response: ~azure.core.pipeline.HttpResponse :param deserialization_callback: A callback that takes a Response and return a deserialized object. If a subclass of Model is given, this passes "deserialize" as callback. :type deserialization_callback: callable or msrest.serialization.Model :param polling_method: The polling strategy to adopt - :type polling_method: msrest.polling.PollingMethod + :type polling_method: ~msrest.polling.PollingMethod """ def __init__(self, client, initial_response, deserialization_callback, polling_method): @@ -142,7 +145,8 @@ def __init__(self, client, initial_response, deserialization_callback, polling_m def _start(self): """Start the long running operation. On completion, runs any callbacks. - :param callable update_cmd: The API reuqest to check the status of + + :param callable update_cmd: The API request to check the status of the operation. """ try: @@ -162,6 +166,7 @@ def _start(self): def status(self): # type: () -> str """Returns the current status string. + :returns: The current status string :rtype: str """ @@ -171,6 +176,7 @@ def result(self, timeout=None): # type: (Optional[int]) -> Model """Return the result of the long running operation, or the result available after the specified timeout. + :returns: The deserialized resource of the long running operation, if one is available. :raises CloudError: Server problem with the query. @@ -183,6 +189,7 @@ def wait(self, timeout=None): """Wait on the long running operation for a specified length of time. You can check if this call as ended with timeout with the "done()" method. + :param int timeout: Period of time to wait for the long running operation to complete (in seconds). :raises CloudError: Server problem with the query. @@ -199,6 +206,7 @@ def wait(self, timeout=None): def done(self): # type: () -> bool """Check status of the long running operation. + :returns: 'True' if the process has completed, else 'False'. """ return self._thread is None or not self._thread.is_alive() @@ -207,6 +215,7 @@ def add_done_callback(self, func): # type: (Callable) -> None """Add callback function to be run once the long running operation has completed - regardless of the status of the operation. + :param callable func: Callback function that takes at least one argument, a completed LongRunningOperation. """ @@ -219,6 +228,7 @@ def add_done_callback(self, func): def remove_done_callback(self, func): # type: (Callable) -> None """Remove a callback from the long running operation. + :param callable func: The function to be removed from the callbacks. :raises: ValueError if the long running operation has already completed.