Skip to content

Commit

Permalink
chore: fix import ordering using isort
Browse files Browse the repository at this point in the history
Fix the import ordering using isort.

https://pycqa.github.io/isort/
  • Loading branch information
JohnVillalovos committed May 25, 2021
1 parent dda646e commit f3afd34
Show file tree
Hide file tree
Showing 95 changed files with 81 additions and 143 deletions.
1 change: 0 additions & 1 deletion gitlab/__init__.py
Expand Up @@ -31,5 +31,4 @@
from gitlab.const import * # noqa: F401,F403
from gitlab.exceptions import * # noqa: F401,F403


warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab")
1 change: 0 additions & 1 deletion gitlab/__main__.py
@@ -1,5 +1,4 @@
import gitlab.cli


if __name__ == "__main__":
gitlab.cli.main()
3 changes: 2 additions & 1 deletion gitlab/base.py
Expand Up @@ -19,9 +19,10 @@
from types import ModuleType
from typing import Any, Dict, Iterable, NamedTuple, Optional, Tuple, Type

from .client import Gitlab, GitlabList
from gitlab import types as g_types

from .client import Gitlab, GitlabList

__all__ = [
"RequiredOptional",
"RESTObject",
Expand Down
1 change: 0 additions & 1 deletion gitlab/cli.py
Expand Up @@ -28,7 +28,6 @@
import gitlab.config
from gitlab.base import RESTObject


# This regex is based on:
# https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py
camel_upperlower_regex = re.compile(r"([A-Z]+)([A-Z][a-z])")
Expand Down
6 changes: 2 additions & 4 deletions gitlab/client.py
Expand Up @@ -17,17 +17,16 @@
"""Wrapper for the GitLab API."""

import time
from typing import cast, Any, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
from typing import Any, cast, Dict, List, Optional, Tuple, TYPE_CHECKING, Union

import requests
import requests.utils
from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore

import gitlab.config
import gitlab.const
import gitlab.exceptions
from gitlab import utils
from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore


REDIRECT_MSG = (
"python-gitlab detected an http to https redirection. You "
Expand Down Expand Up @@ -385,7 +384,6 @@ def _set_auth_info(self) -> None:

def enable_debug(self) -> None:
import logging

from http.client import HTTPConnection # noqa

HTTPConnection.debuglevel = 1 # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions gitlab/config.py
Expand Up @@ -15,12 +15,12 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import configparser
import os
import shlex
import subprocess
from typing import List, Optional, Union
from os.path import expanduser, expandvars
from typing import List, Optional, Union

from gitlab.const import USER_AGENT

Expand Down
1 change: 0 additions & 1 deletion gitlab/const.py
Expand Up @@ -17,7 +17,6 @@

from gitlab.__version__ import __title__, __version__


NO_ACCESS: int = 0
MINIMAL_ACCESS: int = 5
GUEST_ACCESS: int = 10
Expand Down
2 changes: 1 addition & 1 deletion gitlab/exceptions.py
Expand Up @@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import functools
from typing import Any, Callable, cast, Optional, Type, TypeVar, TYPE_CHECKING, Union
from typing import Any, Callable, cast, Optional, Type, TYPE_CHECKING, TypeVar, Union


class GitlabError(Exception):
Expand Down
5 changes: 2 additions & 3 deletions gitlab/mixins.py
Expand Up @@ -15,6 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import warnings
from types import ModuleType
from typing import (
Any,
Expand All @@ -31,12 +32,10 @@
import requests

import gitlab
from gitlab import base
from gitlab import cli
from gitlab import base, cli
from gitlab import exceptions as exc
from gitlab import types as g_types
from gitlab import utils
import warnings

__all__ = [
"GetMixin",
Expand Down
1 change: 1 addition & 0 deletions gitlab/tests/conftest.py
@@ -1,4 +1,5 @@
import pytest

import gitlab


Expand Down
2 changes: 1 addition & 1 deletion gitlab/tests/mixins/test_meta_mixins.py
Expand Up @@ -5,8 +5,8 @@
GetMixin,
ListMixin,
NoUpdateMixin,
UpdateMixin,
RetrieveMixin,
UpdateMixin,
)


Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/mixins/test_mixin_methods.py
@@ -1,5 +1,4 @@
import pytest

from httmock import HTTMock, response, urlmatch # noqa

from gitlab import base
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_appearance.py
Expand Up @@ -5,7 +5,6 @@
import pytest
import responses


title = "GitLab Test Instance"
description = "gitlab-test.example.com"
new_title = "new-title"
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_applications.py
Expand Up @@ -5,7 +5,6 @@
import pytest
import responses


title = "GitLab Test Instance"
description = "gitlab-test.example.com"
new_title = "new-title"
Expand Down
2 changes: 1 addition & 1 deletion gitlab/tests/objects/test_badges.py
Expand Up @@ -7,7 +7,7 @@
import pytest
import responses

from gitlab.v4.objects import ProjectBadge, GroupBadge
from gitlab.v4.objects import GroupBadge, ProjectBadge

link_url = (
"http://example.com/ci_status.svg?project=example-org/example-project&ref=master"
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_deploy_tokens.py
Expand Up @@ -6,7 +6,6 @@

from gitlab.v4.objects import ProjectDeployToken


create_content = {
"id": 1,
"name": "test_deploy_token",
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_job_artifacts.py
Expand Up @@ -5,7 +5,6 @@
import pytest
import responses


ref_name = "master"
job = "build"

Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_jobs.py
Expand Up @@ -6,7 +6,6 @@

from gitlab.v4.objects import ProjectJob


job_content = {
"commit": {
"author_email": "admin@example.com",
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_packages.py
Expand Up @@ -8,7 +8,6 @@

from gitlab.v4.objects import GroupPackage, ProjectPackage, ProjectPackageFile


package_content = {
"id": 1,
"name": "com/mycompany/my-app",
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_pipelines.py
Expand Up @@ -6,7 +6,6 @@

from gitlab.v4.objects import ProjectPipeline


pipeline_content = {
"id": 46,
"project_id": 1,
Expand Down
Expand Up @@ -9,7 +9,6 @@

import gitlab


approval_rule_id = 1
approval_rule_name = "security"
approvals_required = 3
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_projects.py
Expand Up @@ -7,7 +7,6 @@

from gitlab.v4.objects import Project


project_content = {"name": "name", "id": 1}
import_content = {
"id": 1,
Expand Down
2 changes: 1 addition & 1 deletion gitlab/tests/objects/test_resource_label_events.py
Expand Up @@ -6,9 +6,9 @@
import responses

from gitlab.v4.objects import (
GroupEpicResourceLabelEvent,
ProjectIssueResourceLabelEvent,
ProjectMergeRequestResourceLabelEvent,
GroupEpicResourceLabelEvent,
)


Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_resource_state_events.py
Expand Up @@ -10,7 +10,6 @@
ProjectMergeRequestResourceStateEvent,
)


issue_event_content = {"id": 1, "resource_type": "Issue"}
mr_event_content = {"id": 1, "resource_type": "MergeRequest"}

Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_runners.py
Expand Up @@ -5,7 +5,6 @@

import gitlab


runner_detail = {
"active": True,
"architecture": "amd64",
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_snippets.py
Expand Up @@ -6,7 +6,6 @@
import pytest
import responses


title = "Example Snippet Title"
visibility = "private"
new_title = "new-title"
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_todos.py
Expand Up @@ -10,7 +10,6 @@

from gitlab.v4.objects import Todo


with open(os.path.dirname(__file__) + "/../data/todo.json", "r") as json_file:
todo_content = json_file.read()
json_content = json.loads(todo_content)
Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/objects/test_variables.py
Expand Up @@ -12,7 +12,6 @@

from gitlab.v4.objects import GroupVariable, ProjectVariable, Variable


key = "TEST_VARIABLE_1"
value = "TEST_1"
new_value = "TEST_2"
Expand Down
3 changes: 2 additions & 1 deletion gitlab/tests/test_base.py
Expand Up @@ -17,9 +17,10 @@

import pickle

from gitlab import base
import pytest

from gitlab import base


class FakeGitlab(object):
pass
Expand Down
3 changes: 1 addition & 2 deletions gitlab/tests/test_cli.py
Expand Up @@ -17,10 +17,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import argparse
import io
import os
import tempfile
import io

from contextlib import redirect_stderr # noqa: H302

import pytest
Expand Down
5 changes: 2 additions & 3 deletions gitlab/tests/test_config.py
Expand Up @@ -15,15 +15,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import io
import os
from textwrap import dedent

import mock
import io

from gitlab import config, USER_AGENT
import pytest

from gitlab import config, USER_AGENT

custom_user_agent = "my-package/1.0.0"

Expand Down
1 change: 0 additions & 1 deletion gitlab/tests/test_gitlab.py
Expand Up @@ -24,7 +24,6 @@
from gitlab import Gitlab, GitlabList, USER_AGENT
from gitlab.v4.objects import CurrentUser


username = "username"
user_id = 1

Expand Down
3 changes: 1 addition & 2 deletions gitlab/tests/test_gitlab_http_methods.py
@@ -1,7 +1,6 @@
import pytest
import requests

from httmock import HTTMock, urlmatch, response
from httmock import HTTMock, response, urlmatch

from gitlab import GitlabHttpError, GitlabList, GitlabParsingError

Expand Down
2 changes: 1 addition & 1 deletion gitlab/v4/cli.py
Expand Up @@ -22,8 +22,8 @@

import gitlab
import gitlab.base
from gitlab import cli
import gitlab.v4.objects
from gitlab import cli


class GitlabCLI(object):
Expand Down
5 changes: 2 additions & 3 deletions gitlab/v4/objects/__init__.py
Expand Up @@ -29,8 +29,8 @@
from .container_registry import *
from .custom_attributes import *
from .deploy_keys import *
from .deployments import *
from .deploy_tokens import *
from .deployments import *
from .discussions import *
from .environments import *
from .epics import *
Expand All @@ -54,6 +54,7 @@
from .notification_settings import *
from .packages import *
from .pages import *
from .personal_access_tokens import *
from .pipelines import *
from .projects import *
from .push_rules import *
Expand All @@ -71,8 +72,6 @@
from .users import *
from .variables import *
from .wikis import *
from .personal_access_tokens import *


# TODO: deprecate these in favor of gitlab.const.*
VISIBILITY_PRIVATE = "private"
Expand Down
1 change: 0 additions & 1 deletion gitlab/v4/objects/access_requests.py
Expand Up @@ -7,7 +7,6 @@
ObjectDeleteMixin,
)


__all__ = [
"GroupAccessRequest",
"GroupAccessRequestManager",
Expand Down
1 change: 0 additions & 1 deletion gitlab/v4/objects/appearance.py
Expand Up @@ -2,7 +2,6 @@
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin


__all__ = [
"ApplicationAppearance",
"ApplicationAppearanceManager",
Expand Down
1 change: 0 additions & 1 deletion gitlab/v4/objects/award_emojis.py
@@ -1,7 +1,6 @@
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin


__all__ = [
"ProjectIssueAwardEmoji",
"ProjectIssueAwardEmojiManager",
Expand Down
1 change: 0 additions & 1 deletion gitlab/v4/objects/badges.py
@@ -1,7 +1,6 @@
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import BadgeRenderMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin


__all__ = [
"GroupBadge",
"GroupBadgeManager",
Expand Down

0 comments on commit f3afd34

Please sign in to comment.