Skip to content

Commit f1d725c

Browse files
authored
Update typing (Azure#37294)
* Update typing * update * update * update
1 parent 4868862 commit f1d725c

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

sdk/core/azure-core/CHANGELOG.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.31.0 (Unreleased)
3+
## 1.31.0 (2024-09-12)
44

55
### Features Added
66

@@ -12,10 +12,6 @@
1212
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now first check if a credential has the `get_token_info` method defined. If so, the `get_token_info` method is used to acquire a token. Otherwise, the `get_token` method is used. #36565
1313
- These policies now also check the `refresh_on` attribute when determining if a new token request should be made.
1414

15-
### Breaking Changes
16-
17-
### Bugs Fixed
18-
1915
### Other Changes
2016

2117
- The Azure Core OpenTelemetry tracing plugin will now be the preferred tracing plugin over the OpenCensus plugin. If both plugins are installed and `opentelemetry` is imported, then OpenTelemetry will be used to trace Azure SDK operations. #35050

sdk/core/azure-core/azure/core/credentials_async.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
# ------------------------------------
55
from __future__ import annotations
66
from types import TracebackType
7-
from typing import Any, Optional, AsyncContextManager, Type, Union
7+
from typing import Any, Optional, AsyncContextManager, Type, Union, TYPE_CHECKING
88
from typing_extensions import Protocol, runtime_checkable
9-
from .credentials import (
10-
AccessToken as _AccessToken,
11-
AccessTokenInfo as _AccessTokenInfo,
12-
TokenRequestOptions as _TokenRequestOptions,
13-
)
9+
10+
if TYPE_CHECKING:
11+
from .credentials import AccessToken, AccessTokenInfo, TokenRequestOptions
1412

1513

1614
@runtime_checkable
@@ -24,7 +22,7 @@ async def get_token(
2422
tenant_id: Optional[str] = None,
2523
enable_cae: bool = False,
2624
**kwargs: Any,
27-
) -> _AccessToken:
25+
) -> AccessToken:
2826
"""Request an access token for `scopes`.
2927
3028
:param str scopes: The type of access needed.
@@ -56,7 +54,7 @@ async def __aexit__(
5654
class AsyncSupportsTokenInfo(Protocol, AsyncContextManager["AsyncSupportsTokenInfo"]):
5755
"""Protocol for classes able to provide OAuth access tokens with additional properties."""
5856

59-
async def get_token_info(self, *scopes: str, options: Optional[_TokenRequestOptions] = None) -> _AccessTokenInfo:
57+
async def get_token_info(self, *scopes: str, options: Optional[TokenRequestOptions] = None) -> AccessTokenInfo:
6058
"""Request an access token for `scopes`.
6159
6260
This is an alternative to `get_token` to enable certain scenarios that require additional properties

0 commit comments

Comments
 (0)