From: Thanh Ha Date: Tue, 5 Oct 2021 23:25:12 +0000 (-0400) Subject: Refactor: Resolve Flake8 F401 and F403 and F405 X-Git-Tag: v0.35.11~4 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F43%2F68943%2F2;p=releng%2Flftools.git Refactor: Resolve Flake8 F401 and F403 and F405 It's bad practice to use * imports (F405) since the methods or variables being imported could be undefined. Explicitly importing makes this more clear. Also F403 violation makes it difficult to detect undefined names. Additionally F401 violation to allow an indirect module import makes things harder to debug. It's better to be explicit. https://www.flake8rules.com/rules/F401.html https://www.flake8rules.com/rules/F403.html https://www.flake8rules.com/rules/F405.html Change-Id: Ib938f865d3ac6456216a119c830d3b013932bf88 Signed-off-by: Thanh Ha --- diff --git a/lftools/cli/nexus2/__init__.py b/lftools/cli/nexus2/__init__.py index f7e6d967..955b389c 100644 --- a/lftools/cli/nexus2/__init__.py +++ b/lftools/cli/nexus2/__init__.py @@ -13,12 +13,14 @@ __author__ = "DW Talton" +import click + from lftools.api.endpoints import nexus2 -from .privilege import * -from .repository import * -from .role import * -from .user import * +from .privilege import privilege +from .repository import repo +from .role import role +from .user import user @click.group(name="nexus2") diff --git a/lftools/cli/nexus3/__init__.py b/lftools/cli/nexus3/__init__.py index 43a8bcf0..ab102e8a 100644 --- a/lftools/cli/nexus3/__init__.py +++ b/lftools/cli/nexus3/__init__.py @@ -12,14 +12,18 @@ __author__ = "DW Talton" -from .asset import * -from .privilege import * -from .repository import * -from .role import * -from .script import * -from .tag import * -from .task import * -from .user import * +import click + +from lftools.api.endpoints import nexus3 + +from .asset import asset +from .privilege import privilege +from .repository import repository +from .role import role +from .script import script +from .tag import tag +from .task import task +from .user import user @click.group(name="nexus3") diff --git a/lftools/cli/nexus3/repository.py b/lftools/cli/nexus3/repository.py index 49fa790e..2abfa175 100644 --- a/lftools/cli/nexus3/repository.py +++ b/lftools/cli/nexus3/repository.py @@ -17,8 +17,6 @@ from pprint import pformat import click -from lftools.api.endpoints import nexus3 # noqa: F401 - log = logging.getLogger(__name__) diff --git a/lftools/cli/nexus3/role.py b/lftools/cli/nexus3/role.py index ceba7da3..f3f2530a 100644 --- a/lftools/cli/nexus3/role.py +++ b/lftools/cli/nexus3/role.py @@ -18,8 +18,6 @@ from pprint import pformat import click from tabulate import tabulate -from lftools.api.endpoints import nexus3 # noqa: F401 - log = logging.getLogger(__name__) diff --git a/lftools/cli/nexus3/script.py b/lftools/cli/nexus3/script.py index 2b467211..6cbbca9f 100644 --- a/lftools/cli/nexus3/script.py +++ b/lftools/cli/nexus3/script.py @@ -16,8 +16,6 @@ import logging import click -from lftools.api.endpoints import nexus3 # noqa: F401 - log = logging.getLogger(__name__) diff --git a/lftools/cli/nexus3/task.py b/lftools/cli/nexus3/task.py index 72b26703..7febee83 100644 --- a/lftools/cli/nexus3/task.py +++ b/lftools/cli/nexus3/task.py @@ -17,8 +17,6 @@ import logging import click from tabulate import tabulate -from lftools.api.endpoints import nexus3 # noqa: F401 - log = logging.getLogger(__name__) diff --git a/lftools/cli/nexus3/user.py b/lftools/cli/nexus3/user.py index 4c2e2575..5aad400d 100644 --- a/lftools/cli/nexus3/user.py +++ b/lftools/cli/nexus3/user.py @@ -17,8 +17,6 @@ import logging import click from tabulate import tabulate -from lftools.api.endpoints import nexus3 # noqa: F401 - log = logging.getLogger(__name__)