Skip to content

Commit

Permalink
azure-core black/pylint/mypy (Azure#6581)
Browse files Browse the repository at this point in the history
* Pylint/black happyness

* mypy

* Fix exceptiont tests

* bad-continuation ignroe by defulat
  • Loading branch information
lmazuel authored and rakshith91 committed Aug 2, 2019
1 parent d5cb186 commit f349ea6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ reports=no
# locally-disabled: Warning locally suppressed using disable-msg
# 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.
disable=useless-object-inheritance,missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-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

[FORMAT]
max-line-length=120
Expand Down
7 changes: 5 additions & 2 deletions sdk/core/azure-core/azure/core/async_paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ async def __anext__(self) -> ReturnType:
class AsyncPageIterator(AsyncIterator[AsyncIterator[ReturnType]]):
def __init__(
self,
get_next: Callable[[Optional[str]], Awaitable[ResponseType]],
get_next: Callable[
[Optional[str]], Awaitable[ResponseType]
],
extract_data: Callable[
[ResponseType], Awaitable[Tuple[str, AsyncIterator[ReturnType]]]
],
Expand Down Expand Up @@ -120,7 +122,8 @@ def __init__(self, *args, **kwargs) -> None:
)

def by_page(
self, continuation_token: Optional[str] = None
self,
continuation_token: Optional[str] = None,
) -> AsyncIterator[AsyncIterator[ReturnType]]:
"""Get an async iterator of pages of objects, instead of an async iterator of objects.
Expand Down
8 changes: 4 additions & 4 deletions sdk/core/azure-core/azure/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import logging
import sys

from typing import Callable, Any, Dict, Optional, TYPE_CHECKING
from typing import Callable, Any, Dict, Optional, List, Union, TYPE_CHECKING

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -237,10 +237,10 @@ class ODataV4Error(HttpResponseError):
_ERROR_FORMAT = ODataV4Format

def __init__(self, response, **kwargs):
# type: (_HttpResponseBase, Dict[str, Any]) -> None
# type: (_HttpResponseBase, Any) -> None

# Ensure field are declared, whatever can happen afterwards
self.odata_json = None # type: Optional[dict[str, Any]]
self.odata_json = None # type: Optional[Dict[str, Any]]
try:
self.odata_json = json.loads(response.text())
odata_message = self.odata_json.setdefault("error", {}).get("message")
Expand All @@ -259,7 +259,7 @@ def __init__(self, response, **kwargs):

super(ODataV4Error, self).__init__(response=response, **kwargs)

self._error_format = None
self._error_format = None # type: Optional[Union[str, ODataV4Format]]
if self.odata_json:
try:
error_node = self.odata_json["error"]
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core/azure/core/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#
# --------------------------------------------------------------------------
import itertools
from typing import (
from typing import ( # pylint: disable=unused-import
Callable,
Optional,
TypeVar,
Iterator,
Iterable,
Tuple,
) # pylint: disable=unused-import
)
import logging


Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class PipelineRequest(object):
:type context: ~azure.core.pipeline.PipelineContext
"""
def __init__(self, http_request, context):
# type: (HTTPRequestType, Optional[Any]) -> None
# type: (HTTPRequestType, PipelineContext) -> None
self.http_request = http_request
self.context = context

Expand Down

0 comments on commit f349ea6

Please sign in to comment.