From 1324ce1a439befb4620953a4df1f70b74bf70cbd Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Fri, 3 Jun 2022 16:47:51 -0700 Subject: [PATCH] chore: enable pylint check: "redefined-outer-name", Enable the pylint check "redefined-outer-name" and fix the errors detected. --- gitlab/cli.py | 4 ++-- gitlab/client.py | 7 +++---- pyproject.toml | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gitlab/cli.py b/gitlab/cli.py index 18618ebc8..d6e7d7769 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -252,10 +252,10 @@ def _get_base_parser(add_help: bool = True) -> argparse.ArgumentParser: def _get_parser() -> argparse.ArgumentParser: # NOTE: We must delay import of gitlab.v4.cli until now or # otherwise it will cause circular import errors - import gitlab.v4.cli + from gitlab.v4 import cli as v4_cli parser = _get_base_parser() - return gitlab.v4.cli.extend_parser(parser) + return v4_cli.extend_parser(parser) def _parse_value(v: Any) -> Any: diff --git a/gitlab/client.py b/gitlab/client.py index 0019c0e75..f5d12dfc1 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -119,9 +119,8 @@ def __init__( raise ModuleNotFoundError(f"gitlab.v{self._api_version}.objects") # NOTE: We must delay import of gitlab.v4.objects until now or # otherwise it will cause circular import errors - import gitlab.v4.objects + from gitlab.v4 import objects - objects = gitlab.v4.objects self._objects = objects self.user: Optional[objects.CurrentUser] = None @@ -214,9 +213,9 @@ def __setstate__(self, state: Dict[str, Any]) -> None: ) # pragma: no cover, dead code currently # NOTE: We must delay import of gitlab.v4.objects until now or # otherwise it will cause circular import errors - import gitlab.v4.objects + from gitlab.v4 import objects - self._objects = gitlab.v4.objects + self._objects = objects @property def url(self) -> str: diff --git a/pyproject.toml b/pyproject.toml index 986c7ca2a..fc6c1eca9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,6 @@ disable = [ "missing-module-docstring", "protected-access", "redefined-builtin", - "redefined-outer-name", "signature-differs", "too-few-public-methods", "too-many-ancestors",