diff options
author | John L. Villalovos <john@sodarock.com> | 2022-01-03 22:11:46 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2022-01-03 22:11:46 -0800 |
commit | 6b3e7c0f5f77baed94cc807b7087feaaf0fac121 (patch) | |
tree | a9d8d3b3f04b072e6707f775861e1835e94afc8d /gitlab/__init__.py | |
parent | 789122d5df9b4f39331e23c7fdb6e9021e7836cf (diff) | |
download | gitlab-jlvillal/relative_imports.tar.gz |
chore: convert to using relative importsjlvillal/relative_imports
Switch to using relative imports to ensure that we are importing from
within our library.
Also use the form:
from foo import bar as bar
When we want to signify that we want the import to be re-exported.
https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport
Diffstat (limited to 'gitlab/__init__.py')
-rw-r--r-- | gitlab/__init__.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index be1794a..e354354 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -19,17 +19,18 @@ import warnings from typing import Any -import gitlab.config # noqa: F401 -from gitlab.version import ( # noqa: F401 - __author__, - __copyright__, - __email__, - __license__, - __title__, - __version__, -) -from gitlab.client import Gitlab, GitlabList # noqa: F401 -from gitlab.exceptions import * # noqa: F401,F403 +from . import config as config # noqa: F401 +from . import const as const +from . import exceptions as exceptions # noqa: F401 +from .client import Gitlab as Gitlab # noqa: F401 +from .client import GitlabList as GitlabList # noqa: F401 +from .exceptions import * # noqa: F401,F403 +from .version import __author__ as __author__ # noqa: F401 +from .version import __copyright__ as __copyright__ # noqa: F401 +from .version import __email__ as __email__ # noqa: F401 +from .version import __license__ as __license__ # noqa: F401 +from .version import __title__ as __title__ # noqa: F401 +from .version import __version__ as __version__ # noqa: F401 warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab") @@ -39,12 +40,12 @@ warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab" # 'from gitlab.const import *' statement. def __getattr__(name: str) -> Any: # Deprecate direct access to constants without namespace - if name in gitlab.const._DEPRECATED: + if name in const._DEPRECATED: warnings.warn( f"\nDirect access to 'gitlab.{name}' is deprecated and will be " f"removed in a future major python-gitlab release. Please " f"use 'gitlab.const.{name}' instead.", DeprecationWarning, ) - return getattr(gitlab.const, name) + return getattr(const, name) raise AttributeError(f"module {__name__} has no attribute {name}") |