Skip to content

Commit

Permalink
[Tables] updating docstring (#19547)
Browse files Browse the repository at this point in the history
  • Loading branch information
seankane-msft authored Jun 28, 2021
1 parent d57ed34 commit 88a742c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license information.
# --------------------------------------------------------------------------

from typing import Dict, Optional, Any, List, Mapping, Union
from typing import Dict, Optional, Any, List, Mapping, Union, TYPE_CHECKING
from uuid import uuid4
try:
from urllib.parse import parse_qs, quote, urlparse
Expand Down Expand Up @@ -50,6 +50,8 @@
)
from ._sdk_moniker import SDK_MONIKER

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential

_SUPPORTED_API_VERSIONS = ["2019-02-02", "2019-07-07"]

Expand All @@ -71,7 +73,7 @@ class AccountHostsMixin(object): # pylint: disable=too-many-instance-attributes
def __init__(
self,
account_url, # type: Any
credential=None, # type: Optional[Union[AzureNamedKeyCredential, AzureSasCredential]]
credential=None, # type: Optional[Union[AzureNamedKeyCredential, AzureSasCredential, "TokenCredential"]]
**kwargs # type: Any
):
# type: (...) -> None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license information.
# --------------------------------------------------------------------------

from typing import Any, List, Mapping, Optional, Union
from typing import Any, List, Mapping, Optional, Union, TYPE_CHECKING
from uuid import uuid4

from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential
Expand Down Expand Up @@ -35,17 +35,20 @@
from .._sdk_moniker import SDK_MONIKER
from ._policies_async import AsyncTablesRetryPolicy

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential


class AsyncTablesBaseClient(AccountHostsMixin):

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self,
endpoint: str,
*,
credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential]] = None,
credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, "AsyncTokenCredential"]] = None,
**kwargs: Any
) -> None:
super(AsyncTablesBaseClient, self).__init__(endpoint, credential=credential, **kwargs)
super(AsyncTablesBaseClient, self).__init__(endpoint, credential=credential, **kwargs) # type: ignore
self._client = AzureTable(
self.url,
policies=kwargs.pop('policies', self._policies),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license information.
# --------------------------------------------------------------------------
import functools
from typing import List, Union, Any, Optional, Mapping, Iterable, Dict, overload, cast
from typing import List, Union, Any, Optional, Mapping, Iterable, Dict, overload, cast, TYPE_CHECKING
try:
from urllib.parse import urlparse, unquote
except ImportError:
Expand Down Expand Up @@ -38,6 +38,9 @@
from ._models import TableEntityPropertiesPaged
from ._table_batch_async import TableBatchOperations

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential


class TableClient(AsyncTablesBaseClient):
"""A client to interact with a specific Table in an Azure Tables account.
Expand All @@ -52,7 +55,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
endpoint: str,
table_name: str,
*,
credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential]] = None,
credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, "AsyncTokenCredential"]] = None,
**kwargs
) -> None:
"""Create TableClient from a Credential.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def get_table_client(self, table_name: str, **kwargs) -> TableClient:
return TableClient(
self.url,
table_name=table_name,
credential=self.credential,
credential=self.credential, # type: ignore
api_version=self.api_version,
pipeline=pipeline,
location_mode=self._location_mode,
Expand Down

0 comments on commit 88a742c

Please sign in to comment.