From 803e74c3c82dd983347cfbcf3e4d3b1109d213eb Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 26 Jan 2021 17:24:52 -0500 Subject: [PATCH 1/5] updating pylint statements --- .../azure/data/tables/_authentication.py | 2 +- .../azure/data/tables/_base_client.py | 39 ++++++++++--------- .../azure/data/tables/_deserialize.py | 36 +++++++++-------- .../azure/data/tables/_entity.py | 8 ++-- .../azure/data/tables/_error.py | 16 ++++---- .../azure/data/tables/_models.py | 30 +++++++------- .../azure/data/tables/_policies.py | 10 ++--- .../azure/data/tables/_serialize.py | 4 +- .../data/tables/_shared_access_signature.py | 4 +- .../azure/data/tables/_table_batch.py | 16 ++++---- .../azure/data/tables/_table_client.py | 21 +++++----- .../data/tables/_table_service_client.py | 4 +- .../data/tables/aio/_base_client_async.py | 2 +- .../azure/data/tables/aio/_models.py | 2 +- .../azure/data/tables/aio/_policies_async.py | 8 ++-- .../data/tables/aio/_table_batch_async.py | 30 +++++++------- .../data/tables/aio/_table_client_async.py | 12 +++--- .../tables/aio/_table_service_client_async.py | 4 +- 18 files changed, 128 insertions(+), 120 deletions(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py index 5c8b9b4c5e46..f1c493e8be29 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py @@ -49,7 +49,7 @@ class AzureSigningError(ClientAuthenticationError): class SharedKeyCredentialPolicy(SansIOHTTPPolicy): def __init__( self, account_name, account_key, is_emulated=False - ): # pylint: disable=super-init-not-called + ): self.account_name = account_name self.account_key = account_key self.is_emulated = is_emulated diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py index 0e51a1108751..293d52991f82 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py @@ -4,17 +4,8 @@ # license information. # -------------------------------------------------------------------------- -from typing import ( # pylint: disable=unused-import - Union, - Optional, - Any, - Iterable, - Dict, - List, - Type, - Tuple, - TYPE_CHECKING, -) +from typing import TYPE_CHECKING + import logging from uuid import uuid4, UUID from datetime import datetime @@ -65,6 +56,18 @@ from ._models import BatchErrorException from ._sdk_moniker import SDK_MONIKER +if TYPE_CHECKING: + from typing import ( # pylint: disable=ungrouped-imports + Union, + Optional, + Any, + Iterable, + Dict, + List, + Type, + Tuple, + ) + _LOGGER = logging.getLogger(__name__) _SERVICE_PARAMS = { "blob": {"primary": "BlobEndpoint", "secondary": "BlobSecondaryEndpoint"}, @@ -75,7 +78,7 @@ } -class StorageAccountHostsMixin(object): # pylint: disable=too-many-instance-attributes +class StorageAccountHostsMixin(object): def __init__( self, parsed_url, # type: Any @@ -261,7 +264,7 @@ def _configure_credential(self, credential): elif credential is not None: raise TypeError("Unsupported credential: {}".format(credential)) - def _batch_send( # pylint: disable=inconsistent-return-statements + def _batch_send( self, entities, # type: List[TableEntity] *reqs, # type: List[HttpRequest] @@ -292,7 +295,7 @@ def _batch_send( # pylint: disable=inconsistent-return-statements boundary="batch_{}".format(uuid4()), ) - pipeline_response = self._client._client._pipeline.run(request, **kwargs) # pylint:disable=protected-access + pipeline_response = self._client._client._pipeline.run(request, **kwargs) # pylint: disable=protected-access response = pipeline_response.http_response if response.status_code == 403: @@ -328,10 +331,10 @@ def _batch_send( # pylint: disable=inconsistent-return-statements ) return transaction_result - def _parameter_filter_substitution( # pylint: disable = R0201 + def _parameter_filter_substitution( # pylint: disable=no-self-use self, parameters, # type: dict[str,str] - filter # type: str # pylint: disable = W0622 + filter # type: str pylint:disable=redefined-builtin ): """Replace user defined parameter in filter :param parameters: User defined parameters @@ -354,7 +357,7 @@ def _parameter_filter_substitution( # pylint: disable = R0201 filter_strings[index] = "'{}'".format(val) return ' '.join(filter_strings) - return filter # pylint: disable = W0622 + return filter class TransportWrapper(HttpTransport): @@ -378,7 +381,7 @@ def close(self): def __enter__(self): pass - def __exit__(self, *args): # pylint: disable=arguments-differ + def __exit__(self, *args): pass diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py index 65fc548ccfe0..86f4df027911 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py @@ -3,18 +3,8 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -# pylint: disable=unused-argument -from typing import ( # pylint: disable=unused-import - Union, - Optional, - Any, - Iterable, - Dict, - List, - Type, - Tuple, - TYPE_CHECKING, -) + +from typing import TYPE_CHECKING from uuid import UUID import logging import datetime @@ -37,6 +27,18 @@ except ImportError: from urllib2 import quote # type: ignore +if TYPE_CHECKING: + from typing import ( # pylint: disable=ungrouped-imports + Union, + Optional, + Any, + Iterable, + Dict, + List, + Type, + Tuple, +) + def url_quote(url): return quote(url) @@ -81,7 +83,7 @@ def _from_entity_int64(value): zero = datetime.timedelta(0) # same as 00:00 -class Timezone(datetime.tzinfo): # pylint: disable : W0223 +class Timezone(datetime.tzinfo): def utcoffset(self, dt): return zero @@ -183,7 +185,7 @@ def _convert_to_entity(entry_element): mtype = edmtypes.get(name) # Add type for Int32 - if type(value) is int and mtype is None: # pylint:disable=C0123 + if isinstance(value, int) and mtype is None: mtype = EdmType.INT32 if value >= 2 ** 31 or value < (-(2 ** 31)): @@ -191,10 +193,10 @@ def _convert_to_entity(entry_element): # Add type for String try: - if type(value) is unicode and mtype is None: # pylint:disable=C0123 + if isinstance(value, unicode) and mtype is None: mtype = EdmType.STRING except NameError: - if type(value) is str and mtype is None: # pylint:disable=C0123 + if isinstance(value, str) and mtype is None: mtype = EdmType.STRING # no type info, property should parse automatically @@ -216,7 +218,7 @@ def _convert_to_entity(entry_element): etag = "W/\"datetime'" + url_quote(timestamp) + "'\"" entity["etag"] = etag - entity._set_metadata() # pylint: disable = W0212 + entity._set_metadata() # pylint: disable=protected-access return entity diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py index 96bc15f98e6b..8d20acf5fefc 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py @@ -24,14 +24,14 @@ class TableEntity(dict): def _set_metadata(self): if "Timestamp" in self.keys(): - self._metadata = { # pylint:disable=W0201 + self._metadata = { # pylint: disable=attribute-defined-outside-init "etag": self.pop("etag"), "timestamp": self.pop("Timestamp"), } else: - self._metadata = {"etag": self.pop("etag")} # pylint:disable=W0201 + self._metadata = {"etag": self.pop("etag")} # pylint: disable=attribute-defined-outside-init - def metadata(self, **kwargs): # pylint: disable = W0613 + def metadata(self): # type: (...) -> Dict[str,Any] """Resets metadata to be a part of the entity :return Dict of entity metadata @@ -83,7 +83,7 @@ class EntityProperty(object): def __init__( self, value=None, # type: Any - type=None, # type: Union[str,EdmType] # pylint:disable=W0622 + type=None, # type: Union[str,EdmType] pylint: disable=redefined-builtin ): """ Represents an Azure Table. Returned by list_tables. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_error.py b/sdk/tables/azure-data-tables/azure/data/tables/_error.py index 9f2e63751633..3850d2ca52e6 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_error.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_error.py @@ -55,17 +55,17 @@ def _validate_not_none(param_name, param): def _wrap_exception(ex, desired_type): msg = "" - if len(ex.args) > 0: # pylint: disable=C1801 + if len(ex.args) > 0: msg = ex.args[0] - if version_info >= (3,): # pylint: disable=R1705 + if version_info >= (3,): # Automatic chaining in Python 3 means we keep the trace return desired_type(msg) - else: - # There isn't a good solution in 2 for keeping the stack trace - # in general, or that will not result in an error in 3 - # However, we can keep the previous error type and message - # TODO: In the future we will log the trace - return desired_type("{}: {}".format(ex.__class__.__name__, msg)) + + # There isn't a good solution in 2 for keeping the stack trace + # in general, or that will not result in an error in 3 + # However, we can keep the previous error type and message + # TODO: In the future we will log the trace + return desired_type("{}: {}".format(ex.__class__.__name__, msg)) def _validate_table_name(table_name): diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_models.py index 5cb134af43f1..c1662aea3051 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -30,7 +30,9 @@ class TableServiceStats(GenTableServiceStats): :type geo_replication: ~azure.data.tables.models.GeoReplication """ - def __init__(self, geo_replication=None, **kwargs): # pylint:disable=W0231 + def __init__( # pylint: disable=super-init-not-called + self, geo_replication=None, **kwargs + ): self.geo_replication = geo_replication @@ -77,9 +79,9 @@ class AccessPolicy(GenAccessPolicy): :type start: ~datetime.datetime or str """ - def __init__( + def __init__( # pylint: disable=super-init-not-called self, permission=None, expiry=None, start=None, **kwargs - ): # pylint:disable=W0231 + ): self.start = start self.expiry = expiry self.permission = permission @@ -98,7 +100,7 @@ class TableAnalyticsLogging(GeneratedLogging): The retention policy for the metrics. """ - def __init__( # pylint:disable=W0231 + def __init__( # pylint: disable=super-init-not-called self, **kwargs # type: Any ): # type: (...)-> None @@ -118,7 +120,7 @@ def _from_generated(cls, generated): delete=generated.delete, read=generated.read, write=generated.write, - retention_policy=RetentionPolicy._from_generated( # pylint:disable=protected-access + retention_policy=RetentionPolicy._from_generated( # pylint: disable=protected-access generated.retention_policy ) ) @@ -137,7 +139,7 @@ class Metrics(GeneratedMetrics): The retention policy for the metrics. """ - def __init__( # pylint:disable=super-init-not-called + def __init__( # pylint: disable=super-init-not-called self, **kwargs # type: Any ): @@ -166,7 +168,7 @@ def _from_generated(cls, generated): class RetentionPolicy(GeneratedRetentionPolicy): - def __init__( # pylint:disable=W0231 + def __init__( # pylint: disable=super-init-not-called self, enabled=False, # type: bool days=None, # type: int @@ -191,7 +193,7 @@ def __init__( # pylint:disable=W0231 raise ValueError("If policy is enabled, 'days' must be specified.") @classmethod - def _from_generated(cls, generated, **kwargs): # pylint:disable=W0613 + def _from_generated(cls, generated, **kwargs): # pylint:disable=unused-argument # type: (...) -> cls """The retention policy which determines how long the associated data should persist. @@ -239,7 +241,7 @@ class CorsRule(GeneratedCorsRule): headers. Each header can be up to 256 characters. """ - def __init__( # pylint:disable=W0231 + def __init__( # pylint: disable=super-init-not-called self, allowed_origins, # type: list[str] allowed_methods, # type: list[str] @@ -307,7 +309,7 @@ def _get_next_cb(self, continuation_token, **kwargs): def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint:disable=protected-access + TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint: disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list @@ -416,7 +418,7 @@ def from_string( cls, permission, # type: str **kwargs - ): # pylint:disable=W0613 + ): """Create AccountSasPermissions from a string. To specify read, write, delete, etc. permissions you need only to @@ -490,7 +492,7 @@ def __init__(self, table_name, **kwargs): self.date = kwargs.get("date") or kwargs.get("Date") @classmethod - def _from_generated(cls, generated, **kwargs): # pylint:disable=W0613 + def _from_generated(cls, generated, **kwargs): # type: (obj, **Any) -> cls return cls(generated.table_name, **kwargs) @@ -670,7 +672,7 @@ class AccountSasPermissions(object): Valid for the following Object resource type only: queue messages. """ - def __init__(self, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, **kwargs): self.read = kwargs.pop("read", None) self.write = kwargs.pop("write", None) self.delete = kwargs.pop("delete", None) @@ -694,7 +696,7 @@ def __str__(self): return self._str @classmethod - def from_string(cls, permission, **kwargs): # pylint:disable=W0613 + def from_string(cls, permission, **kwargs): """Create AccountSasPermissions from a string. To specify read, write, delete, etc. permissions you need only to diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py index 32be833324ba..63e187c235f7 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py @@ -153,7 +153,7 @@ def on_response(self, request, response): class StorageHosts(SansIOHTTPPolicy): - def __init__(self, hosts=None, **kwargs): # pylint: disable=unused-argument + def __init__(self, hosts=None, **kwargs): # pylint:disable=unused-argument self.hosts = hosts super(StorageHosts, self).__init__() @@ -279,7 +279,7 @@ def on_response(self, request, response): class StorageRequestHook(SansIOHTTPPolicy): - def __init__(self, **kwargs): # pylint: disable=unused-argument + def __init__(self, **kwargs): self._request_callback = kwargs.get("raw_request_hook") super(StorageRequestHook, self).__init__() @@ -293,7 +293,7 @@ def on_request(self, request): class StorageResponseHook(HTTPPolicy): - def __init__(self, **kwargs): # pylint: disable=unused-argument + def __init__(self, **kwargs): self._response_callback = kwargs.get("raw_response_hook") super(StorageResponseHook, self).__init__() @@ -485,7 +485,7 @@ def _set_next_host_location(self, settings, request): # pylint: disable=no-self def configure_retries( self, request ): # pylint: disable=no-self-use, arguments-differ - # type: (...)-> dict + # type: (...) -> Dict[Any, Any] """ :param Any request: :param kwargs: @@ -532,7 +532,7 @@ def sleep(self, settings, transport): # pylint: disable=arguments-differ def increment( self, settings, request, response=None, error=None, **kwargs - ): # pylint:disable=unused-argument, arguments-differ + ): # pylint: disable=unused-argument, arguments-differ # type: (...)->None """Increment the retry counters. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py index b4f2e3e3ec79..ca39b71a1b84 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -# pylint: disable=no-self-use + from uuid import UUID from datetime import datetime from math import isnan @@ -159,7 +159,7 @@ def _to_entity_str(value): return EdmType.STRING, value -def _to_entity_none(value): # pylint:disable=W0613 +def _to_entity_none(value): # pylint: disable=unused-argument return None, None diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py index 4b42b55602d9..efab141cbc3f 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py @@ -176,7 +176,7 @@ def add_base(self, permission, expiry, start, ip, protocol, x_ms_version): def add_resource(self, resource): self._add_query(QueryStringConstants.SIGNED_RESOURCE, resource) - def add_id(self, id): # pylint:disable=W0622 + def add_id(self, id): # pylint: disable=redefined-builtin self._add_query(QueryStringConstants.SIGNED_IDENTIFIER, id) def add_account(self, services, resource_types): @@ -222,7 +222,7 @@ def get_value_to_append(query): + get_value_to_append(QueryStringConstants.SIGNED_VERSION) ) - if service == "blob" or service == "file": # pylint:disable=R1714 + if service in ["blob", "file"]: string_to_sign += ( get_value_to_append(QueryStringConstants.SIGNED_CACHE_CONTROL) + get_value_to_append(QueryStringConstants.SIGNED_CONTENT_DISPOSITION) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py index f548676f5f9c..95a3e1130aa8 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py @@ -145,7 +145,7 @@ def _batch_create_entity( ), "table": self._serialize.url("table", table, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -187,7 +187,7 @@ def _batch_create_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.post( # pylint:disable=protected-access + request = self._client._client.post( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -314,7 +314,7 @@ def _batch_update_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -356,7 +356,7 @@ def _batch_update_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.put( # pylint:disable=protected-access + request = self._client._client.put( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -422,7 +422,7 @@ def _batch_merge_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -464,7 +464,7 @@ def _batch_merge_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.patch( # pylint:disable=protected-access + request = self._client._client.patch( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -577,7 +577,7 @@ def _batch_delete_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -609,7 +609,7 @@ def _batch_delete_entity( ) header_parameters["Accept"] = self._serialize.header("accept", accept, "str") - request = self._client._client.delete( # pylint:disable=protected-access + request = self._client._client.delete( # pylint: disable=protected-access url, query_parameters, header_parameters ) self._requests.append(request) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index f33c60ce3a32..6dcc5c530442 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -5,7 +5,8 @@ # -------------------------------------------------------------------------- import functools -from typing import Optional, Any, Union # pylint: disable = W0611 +from typing import TYPE_CHECKING + try: from urllib.parse import urlparse, unquote @@ -34,6 +35,8 @@ from ._table_batch import TableBatchOperations from ._models import TableEntityPropertiesPaged, UpdateMode, AccessPolicy +if TYPE_CHECKING: + from typing import Optional, Any, Union # pylint: disable=ungrouped-imports class TableClient(TableClientBase): """ :ivar str account_name: Name of the storage account (Cosmos or Azure)""" @@ -458,7 +461,7 @@ def list_entities( @distributed_trace def query_entities( self, - filter, # type: str # pylint: disable = W0622 + filter, # type: str pylint: disable=redefined-builtin **kwargs ): # type: (...) -> ItemPaged[TableEntity] @@ -485,7 +488,7 @@ def query_entities( parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter - ) # pylint: disable = W0622 + ) top = kwargs.pop("results_per_page", None) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -542,7 +545,7 @@ def get_entity( _process_table_error(error) @distributed_trace - def upsert_entity( # pylint:disable=R1710 + def upsert_entity( self, entity, # type: Union[TableEntity, Dict[str,str]] mode=UpdateMode.MERGE, # type: UpdateMode @@ -624,9 +627,9 @@ def create_batch( """ return TableBatchOperations( self._client, - self._client._serialize, # pylint:disable=protected-access - self._client._deserialize, # pylint:disable=protected-access - self._client._config, # pylint:disable=protected-access + self._client._serialize, # pylint: disable=protected-access + self._client._deserialize, # pylint: disable=protected-access + self._client._config, # pylint: disable=protected-access self.table_name, self, **kwargs @@ -653,6 +656,6 @@ def send_batch( :dedent: 8 :caption: Using batches to send multiple requests at once """ - return self._batch_send( # pylint:disable=protected-access - batch._entities, *batch._requests, **kwargs # pylint:disable=protected-access + return self._batch_send( # pylint: disable=protected-access + batch._entities, *batch._requests, **kwargs # pylint: disable=protected-access ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py index 8726111cdce9..cf60ecbedb9e 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py @@ -268,7 +268,7 @@ def delete_table( @distributed_trace def query_tables( self, - filter, # pylint: disable=W0622 + filter, # pylint: disable=redefined-builtin **kwargs # type: Any ): # type: (...) -> ItemPaged[TableItem] @@ -296,7 +296,7 @@ def query_tables( parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter - ) # pylint: disable=W0622 + ) # pylint: disable=redefined-builtin top = kwargs.pop("results_per_page", None) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py index 14e7955916ca..e9594190abb6 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py @@ -150,7 +150,7 @@ async def _batch_send( boundary="batch_{}".format(uuid4()), ) - pipeline_response = await self._client._client._pipeline.run(request, **kwargs) # pylint:disable=protected-access + pipeline_response = await self._client._client._pipeline.run(request, **kwargs) # pylint: disable=protected-access response = pipeline_response.http_response if response.status_code == 403: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py index 071a1c7a4b48..d300978542c5 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -60,7 +60,7 @@ async def _get_next_cb(self, continuation_token, **kwargs): async def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint:disable=protected-access + TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint: disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py index 7ac8b7a7f283..c932a4102737 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py @@ -38,7 +38,7 @@ async def retry_hook(settings, **kwargs): class AsyncStorageResponseHook(AsyncHTTPPolicy): - def __init__(self, **kwargs): # pylint: disable=unused-argument + def __init__(self, **kwargs): self._response_callback = kwargs.get("raw_response_hook") super(AsyncStorageResponseHook, self).__init__() @@ -152,15 +152,15 @@ def get_backoff_time(self, settings): random_range_end = backoff + self.random_jitter_range return random_generator.uniform(random_range_start, random_range_end) - async def sleep( + async def sleep( # pylint: disable=arguments-differ self, settings, transport - ): # pylint: disable=W0236, arguments-differ + ): backoff = self.get_backoff_time(settings) if not backoff or backoff < 0: return await transport.sleep(backoff) - async def send(self, request): # pylint: disable =W0236 + async def send(self, request): retries_remaining = True response = None retry_settings = self.configure_retries(request) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py index e197e9896677..9135b6b05792 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py @@ -3,25 +3,23 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Dict, Any, Optional, Union +from typing import Dict, Any, Optional, Union, TYPE_CHECKING import msrest from azure.core.pipeline import PipelineResponse -from azure.core.exceptions import ( # pylint:disable=unused-import - ClientAuthenticationError, - ResourceNotFoundError, - ResourceExistsError, -) + from .._models import UpdateMode from .._serialize import ( _get_match_headers, _add_entity_properties, -) # pylint:disable=unused-import -from .._generated.models import QueryOptions # pylint:disable=unused-import +) + from .._generated.aio._azure_table import AzureTable from .._generated.aio._configuration import AzureTableConfiguration +if TYPE_CHECKING: + from .._generated.models import QueryOptions class TableBatchOperations(object): """ @@ -138,7 +136,7 @@ def _batch_create_entity( ), "table": self._serialize.url("table", table, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -180,7 +178,7 @@ def _batch_create_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.post( # pylint:disable=protected-access + request = self._client._client.post( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -307,7 +305,7 @@ def _batch_update_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -349,7 +347,7 @@ def _batch_update_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.put( # pylint:disable=protected-access + request = self._client._client.put( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -415,7 +413,7 @@ def _batch_merge_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -457,7 +455,7 @@ def _batch_merge_entity( else: body_content = None body_content_kwargs["content"] = body_content - request = self._client._client.patch( # pylint:disable=protected-access + request = self._client._client.patch( # pylint: disable=protected-access url, query_parameters, header_parameters, **body_content_kwargs ) self._requests.append(request) @@ -571,7 +569,7 @@ def _batch_delete_entity( "partitionKey": self._serialize.url("partition_key", partition_key, "str"), "rowKey": self._serialize.url("row_key", row_key, "str"), } - url = self._client._client.format_url( # pylint:disable=protected-access + url = self._client._client.format_url( # pylint: disable=protected-access url, **path_format_arguments ) @@ -603,7 +601,7 @@ def _batch_delete_entity( ) header_parameters["Accept"] = self._serialize.header("accept", accept, "str") - request = self._client._client.delete( # pylint:disable=protected-access + request = self._client._client.delete( # pylint: disable=protected-access url, query_parameters, header_parameters ) self._requests.append(request) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 1d75e5cdf274..cc975ba99395 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -476,7 +476,7 @@ def list_entities( @distributed_trace def query_entities( self, - filter, # type: str # pylint: disable = W0622 + filter, # type: str # pylint: disable = redefined-builtin **kwargs ): # type: (...) -> AsyncItemPaged[TableEntity] @@ -503,7 +503,7 @@ def query_entities( parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter - ) # pylint: disable = W0622 + ) # pylint: disable = redefined-builtin top = kwargs.pop("results_per_page", None) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -640,9 +640,9 @@ def create_batch(self, **kwargs: Dict[str, Any]) -> TableBatchOperations: """ return TableBatchOperations( self._client, - self._client._serialize, # pylint:disable=protected-access - self._client._deserialize, # pylint:disable=protected-access - self._client._config, # pylint:disable=protected-access + self._client._serialize, # pylint: disable=protected-access + self._client._deserialize, # pylint: disable=protected-access + self._client._config, # pylint: disable=protected-access self.table_name, self, **kwargs @@ -668,5 +668,5 @@ async def send_batch( :caption: Using batches to send multiple requests at once """ return await self._batch_send( - batch._entities, *batch._requests, **kwargs # pylint:disable=protected-access + batch._entities, *batch._requests, **kwargs # pylint: disable=protected-access ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py index 0505bb6d9255..3adebc7f14f9 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py @@ -330,7 +330,7 @@ def list_tables( @distributed_trace def query_tables( self, - filter, # type: str pylint: disable=W0622 + filter, # type: str pylint: disable=redefined-builtin **kwargs # type: Any ): # type: (...) -> AsyncItemPaged[TableItem] @@ -358,7 +358,7 @@ def query_tables( parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter - ) # pylint: disable=W0622 + ) # pylint: disable=redefined-builtin user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): user_select = ", ".join(user_select) From 4b8d0ed4d2e8efb063faaa11abda46353a205b9f Mon Sep 17 00:00:00 2001 From: Sean Kane <68240067+seankane-msft@users.noreply.github.com> Date: Wed, 27 Jan 2021 10:37:46 -0500 Subject: [PATCH 2/5] Update sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com> --- .../azure/data/tables/aio/_table_client_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index cc975ba99395..0f0597191cb3 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -476,7 +476,7 @@ def list_entities( @distributed_trace def query_entities( self, - filter, # type: str # pylint: disable = redefined-builtin + filter, # type: str # pylint: disable=redefined-builtin **kwargs ): # type: (...) -> AsyncItemPaged[TableEntity] From 661f6e8af87a9c8c81f8c1fb2c8efbb95c7dabe6 Mon Sep 17 00:00:00 2001 From: Sean Kane <68240067+seankane-msft@users.noreply.github.com> Date: Wed, 27 Jan 2021 10:37:58 -0500 Subject: [PATCH 3/5] Update sdk/tables/azure-data-tables/azure/data/tables/_policies.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com> --- sdk/tables/azure-data-tables/azure/data/tables/_policies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py index 63e187c235f7..17cfa2776052 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py @@ -153,7 +153,7 @@ def on_response(self, request, response): class StorageHosts(SansIOHTTPPolicy): - def __init__(self, hosts=None, **kwargs): # pylint:disable=unused-argument + def __init__(self, hosts=None, **kwargs): # pylint: disable=unused-argument self.hosts = hosts super(StorageHosts, self).__init__() From 93f1ef8dfdb67dfac8d2c14c60d3b0bbdd3bd46e Mon Sep 17 00:00:00 2001 From: Sean Kane <68240067+seankane-msft@users.noreply.github.com> Date: Wed, 27 Jan 2021 10:38:05 -0500 Subject: [PATCH 4/5] Update sdk/tables/azure-data-tables/azure/data/tables/_models.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com> --- sdk/tables/azure-data-tables/azure/data/tables/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_models.py index c1662aea3051..eac5e496c415 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -193,7 +193,7 @@ def __init__( # pylint: disable=super-init-not-called raise ValueError("If policy is enabled, 'days' must be specified.") @classmethod - def _from_generated(cls, generated, **kwargs): # pylint:disable=unused-argument + def _from_generated(cls, generated, **kwargs): # pylint: disable=unused-argument # type: (...) -> cls """The retention policy which determines how long the associated data should persist. From 6d4c1c4bfd5818a70f1e87194f50452333355806 Mon Sep 17 00:00:00 2001 From: Sean Kane <68240067+seankane-msft@users.noreply.github.com> Date: Wed, 27 Jan 2021 10:38:12 -0500 Subject: [PATCH 5/5] Update sdk/tables/azure-data-tables/azure/data/tables/_base_client.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com> --- sdk/tables/azure-data-tables/azure/data/tables/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py index 293d52991f82..e497dad2fe85 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py @@ -334,7 +334,7 @@ def _batch_send( def _parameter_filter_substitution( # pylint: disable=no-self-use self, parameters, # type: dict[str,str] - filter # type: str pylint:disable=redefined-builtin + filter # type: str pylint: disable=redefined-builtin ): """Replace user defined parameter in filter :param parameters: User defined parameters