A few linting fixes
Add some Python 3.8 type: ignores; all are already fixed in the next mypy release, so can be removed once we upgrade. Also move some flake8 ignores which seem to have changed places.
This commit is contained in:
parent
c49c61fdaf
commit
f760356578
|
@ -60,7 +60,7 @@ class Source:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload # noqa: F811
|
||||||
def __getitem__(self, key: slice) -> "Source":
|
def __getitem__(self, key: slice) -> "Source": # noqa: F811
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def __getitem__(self, key: Union[int, slice]) -> Union[str, "Source"]: # noqa: F811
|
def __getitem__(self, key: Union[int, slice]) -> Union[str, "Source"]: # noqa: F811
|
||||||
|
|
|
@ -1074,13 +1074,14 @@ def try_makedirs(cache_dir) -> bool:
|
||||||
|
|
||||||
def get_cache_dir(file_path: Path) -> Path:
|
def get_cache_dir(file_path: Path) -> Path:
|
||||||
"""Returns the cache directory to write .pyc files for the given .py file path"""
|
"""Returns the cache directory to write .pyc files for the given .py file path"""
|
||||||
if sys.version_info >= (3, 8) and sys.pycache_prefix:
|
# Type ignored until added in next mypy release.
|
||||||
|
if sys.version_info >= (3, 8) and sys.pycache_prefix: # type: ignore
|
||||||
# given:
|
# given:
|
||||||
# prefix = '/tmp/pycs'
|
# prefix = '/tmp/pycs'
|
||||||
# path = '/home/user/proj/test_app.py'
|
# path = '/home/user/proj/test_app.py'
|
||||||
# we want:
|
# we want:
|
||||||
# '/tmp/pycs/home/user/proj'
|
# '/tmp/pycs/home/user/proj'
|
||||||
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1])
|
return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1]) # type: ignore
|
||||||
else:
|
else:
|
||||||
# classic pycache directory
|
# classic pycache directory
|
||||||
return file_path.parent / "__pycache__"
|
return file_path.parent / "__pycache__"
|
||||||
|
|
|
@ -40,7 +40,8 @@ MODULE_NOT_FOUND_ERROR = (
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 8):
|
if sys.version_info >= (3, 8):
|
||||||
from importlib import metadata as importlib_metadata # noqa: F401
|
# Type ignored until next mypy release.
|
||||||
|
from importlib import metadata as importlib_metadata # type: ignore
|
||||||
else:
|
else:
|
||||||
import importlib_metadata # noqa: F401
|
import importlib_metadata # noqa: F401
|
||||||
|
|
||||||
|
@ -407,7 +408,9 @@ else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload # noqa: F811
|
||||||
def __get__(self, instance: _S, owner: Optional["Type[_S]"] = ...) -> _T:
|
def __get__( # noqa: F811
|
||||||
|
self, instance: _S, owner: Optional["Type[_S]"] = ...
|
||||||
|
) -> _T:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def __get__(self, instance, owner=None): # noqa: F811
|
def __get__(self, instance, owner=None): # noqa: F811
|
||||||
|
|
|
@ -552,7 +552,7 @@ def raises(
|
||||||
|
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload # noqa: F811
|
||||||
def raises(
|
def raises( # noqa: F811
|
||||||
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
||||||
func: Callable,
|
func: Callable,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
|
|
|
@ -60,18 +60,18 @@ def warns(
|
||||||
*,
|
*,
|
||||||
match: "Optional[Union[str, Pattern]]" = ...
|
match: "Optional[Union[str, Pattern]]" = ...
|
||||||
) -> "WarningsChecker":
|
) -> "WarningsChecker":
|
||||||
... # pragma: no cover
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload # noqa: F811
|
||||||
def warns(
|
def warns( # noqa: F811
|
||||||
expected_warning: Union["Type[Warning]", Tuple["Type[Warning]", ...]],
|
expected_warning: Union["Type[Warning]", Tuple["Type[Warning]", ...]],
|
||||||
func: Callable,
|
func: Callable,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
match: Optional[Union[str, "Pattern"]] = ...,
|
match: Optional[Union[str, "Pattern"]] = ...,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> Union[Any]:
|
) -> Union[Any]:
|
||||||
... # pragma: no cover
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
def warns( # noqa: F811
|
def warns( # noqa: F811
|
||||||
|
|
Loading…
Reference in New Issue