From f37463d17277a202dc8edb6203297cac21577593 Mon Sep 17 00:00:00 2001 From: Ethan Paul Date: Thu, 15 Aug 2024 14:41:34 -0400 Subject: [PATCH] Fix linting errors Remove unused imports Disable redundant errors Add notes for why errors are disabled --- tests/fixtures.py | 2 +- tests/test_installer.py | 2 +- tests/test_transients.py | 4 +--- tox_poetry_installer/_poetry.py | 2 +- tox_poetry_installer/constants.py | 1 - tox_poetry_installer/hooks/_tox_on_install_helpers.py | 4 ++++ tox_poetry_installer/hooks/tox_add_env_config.py | 5 ++++- tox_poetry_installer/hooks/tox_add_option.py | 1 + tox_poetry_installer/hooks/tox_on_install.py | 5 ++--- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/fixtures.py b/tests/fixtures.py index f2c9f86..f83a983 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-module-docstring, missing-function-docstring, unused-argument, too-few-public-methods +# pylint: disable=missing-module-docstring,missing-function-docstring,unused-argument,too-few-public-methods,protected-access import time from pathlib import Path from typing import List diff --git a/tests/test_installer.py b/tests/test_installer.py index 5a4cd28..4f9c6ee 100644 --- a/tests/test_installer.py +++ b/tests/test_installer.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import +# pylint: disable=missing-module-docstring,redefined-outer-name,unused-argument,unused-import,protected-access import time from unittest import mock diff --git a/tests/test_transients.py b/tests/test_transients.py index cd883ff..8766278 100644 --- a/tests/test_transients.py +++ b/tests/test_transients.py @@ -1,13 +1,11 @@ -# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import +# pylint: disable=missing-module-docstring,redefined-outer-name,unused-argument,unused-import,protected-access import poetry.factory import poetry.utils.env import pytest -from poetry.puzzle.provider import Provider import tox_poetry_installer.hooks._tox_on_install_helpers from .fixtures import mock_poetry_factory from .fixtures import mock_venv -from tox_poetry_installer import constants from tox_poetry_installer import exceptions diff --git a/tox_poetry_installer/_poetry.py b/tox_poetry_installer/_poetry.py index 3b44044..f35e9cd 100644 --- a/tox_poetry_installer/_poetry.py +++ b/tox_poetry_installer/_poetry.py @@ -21,13 +21,13 @@ at the module scope it is imported into function scope wherever Poetry component moves import errors from load time to runtime which allows the plugin to be skipped if Poetry isn't installed and/or a more helpful error be raised within the Tox framework. """ -# pylint: disable=unused-import import sys from tox_poetry_installer import exceptions try: + # pylint: disable=import-outside-toplevel,unused-import from cleo.io.null_io import NullIO from poetry.config.config import Config from poetry.core.packages.dependency import Dependency as PoetryDependency diff --git a/tox_poetry_installer/constants.py b/tox_poetry_installer/constants.py index 80ca64c..76afc1b 100644 --- a/tox_poetry_installer/constants.py +++ b/tox_poetry_installer/constants.py @@ -5,7 +5,6 @@ in this module. All constants should be type hinted. """ -from typing import Set from typing import Tuple from tox_poetry_installer import __about__ diff --git a/tox_poetry_installer/hooks/_tox_on_install_helpers.py b/tox_poetry_installer/hooks/_tox_on_install_helpers.py index b02a515..693ad4a 100644 --- a/tox_poetry_installer/hooks/_tox_on_install_helpers.py +++ b/tox_poetry_installer/hooks/_tox_on_install_helpers.py @@ -23,6 +23,10 @@ from tox_poetry_installer import logger if typing.TYPE_CHECKING: from tox_poetry_installer import _poetry +# This is globally disabled to support the usage of the _poetry shadow module +# pylint: disable=import-outside-toplevel + + PackageMap = Dict[str, List[PoetryPackage]] diff --git a/tox_poetry_installer/hooks/tox_add_env_config.py b/tox_poetry_installer/hooks/tox_add_env_config.py index 301f4b0..019d3ac 100644 --- a/tox_poetry_installer/hooks/tox_add_env_config.py +++ b/tox_poetry_installer/hooks/tox_add_env_config.py @@ -5,8 +5,11 @@ from tox.config.sets import EnvConfigSet from tox.plugin import impl +# pylint: disable=missing-function-docstring @impl -def tox_add_env_config(env_conf: EnvConfigSet): +def tox_add_env_config( + env_conf: EnvConfigSet, +): env_conf.add_config( "poetry_dep_groups", of_type=List[str], diff --git a/tox_poetry_installer/hooks/tox_add_option.py b/tox_poetry_installer/hooks/tox_add_option.py index 9e71fdf..8d59737 100644 --- a/tox_poetry_installer/hooks/tox_add_option.py +++ b/tox_poetry_installer/hooks/tox_add_option.py @@ -5,6 +5,7 @@ from tox.plugin import impl from tox_poetry_installer import constants +# pylint: disable=missing-function-docstring @impl def tox_add_option(parser: ToxParser): parser.add_argument( diff --git a/tox_poetry_installer/hooks/tox_on_install.py b/tox_poetry_installer/hooks/tox_on_install.py index ae324c0..be3ffde 100644 --- a/tox_poetry_installer/hooks/tox_on_install.py +++ b/tox_poetry_installer/hooks/tox_on_install.py @@ -21,10 +21,9 @@ from tox_poetry_installer.hooks._tox_on_install_helpers import find_project_deps from tox_poetry_installer.hooks._tox_on_install_helpers import install_package +# pylint: disable=missing-function-docstring,unused-argument @impl -def tox_on_install( - tox_env: ToxVirtualEnv, section: str # pylint: disable=unused-argument -) -> None: +def tox_on_install(tox_env: ToxVirtualEnv, *args) -> None: try: poetry = check_preconditions(tox_env) except exceptions.SkipEnvironment as err: