Skip to content

Commit bd605d9

Browse files
authored
core doc fixes (Azure#38878)
* core doc fixes * update * update * update * update
1 parent 03d979a commit bd605d9

19 files changed

+38
-42
lines changed

sdk/core/azure-core/azure/core/credentials.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class AzureKeyCredential:
147147
It provides the ability to update the key without creating a new client.
148148
149149
:param str key: The key used to authenticate to an Azure service
150-
:raises: TypeError
150+
:raises TypeError: If the key is not a string.
151151
"""
152152

153153
def __init__(self, key: str) -> None:
@@ -185,7 +185,7 @@ class AzureSasCredential:
185185
It provides the ability to update the shared access signature without creating a new client.
186186
187187
:param str signature: The shared access signature used to authenticate to an Azure service
188-
:raises: TypeError
188+
:raises TypeError: If the signature is not a string.
189189
"""
190190

191191
def __init__(self, signature: str) -> None:
@@ -209,7 +209,8 @@ def update(self, signature: str) -> None:
209209
to update long-lived clients.
210210
211211
:param str signature: The shared access signature used to authenticate to an Azure service
212-
:raises: ValueError or TypeError
212+
:raises ValueError: If the signature is None or empty.
213+
:raises TypeError: If the signature is not a string.
213214
"""
214215
if not signature:
215216
raise ValueError("The signature used for updating can not be None or empty")
@@ -224,7 +225,7 @@ class AzureNamedKeyCredential:
224225
225226
:param str name: The name of the credential used to authenticate to an Azure service.
226227
:param str key: The key used to authenticate to an Azure service.
227-
:raises: TypeError
228+
:raises TypeError: If the name or key is not a string.
228229
"""
229230

230231
def __init__(self, name: str, key: str) -> None:

sdk/core/azure-core/azure/core/pipeline/_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def await_result(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T:
4444
:type args: list
4545
:rtype: any
4646
:return: The result of the function
47-
:raises: TypeError
47+
:raises TypeError: If the function returns an awaitable object.
4848
"""
4949
result = func(*args, **kwargs)
5050
if hasattr(result, "__await__"):

sdk/core/azure-core/azure/core/pipeline/policies/_authentication.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class BearerTokenCredentialPolicy(_BearerTokenCredentialPolicyBase, HTTPPolicy[H
116116
:param str scopes: Lets you specify the type of access needed.
117117
:keyword bool enable_cae: Indicates whether to enable Continuous Access Evaluation (CAE) on all requested
118118
tokens. Defaults to False.
119-
:raises: :class:`~azure.core.exceptions.ServiceRequestError`
119+
:raises ~azure.core.exceptions.ServiceRequestError: If the request fails.
120120
"""
121121

122122
def on_request(self, request: PipelineRequest[HTTPRequestType]) -> None:
@@ -245,7 +245,8 @@ class AzureKeyCredentialPolicy(SansIOHTTPPolicy[HTTPRequestType, HTTPResponseTyp
245245
:type credential: ~azure.core.credentials.AzureKeyCredential
246246
:param str name: The name of the key header used for the credential.
247247
:keyword str prefix: The name of the prefix for the header value if any.
248-
:raises: ValueError or TypeError
248+
:raises ValueError: if name is None or empty.
249+
:raises TypeError: if name is not a string or if credential is not an instance of AzureKeyCredential.
249250
"""
250251

251252
def __init__( # pylint: disable=unused-argument
@@ -276,7 +277,7 @@ class AzureSasCredentialPolicy(SansIOHTTPPolicy[HTTPRequestType, HTTPResponseTyp
276277
277278
:param credential: The credential used to authenticate requests.
278279
:type credential: ~azure.core.credentials.AzureSasCredential
279-
:raises: ValueError or TypeError
280+
:raises ValueError: if credential is None.
280281
"""
281282

282283
def __init__(

sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def on_request(self, request: PipelineRequest[HTTPRequestType]) -> None:
6161
6262
:param request: The pipeline request object to be modified.
6363
:type request: ~azure.core.pipeline.PipelineRequest
64-
:raises: :class:`~azure.core.exceptions.ServiceRequestError`
64+
:raises ~azure.core.exceptions.ServiceRequestError: If the request fails.
6565
"""
6666
_BearerTokenCredentialPolicyBase._enforce_https(request) # pylint:disable=protected-access
6767

sdk/core/azure-core/azure/core/pipeline/policies/_redirect.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
def domain_changed(original_domain: Optional[str], url: str) -> bool:
6060
"""Checks if the domain has changed.
61+
6162
:param str original_domain: The original domain.
6263
:param str url: The new url.
6364
:rtype: bool
@@ -193,9 +194,9 @@ def send(self, request: PipelineRequest[HTTPRequestType]) -> PipelineResponse[HT
193194
194195
:param request: The PipelineRequest object
195196
:type request: ~azure.core.pipeline.PipelineRequest
196-
:return: Returns the PipelineResponse or raises error if maximum redirects exceeded.
197+
:return: The PipelineResponse.
197198
:rtype: ~azure.core.pipeline.PipelineResponse
198-
:raises: ~azure.core.exceptions.TooManyRedirectsError if maximum redirects exceeded.
199+
:raises ~azure.core.exceptions.TooManyRedirectsError: if maximum redirects exceeded.
199200
"""
200201
retryable: bool = True
201202
redirect_settings = self.configure_redirects(request.context.options)

sdk/core/azure-core/azure/core/pipeline/policies/_redirect_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ async def send(
6565
6666
:param request: The PipelineRequest object
6767
:type request: ~azure.core.pipeline.PipelineRequest
68-
:return: Returns the PipelineResponse or raises error if maximum redirects exceeded.
68+
:return: the PipelineResponse.
6969
:rtype: ~azure.core.pipeline.PipelineResponse
70-
:raises: ~azure.core.exceptions.TooManyRedirectsError if maximum redirects exceeded.
70+
:raises ~azure.core.exceptions.TooManyRedirectsError: if maximum redirects exceeded.
7171
"""
7272
redirects_remaining = True
7373
redirect_settings = self.configure_redirects(request.context.options)

sdk/core/azure-core/azure/core/pipeline/policies/_retry.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -422,28 +422,21 @@ class RetryPolicy(RetryPolicyBase, HTTPPolicy[HTTPRequestType, HTTPResponseType]
422422
423423
:keyword int retry_total: Total number of retries to allow. Takes precedence over other counts.
424424
Default value is 10.
425-
426425
:keyword int retry_connect: How many connection-related errors to retry on.
427426
These are errors raised before the request is sent to the remote server,
428427
which we assume has not triggered the server to process the request. Default value is 3.
429-
430428
:keyword int retry_read: How many times to retry on read errors.
431429
These errors are raised after the request was sent to the server, so the
432430
request may have side-effects. Default value is 3.
433-
434431
:keyword int retry_status: How many times to retry on bad status codes. Default value is 3.
435-
436432
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
437433
(most errors are resolved immediately by a second try without a delay).
438434
In fixed mode, retry policy will always sleep for {backoff factor}.
439435
In 'exponential' mode, retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))`
440436
seconds. If the backoff_factor is 0.1, then the retry will sleep
441437
for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8.
442-
443438
:keyword int retry_backoff_max: The maximum back off time. Default value is 120 seconds (2 minutes).
444-
445439
:keyword RetryMode retry_mode: Fixed or exponential delay between attemps, default is exponential.
446-
447440
:keyword int timeout: Timeout setting for the operation in seconds, default is 604800s (7 days).
448441
449442
.. admonition:: Example:
@@ -522,10 +515,10 @@ def send(self, request: PipelineRequest[HTTPRequestType]) -> PipelineResponse[HT
522515
523516
:param request: The PipelineRequest object
524517
:type request: ~azure.core.pipeline.PipelineRequest
525-
:return: Returns the PipelineResponse or raises error if maximum retries exceeded.
518+
:return: The PipelineResponse.
526519
:rtype: ~azure.core.pipeline.PipelineResponse
527-
:raises: ~azure.core.exceptions.AzureError if maximum retries exceeded.
528-
:raises: ~azure.core.exceptions.ClientAuthenticationError if authentication
520+
:raises ~azure.core.exceptions.AzureError: if maximum retries exceeded.
521+
:raises ~azure.core.exceptions.ClientAuthenticationError: if authentication fails.
529522
"""
530523
retry_active = True
531524
response = None

sdk/core/azure-core/azure/core/pipeline/policies/_retry_async.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,18 @@ class AsyncRetryPolicy(RetryPolicyBase, AsyncHTTPPolicy[HTTPRequestType, AsyncHT
5757
5858
:keyword int retry_total: Total number of retries to allow. Takes precedence over other counts.
5959
Default value is 10.
60-
6160
:keyword int retry_connect: How many connection-related errors to retry on.
6261
These are errors raised before the request is sent to the remote server,
6362
which we assume has not triggered the server to process the request. Default value is 3.
64-
6563
:keyword int retry_read: How many times to retry on read errors.
6664
These errors are raised after the request was sent to the server, so the
6765
request may have side-effects. Default value is 3.
68-
6966
:keyword int retry_status: How many times to retry on bad status codes. Default value is 3.
70-
7167
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
7268
(most errors are resolved immediately by a second try without a delay).
7369
Retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))`
7470
seconds. If the backoff_factor is 0.1, then the retry will sleep
7571
for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8.
76-
7772
:keyword int retry_backoff_max: The maximum back off time. Default value is 120 seconds (2 minutes).
7873
7974
.. admonition:: Example:
@@ -154,10 +149,10 @@ async def send(
154149
155150
:param request: The PipelineRequest object
156151
:type request: ~azure.core.pipeline.PipelineRequest
157-
:return: Returns the PipelineResponse or raises error if maximum retries exceeded.
152+
:return: The PipelineResponse.
158153
:rtype: ~azure.core.pipeline.PipelineResponse
159-
:raise: ~azure.core.exceptions.AzureError if maximum retries exceeded.
160-
:raise: ~azure.core.exceptions.ClientAuthenticationError if authentication fails
154+
:raise ~azure.core.exceptions.AzureError: if maximum retries exceeded.
155+
:raise ~azure.core.exceptions.ClientAuthenticationError: if authentication fails
161156
"""
162157
retry_active = True
163158
response = None

sdk/core/azure-core/azure/core/pipeline/policies/_universal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def user_agent(self) -> str:
234234

235235
def add_user_agent(self, value: str) -> None:
236236
"""Add value to current user agent with a space.
237+
237238
:param str value: value to add to user agent.
238239
"""
239240
self._user_agent = "{} {}".format(self._user_agent, value)
@@ -441,6 +442,7 @@ def on_request( # pylint: disable=too-many-return-statements
441442
self, request: PipelineRequest[HTTPRequestType]
442443
) -> None:
443444
"""Logs HTTP method, url and headers.
445+
444446
:param request: The PipelineRequest object.
445447
:type request: ~azure.core.pipeline.PipelineRequest
446448
"""

sdk/core/azure-core/azure/core/pipeline/transport/_aiohttp.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class AioHttpTransport(AsyncHttpTransport):
8585
:keyword session: The client session.
8686
:paramtype session: ~aiohttp.ClientSession
8787
:keyword bool session_owner: Session owner. Defaults True.
88-
8988
:keyword bool use_env_settings: Uses proxy settings from environment. Defaults to True.
9089
9190
.. admonition:: Example:

0 commit comments

Comments
 (0)