From ff21eb664871904137e6df18308b6e90290ad490 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 17 Apr 2021 14:20:05 -0700 Subject: [PATCH] chore: fix F401 errors reported by flake8 F401: Module imported but unused https://www.flake8rules.com/rules/F401.html --- gitlab/__init__.py | 10 +-- gitlab/cli.py | 2 +- gitlab/mixins.py | 1 - gitlab/tests/objects/test_bridges.py | 4 +- gitlab/tests/objects/test_submodules.py | 2 - gitlab/tests/test_config.py | 1 - gitlab/tests/test_gitlab_http_methods.py | 2 +- gitlab/v4/objects/commits.py | 2 +- gitlab/v4/objects/discussions.py | 2 +- gitlab/v4/objects/epics.py | 2 +- gitlab/v4/objects/events.py | 1 - gitlab/v4/objects/groups.py | 38 +++++------ gitlab/v4/objects/issues.py | 8 +-- gitlab/v4/objects/merge_requests.py | 10 +-- gitlab/v4/objects/milestones.py | 1 - gitlab/v4/objects/notes.py | 4 +- gitlab/v4/objects/pipelines.py | 2 +- gitlab/v4/objects/projects.py | 85 ++++++++++++------------ gitlab/v4/objects/releases.py | 2 - gitlab/v4/objects/repositories.py | 2 +- gitlab/v4/objects/services.py | 1 - gitlab/v4/objects/snippets.py | 6 +- gitlab/v4/objects/users.py | 4 +- tox.ini | 2 + 24 files changed, 93 insertions(+), 101 deletions(-) diff --git a/gitlab/__init__.py b/gitlab/__init__.py index b264e5a3b..4d3ebfb3a 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -18,8 +18,8 @@ import warnings -import gitlab.config -from gitlab.__version__ import ( +import gitlab.config # noqa: F401 +from gitlab.__version__ import ( # noqa: F401 __author__, __copyright__, __email__, @@ -27,9 +27,9 @@ __title__, __version__, ) -from gitlab.client import Gitlab, GitlabList -from gitlab.const import * # noqa -from gitlab.exceptions import * # noqa +from gitlab.client import Gitlab, GitlabList # noqa: F401 +from gitlab.const import * # noqa: F401,F403 +from gitlab.exceptions import * # noqa: F401,F403 warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab") diff --git a/gitlab/cli.py b/gitlab/cli.py index bd2c13d9f..ce50406c6 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -23,7 +23,7 @@ import sys from typing import Any, Callable, Dict, Optional, Tuple, Union -import gitlab.config +import gitlab.config # noqa: F401 camel_re = re.compile("(.)([A-Z])") diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 9fce3da2a..ea6f3a8b9 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -22,7 +22,6 @@ Dict, List, Optional, - Tuple, Type, TYPE_CHECKING, Union, diff --git a/gitlab/tests/objects/test_bridges.py b/gitlab/tests/objects/test_bridges.py index ea8c6349a..4d3918628 100644 --- a/gitlab/tests/objects/test_bridges.py +++ b/gitlab/tests/objects/test_bridges.py @@ -1,12 +1,10 @@ """ GitLab API: https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-bridges """ -import re - import pytest import responses -from gitlab.v4.objects import Project, ProjectPipelineBridge +from gitlab.v4.objects import ProjectPipelineBridge @pytest.fixture diff --git a/gitlab/tests/objects/test_submodules.py b/gitlab/tests/objects/test_submodules.py index 539af7b5c..69c1cd777 100644 --- a/gitlab/tests/objects/test_submodules.py +++ b/gitlab/tests/objects/test_submodules.py @@ -4,8 +4,6 @@ import pytest import responses -from gitlab.v4.objects import Project - @pytest.fixture def resp_update_submodule(): diff --git a/gitlab/tests/test_config.py b/gitlab/tests/test_config.py index b456cff2d..18b54c8bb 100644 --- a/gitlab/tests/test_config.py +++ b/gitlab/tests/test_config.py @@ -16,7 +16,6 @@ # along with this program. If not, see . import os -import unittest from textwrap import dedent import mock diff --git a/gitlab/tests/test_gitlab_http_methods.py b/gitlab/tests/test_gitlab_http_methods.py index 7d9e61e6f..020fabf23 100644 --- a/gitlab/tests/test_gitlab_http_methods.py +++ b/gitlab/tests/test_gitlab_http_methods.py @@ -3,7 +3,7 @@ from httmock import HTTMock, urlmatch, response -from gitlab import * +from gitlab import GitlabHttpError, GitlabList, GitlabParsingError def test_build_url(gl): diff --git a/gitlab/v4/objects/commits.py b/gitlab/v4/objects/commits.py index bb81407d5..037a90d3f 100644 --- a/gitlab/v4/objects/commits.py +++ b/gitlab/v4/objects/commits.py @@ -2,7 +2,7 @@ from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CreateMixin, ListMixin, RefreshMixin, RetrieveMixin -from .discussions import ProjectCommitDiscussionManager +from .discussions import ProjectCommitDiscussionManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/discussions.py b/gitlab/v4/objects/discussions.py index 347715834..2209185f7 100644 --- a/gitlab/v4/objects/discussions.py +++ b/gitlab/v4/objects/discussions.py @@ -1,6 +1,6 @@ from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin -from .notes import ( +from .notes import ( # noqa: F401 ProjectCommitDiscussionNoteManager, ProjectIssueDiscussionNoteManager, ProjectMergeRequestDiscussionNoteManager, diff --git a/gitlab/v4/objects/epics.py b/gitlab/v4/objects/epics.py index 600378db4..023d0a606 100644 --- a/gitlab/v4/objects/epics.py +++ b/gitlab/v4/objects/epics.py @@ -10,7 +10,7 @@ SaveMixin, UpdateMixin, ) -from .events import GroupEpicResourceLabelEventManager +from .events import GroupEpicResourceLabelEventManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/events.py b/gitlab/v4/objects/events.py index d1c3cb4a9..98936da70 100644 --- a/gitlab/v4/objects/events.py +++ b/gitlab/v4/objects/events.py @@ -1,4 +1,3 @@ -from gitlab import exceptions as exc from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ListMixin, RetrieveMixin diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py index 588c50614..bc8388999 100644 --- a/gitlab/v4/objects/groups.py +++ b/gitlab/v4/objects/groups.py @@ -2,25 +2,25 @@ from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin -from .access_requests import GroupAccessRequestManager -from .audit_events import GroupAuditEventManager -from .badges import GroupBadgeManager -from .boards import GroupBoardManager -from .custom_attributes import GroupCustomAttributeManager -from .export_import import GroupExportManager, GroupImportManager -from .epics import GroupEpicManager -from .issues import GroupIssueManager -from .labels import GroupLabelManager -from .members import GroupMemberManager -from .merge_requests import GroupMergeRequestManager -from .milestones import GroupMilestoneManager -from .notification_settings import GroupNotificationSettingsManager -from .packages import GroupPackageManager -from .projects import GroupProjectManager -from .runners import GroupRunnerManager -from .variables import GroupVariableManager -from .clusters import GroupClusterManager -from .deploy_tokens import GroupDeployTokenManager +from .access_requests import GroupAccessRequestManager # noqa: F401 +from .audit_events import GroupAuditEventManager # noqa: F401 +from .badges import GroupBadgeManager # noqa: F401 +from .boards import GroupBoardManager # noqa: F401 +from .custom_attributes import GroupCustomAttributeManager # noqa: F401 +from .export_import import GroupExportManager, GroupImportManager # noqa: F401 +from .epics import GroupEpicManager # noqa: F401 +from .issues import GroupIssueManager # noqa: F401 +from .labels import GroupLabelManager # noqa: F401 +from .members import GroupMemberManager # noqa: F401 +from .merge_requests import GroupMergeRequestManager # noqa: F401 +from .milestones import GroupMilestoneManager # noqa: F401 +from .notification_settings import GroupNotificationSettingsManager # noqa: F401 +from .packages import GroupPackageManager # noqa: F401 +from .projects import GroupProjectManager # noqa: F401 +from .runners import GroupRunnerManager # noqa: F401 +from .variables import GroupVariableManager # noqa: F401 +from .clusters import GroupClusterManager # noqa: F401 +from .deploy_tokens import GroupDeployTokenManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py index 4da7f910c..1854eb336 100644 --- a/gitlab/v4/objects/issues.py +++ b/gitlab/v4/objects/issues.py @@ -15,13 +15,13 @@ TodoMixin, UserAgentDetailMixin, ) -from .award_emojis import ProjectIssueAwardEmojiManager -from .discussions import ProjectIssueDiscussionManager -from .events import ( +from .award_emojis import ProjectIssueAwardEmojiManager # noqa: F401 +from .discussions import ProjectIssueDiscussionManager # noqa: F401 +from .events import ( # noqa: F401 ProjectIssueResourceLabelEventManager, ProjectIssueResourceMilestoneEventManager, ) -from .notes import ProjectIssueNoteManager +from .notes import ProjectIssueNoteManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py index f9b305a1a..149179392 100644 --- a/gitlab/v4/objects/merge_requests.py +++ b/gitlab/v4/objects/merge_requests.py @@ -14,14 +14,14 @@ ) from .commits import ProjectCommit, ProjectCommitManager from .issues import ProjectIssue, ProjectIssueManager -from .merge_request_approvals import ( +from .merge_request_approvals import ( # noqa: F401 ProjectMergeRequestApprovalManager, ProjectMergeRequestApprovalRuleManager, ) -from .award_emojis import ProjectMergeRequestAwardEmojiManager -from .discussions import ProjectMergeRequestDiscussionManager -from .notes import ProjectMergeRequestNoteManager -from .events import ( +from .award_emojis import ProjectMergeRequestAwardEmojiManager # noqa: F401 +from .discussions import ProjectMergeRequestDiscussionManager # noqa: F401 +from .notes import ProjectMergeRequestNoteManager # noqa: F401 +from .events import ( # noqa: F401 ProjectMergeRequestResourceLabelEventManager, ProjectMergeRequestResourceMilestoneEventManager, ) diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py index 748f0c6ed..463fbf61c 100644 --- a/gitlab/v4/objects/milestones.py +++ b/gitlab/v4/objects/milestones.py @@ -7,7 +7,6 @@ ProjectMergeRequest, ProjectMergeRequestManager, GroupMergeRequest, - GroupMergeRequestManager, ) diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py index 362f901f8..6fa50b9f7 100644 --- a/gitlab/v4/objects/notes.py +++ b/gitlab/v4/objects/notes.py @@ -1,5 +1,3 @@ -from gitlab import cli -from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( CRUDMixin, @@ -11,7 +9,7 @@ SaveMixin, UpdateMixin, ) -from .award_emojis import ( +from .award_emojis import ( # noqa: F401 ProjectIssueNoteAwardEmojiManager, ProjectMergeRequestNoteAwardEmojiManager, ProjectSnippetNoteAwardEmojiManager, diff --git a/gitlab/v4/objects/pipelines.py b/gitlab/v4/objects/pipelines.py index 703d40b41..bafab9b1b 100644 --- a/gitlab/v4/objects/pipelines.py +++ b/gitlab/v4/objects/pipelines.py @@ -1,4 +1,4 @@ -from gitlab import cli, types +from gitlab import cli from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index c78c8c9c0..3dba95dbd 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -11,55 +11,58 @@ UpdateMixin, ) -from .project_access_tokens import ProjectAccessTokenManager -from .access_requests import ProjectAccessRequestManager -from .badges import ProjectBadgeManager -from .boards import ProjectBoardManager -from .branches import ProjectBranchManager, ProjectProtectedBranchManager -from .clusters import ProjectClusterManager -from .commits import ProjectCommitManager -from .container_registry import ProjectRegistryRepositoryManager -from .custom_attributes import ProjectCustomAttributeManager -from .deploy_keys import ProjectKeyManager -from .deploy_tokens import ProjectDeployTokenManager -from .deployments import ProjectDeploymentManager -from .environments import ProjectEnvironmentManager -from .events import ProjectEventManager -from .audit_events import ProjectAuditEventManager -from .export_import import ProjectExportManager, ProjectImportManager -from .files import ProjectFileManager -from .hooks import ProjectHookManager -from .issues import ProjectIssueManager -from .jobs import ProjectJobManager -from .labels import ProjectLabelManager -from .members import ProjectMemberManager -from .merge_request_approvals import ProjectApprovalManager, ProjectApprovalRuleManager -from .merge_requests import ProjectMergeRequestManager -from .milestones import ProjectMilestoneManager -from .notes import ProjectNoteManager -from .notification_settings import ProjectNotificationSettingsManager -from .packages import ProjectPackageManager -from .pages import ProjectPagesDomainManager -from .pipelines import ( +from .project_access_tokens import ProjectAccessTokenManager # noqa: F401 +from .access_requests import ProjectAccessRequestManager # noqa: F401 +from .badges import ProjectBadgeManager # noqa: F401 +from .boards import ProjectBoardManager # noqa: F401 +from .branches import ProjectBranchManager, ProjectProtectedBranchManager # noqa: F401 +from .clusters import ProjectClusterManager # noqa: F401 +from .commits import ProjectCommitManager # noqa: F401 +from .container_registry import ProjectRegistryRepositoryManager # noqa: F401 +from .custom_attributes import ProjectCustomAttributeManager # noqa: F401 +from .deploy_keys import ProjectKeyManager # noqa: F401 +from .deploy_tokens import ProjectDeployTokenManager # noqa: F401 +from .deployments import ProjectDeploymentManager # noqa: F401 +from .environments import ProjectEnvironmentManager # noqa: F401 +from .events import ProjectEventManager # noqa: F401 +from .audit_events import ProjectAuditEventManager # noqa: F401 +from .export_import import ProjectExportManager, ProjectImportManager # noqa: F401 +from .files import ProjectFileManager # noqa: F401 +from .hooks import ProjectHookManager # noqa: F401 +from .issues import ProjectIssueManager # noqa: F401 +from .jobs import ProjectJobManager # noqa: F401 +from .labels import ProjectLabelManager # noqa: F401 +from .members import ProjectMemberManager # noqa: F401 +from .merge_request_approvals import ( # noqa: F401 + ProjectApprovalManager, + ProjectApprovalRuleManager, +) +from .merge_requests import ProjectMergeRequestManager # noqa: F401 +from .milestones import ProjectMilestoneManager # noqa: F401 +from .notes import ProjectNoteManager # noqa: F401 +from .notification_settings import ProjectNotificationSettingsManager # noqa: F401 +from .packages import ProjectPackageManager # noqa: F401 +from .pages import ProjectPagesDomainManager # noqa: F401 +from .pipelines import ( # noqa: F401 ProjectPipeline, ProjectPipelineManager, ProjectPipelineScheduleManager, ) -from .push_rules import ProjectPushRulesManager -from .releases import ProjectReleaseManager +from .push_rules import ProjectPushRulesManager # noqa: F401 +from .releases import ProjectReleaseManager # noqa: F401 from .repositories import RepositoryMixin -from .runners import ProjectRunnerManager -from .services import ProjectServiceManager -from .snippets import ProjectSnippetManager -from .statistics import ( +from .runners import ProjectRunnerManager # noqa: F401 +from .services import ProjectServiceManager # noqa: F401 +from .snippets import ProjectSnippetManager # noqa: F401 +from .statistics import ( # noqa: F401 ProjectAdditionalStatisticsManager, ProjectIssuesStatisticsManager, ) -from .tags import ProjectProtectedTagManager, ProjectTagManager -from .triggers import ProjectTriggerManager -from .users import ProjectUserManager -from .variables import ProjectVariableManager -from .wikis import ProjectWikiManager +from .tags import ProjectProtectedTagManager, ProjectTagManager # noqa: F401 +from .triggers import ProjectTriggerManager # noqa: F401 +from .users import ProjectUserManager # noqa: F401 +from .variables import ProjectVariableManager # noqa: F401 +from .wikis import ProjectWikiManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/releases.py b/gitlab/v4/objects/releases.py index 2c549b119..ea74adb25 100644 --- a/gitlab/v4/objects/releases.py +++ b/gitlab/v4/objects/releases.py @@ -1,5 +1,3 @@ -from gitlab import cli -from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py index 6a04174b9..a171ffbf3 100644 --- a/gitlab/v4/objects/repositories.py +++ b/gitlab/v4/objects/repositories.py @@ -4,7 +4,7 @@ Currently this module only contains repository-related methods for projects. """ -from gitlab import cli, types, utils +from gitlab import cli, utils from gitlab import exceptions as exc diff --git a/gitlab/v4/objects/services.py b/gitlab/v4/objects/services.py index c63833646..17bf63a7d 100644 --- a/gitlab/v4/objects/services.py +++ b/gitlab/v4/objects/services.py @@ -1,5 +1,4 @@ from gitlab import cli -from gitlab import exceptions as exc from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ( DeleteMixin, diff --git a/gitlab/v4/objects/snippets.py b/gitlab/v4/objects/snippets.py index 6159442aa..330cc8c76 100644 --- a/gitlab/v4/objects/snippets.py +++ b/gitlab/v4/objects/snippets.py @@ -3,9 +3,9 @@ from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin, UserAgentDetailMixin -from .award_emojis import ProjectSnippetAwardEmojiManager -from .discussions import ProjectSnippetDiscussionManager -from .notes import ProjectSnippetNoteManager, ProjectSnippetDiscussionNoteManager +from .award_emojis import ProjectSnippetAwardEmojiManager # noqa: F401 +from .discussions import ProjectSnippetDiscussionManager # noqa: F401 +from .notes import ProjectSnippetNoteManager # noqa: F401 __all__ = [ diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index 940cf07bb..c90a7c910 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -14,8 +14,8 @@ UpdateMixin, ) -from .custom_attributes import UserCustomAttributeManager -from .events import UserEventManager +from .custom_attributes import UserCustomAttributeManager # noqa: F401 +from .events import UserEventManager # noqa: F401 __all__ = [ diff --git a/tox.ini b/tox.ini index f45e74265..c521a3bb5 100644 --- a/tox.ini +++ b/tox.ini @@ -53,6 +53,8 @@ commands = {posargs} exclude = .git,.venv,.tox,dist,doc,*egg,build, max-line-length = 88 ignore = E501,H501,H803,W503 +per-file-ignores = + gitlab/v4/objects/__init__.py:F401,F403 [testenv:docs] deps = -r{toxinidir}/rtd-requirements.txt