From 23c9856857b4fad351491b064a30a1e1eddc0589 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 24 Apr 2020 22:24:40 +0300 Subject: [PATCH] Remove no longer needed noqa's --- src/_pytest/_code/code.py | 2 +- src/_pytest/capture.py | 2 +- src/_pytest/compat.py | 2 +- src/_pytest/config/argparsing.py | 2 +- src/_pytest/config/findpaths.py | 2 +- src/_pytest/logging.py | 14 +++++++------- src/_pytest/mark/legacy.py | 2 +- src/_pytest/nodes.py | 2 +- src/_pytest/outcomes.py | 2 +- src/_pytest/python.py | 4 ++-- src/_pytest/python_api.py | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index bc0e36693..2075fd0eb 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -44,7 +44,7 @@ from _pytest.compat import TYPE_CHECKING if TYPE_CHECKING: from typing import Type from typing_extensions import Literal - from weakref import ReferenceType # noqa: F401 + from weakref import ReferenceType _TracebackStyle = Literal["long", "short", "line", "no", "native"] diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index d34bf23f8..7eafeb3e4 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -669,7 +669,7 @@ class SysCaptureBinary: class SysCapture(SysCaptureBinary): - EMPTY_BUFFER = "" # type: ignore[assignment] # noqa: F821 + EMPTY_BUFFER = "" # type: ignore[assignment] def snap(self): res = self.tmpfile.getvalue() diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 6a0614f01..4cc22ba4a 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -32,7 +32,7 @@ else: if TYPE_CHECKING: - from typing import Type # noqa: F401 (used in type string) + from typing import Type _T = TypeVar("_T") diff --git a/src/_pytest/config/argparsing.py b/src/_pytest/config/argparsing.py index 940eaa6a7..b57db92ca 100644 --- a/src/_pytest/config/argparsing.py +++ b/src/_pytest/config/argparsing.py @@ -21,7 +21,7 @@ from _pytest.config.exceptions import UsageError if TYPE_CHECKING: from typing import NoReturn - from typing_extensions import Literal # noqa: F401 + from typing_extensions import Literal FILE_OR_DIR = "file_or_dir" diff --git a/src/_pytest/config/findpaths.py b/src/_pytest/config/findpaths.py index 101fdf66f..f4f62e06b 100644 --- a/src/_pytest/config/findpaths.py +++ b/src/_pytest/config/findpaths.py @@ -12,7 +12,7 @@ from _pytest.compat import TYPE_CHECKING from _pytest.outcomes import fail if TYPE_CHECKING: - from . import Config # noqa: F401 + from . import Config def exists(path, ignore=OSError): diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 5e60a2321..681fdee62 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -338,7 +338,7 @@ class LogCaptureFixture: """ :rtype: LogCaptureHandler """ - return self._item.catch_log_handler # type: ignore[no-any-return] # noqa: F723 + return self._item.catch_log_handler # type: ignore[no-any-return] def get_records(self, when: str) -> List[logging.LogRecord]: """ @@ -354,7 +354,7 @@ class LogCaptureFixture: """ handler = self._item.catch_log_handlers.get(when) if handler: - return handler.records # type: ignore[no-any-return] # noqa: F723 + return handler.records # type: ignore[no-any-return] else: return [] @@ -640,15 +640,15 @@ class LoggingPlugin: return if not hasattr(item, "catch_log_handlers"): - item.catch_log_handlers = {} # type: ignore[attr-defined] # noqa: F821 - item.catch_log_handlers[when] = log_handler # type: ignore[attr-defined] # noqa: F821 - item.catch_log_handler = log_handler # type: ignore[attr-defined] # noqa: F821 + item.catch_log_handlers = {} # type: ignore[attr-defined] + item.catch_log_handlers[when] = log_handler # type: ignore[attr-defined] + item.catch_log_handler = log_handler # type: ignore[attr-defined] try: yield # run test finally: if when == "teardown": - del item.catch_log_handler # type: ignore[attr-defined] # noqa: F821 - del item.catch_log_handlers # type: ignore[attr-defined] # noqa: F821 + del item.catch_log_handler # type: ignore[attr-defined] + del item.catch_log_handlers # type: ignore[attr-defined] if self.print_logs: # Add a captured log section to the report. diff --git a/src/_pytest/mark/legacy.py b/src/_pytest/mark/legacy.py index a9461d4ce..1a9fdee8d 100644 --- a/src/_pytest/mark/legacy.py +++ b/src/_pytest/mark/legacy.py @@ -12,7 +12,7 @@ from _pytest.mark.expression import evaluate from _pytest.mark.expression import ParseError if TYPE_CHECKING: - from _pytest.nodes import Item # noqa: F401 (used in type string) + from _pytest.nodes import Item @attr.s diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index d55e00034..448e67127 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -33,7 +33,7 @@ from _pytest.store import Store if TYPE_CHECKING: # Imported here due to circular import. - from _pytest.main import Session # noqa: F401 + from _pytest.main import Session SEP = "/" diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index bed73c94d..7d7e9df7a 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -15,7 +15,7 @@ TYPE_CHECKING = False # avoid circular import through compat if TYPE_CHECKING: from typing import NoReturn - from typing import Type # noqa: F401 (Used in string type annotation.) + from typing import Type # noqa: F401 (used in type string) from typing_extensions import Protocol else: # typing.Protocol is only available starting from Python 3.8. It is also diff --git a/src/_pytest/python.py b/src/_pytest/python.py index ef3ebf791..6ae57cb37 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -136,7 +136,7 @@ def pytest_cmdline_main(config): def pytest_generate_tests(metafunc: "Metafunc") -> None: for marker in metafunc.definition.iter_markers(name="parametrize"): # TODO: Fix this type-ignore (overlapping kwargs). - metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker) # type: ignore[misc] # noqa: F821 + metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker) # type: ignore[misc] def pytest_configure(config): @@ -1013,7 +1013,7 @@ class Metafunc: func_name: str, ) -> List[Union[None, str]]: try: - num_ids = len(ids) # type: ignore[arg-type] # noqa: F821 + num_ids = len(ids) # type: ignore[arg-type] except TypeError: try: iter(ids) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 78051172d..a523caae5 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -27,7 +27,7 @@ from _pytest.compat import TYPE_CHECKING from _pytest.outcomes import fail if TYPE_CHECKING: - from typing import Type # noqa: F401 (used in type string) + from typing import Type BASE_TYPE = (type, STRING_TYPES)