From b78f71216f6067e16bf3eb25132bc4da8b41c5e7 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 28 Dec 2020 18:17:24 -0800 Subject: [PATCH] Remove unnecessary "noqa" comments --- news/8a225e3d-998e-4924-92e6-2ab2173159f8.trivial.rst | 0 src/pip/__main__.py | 2 +- src/pip/_internal/network/auth.py | 2 +- src/pip/_internal/req/req_set.py | 4 ++-- src/pip/_internal/utils/logging.py | 4 ++-- src/pip/_internal/utils/misc.py | 4 +--- 6 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 news/8a225e3d-998e-4924-92e6-2ab2173159f8.trivial.rst diff --git a/news/8a225e3d-998e-4924-92e6-2ab2173159f8.trivial.rst b/news/8a225e3d-998e-4924-92e6-2ab2173159f8.trivial.rst new file mode 100644 index 000000000..e69de29bb diff --git a/src/pip/__main__.py b/src/pip/__main__.py index ea738bfc2..1005489f3 100644 --- a/src/pip/__main__.py +++ b/src/pip/__main__.py @@ -18,7 +18,7 @@ if __package__ == '': path = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, path) -from pip._internal.cli.main import main as _main # isort:skip # noqa +from pip._internal.cli.main import main as _main if __name__ == '__main__': sys.exit(_main()) diff --git a/src/pip/_internal/network/auth.py b/src/pip/_internal/network/auth.py index a63a2965c..174eb8348 100644 --- a/src/pip/_internal/network/auth.py +++ b/src/pip/_internal/network/auth.py @@ -31,7 +31,7 @@ if MYPY_CHECK_RUNNING: logger = logging.getLogger(__name__) try: - import keyring # noqa + import keyring except ImportError: keyring = None except Exception as exc: diff --git a/src/pip/_internal/req/req_set.py b/src/pip/_internal/req/req_set.py index 96bb4013e..fa58be663 100644 --- a/src/pip/_internal/req/req_set.py +++ b/src/pip/_internal/req/req_set.py @@ -24,7 +24,7 @@ class RequirementSet: """Create a RequirementSet. """ - self.requirements = OrderedDict() # type: Dict[str, InstallRequirement] # noqa: E501 + self.requirements = OrderedDict() # type: Dict[str, InstallRequirement] self.check_supported_wheels = check_supported_wheels self.unnamed_requirements = [] # type: List[InstallRequirement] @@ -69,7 +69,7 @@ class RequirementSet: parent_req_name=None, # type: Optional[str] extras_requested=None # type: Optional[Iterable[str]] ): - # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501 + # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] """Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this diff --git a/src/pip/_internal/utils/logging.py b/src/pip/_internal/utils/logging.py index 6e1aff123..687bfe3b2 100644 --- a/src/pip/_internal/utils/logging.py +++ b/src/pip/_internal/utils/logging.py @@ -45,7 +45,7 @@ if WINDOWS: # https://bugs.python.org/issue30418 def _is_broken_pipe_error(exc_class, exc): """See the docstring for non-Windows below.""" - return ((exc_class is BrokenPipeError) or # noqa: F821 + return ((exc_class is BrokenPipeError) or (exc_class is OSError and exc.errno in (errno.EINVAL, errno.EPIPE))) else: @@ -58,7 +58,7 @@ else: exc_class: an exception class. exc: an exception instance. """ - return (exc_class is BrokenPipeError) # noqa: F821 + return (exc_class is BrokenPipeError) @contextlib.contextmanager diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py index bd205ada5..85e26a021 100644 --- a/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py @@ -170,9 +170,7 @@ def path_to_display(path): except UnicodeDecodeError: # Include the full bytes to make troubleshooting easier, even though # it may not be very human readable. - # Silence the "F821 undefined name 'ascii'" flake8 error since - # ascii() is a built-in. - display_path = ascii(path) # noqa: F821 + display_path = ascii(path) return display_path