diff --git a/eng/ci_tools.txt b/eng/ci_tools.txt index a281981f6a2c..dac85fba9d07 100644 --- a/eng/ci_tools.txt +++ b/eng/ci_tools.txt @@ -1,36 +1,35 @@ # requirements leveraged by ci tools setuptools==44.1.0; python_version == '2.7' -setuptools==45.1.0; python_version >= '3.5' +setuptools==46.4.0; python_version >= '3.5' virtualenv==20.0.23 wheel==0.34.2 -Jinja2==2.11.1 +Jinja2==2.11.2 packaging==20.4 -tox==3.14.6 +tox==3.15.0 tox-monorepo==0.1.2 -twine==1.15.0 +twine==1.15.0; python_version == '2.7' or python_version == '3.5' +twine==3.1.1; python_version >= '3.6' pathlib2==2.3.5 readme-renderer[md]==25.0 doc-warden==0.7.1 +# we pin coverage to 4.5.4 because there is an bug with `pytest-cov`. the generated coverage files cannot be `coverage combine`ed coverage==4.5.4 -codecov==2.0.22 -beautifulsoup4==4.8.2 +codecov==2.1.0 +beautifulsoup4==4.9.1 pkginfo==1.5.0.1 # locking packages defined as deps from azure-sdk-tools or azure-devtools pytoml==0.1.21 pyOpenSSL==19.1.0 json-delta==2.0 -ConfigArgParse==1.1 +ConfigArgParse==1.2.3 six==1.14.0 vcrpy==3.0.0 pyyaml==5.3.1 -pytest==5.4.1; python_version >= '3.5' +pytest==5.4.2; python_version >= '3.5' pytest==4.6.9; python_version == '2.7' pytest-cov==2.8.1 # local dev packages ./tools/azure-devtools ./tools/azure-sdk-tools - - - diff --git a/eng/test_tools.txt b/eng/test_tools.txt index a21469ca3756..566e3d544c0c 100644 --- a/eng/test_tools.txt +++ b/eng/test_tools.txt @@ -1,10 +1,11 @@ # requirements leveraged by ci for testing -pytest==5.4.1; python_version >= '3.5' pytest==4.6.9; python_version == '2.7' -pytest-asyncio==0.10.0; python_version >= '3.5' +pytest==5.4.2; python_version >= '3.5' +pytest-asyncio==0.12.0; python_version >= '3.5' pytest-cov==2.8.1 pytest-custom-exit-code==0.3.0 -pytest-xdist==1.31.0 +pytest-xdist==1.32.0 +# we pin coverage to 4.5.4 because there is an bug with `pytest-cov`. the generated coverage files cannot be `coverage combine`ed coverage==4.5.4 # locking packages defined as deps from azure-sdk-tools or azure-devtools @@ -12,18 +13,17 @@ pytoml==0.1.21 readme-renderer[md]==25.0 pyOpenSSL==19.1.0 json-delta==2.0 -ConfigArgParse==1.1 +ConfigArgParse==1.2.3 six==1.14.0 vcrpy==3.0.0 pyyaml==5.3.1 packaging==20.4 wheel==0.34.2 -Jinja2==2.11.1 +Jinja2==2.11.2 # Locking pylint and required packages -pylint==2.3.1; python_version >= '3.4' pylint==1.8.4; python_version < '3.4' -astroid==2.3.3; python_version >= '3.4' +pylint==2.5.2; python_version >= '3.4' ../../../tools/azure-devtools ../../../tools/azure-sdk-tools diff --git a/pylintrc b/pylintrc index 399344e8ea99..d71525ef3f83 100644 --- a/pylintrc +++ b/pylintrc @@ -3,7 +3,7 @@ ignore-patterns=test_*,conftest,setup reports=no # PYLINT DIRECTORY BLACKLIST. -ignore=_generated,samples,examples,test,tests,doc,.tox +ignore=_vendor,_generated,samples,examples,test,tests,doc,.tox init-hook='import sys; sys.path.insert(0, os.path.abspath(os.getcwd().rsplit("azure-sdk-for-python", 1)[0] + "azure-sdk-for-python/scripts/pylint_custom_plugin"))' load-plugins=pylint_guidelines_checker @@ -14,7 +14,7 @@ load-plugins=pylint_guidelines_checker # cyclic-import: because of https://github.com/PyCQA/pylint/issues/850 # too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods. # Let's black deal with bad-continuation -disable=useless-object-inheritance,missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,bad-continuation,check-docstrings +disable=useless-object-inheritance,missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,bad-continuation,check-docstrings,import-outside-toplevel [FORMAT] max-line-length=120 diff --git a/scripts/pylint_custom_plugin/README.md b/scripts/pylint_custom_plugin/README.md index adb1e0e4a694..963a3d098916 100644 --- a/scripts/pylint_custom_plugin/README.md +++ b/scripts/pylint_custom_plugin/README.md @@ -3,7 +3,7 @@ In order to lint for the guidelines, you must make sure you are using the pylintrc file. It is recommended you run pylint at the library package level to be consistent with how the CI runs pylint. -Check that you are running pylint version >=2.31 and astroid version >=2.25. +Check that you are running pylint version >=2.5.2 and astroid version >=2.4.1. **How to run pylint locally using the pylintrc:** diff --git a/scripts/pylint_custom_plugin/pylint_guidelines_checker.py b/scripts/pylint_custom_plugin/pylint_guidelines_checker.py index cd1bd4920a7d..e62a68296254 100644 --- a/scripts/pylint_custom_plugin/pylint_guidelines_checker.py +++ b/scripts/pylint_custom_plugin/pylint_guidelines_checker.py @@ -72,11 +72,11 @@ def visit_functiondef(self, node): arg_names = [argument.name for argument in node.args.args] if "credential" not in arg_names: self.add_message( - msg_id="missing-client-constructor-parameter-credential", node=node, confidence=None + msgid="missing-client-constructor-parameter-credential", node=node, confidence=None ) if not node.args.kwarg: self.add_message( - msg_id="missing-client-constructor-parameter-kwargs", node=node, confidence=None + msgid="missing-client-constructor-parameter-kwargs", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if constructor has correct parameters.") @@ -128,7 +128,7 @@ def visit_functiondef(self, node): if line.find("Policy") != -1: if line.find("**kwargs") == -1: self.add_message( - msg_id="config-missing-kwargs-in-policy", + msgid="config-missing-kwargs-in-policy", node=list(node.get_children())[idx], confidence=None ) @@ -188,7 +188,7 @@ def visit_classdef(self, node): prefix = method.name.split("_")[0] if prefix.lower() not in approved_prefixes: self.add_message( - msg_id="unapproved-client-method-name-prefix", + msgid="unapproved-client-method-name-prefix", node=client_methods[idx], confidence=None ) @@ -242,7 +242,7 @@ def visit_functiondef(self, node): positional_args = len(node.args.args) - len(node.args.defaults) if positional_args > 6: self.add_message( - msg_id="client-method-has-more-than-5-positional-arguments", node=node, confidence=None + msgid="client-method-has-more-than-5-positional-arguments", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if kwargs is used for multiple parameters.") @@ -308,7 +308,7 @@ def visit_functiondef(self, node): # Note that if the method returns nothing it will be of type ast.Const.NoneType if (type_annotations == [] and len(node.args.args) > 1) or node.returns is None: self.add_message( - msg_id="client-method-missing-type-annotations", node=node, confidence=None + msgid="client-method-missing-type-annotations", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client methods missing type annotations.") @@ -377,7 +377,7 @@ def visit_functiondef(self, node): if node.args.kwarg and "azure.core.tracing.decorator.distributed_trace" not in node.decoratornames() \ and "builtins.classmethod" not in node.decoratornames(): self.add_message( - msg_id="client-method-missing-tracing-decorator", node=node, confidence=None + msgid="client-method-missing-tracing-decorator", node=node, confidence=None ) except AttributeError: pass @@ -398,7 +398,7 @@ def visit_asyncfunctiondef(self, node): if node.args.kwarg and "azure.core.tracing.decorator_async.distributed_trace_async" not in \ node.decoratornames() and "builtins.classmethod" not in node.decoratornames(): self.add_message( - msg_id="client-method-missing-tracing-decorator-async", node=node, confidence=None + msgid="client-method-missing-tracing-decorator-async", node=node, confidence=None ) except AttributeError: pass @@ -446,7 +446,7 @@ def visit_functiondef(self, node): if not node.name.startswith("_") and node.decorators is not None: if "builtins.staticmethod" in node.decoratornames(): self.add_message( - msg_id="client-method-should-not-use-static-method", node=node, confidence=None + msgid="client-method-should-not-use-static-method", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client methods do not use staticmethods.") @@ -495,7 +495,7 @@ def visit_module(self, node): header = node.stream().read(200).lower() if header.find(b'copyright') == -1: self.add_message( - msg_id="file-needs-copyright-header", node=node, confidence=None + msgid="file-needs-copyright-header", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if file is missing a copyright header.") @@ -544,7 +544,7 @@ def visit_classdef(self, node): if "_" in node.name or node.name.endswith("client") or node.name[0] != node.name[0].upper(): if not node.name.startswith("_") and node.name not in self.ignore_clients: self.add_message( - msg_id="client-incorrect-naming-convention", node=node, confidence=None + msgid="client-incorrect-naming-convention", node=node, confidence=None ) # check for correct naming convention in any class constants @@ -554,7 +554,7 @@ def visit_classdef(self, node): const_name = node.body[idx].targets[0].name if const_name != const_name.upper(): self.add_message( - msg_id="client-incorrect-naming-convention", node=node.body[idx], confidence=None + msgid="client-incorrect-naming-convention", node=node.body[idx], confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses correct naming conventions.") @@ -565,7 +565,7 @@ def visit_classdef(self, node): for func in node.body: if func.name != func.name.lower() and not func.name.startswith("_"): self.add_message( - msg_id="client-incorrect-naming-convention", node=func, confidence=None + msgid="client-incorrect-naming-convention", node=func, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses correct naming conventions.") @@ -619,7 +619,7 @@ def visit_functiondef(self, node): "azure.core.tracing.decorator_async.distributed_trace_async" in node.decoratornames()): if not node.args.kwarg: self.add_message( - msg_id="client-method-missing-kwargs", node=node, confidence=None + msgid="client-method-missing-kwargs", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses kwargs parameter in method.") @@ -669,7 +669,7 @@ def visit_functiondef(self, node): if node.parent.name.endswith("Client") and node.is_method() and node.parent.name not in self.ignore_clients: if node.name.startswith("__") and node.name not in self.acceptable_names: self.add_message( - msg_id="client-method-name-no-double-underscore", node=node, confidence=None + msgid="client-method-name-no-double-underscore", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client method name does not use double underscore prefix.") @@ -720,7 +720,7 @@ def visit_classdef(self, node): if node.name.endswith("Client") and node.name not in self.ignore_clients: if node.doc.find("code-block") != -1: self.add_message( - msg_id="client-docstring-use-literal-include", node=node, confidence=None + msgid="client-docstring-use-literal-include", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses literalinclude over code-block.") @@ -738,7 +738,7 @@ def visit_functiondef(self, node): if node.parent.name.endswith("Client") and node.parent.name not in self.ignore_clients and node.is_method(): if node.doc.find("code-block") != -1: self.add_message( - msg_id="client-docstring-use-literal-include", node=node, confidence=None + msgid="client-docstring-use-literal-include", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses literalinclude over code-block.") @@ -789,7 +789,7 @@ def visit_classdef(self, node): if node.name.endswith("Client") and "async" in node.name.lower() and "base" not in node.name.lower(): if not node.name.startswith("_") and node.name not in self.ignore_clients: self.add_message( - msg_id="async-client-bad-name", node=node, confidence=None + msgid="async-client-bad-name", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if async client uses correct naming.") @@ -840,7 +840,7 @@ def visit_call(self, node): # node.args represent positional arguments if len(node.args) > 2 and node.func.attrname != "format": self.add_message( - msg_id="specify-parameter-names-in-call", node=node, confidence=None + msgid="specify-parameter-names-in-call", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client methods specify parameters name in call.") @@ -892,7 +892,7 @@ def visit_functiondef(self, node): returns = next(node.infer_call_result()).as_string() if returns.find("ItemPaged") == -1 and returns.find("AsyncItemPaged") == -1: self.add_message( - msg_id="client-list-methods-use-paging", node=node, confidence=None + msgid="client-list-methods-use-paging", node=node, confidence=None ) except (astroid.exceptions.InferenceError, AttributeError): # astroid can't always infer the return logger.debug("Pylint custom checker failed to check if client list method uses core paging.") @@ -947,7 +947,7 @@ def visit_functiondef(self, node): returns = next(node.infer_call_result()).as_string() if returns.find("LROPoller") == -1: self.add_message( - msg_id="client-lro-methods-use-polling", node=node, confidence=None + msgid="client-lro-methods-use-polling", node=node, confidence=None ) except (astroid.exceptions.InferenceError, AttributeError): # astroid can't always infer the return logger.debug("Pylint custom checker failed to check if client begin method uses core polling.") @@ -1008,7 +1008,7 @@ def visit_return(self, node): method = node.value.func.scope() if not method.name.startswith("begin") and not method.name.startswith("_"): self.add_message( - msg_id="lro-methods-use-correct-naming", node=method, confidence=None + msgid="lro-methods-use-correct-naming", node=method, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client method with polling uses correct naming.") @@ -1059,7 +1059,7 @@ def visit_classdef(self, node): for argument in func.args.args: if argument.name == "connection_string" or argument.name == "conn_str": self.add_message( - msg_id="connection-string-should-not-be-constructor-param", node=node, confidence=None + msgid="connection-string-should-not-be-constructor-param", node=node, confidence=None ) except AttributeError: logger.debug("Pylint custom checker failed to check if client uses connection string param in constructor.") @@ -1109,7 +1109,7 @@ def visit_module(self, node): package = nod.value if package.value.find(".") != -1 or package.value.find("_") != -1: self.add_message( - msg_id="package-name-incorrect", node=node, confidence=None + msgid="package-name-incorrect", node=node, confidence=None ) except Exception: logger.debug("Pylint custom checker failed to check if package name is correct.") @@ -1164,7 +1164,7 @@ def visit_module(self, node): has_client_suffix = True if has_client_suffix is False: self.add_message( - msg_id="client-suffix-needed", node=node, confidence=None + msgid="client-suffix-needed", node=node, confidence=None ) except Exception: logger.debug("Pylint custom checker failed to check if service client has a client suffix.") @@ -1315,7 +1315,7 @@ def check_parameters(self, node): if missing_params: self.add_message( - msg_id="docstring-missing-param", args=(", ".join(missing_params)), node=node, confidence=None + msgid="docstring-missing-param", args=(", ".join(missing_params)), node=node, confidence=None ) # check if we have a type for each param and check if documented params that should be keywords @@ -1329,12 +1329,12 @@ def check_parameters(self, node): if missing_types: self.add_message( - msg_id="docstring-missing-type", args=(", ".join(missing_types)), node=node, confidence=None + msgid="docstring-missing-type", args=(", ".join(missing_types)), node=node, confidence=None ) if should_be_keywords: self.add_message( - msg_id="docstring-should-be-keyword", + msgid="docstring-should-be-keyword", args=(", ".join(should_be_keywords)), node=node, confidence=None @@ -1370,11 +1370,11 @@ def check_return(self, node): if has_return is False: self.add_message( - msg_id="docstring-missing-return", node=node, confidence=None + msgid="docstring-missing-return", node=node, confidence=None ) if has_rtype is False: self.add_message( - msg_id="docstring-missing-rtype", node=node, confidence=None + msgid="docstring-missing-rtype", node=node, confidence=None ) def visit_classdef(self, node): @@ -1602,22 +1602,22 @@ def close(self): if self.disable_logging_error is False: if "NetworkTraceLoggingPolicy" not in self.has_policies: self.add_message( - msg_id="missing-logging-policy", node=self.node_to_use, confidence=None + msgid="missing-logging-policy", node=self.node_to_use, confidence=None ) if self.disable_retry_error is False: if "RetryPolicy" not in self.has_policies: self.add_message( - msg_id="missing-retry-policy", node=self.node_to_use, confidence=None + msgid="missing-retry-policy", node=self.node_to_use, confidence=None ) if self.disable_user_agent_error is False: if "UserAgentPolicy" not in self.has_policies: self.add_message( - msg_id="missing-user-agent-policy", node=self.node_to_use, confidence=None + msgid="missing-user-agent-policy", node=self.node_to_use, confidence=None ) if self.disable_tracing_error is False: if "DistributedTracingPolicy" not in self.has_policies: self.add_message( - msg_id="missing-distributed-tracing-policy", node=self.node_to_use, confidence=None + msgid="missing-distributed-tracing-policy", node=self.node_to_use, confidence=None ) diff --git a/sdk/core/azure-core/azure/core/pipeline/_base.py b/sdk/core/azure-core/azure/core/pipeline/_base.py index 905111135eaf..b67721dec26f 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/_base.py @@ -176,7 +176,7 @@ def prepare_requests(req): with concurrent.futures.ThreadPoolExecutor() as executor: # List comprehension to raise exceptions if happened - [ # pylint: disable=expression-not-assigned + [ # pylint: disable=expression-not-assigned, unnecessary-comprehension _ for _ in executor.map(prepare_requests, requests) ] diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py index 05888359a154..b300d15e5e78 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py @@ -23,7 +23,7 @@ def __init__(self, credential, *scopes, **kwargs): super().__init__(credential, *scopes, **kwargs) self._lock = asyncio.Lock() - async def on_request(self, request: PipelineRequest): + async def on_request(self, request: PipelineRequest): # pylint:disable=invalid-overridden-method """Adds a bearer token Authorization header to request and sends request to next policy. :param request: The pipeline request object to be modified. 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 f9d688bdd4c3..43f52aa0af3b 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 @@ -48,7 +48,7 @@ class AsyncRedirectPolicy(RedirectPolicy, AsyncHTTPPolicy): :caption: Configuring an async redirect policy. """ - async def send(self, request): + async def send(self, request): # pylint:disable=invalid-overridden-method """Sends the PipelineRequest object to the next policy. Uses redirect settings to send the request to redirect endpoint if necessary. 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 6efad6cf1627..28436a5fd738 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 @@ -80,7 +80,7 @@ class AsyncRetryPolicy(RetryPolicy, AsyncHTTPPolicy): :caption: Configuring an async retry policy. """ - async def _sleep_for_retry(self, response, transport): + async def _sleep_for_retry(self, response, transport): # pylint:disable=invalid-overridden-method """Sleep based on the Retry-After response header value. :param response: The PipelineResponse object. @@ -93,7 +93,7 @@ async def _sleep_for_retry(self, response, transport): return True return False - async def _sleep_backoff(self, settings, transport): + async def _sleep_backoff(self, settings, transport): # pylint:disable=invalid-overridden-method """Sleep using exponential backoff. Immediately returns if backoff is 0. :param dict settings: The retry settings. @@ -104,7 +104,7 @@ async def _sleep_backoff(self, settings, transport): return await transport.sleep(backoff) - async def sleep(self, settings, transport, response=None): + async def sleep(self, settings, transport, response=None): # pylint:disable=invalid-overridden-method """Sleep between retry attempts. This method will respect a server's ``Retry-After`` response header @@ -123,7 +123,7 @@ async def sleep(self, settings, transport, response=None): return await self._sleep_backoff(settings, transport) - async def send(self, request): + async def send(self, request): # pylint:disable=invalid-overridden-method """Uses the configured retry policy to send the request to the next policy in the pipeline. :param request: The PipelineRequest object 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 0ec0275e47bf..eee08d7fa859 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_base.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_base.py @@ -626,7 +626,7 @@ def parse_responses(response): with concurrent.futures.ThreadPoolExecutor() as executor: # List comprehension to raise exceptions if happened - [ # pylint: disable=expression-not-assigned + [ # pylint: disable=expression-not-assigned, unnecessary-comprehension _ for _ in executor.map(parse_responses, responses) ] diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py index 4b3494c44931..d82d3ab1f3da 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py @@ -79,10 +79,10 @@ async def __aenter__(self): async def __aexit__(self, *exc_details): # pylint: disable=arguments-differ return super(AsyncioRequestsTransport, self).__exit__() - async def sleep(self, duration): + async def sleep(self, duration): # pylint:disable=invalid-overridden-method await asyncio.sleep(duration) - async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore + async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore # pylint:disable=invalid-overridden-method """Send the request using this HTTP sender. :param request: The HttpRequest diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py index 67926d70420d..419a8c5d2c02 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py @@ -150,10 +150,10 @@ async def __aenter__(self): async def __aexit__(self, *exc_details): # pylint: disable=arguments-differ return super(TrioRequestsTransport, self).__exit__() - async def sleep(self, duration): + async def sleep(self, duration): # pylint:disable=invalid-overridden-method await trio.sleep(duration) - async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore + async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore # pylint:disable=invalid-overridden-method """Send the request using this HTTP sender. :param request: The HttpRequest 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 935dc455987e..8c4a9b7567c6 100644 --- a/sdk/core/azure-core/azure/core/polling/_async_poller.py +++ b/sdk/core/azure-core/azure/core/polling/_async_poller.py @@ -69,7 +69,7 @@ def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any class AsyncNoPolling(_NoPolling): """An empty async poller that returns the deserialized initial response. """ - async def run(self): + async def run(self): # pylint:disable=invalid-overridden-method """Empty run, no polling. Just override initial run to add "async" """ diff --git a/sdk/core/azure-core/azure/core/polling/async_base_polling.py b/sdk/core/azure-core/azure/core/polling/async_base_polling.py index d8676b0e6634..c62ea4c00fa4 100644 --- a/sdk/core/azure-core/azure/core/polling/async_base_polling.py +++ b/sdk/core/azure-core/azure/core/polling/async_base_polling.py @@ -40,7 +40,7 @@ class AsyncLROBasePolling(LROBasePolling): """A subclass or LROBasePolling that redefine "run" as async. """ - async def run(self): + async def run(self): # pylint:disable=invalid-overridden-method try: await self._poll() except BadStatus as err: @@ -62,7 +62,7 @@ async def run(self): response=self._pipeline_response.http_response, error=err ) - async def _poll(self): + async def _poll(self): # pylint:disable=invalid-overridden-method """Poll status of operation so long as operation is incomplete and we have an endpoint to query. @@ -85,17 +85,17 @@ async def _poll(self): self._pipeline_response = await self.request_status(final_get_url) _raise_if_bad_http_status_and_method(self._pipeline_response.http_response) - async def _sleep(self, delay): + async def _sleep(self, delay): # pylint:disable=invalid-overridden-method await self._transport.sleep(delay) - async def _delay(self): + async def _delay(self): # pylint:disable=invalid-overridden-method """Check for a 'retry-after' header to set timeout, otherwise use configured timeout. """ delay = self._extract_delay() await self._sleep(delay) - async def update_status(self): + async def update_status(self): # pylint:disable=invalid-overridden-method """Update the current status of the LRO. """ self._pipeline_response = await self.request_status( @@ -104,7 +104,7 @@ async def update_status(self): _raise_if_bad_http_status_and_method(self._pipeline_response.http_response) self._status = self._operation.get_status(self._pipeline_response) - async def request_status(self, status_link): + async def request_status(self, status_link): # pylint:disable=invalid-overridden-method """Do a simple GET to this status link. This method re-inject 'x-ms-client-request-id'. diff --git a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py index 90de3ea028d5..1d12e480049b 100644 --- a/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py +++ b/sdk/core/azure-mgmt-core/azure/mgmt/core/policies/_base_async.py @@ -42,7 +42,7 @@ class AsyncARMAutoResourceProviderRegistrationPolicy( """Auto register an ARM resource provider if not done yet. """ - async def send(self, request: PipelineRequest): + async def send(self, request: PipelineRequest): # pylint: disable=invalid-overridden-method http_request = request.http_request response = await self.next.send(request) if response.http_response.status_code == 409: diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py index e37349a94b06..7b6a95d6cdd7 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py @@ -181,7 +181,7 @@ def trace_link_message(events, parent_span=None): Will extract DiagnosticId if available. """ - trace_events = events if isinstance(events, Iterable) else (events,) + trace_events = events if isinstance(events, Iterable) else (events,) # pylint:disable=isinstance-second-argument-not-valid-type try: # pylint:disable=too-many-nested-blocks span_impl_type = settings.tracing_implementation() # type: Type[AbstractSpan] if span_impl_type is not None: diff --git a/sdk/identity/azure-identity/azure/identity/aio/_authn_client.py b/sdk/identity/azure-identity/azure/identity/aio/_authn_client.py index 9cfe13bd9498..53cc9fc32959 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_authn_client.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_authn_client.py @@ -64,7 +64,7 @@ async def __aexit__(self, *args): async def close(self) -> None: await self._pipeline.__aexit__() - async def request_token( + async def request_token( # pylint:disable=invalid-overridden-method self, scopes: "Iterable[str]", method: "Optional[str]" = "POST", diff --git a/sdk/identity/azure-identity/azure/identity/aio/_credentials/certificate.py b/sdk/identity/azure-identity/azure/identity/aio/_credentials/certificate.py index 1b044a24c0e1..a569ea5af8db 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_credentials/certificate.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_credentials/certificate.py @@ -37,7 +37,7 @@ async def close(self): await self._client.__aexit__() - async def get_token(self, *scopes: str, **kwargs: "Any") -> "AccessToken": # pylint:disable=unused-argument + async def get_token(self, *scopes: str, **kwargs: "Any") -> "AccessToken": """Asynchronously request an access token for `scopes`. .. note:: This method is called by Azure SDK clients. It isn't intended for use in application code. diff --git a/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py b/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py index d45f83752bfb..db5065412ae8 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py @@ -29,6 +29,7 @@ Policy = Union[AsyncHTTPPolicy, SansIOHTTPPolicy] +# pylint:disable=invalid-overridden-method class AadClient(AadClientBase): async def __aenter__(self): await self._pipeline.__aenter__() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc.py index 8e7d22e58e68..459f4c094e6f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc.py @@ -39,7 +39,6 @@ def finalize(self, data): padded = self._ctx.finalize() return self._padder.update(padded) + self._padder.finalize() - @property def block_size(self): # return self._cipher.block_size raise NotImplementedError() @@ -59,7 +58,6 @@ def finalize(self, data): padded = self._padder.finalize() return self._ctx.update(padded) + self._ctx.finalize() - @property def block_size(self): # return self._cipher.block_size raise NotImplementedError() diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc_hmac.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc_hmac.py index efb80716441d..a6016bd30503 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc_hmac.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc_hmac.py @@ -15,6 +15,8 @@ class _AesCbcHmacCryptoTransform(AuthenticatedCryptoTransform): def __init__(self, key, iv, auth_data, auth_tag): + super(_AesCbcHmacCryptoTransform, self).__init__() + self._aes_key = key[: len(key) // 2] self._hmac_key = key[len(key) // 2 :] hash_algo = {256: hashes.SHA256(), 384: hashes.SHA384(), 512: hashes.SHA512()}[len(key) * 8] diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/ecdsa.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/ecdsa.py index 07f6a19f9712..cff7410a6b44 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/ecdsa.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/ecdsa.py @@ -12,6 +12,8 @@ class _EcdsaSignatureTransform(SignatureTransform): def __init__(self, key, hash_algorithm): + super(_EcdsaSignatureTransform, self).__init__() + self._key = key self._hash_algorithm = hash_algorithm diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/rsa_signing.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/rsa_signing.py index ffa4628a435b..885070631b85 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/rsa_signing.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/rsa_signing.py @@ -11,6 +11,7 @@ class RsaSignatureTransform(SignatureTransform): def __init__(self, key, padding_function, hash_algorithm): + super(RsaSignatureTransform, self).__init__() self._key = key self._padding_function = padding_function self._hash_algorithm = hash_algorithm diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/sha_2.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/sha_2.py index 26c947808dc6..c6656b0493c5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/sha_2.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/sha_2.py @@ -11,6 +11,7 @@ class _Sha2DigestTransform(DigestTransform): def __init__(self, algorithm): + super(_Sha2DigestTransform, self).__init__() self._digest = hashes.Hash(algorithm=algorithm, backend=default_backend()) def update(self, data): diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py index 69bd3bb7b5e2..80361f35e506 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py @@ -434,7 +434,7 @@ def sequence_number(self): return None -class ReceivedMessage(PeekMessage): +class ReceivedMessageBase(PeekMessage): """ A Service Bus Message received from service side. @@ -452,7 +452,7 @@ class ReceivedMessage(PeekMessage): """ def __init__(self, message, mode=ReceiveSettleMode.PeekLock, **kwargs): - super(ReceivedMessage, self).__init__(message=message) + super(ReceivedMessageBase, self).__init__(message=message) self._settled = (mode == ReceiveSettleMode.ReceiveAndDelete) self._is_deferred_message = kwargs.get("is_deferred_message", False) self.auto_renew_error = None @@ -594,6 +594,8 @@ def _settle_via_receiver_link(self, settle_operation, dead_letter_reason=None, d return functools.partial(self.message.modify, True, True) raise ValueError("Unsupported settle operation type: {}".format(settle_operation)) + +class ReceivedMessage(ReceivedMessageBase): def _settle_message( self, settle_operation, diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_async_message.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_async_message.py index a0280dec0768..6bd8c7122864 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_async_message.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_async_message.py @@ -22,7 +22,7 @@ _LOGGER = logging.getLogger(__name__) -class ReceivedMessage(sync_message.ReceivedMessage): +class ReceivedMessage(sync_message.ReceivedMessageBase): """A Service Bus Message received from service side. """ diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_shared_key_policy_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_shared_key_policy_async.py index b63c989fd6c1..a1b93b5e4357 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_shared_key_policy_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_shared_key_policy_async.py @@ -22,11 +22,11 @@ def __init__(self, endpoint: str, credential: ServiceBusSharedKeyCredential, nam self._token_expiry_on = 0 self._token = None - async def _update_token(self): + async def _update_token(self): # pylint: disable=invalid-overridden-method if self._token_expiry_on + 60 <= time.time(): # Update token if it's expiring in 60 seconds access_token, self._token_expiry_on = await self._credential.get_token(self._endpoint) self._token = access_token.decode("utf-8") - async def on_request(self, request): + async def on_request(self, request): # pylint: disable=invalid-overridden-method await self._update_token() request.http_request.headers[self._name] = self._token diff --git a/sdk/storage/azure-storage-blob-changefeed/azure/storage/blob/changefeed/_models.py b/sdk/storage/azure-storage-blob-changefeed/azure/storage/blob/changefeed/_models.py index b904f751363e..a5d8aef59b32 100644 --- a/sdk/storage/azure-storage-blob-changefeed/azure/storage/blob/changefeed/_models.py +++ b/sdk/storage/azure-storage-blob-changefeed/azure/storage/blob/changefeed/_models.py @@ -384,11 +384,13 @@ def __iter__(self): def seekable(): return True - def next(self): + def __next__(self): next_chunk = next(self._iterator) self._download_offset += len(next_chunk) return next_chunk + next = __next__ # Python 2 compatibility. + def tell(self): return self._point @@ -406,7 +408,7 @@ def read(self, size): try: # keep downloading file content until the buffer has enough bytes to read while self._point + size > self._download_offset: - next_data_chunk = self.next() + next_data_chunk = self.__next__() self._buf += next_data_chunk except StopIteration: pass diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_quick_query_helper.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_quick_query_helper.py index ab69dd7ae835..afad9a1727ff 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_quick_query_helper.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_quick_query_helper.py @@ -148,11 +148,13 @@ def __iter__(self): def seekable(): return True - def next(self): + def __next__(self): next_part = next(self.iterator) self._download_offset += len(next_part) return next_part + next = __next__ # Python 2 compatibility. + def tell(self): return self._point @@ -170,7 +172,7 @@ def read(self, size): try: # keep reading from the generator until the buffer of this stream has enough data to read while self._point + size > self._download_offset: - self._buf += self.next() + self._buf += self.__next__() except StopIteration: self.file_length = self._download_offset diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py index a8db96d4a051..b11dc5757808 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py @@ -64,27 +64,30 @@ def __init__(self, account_name, account_key): self.account_key = account_key super(SharedKeyCredentialPolicy, self).__init__() - def _get_headers(self, request, headers_to_sign): + @staticmethod + def _get_headers(request, headers_to_sign): headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value) if 'content-length' in headers and headers['content-length'] == '0': del headers['content-length'] return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' - def _get_verb(self, request): + @staticmethod + def _get_verb(request): return request.http_request.method + '\n' def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: pass return '/' + self.account_name + uri_path - def _get_canonicalized_headers(self, request): + @staticmethod + def _get_canonicalized_headers(request): string_to_sign = '' x_ms_headers = [] for name, value in request.http_request.headers.items(): @@ -96,8 +99,9 @@ def _get_canonicalized_headers(self, request): string_to_sign += ''.join([name, ':', value, '\n']) return string_to_sign - def _get_canonicalized_resource_query(self, request): - sorted_queries = [(name, value) for name, value in request.http_request.query.items()] + @staticmethod + def _get_canonicalized_resource_query(request): + sorted_queries = list(request.http_request.query.items()) sorted_queries.sort() string_to_sign = '' diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/avro/schema.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/avro/schema.py index 6832ab4fd2d5..ffe28530167f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/avro/schema.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/avro/schema.py @@ -393,7 +393,7 @@ class NamedSchema(Schema): def __init__( self, data_type, - name, + name=None, namespace=None, names=None, other_props=None, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies_async.py index c0a44767b177..e0926b81dbc5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import asyncio import random diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/uploads.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/uploads.py index 623fa16182ea..abf3fb2ce007 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/uploads.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/uploads.py @@ -520,9 +520,11 @@ def __iter__(self): def seekable(self): return False - def next(self): + def __next__(self): return next(self.iterator) + next = __next__ # Python 2 compatibility. + def tell(self, *args, **kwargs): raise UnsupportedOperation("Data generator does not support tell.") @@ -534,7 +536,7 @@ def read(self, size): count = len(self.leftover) try: while count < size: - chunk = self.next() + chunk = self.__next__() if isinstance(chunk, six.text_type): chunk = chunk.encode(self.encoding) data += chunk diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py index 82a5c627f050..28f333fc21e9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines, invalid-overridden-method from typing import ( # pylint: disable=unused-import Union, Optional, Any, IO, Iterable, AnyStr, Dict, List, Tuple, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py index 14944c510eb7..ab2e8a0defc7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import Union, Optional, Any, Iterable, Dict, List, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py index 8a777cb5daa2..ee31e3c9e7de 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import Union, Optional, Any, Iterable, AnyStr, Dict, List, IO, AsyncIterator, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py index ea83862e4ae5..c698cb40a40a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import asyncio import sys diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py index ecd9076bc8cd..53ab5ae3ff75 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method from typing import ( # pylint: disable=unused-import Union, Optional, Any, IO, Iterable, AnyStr, Dict, List, Tuple, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py index a8db96d4a051..b11dc5757808 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py @@ -64,27 +64,30 @@ def __init__(self, account_name, account_key): self.account_key = account_key super(SharedKeyCredentialPolicy, self).__init__() - def _get_headers(self, request, headers_to_sign): + @staticmethod + def _get_headers(request, headers_to_sign): headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value) if 'content-length' in headers and headers['content-length'] == '0': del headers['content-length'] return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' - def _get_verb(self, request): + @staticmethod + def _get_verb(request): return request.http_request.method + '\n' def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: pass return '/' + self.account_name + uri_path - def _get_canonicalized_headers(self, request): + @staticmethod + def _get_canonicalized_headers(request): string_to_sign = '' x_ms_headers = [] for name, value in request.http_request.headers.items(): @@ -96,8 +99,9 @@ def _get_canonicalized_headers(self, request): string_to_sign += ''.join([name, ':', value, '\n']) return string_to_sign - def _get_canonicalized_resource_query(self, request): - sorted_queries = [(name, value) for name, value in request.http_request.query.items()] + @staticmethod + def _get_canonicalized_resource_query(request): + sorted_queries = list(request.http_request.query.items()) sorted_queries.sort() string_to_sign = '' diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies_async.py index c0a44767b177..e0926b81dbc5 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import asyncio import random diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads.py index 68c6c72d03d0..29949d57a293 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads.py @@ -538,9 +538,11 @@ def __iter__(self): def seekable(self): return False - def next(self): + def __next__(self): return next(self.iterator) + next = __next__ # Python 2 compatibility. + def tell(self, *args, **kwargs): raise UnsupportedOperation("Data generator does not support tell.") @@ -552,7 +554,7 @@ def read(self, size): count = len(self.leftover) try: while count < size: - chunk = self.next() + chunk = self.__next__() if isinstance(chunk, six.text_type): chunk = chunk.encode(self.encoding) data += chunk diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py index f655adc0f791..8d4eb3ebbe83 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py @@ -3,6 +3,8 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method + from ._data_lake_file_client_async import DataLakeFileClient from .._data_lake_directory_client import DataLakeDirectoryClient as DataLakeDirectoryClientBase from .._models import DirectoryProperties diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_file_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_file_client_async.py index 12f0ff86aaa7..e74cc13442ad 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_file_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_file_client_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method from ._download_async import StorageStreamDownloader from ._path_client_async import PathClient diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_lease_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_lease_async.py index cadf7bc0c396..10205f9b551a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_lease_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_lease_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method from typing import ( # pylint: disable=unused-import Union, Optional, Any, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py index 205a4ec4f6b5..18935c8d5e35 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py @@ -3,6 +3,8 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method + from azure.core.paging import ItemPaged from azure.storage.blob.aio import BlobServiceClient diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py index a39bfb2fee7f..6b1be52d7137 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py @@ -4,6 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py index 6f9693090422..688f2d4c3ffd 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method from azure.storage.blob.aio import BlobClient from .._shared.base_client_async import AsyncStorageAccountHostsMixin from .._path_client import PathClient as PathClientBase diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py index a8db96d4a051..b11dc5757808 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py @@ -64,27 +64,30 @@ def __init__(self, account_name, account_key): self.account_key = account_key super(SharedKeyCredentialPolicy, self).__init__() - def _get_headers(self, request, headers_to_sign): + @staticmethod + def _get_headers(request, headers_to_sign): headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value) if 'content-length' in headers and headers['content-length'] == '0': del headers['content-length'] return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' - def _get_verb(self, request): + @staticmethod + def _get_verb(request): return request.http_request.method + '\n' def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: pass return '/' + self.account_name + uri_path - def _get_canonicalized_headers(self, request): + @staticmethod + def _get_canonicalized_headers(request): string_to_sign = '' x_ms_headers = [] for name, value in request.http_request.headers.items(): @@ -96,8 +99,9 @@ def _get_canonicalized_headers(self, request): string_to_sign += ''.join([name, ':', value, '\n']) return string_to_sign - def _get_canonicalized_resource_query(self, request): - sorted_queries = [(name, value) for name, value in request.http_request.query.items()] + @staticmethod + def _get_canonicalized_resource_query(request): + sorted_queries = list(request.http_request.query.items()) sorted_queries.sort() string_to_sign = '' diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies_async.py index c0a44767b177..e0926b81dbc5 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import asyncio import random diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/uploads.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/uploads.py index 623fa16182ea..abf3fb2ce007 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/uploads.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/uploads.py @@ -520,9 +520,11 @@ def __iter__(self): def seekable(self): return False - def next(self): + def __next__(self): return next(self.iterator) + next = __next__ # Python 2 compatibility. + def tell(self, *args, **kwargs): raise UnsupportedOperation("Data generator does not support tell.") @@ -534,7 +536,7 @@ def read(self, size): count = len(self.leftover) try: while count < size: - chunk = self.next() + chunk = self.__next__() if isinstance(chunk, six.text_type): chunk = chunk.encode(self.encoding) data += chunk diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py index 260c9a08c907..29b63969fbfe 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method import functools import time from typing import ( # pylint: disable=unused-import diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py index 7636190e8b8e..c0db16d6f7a2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method import asyncio import sys from io import BytesIO diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py index de63720f53cb..3d48fdc0d882 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines, invalid-overridden-method import functools import time from io import BytesIO diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py index bdd06d72be1b..0a04484638f3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_lease_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method from typing import ( # pylint: disable=unused-import Union, Optional, Any, IO, Iterable, AnyStr, Dict, List, Tuple, TypeVar, TYPE_CHECKING diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py index 2a795f683f6c..b6fb243067e9 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method from typing import ( # pylint: disable=unused-import Optional, Union, Dict, Any, Iterable, TYPE_CHECKING ) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py index 9b5e3f2a7310..2ee8390932f4 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import Union, Optional, Any, Iterable, Dict, List, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py index a8db96d4a051..b11dc5757808 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py @@ -64,27 +64,30 @@ def __init__(self, account_name, account_key): self.account_key = account_key super(SharedKeyCredentialPolicy, self).__init__() - def _get_headers(self, request, headers_to_sign): + @staticmethod + def _get_headers(request, headers_to_sign): headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value) if 'content-length' in headers and headers['content-length'] == '0': del headers['content-length'] return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n' - def _get_verb(self, request): + @staticmethod + def _get_verb(request): return request.http_request.method + '\n' def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: pass return '/' + self.account_name + uri_path - def _get_canonicalized_headers(self, request): + @staticmethod + def _get_canonicalized_headers(request): string_to_sign = '' x_ms_headers = [] for name, value in request.http_request.headers.items(): @@ -96,8 +99,9 @@ def _get_canonicalized_headers(self, request): string_to_sign += ''.join([name, ':', value, '\n']) return string_to_sign - def _get_canonicalized_resource_query(self, request): - sorted_queries = [(name, value) for name, value in request.http_request.query.items()] + @staticmethod + def _get_canonicalized_resource_query(request): + sorted_queries = list(request.http_request.query.items()) sorted_queries.sort() string_to_sign = '' diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies_async.py index c0a44767b177..e0926b81dbc5 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import asyncio import random diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/uploads.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/uploads.py index 623fa16182ea..abf3fb2ce007 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/uploads.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/uploads.py @@ -520,9 +520,11 @@ def __iter__(self): def seekable(self): return False - def next(self): + def __next__(self): return next(self.iterator) + next = __next__ # Python 2 compatibility. + def tell(self, *args, **kwargs): raise UnsupportedOperation("Data generator does not support tell.") @@ -534,7 +536,7 @@ def read(self, size): count = len(self.leftover) try: while count < size: - chunk = self.next() + chunk = self.__next__() if isinstance(chunk, six.text_type): chunk = chunk.encode(self.encoding) data += chunk diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py index cc5851ec9412..21e710554e2a 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py index 4d32d1f8b0d8..42d0d45f4583 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=invalid-overridden-method import functools from typing import ( # pylint: disable=unused-import