summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/lint.yml2
-rw-r--r--README.rst5
-rw-r--r--docker-requirements.txt2
-rw-r--r--gitlab/__init__.py1
-rw-r--r--gitlab/base.py12
-rw-r--r--gitlab/cli.py21
-rw-r--r--gitlab/client.py216
-rw-r--r--gitlab/config.py11
-rw-r--r--gitlab/const.py60
-rw-r--r--gitlab/utils.py20
-rw-r--r--gitlab/v4/objects/access_requests.py10
-rw-r--r--gitlab/v4/objects/appearance.py4
-rw-r--r--gitlab/v4/objects/applications.py4
-rw-r--r--gitlab/v4/objects/audit_events.py4
-rw-r--r--gitlab/v4/objects/award_emojis.py4
-rw-r--r--gitlab/v4/objects/badges.py4
-rw-r--r--gitlab/v4/objects/boards.py4
-rw-r--r--gitlab/v4/objects/branches.py4
-rw-r--r--gitlab/v4/objects/broadcast_messages.py4
-rw-r--r--gitlab/v4/objects/clusters.py4
-rw-r--r--gitlab/v4/objects/commits.py4
-rw-r--r--gitlab/v4/objects/container_registry.py4
-rw-r--r--gitlab/v4/objects/custom_attributes.py4
-rw-r--r--gitlab/v4/objects/deploy_keys.py4
-rw-r--r--gitlab/v4/objects/deploy_tokens.py4
-rw-r--r--gitlab/v4/objects/deployments.py4
-rw-r--r--gitlab/v4/objects/discussions.py4
-rw-r--r--gitlab/v4/objects/environments.py11
-rw-r--r--gitlab/v4/objects/epics.py12
-rw-r--r--gitlab/v4/objects/events.py4
-rw-r--r--gitlab/v4/objects/export_import.py4
-rw-r--r--gitlab/v4/objects/features.py4
-rw-r--r--gitlab/v4/objects/files.py11
-rw-r--r--gitlab/v4/objects/geo_nodes.py10
-rw-r--r--gitlab/v4/objects/groups.py4
-rw-r--r--gitlab/v4/objects/hooks.py4
-rw-r--r--gitlab/v4/objects/issues.py17
-rw-r--r--gitlab/v4/objects/jobs.py4
-rw-r--r--gitlab/v4/objects/labels.py13
-rw-r--r--gitlab/v4/objects/ldap.py3
-rw-r--r--gitlab/v4/objects/members.py4
-rw-r--r--gitlab/v4/objects/merge_request_approvals.py12
-rw-r--r--gitlab/v4/objects/merge_requests.py14
-rw-r--r--gitlab/v4/objects/milestones.py4
-rw-r--r--gitlab/v4/objects/namespaces.py4
-rw-r--r--gitlab/v4/objects/notes.py13
-rw-r--r--gitlab/v4/objects/notification_settings.py4
-rw-r--r--gitlab/v4/objects/packages.py4
-rw-r--r--gitlab/v4/objects/pages.py4
-rw-r--r--gitlab/v4/objects/personal_access_tokens.py4
-rw-r--r--gitlab/v4/objects/pipelines.py14
-rw-r--r--gitlab/v4/objects/projects.py12
-rw-r--r--gitlab/v4/objects/push_rules.py11
-rw-r--r--gitlab/v4/objects/releases.py4
-rw-r--r--gitlab/v4/objects/runners.py10
-rw-r--r--gitlab/v4/objects/services.py11
-rw-r--r--gitlab/v4/objects/settings.py4
-rw-r--r--gitlab/v4/objects/sidekiq.py3
-rw-r--r--gitlab/v4/objects/snippets.py4
-rw-r--r--gitlab/v4/objects/statistics.py4
-rw-r--r--gitlab/v4/objects/tags.py4
-rw-r--r--gitlab/v4/objects/templates.py4
-rw-r--r--gitlab/v4/objects/todos.py4
-rw-r--r--gitlab/v4/objects/triggers.py4
-rw-r--r--gitlab/v4/objects/users.py27
-rw-r--r--gitlab/v4/objects/variables.py4
-rw-r--r--gitlab/v4/objects/wikis.py4
67 files changed, 460 insertions, 260 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 4b918df..4c11810 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- - uses: wagoid/commitlint-github-action@v2
+ - uses: wagoid/commitlint-github-action@v3
mypy:
runs-on: ubuntu-latest
diff --git a/README.rst b/README.rst
index 647091a..9e8c212 100644
--- a/README.rst
+++ b/README.rst
@@ -73,6 +73,11 @@ Bug reports
Please report bugs and feature requests at
https://github.com/python-gitlab/python-gitlab/issues.
+Gitter Community Chat
+=====================
+
+There is a `gitter <https://gitter.im/python-gitlab/Lobby>`_ community chat
+available at https://gitter.im/python-gitlab/Lobby
Documentation
=============
diff --git a/docker-requirements.txt b/docker-requirements.txt
index 5f8431b..335d732 100644
--- a/docker-requirements.txt
+++ b/docker-requirements.txt
@@ -1,5 +1,5 @@
-r requirements.txt
-r test-requirements.txt
-docker-compose==1.28.4 # prevent inconsistent .env behavior from system install
+docker-compose==1.28.5 # prevent inconsistent .env behavior from system install
pytest-console-scripts
pytest-docker
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 2802615..b264e5a 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -30,7 +30,6 @@ from gitlab.__version__ import (
from gitlab.client import Gitlab, GitlabList
from gitlab.const import * # noqa
from gitlab.exceptions import * # noqa
-from gitlab import utils # noqa
warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab")
diff --git a/gitlab/base.py b/gitlab/base.py
index f0bedc7..30f0659 100644
--- a/gitlab/base.py
+++ b/gitlab/base.py
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import importlib
-from typing import Any, Dict, Optional
+from typing import Any, Dict, Optional, Type
from .client import Gitlab, GitlabList
@@ -171,7 +171,9 @@ class RESTObjectList(object):
_list: A GitlabList object
"""
- def __init__(self, manager: "RESTManager", obj_cls, _list: GitlabList) -> None:
+ def __init__(
+ self, manager: "RESTManager", obj_cls: Type[RESTObject], _list: GitlabList
+ ) -> None:
"""Creates an objects list from a GitlabList.
You should not create objects of this type, but use managers list()
@@ -205,7 +207,7 @@ class RESTObjectList(object):
return self._list.current_page
@property
- def prev_page(self) -> int:
+ def prev_page(self) -> Optional[int]:
"""The previous page number.
If None, the current page is the first.
@@ -213,7 +215,7 @@ class RESTObjectList(object):
return self._list.prev_page
@property
- def next_page(self) -> int:
+ def next_page(self) -> Optional[int]:
"""The next page number.
If None, the current page is the last.
@@ -246,7 +248,7 @@ class RESTManager(object):
"""
_path: Optional[str] = None
- _obj_cls: Optional[Any] = None
+ _obj_cls: Optional[Type[RESTObject]] = None
_from_parent_attrs: Dict[str, Any] = {}
def __init__(self, gl: Gitlab, parent: Optional[RESTObject] = None) -> None:
diff --git a/gitlab/cli.py b/gitlab/cli.py
index 3a315a8..1e98a38 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -21,6 +21,7 @@ import argparse
import functools
import re
import sys
+from typing import Any, Callable, Dict, Tuple
import gitlab.config
@@ -31,11 +32,13 @@ camel_re = re.compile("(.)([A-Z])")
# action: (mandatory_args, optional_args, in_obj),
# },
# }
-custom_actions = {}
+custom_actions: Dict[str, Dict[str, Tuple[Tuple[Any, ...], Tuple[Any, ...], bool]]] = {}
-def register_custom_action(cls_names, mandatory=tuple(), optional=tuple()):
- def wrap(f):
+def register_custom_action(
+ cls_names, mandatory: Tuple[Any, ...] = tuple(), optional: Tuple[Any, ...] = tuple()
+) -> Callable:
+ def wrap(f) -> Callable:
@functools.wraps(f)
def wrapped_f(*args, **kwargs):
return f(*args, **kwargs)
@@ -62,22 +65,22 @@ def register_custom_action(cls_names, mandatory=tuple(), optional=tuple()):
return wrap
-def die(msg, e=None):
+def die(msg: str, e=None) -> None:
if e:
msg = "%s (%s)" % (msg, e)
sys.stderr.write(msg + "\n")
sys.exit(1)
-def what_to_cls(what):
+def what_to_cls(what: str) -> str:
return "".join([s.capitalize() for s in what.split("-")])
-def cls_to_what(cls):
+def cls_to_what(cls) -> str:
return camel_re.sub(r"\1-\2", cls.__name__).lower()
-def _get_base_parser(add_help=True):
+def _get_base_parser(add_help: bool = True) -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
add_help=add_help, description="GitLab API Command Line Interface"
)
@@ -148,7 +151,7 @@ def _parse_value(v):
return v
-def docs():
+def docs() -> argparse.ArgumentParser:
"""
Provide a statically generated parser for sphinx only, so we don't need
to provide dummy gitlab config for readthedocs.
@@ -188,7 +191,7 @@ def main():
sys.exit(e)
# We only support v4 API at this time
if config.api_version not in ("4",):
- raise ModuleNotFoundError(name="gitlab.v%s.cli" % self._api_version)
+ raise ModuleNotFoundError(name="gitlab.v%s.cli" % config.api_version)
# Now we build the entire set of subcommands and do the complete parsing
parser = _get_parser(gitlab.v4.cli)
diff --git a/gitlab/client.py b/gitlab/client.py
index 7f4d4a8..dfe7a41 100644
--- a/gitlab/client.py
+++ b/gitlab/client.py
@@ -17,6 +17,7 @@
"""Wrapper for the GitLab API."""
import time
+from typing import cast, Any, Dict, List, Optional, Tuple, Union
import requests
import requests.utils
@@ -56,24 +57,25 @@ class Gitlab(object):
def __init__(
self,
- url,
- private_token=None,
- oauth_token=None,
- job_token=None,
- ssl_verify=True,
- http_username=None,
- http_password=None,
- timeout=None,
- api_version="4",
- session=None,
- per_page=None,
- pagination=None,
- order_by=None,
- user_agent=gitlab.const.USER_AGENT,
- ):
+ url: str,
+ private_token: Optional[str] = None,
+ oauth_token: Optional[str] = None,
+ job_token: Optional[str] = None,
+ ssl_verify: Union[bool, str] = True,
+ http_username: Optional[str] = None,
+ http_password: Optional[str] = None,
+ timeout: Optional[float] = None,
+ api_version: str = "4",
+ session: Optional[requests.Session] = None,
+ per_page: Optional[int] = None,
+ pagination: Optional[str] = None,
+ order_by: Optional[str] = None,
+ user_agent: str = gitlab.const.USER_AGENT,
+ ) -> None:
self._api_version = str(api_version)
- self._server_version = self._server_revision = None
+ self._server_version: Optional[str] = None
+ self._server_revision: Optional[str] = None
self._base_url = url.rstrip("/")
self._url = "%s/api/v%s" % (self._base_url, api_version)
#: Timeout to use for requests to gitlab server
@@ -140,18 +142,18 @@ class Gitlab(object):
self.variables = objects.VariableManager(self)
self.personal_access_tokens = objects.PersonalAccessTokenManager(self)
- def __enter__(self):
+ def __enter__(self) -> "Gitlab":
return self
- def __exit__(self, *args):
+ def __exit__(self, *args) -> None:
self.session.close()
- def __getstate__(self):
+ def __getstate__(self) -> Dict[str, Any]:
state = self.__dict__.copy()
state.pop("_objects")
return state
- def __setstate__(self, state):
+ def __setstate__(self, state: Dict[str, Any]) -> None:
self.__dict__.update(state)
# We only support v4 API at this time
if self._api_version not in ("4",):
@@ -163,22 +165,22 @@ class Gitlab(object):
self._objects = gitlab.v4.objects
@property
- def url(self):
+ def url(self) -> str:
"""The user-provided server URL."""
return self._base_url
@property
- def api_url(self):
+ def api_url(self) -> str:
"""The computed API base URL."""
return self._url
@property
- def api_version(self):
+ def api_version(self) -> str:
"""The API version used (4 only)."""
return self._api_version
@classmethod
- def from_config(cls, gitlab_id=None, config_files=None):
+ def from_config(cls, gitlab_id=None, config_files=None) -> "Gitlab":
"""Create a Gitlab connection from configuration files.
Args:
@@ -210,7 +212,7 @@ class Gitlab(object):
user_agent=config.user_agent,
)
- def auth(self):
+ def auth(self) -> None:
"""Performs an authentication using private token.
The `user` attribute will hold a `gitlab.objects.CurrentUser` object on
@@ -218,7 +220,7 @@ class Gitlab(object):
"""
self.user = self._objects.CurrentUserManager(self).get()
- def version(self):
+ def version(self) -> Tuple[str, str]:
"""Returns the version and revision of the gitlab server.
Note that self.version and self.revision will be set on the gitlab
@@ -232,15 +234,20 @@ class Gitlab(object):
if self._server_version is None:
try:
data = self.http_get("/version")
- self._server_version = data["version"]
- self._server_revision = data["revision"]
+ if isinstance(data, dict):
+ self._server_version = data["version"]
+ self._server_revision = data["revision"]
+ else:
+ self._server_version = "unknown"
+ self._server_revision = "unknown"
except Exception:
- self._server_version = self._server_revision = "unknown"
+ self._server_version = "unknown"
+ self._server_revision = "unknown"
- return self._server_version, self._server_revision
+ return cast(str, self._server_version), cast(str, self._server_revision)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabVerifyError)
- def lint(self, content, **kwargs):
+ def lint(self, content: str, **kwargs) -> Tuple[bool, List[str]]:
"""Validate a gitlab CI configuration.
Args:
@@ -257,10 +264,13 @@ class Gitlab(object):
"""
post_data = {"content": content}
data = self.http_post("/ci/lint", post_data=post_data, **kwargs)
+ assert isinstance(data, dict)
return (data["status"] == "valid", data["errors"])
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabMarkdownError)
- def markdown(self, text, gfm=False, project=None, **kwargs):
+ def markdown(
+ self, text: str, gfm: bool = False, project: Optional[str] = None, **kwargs
+ ) -> str:
"""Render an arbitrary Markdown document.
Args:
@@ -282,10 +292,11 @@ class Gitlab(object):
if project is not None:
post_data["project"] = project
data = self.http_post("/markdown", post_data=post_data, **kwargs)
+ assert isinstance(data, dict)
return data["html"]
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
- def get_license(self, **kwargs):
+ def get_license(self, **kwargs) -> Dict[str, Any]:
"""Retrieve information about the current license.
Args:
@@ -298,10 +309,13 @@ class Gitlab(object):
Returns:
dict: The current license information
"""
- return self.http_get("/license", **kwargs)
+ result = self.http_get("/license", **kwargs)
+ if isinstance(result, dict):
+ return result
+ return {}
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
- def set_license(self, license, **kwargs):
+ def set_license(self, license: str, **kwargs) -> Dict[str, Any]:
"""Add a new license.
Args:
@@ -316,9 +330,11 @@ class Gitlab(object):
dict: The new license information
"""
data = {"license": license}
- return self.http_post("/license", post_data=data, **kwargs)
+ result = self.http_post("/license", post_data=data, **kwargs)
+ assert isinstance(result, dict)
+ return result
- def _set_auth_info(self):
+ def _set_auth_info(self) -> None:
tokens = [
token
for token in [self.private_token, self.oauth_token, self.job_token]
@@ -362,25 +378,25 @@ class Gitlab(object):
self.http_username, self.http_password
)
- def enable_debug(self):
+ def enable_debug(self) -> None:
import logging
from http.client import HTTPConnection # noqa
- HTTPConnection.debuglevel = 1
+ HTTPConnection.debuglevel = 1 # type: ignore
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
- def _create_headers(self, content_type=None):
+ def _create_headers(self, content_type: Optional[str] = None) -> Dict[str, Any]:
request_headers = self.headers.copy()
if content_type is not None:
request_headers["Content-type"] = content_type
return request_headers
- def _get_session_opts(self, content_type):
+ def _get_session_opts(self, content_type: str) -> Dict[str, Any]:
return {
"headers": self._create_headers(content_type),
"auth": self._http_auth,
@@ -388,7 +404,7 @@ class Gitlab(object):
"verify": self.ssl_verify,
}
- def _build_url(self, path):
+ def _build_url(self, path: str) -> str:
"""Returns the full url from path.
If path is already a url, return it unchanged. If it's a path, append
@@ -402,7 +418,7 @@ class Gitlab(object):
else:
return "%s%s" % (self._url, path)
- def _check_redirects(self, result):
+ def _check_redirects(self, result: requests.Response) -> None:
# Check the requests history to detect http to https redirections.
# If the initial verb is POST, the next request will use a GET request,
# leading to an unwanted behaviour.
@@ -424,14 +440,14 @@ class Gitlab(object):
def http_request(
self,
- verb,
- path,
- query_data=None,
- post_data=None,
- streamed=False,
- files=None,
- **kwargs
- ):
+ verb: str,
+ path: str,
+ query_data: Optional[Dict[str, Any]] = None,
+ post_data: Optional[Dict[str, Any]] = None,
+ streamed: bool = False,
+ files: Optional[Dict[str, Any]] = None,
+ **kwargs,
+ ) -> requests.Response:
"""Make an HTTP request to the Gitlab server.
Args:
@@ -455,7 +471,7 @@ class Gitlab(object):
query_data = query_data or {}
url = self._build_url(path)
- params = {}
+ params: Dict[str, Any] = {}
utils.copy_dict(params, query_data)
# Deal with kwargs: by default a user uses kwargs to send data to the
@@ -482,6 +498,8 @@ class Gitlab(object):
# We need to deal with json vs. data when uploading files
if files:
json = None
+ if post_data is None:
+ post_data = {}
post_data["file"] = files.get("file")
post_data["avatar"] = files.get("avatar")
data = MultipartEncoder(post_data)
@@ -553,7 +571,14 @@ class Gitlab(object):
response_body=result.content,
)
- def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
+ def http_get(
+ self,
+ path: str,
+ query_data: Optional[Dict[str, Any]] = None,
+ streamed: bool = False,
+ raw: bool = False,
+ **kwargs,
+ ) -> Union[Dict[str, Any], requests.Response]:
"""Make a GET request to the Gitlab server.
Args:
@@ -592,7 +617,13 @@ class Gitlab(object):
else:
return result
- def http_list(self, path, query_data=None, as_list=None, **kwargs):
+ def http_list(
+ self,
+ path: str,
+ query_data: Optional[Dict[str, Any]] = None,
+ as_list=None,
+ **kwargs,
+ ):
"""Make a GET request to the Gitlab server for list-oriented queries.
Args:
@@ -633,7 +664,14 @@ class Gitlab(object):
# No pagination, generator requested
return GitlabList(self, url, query_data, **kwargs)
- def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs):
+ def http_post(
+ self,
+ path: str,
+ query_data: Optional[Dict[str, Any]] = None,
+ post_data: Optional[Dict[str, Any]] = None,
+ files: Optional[Dict[str, Any]] = None,
+ **kwargs,
+ ) -> Union[Dict[str, Any], requests.Response]:
"""Make a POST request to the Gitlab server.
Args:
@@ -662,7 +700,7 @@ class Gitlab(object):
query_data=query_data,
post_data=post_data,
files=files,
- **kwargs
+ **kwargs,
)
try:
if result.headers.get("Content-Type", None) == "application/json":
@@ -673,7 +711,14 @@ class Gitlab(object):
) from e
return result
- def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
+ def http_put(
+ self,
+ path: str,
+ query_data: Optional[Dict[str, Any]] = None,
+ post_data: Optional[Dict[str, Any]] = None,
+ files: Optional[Dict[str, Any]] = None,
+ **kwargs,
+ ) -> Union[Dict[str, Any], requests.Response]:
"""Make a PUT request to the Gitlab server.
Args:
@@ -701,7 +746,7 @@ class Gitlab(object):
query_data=query_data,
post_data=post_data,
files=files,
- **kwargs
+ **kwargs,
)
try:
return result.json()
@@ -710,7 +755,7 @@ class Gitlab(object):
error_message="Failed to parse the server message"
) from e
- def http_delete(self, path, **kwargs):
+ def http_delete(self, path: str, **kwargs) -> requests.Response:
"""Make a PUT request to the Gitlab server.
Args:
@@ -727,7 +772,7 @@ class Gitlab(object):
return self.http_request("delete", path, **kwargs)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabSearchError)
- def search(self, scope, search, **kwargs):
+ def search(self, scope: str, search: str, **kwargs) -> requests.Response:
"""Search GitLab resources matching the provided string.'
Args:
@@ -753,7 +798,14 @@ class GitlabList(object):
the API again when needed.
"""
- def __init__(self, gl, url, query_data, get_next=True, **kwargs):
+ def __init__(
+ self,
+ gl: Gitlab,
+ url: str,
+ query_data: Dict[str, Any],
+ get_next: bool = True,
+ **kwargs,
+ ) -> None:
self._gl = gl
# Preserve kwargs for subsequent queries
@@ -762,7 +814,9 @@ class GitlabList(object):
self._query(url, query_data, **self._kwargs)
self._get_next = get_next
- def _query(self, url, query_data=None, **kwargs):
+ def _query(
+ self, url: str, query_data: Optional[Dict[str, Any]] = None, **kwargs
+ ) -> None:
query_data = query_data or {}
result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
try:
@@ -776,12 +830,14 @@ class GitlabList(object):
self._next_url = next_url
except KeyError:
self._next_url = None
- self._current_page = result.headers.get("X-Page")
- self._prev_page = result.headers.get("X-Prev-Page")
- self._next_page = result.headers.get("X-Next-Page")
- self._per_page = result.headers.get("X-Per-Page")
- self._total_pages = result.headers.get("X-Total-Pages")
- self._total = result.headers.get("X-Total")
+ self._current_page: Optional[Union[str, int]] = result.headers.get("X-Page")
+ self._prev_page: Optional[Union[str, int]] = result.headers.get("X-Prev-Page")
+ self._next_page: Optional[Union[str, int]] = result.headers.get("X-Next-Page")
+ self._per_page: Optional[Union[str, int]] = result.headers.get("X-Per-Page")
+ self._total_pages: Optional[Union[str, int]] = result.headers.get(
+ "X-Total-Pages"
+ )
+ self._total: Optional[Union[str, int]] = result.headers.get("X-Total")
try:
self._data = result.json()
@@ -793,12 +849,13 @@ class GitlabList(object):
self._current = 0
@property
- def current_page(self):
+ def current_page(self) -> int:
"""The current page number."""
+ assert self._current_page is not None
return int(self._current_page)
@property
- def prev_page(self):
+ def prev_page(self) -> Optional[int]:
"""The previous page number.
If None, the current page is the first.
@@ -806,7 +863,7 @@ class GitlabList(object):
return int(self._prev_page) if self._prev_page else None
@property
- def next_page(self):
+ def next_page(self) -> Optional[int]:
"""The next page number.
If None, the current page is the last.
@@ -814,30 +871,35 @@ class GitlabList(object):
return int(self._next_page) if self._next_page else None
@property
- def per_page(self):
+ def per_page(self) -> int:
"""The number of items per page."""
+ assert self._per_page is not None
return int(self._per_page)
@property
- def total_pages(self):
+ def total_pages(self) -> int:
"""The total number of pages."""
+ assert self._total_pages is not None
return int(self._total_pages)
@property
- def total(self):
+ def total(self) -> int:
"""The total number of items."""
+ assert self._total is not None
return int(self._total)
- def __iter__(self):
+ def __iter__(self) -> "GitlabList":
return self
- def __len__(self):
+ def __len__(self) -> int:
+ if self._total is None:
+ return 0
return int(self._total)
def __next__(self):
return self.next()
- def next(self):
+ def next(self) -> "Gitlab":
try:
item = self._data[self._current]
self._current += 1
diff --git a/gitlab/config.py b/gitlab/config.py
index 4647d61..710a354 100644
--- a/gitlab/config.py
+++ b/gitlab/config.py
@@ -17,17 +17,18 @@
import os
import configparser
+from typing import List, Optional, Union
from gitlab.const import USER_AGENT
-def _env_config():
+def _env_config() -> List[str]:
if "PYTHON_GITLAB_CFG" in os.environ:
return [os.environ["PYTHON_GITLAB_CFG"]]
return []
-_DEFAULT_FILES = _env_config() + [
+_DEFAULT_FILES: List[str] = _env_config() + [
"/etc/python-gitlab.cfg",
os.path.expanduser("~/.python-gitlab.cfg"),
]
@@ -50,7 +51,9 @@ class GitlabConfigMissingError(ConfigError):
class GitlabConfigParser(object):
- def __init__(self, gitlab_id=None, config_files=None):
+ def __init__(
+ self, gitlab_id: Optional[str] = None, config_files: Optional[List[str]] = None
+ ) -> None:
self.gitlab_id = gitlab_id
_files = config_files or _DEFAULT_FILES
file_exist = False
@@ -85,7 +88,7 @@ class GitlabConfigParser(object):
"configuration (%s)" % self.gitlab_id
) from e
- self.ssl_verify = True
+ self.ssl_verify: Union[bool, str] = True
try:
self.ssl_verify = self._config.getboolean("global", "ssl_verify")
except ValueError:
diff --git a/gitlab/const.py b/gitlab/const.py
index 36e3c1a..e006285 100644
--- a/gitlab/const.py
+++ b/gitlab/const.py
@@ -18,41 +18,41 @@
from gitlab.__version__ import __title__, __version__
-NO_ACCESS = 0
-MINIMAL_ACCESS = 5
-GUEST_ACCESS = 10
-REPORTER_ACCESS = 20
-DEVELOPER_ACCESS = 30
-MAINTAINER_ACCESS = 40
-MASTER_ACCESS = MAINTAINER_ACCESS
-OWNER_ACCESS = 50
-
-VISIBILITY_PRIVATE = 0
-VISIBILITY_INTERNAL = 10
-VISIBILITY_PUBLIC = 20
-
-NOTIFICATION_LEVEL_DISABLED = "disabled"
-NOTIFICATION_LEVEL_PARTICIPATING = "participating"
-NOTIFICATION_LEVEL_WATCH = "watch"
-NOTIFICATION_LEVEL_GLOBAL = "global"
-NOTIFICATION_LEVEL_MENTION = "mention"
-NOTIFICATION_LEVEL_CUSTOM = "custom"
+NO_ACCESS: int = 0
+MINIMAL_ACCESS: int = 5
+GUEST_ACCESS: int = 10
+REPORTER_ACCESS: int = 20
+DEVELOPER_ACCESS: int = 30
+MAINTAINER_ACCESS: int = 40
+MASTER_ACCESS: int = MAINTAINER_ACCESS
+OWNER_ACCESS: int = 50
+
+VISIBILITY_PRIVATE: int = 0
+VISIBILITY_INTERNAL: int = 10
+VISIBILITY_PUBLIC: int = 20
+
+NOTIFICATION_LEVEL_DISABLED: str = "disabled"
+NOTIFICATION_LEVEL_PARTICIPATING: str = "participating"
+NOTIFICATION_LEVEL_WATCH: str = "watch"
+NOTIFICATION_LEVEL_GLOBAL: str = "global"
+NOTIFICATION_LEVEL_MENTION: str = "mention"
+NOTIFICATION_LEVEL_CUSTOM: str = "custom"
# Search scopes
# all scopes (global, group and project)
-SEARCH_SCOPE_PROJECTS = "projects"
-SEARCH_SCOPE_ISSUES = "issues"
-SEARCH_SCOPE_MERGE_REQUESTS = "merge_requests"
-SEARCH_SCOPE_MILESTONES = "milestones"
-SEARCH_SCOPE_WIKI_BLOBS = "wiki_blobs"
-SEARCH_SCOPE_COMMITS = "commits"
-SEARCH_SCOPE_BLOBS = "blobs"
-SEARCH_SCOPE_USERS = "users"
+SEARCH_SCOPE_PROJECTS: str = "projects"
+SEARCH_SCOPE_ISSUES: str = "issues"
+SEARCH_SCOPE_MERGE_REQUESTS: str = "merge_requests"
+SEARCH_SCOPE_MILESTONES: str = "milestones"
+SEARCH_SCOPE_WIKI_BLOBS: str = "wiki_blobs"
+SEARCH_SCOPE_COMMITS: str = "commits"
+SEARCH_SCOPE_BLOBS: str = "blobs"
+SEARCH_SCOPE_USERS: str = "users"
# specific global scope
-SEARCH_SCOPE_GLOBAL_SNIPPET_TITLES = "snippet_titles"
+SEARCH_SCOPE_GLOBAL_SNIPPET_TITLES: str = "snippet_titles"
# specific project scope
-SEARCH_SCOPE_PROJECT_NOTES = "notes"
+SEARCH_SCOPE_PROJECT_NOTES: str = "notes"
-USER_AGENT = "{}/{}".format(__title__, __version__)
+USER_AGENT: str = "{}/{}".format(__title__, __version__)
diff --git a/gitlab/utils.py b/gitlab/utils.py
index 67cb7f4..780cf90 100644
--- a/gitlab/utils.py
+++ b/gitlab/utils.py
@@ -15,15 +15,23 @@
# 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/>.
+from typing import Any, Callable, Dict, Optional
from urllib.parse import urlparse
+import requests
+
class _StdoutStream(object):
- def __call__(self, chunk):
+ def __call__(self, chunk) -> None:
print(chunk)
-def response_content(response, streamed, action, chunk_size):
+def response_content(
+ response: requests.Response,
+ streamed: bool,
+ action: Optional[Callable],
+ chunk_size: int,
+):
if streamed is False:
return response.content
@@ -35,7 +43,7 @@ def response_content(response, streamed, action, chunk_size):
action(chunk)
-def copy_dict(dest, src):
+def copy_dict(dest: Dict[str, Any], src: Dict[str, Any]) -> None:
for k, v in src.items():
if isinstance(v, dict):
# Transform dict values to new attributes. For example:
@@ -47,7 +55,7 @@ def copy_dict(dest, src):
dest[k] = v
-def clean_str_id(id):
+def clean_str_id(id: str) -> str:
return id.replace("/", "%2F").replace("#", "%23")
@@ -59,11 +67,11 @@ def sanitize_parameters(value):
return value
-def sanitized_url(url):
+def sanitized_url(url: str) -> str:
parsed = urlparse(url)
new_path = parsed.path.replace(".", "%2E")
return parsed._replace(path=new_path).geturl()
-def remove_none_from_dict(data):
+def remove_none_from_dict(data: Dict[str, Any]) -> Dict[str, Any]:
return {k: v for k, v in data.items() if v is not None}
diff --git a/gitlab/v4/objects/access_requests.py b/gitlab/v4/objects/access_requests.py
index a38b98e..7eef475 100644
--- a/gitlab/v4/objects/access_requests.py
+++ b/gitlab/v4/objects/access_requests.py
@@ -1,5 +1,11 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ AccessRequestMixin,
+ CreateMixin,
+ DeleteMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/appearance.py b/gitlab/v4/objects/appearance.py
index f48a0c1..bbb3ff2 100644
--- a/gitlab/v4/objects/appearance.py
+++ b/gitlab/v4/objects/appearance.py
@@ -1,6 +1,6 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
__all__ = [
diff --git a/gitlab/v4/objects/applications.py b/gitlab/v4/objects/applications.py
index 3fc3def..ddb9d23 100644
--- a/gitlab/v4/objects/applications.py
+++ b/gitlab/v4/objects/applications.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin
__all__ = [
"Application",
diff --git a/gitlab/v4/objects/audit_events.py b/gitlab/v4/objects/audit_events.py
index 24ec309..d9d4119 100644
--- a/gitlab/v4/objects/audit_events.py
+++ b/gitlab/v4/objects/audit_events.py
@@ -3,8 +3,8 @@ GitLab API:
https://docs.gitlab.com/ee/api/audit_events.html#project-audit-events
"""
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import RetrieveMixin
__all__ = [
"ProjectAudit",
diff --git a/gitlab/v4/objects/award_emojis.py b/gitlab/v4/objects/award_emojis.py
index 43efa2c..806121c 100644
--- a/gitlab/v4/objects/award_emojis.py
+++ b/gitlab/v4/objects/award_emojis.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/badges.py b/gitlab/v4/objects/badges.py
index 94b97a9..4edcc51 100644
--- a/gitlab/v4/objects/badges.py
+++ b/gitlab/v4/objects/badges.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import BadgeRenderMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/boards.py b/gitlab/v4/objects/boards.py
index 3936259..d0176b7 100644
--- a/gitlab/v4/objects/boards.py
+++ b/gitlab/v4/objects/boards.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/branches.py b/gitlab/v4/objects/branches.py
index f14fd79..ff9ed99 100644
--- a/gitlab/v4/objects/branches.py
+++ b/gitlab/v4/objects/branches.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/broadcast_messages.py b/gitlab/v4/objects/broadcast_messages.py
index f6d6507..dc2cb94 100644
--- a/gitlab/v4/objects/broadcast_messages.py
+++ b/gitlab/v4/objects/broadcast_messages.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/clusters.py b/gitlab/v4/objects/clusters.py
index 8c8744e..2a7064e 100644
--- a/gitlab/v4/objects/clusters.py
+++ b/gitlab/v4/objects/clusters.py
@@ -1,6 +1,6 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, CreateMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/commits.py b/gitlab/v4/objects/commits.py
index 712a49f..1d66e23 100644
--- a/gitlab/v4/objects/commits.py
+++ b/gitlab/v4/objects/commits.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, ListMixin, RefreshMixin, RetrieveMixin
from .discussions import ProjectCommitDiscussionManager
diff --git a/gitlab/v4/objects/container_registry.py b/gitlab/v4/objects/container_registry.py
index 80d8922..99bc7d2 100644
--- a/gitlab/v4/objects/container_registry.py
+++ b/gitlab/v4/objects/container_registry.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import DeleteMixin, ListMixin, ObjectDeleteMixin, RetrieveMixin
__all__ = [
diff --git a/gitlab/v4/objects/custom_attributes.py b/gitlab/v4/objects/custom_attributes.py
index f48b3f7..a4e9795 100644
--- a/gitlab/v4/objects/custom_attributes.py
+++ b/gitlab/v4/objects/custom_attributes.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import DeleteMixin, ObjectDeleteMixin, RetrieveMixin, SetMixin
__all__ = [
diff --git a/gitlab/v4/objects/deploy_keys.py b/gitlab/v4/objects/deploy_keys.py
index da2fddd..d674c04 100644
--- a/gitlab/v4/objects/deploy_keys.py
+++ b/gitlab/v4/objects/deploy_keys.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/deploy_tokens.py b/gitlab/v4/objects/deploy_tokens.py
index 95a77a0..b9d0bad 100644
--- a/gitlab/v4/objects/deploy_tokens.py
+++ b/gitlab/v4/objects/deploy_tokens.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/deployments.py b/gitlab/v4/objects/deployments.py
index fcd9b49..300d26b 100644
--- a/gitlab/v4/objects/deployments.py
+++ b/gitlab/v4/objects/deployments.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin
__all__ = [
diff --git a/gitlab/v4/objects/discussions.py b/gitlab/v4/objects/discussions.py
index e9a12b3..b65c27b 100644
--- a/gitlab/v4/objects/discussions.py
+++ b/gitlab/v4/objects/discussions.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin
from .notes import (
ProjectCommitDiscussionNoteManager,
ProjectIssueDiscussionNoteManager,
diff --git a/gitlab/v4/objects/environments.py b/gitlab/v4/objects/environments.py
index 8570076..d969203 100644
--- a/gitlab/v4/objects/environments.py
+++ b/gitlab/v4/objects/environments.py
@@ -1,7 +1,14 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CreateMixin,
+ DeleteMixin,
+ ObjectDeleteMixin,
+ RetrieveMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/epics.py b/gitlab/v4/objects/epics.py
index 43c926c..8cf6fc3 100644
--- a/gitlab/v4/objects/epics.py
+++ b/gitlab/v4/objects/epics.py
@@ -1,7 +1,15 @@
from gitlab import types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ DeleteMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+ UpdateMixin,
+)
from .events import GroupEpicResourceLabelEventManager
diff --git a/gitlab/v4/objects/events.py b/gitlab/v4/objects/events.py
index 6e0872a..43eba8d 100644
--- a/gitlab/v4/objects/events.py
+++ b/gitlab/v4/objects/events.py
@@ -1,6 +1,6 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import ListMixin, RetrieveMixin
__all__ = [
diff --git a/gitlab/v4/objects/export_import.py b/gitlab/v4/objects/export_import.py
index 59d110e..054517c 100644
--- a/gitlab/v4/objects/export_import.py
+++ b/gitlab/v4/objects/export_import.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CreateMixin, DownloadMixin, GetWithoutIdMixin, RefreshMixin
__all__ = [
diff --git a/gitlab/v4/objects/features.py b/gitlab/v4/objects/features.py
index 449b2e7..d96615e 100644
--- a/gitlab/v4/objects/features.py
+++ b/gitlab/v4/objects/features.py
@@ -1,7 +1,7 @@
from gitlab import utils
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import DeleteMixin, ListMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py
index 8477989..bb43498 100644
--- a/gitlab/v4/objects/files.py
+++ b/gitlab/v4/objects/files.py
@@ -1,8 +1,15 @@
import base64
from gitlab import cli, utils
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CreateMixin,
+ DeleteMixin,
+ GetMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/geo_nodes.py b/gitlab/v4/objects/geo_nodes.py
index 0652702..b9a1e49 100644
--- a/gitlab/v4/objects/geo_nodes.py
+++ b/gitlab/v4/objects/geo_nodes.py
@@ -1,7 +1,13 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ DeleteMixin,
+ ObjectDeleteMixin,
+ RetrieveMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py
index fc14346..d96acfd 100644
--- a/gitlab/v4/objects/groups.py
+++ b/gitlab/v4/objects/groups.py
@@ -1,7 +1,7 @@
from gitlab import cli, types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
from .access_requests import GroupAccessRequestManager
from .badges import GroupBadgeManager
from .boards import GroupBoardManager
diff --git a/gitlab/v4/objects/hooks.py b/gitlab/v4/objects/hooks.py
index 93a0142..85acf4e 100644
--- a/gitlab/v4/objects/hooks.py
+++ b/gitlab/v4/objects/hooks.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py
index 2d7d570..dfd43f5 100644
--- a/gitlab/v4/objects/issues.py
+++ b/gitlab/v4/objects/issues.py
@@ -1,7 +1,20 @@
from gitlab import cli, types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ DeleteMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ ParticipantsMixin,
+ RetrieveMixin,
+ SaveMixin,
+ SubscribableMixin,
+ TimeTrackingMixin,
+ TodoMixin,
+ UserAgentDetailMixin,
+)
from .award_emojis import ProjectIssueAwardEmojiManager
from .discussions import ProjectIssueDiscussionManager
from .events import (
diff --git a/gitlab/v4/objects/jobs.py b/gitlab/v4/objects/jobs.py
index 33fc991..6513d75 100644
--- a/gitlab/v4/objects/jobs.py
+++ b/gitlab/v4/objects/jobs.py
@@ -1,7 +1,7 @@
from gitlab import cli, utils
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import RefreshMixin, RetrieveMixin
__all__ = [
diff --git a/gitlab/v4/objects/labels.py b/gitlab/v4/objects/labels.py
index 441035f..513f1eb 100644
--- a/gitlab/v4/objects/labels.py
+++ b/gitlab/v4/objects/labels.py
@@ -1,6 +1,15 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CreateMixin,
+ DeleteMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ RetrieveMixin,
+ SaveMixin,
+ SubscribableMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/ldap.py b/gitlab/v4/objects/ldap.py
index e6ff42a..72c8e7f 100644
--- a/gitlab/v4/objects/ldap.py
+++ b/gitlab/v4/objects/ldap.py
@@ -1,6 +1,5 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject, RESTObjectList
__all__ = [
diff --git a/gitlab/v4/objects/members.py b/gitlab/v4/objects/members.py
index 32ac9a2..5802aa8 100644
--- a/gitlab/v4/objects/members.py
+++ b/gitlab/v4/objects/members.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/merge_request_approvals.py b/gitlab/v4/objects/merge_request_approvals.py
index ec2da14..cd09e32 100644
--- a/gitlab/v4/objects/merge_request_approvals.py
+++ b/gitlab/v4/objects/merge_request_approvals.py
@@ -1,6 +1,14 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CreateMixin,
+ DeleteMixin,
+ GetWithoutIdMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py
index f6c5611..f749ba8 100644
--- a/gitlab/v4/objects/merge_requests.py
+++ b/gitlab/v4/objects/merge_requests.py
@@ -1,7 +1,17 @@
from gitlab import cli, types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject, RESTObjectList
+from gitlab.mixins import (
+ CRUDMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ ParticipantsMixin,
+ RetrieveMixin,
+ SaveMixin,
+ SubscribableMixin,
+ TimeTrackingMixin,
+ TodoMixin,
+)
from .commits import ProjectCommit, ProjectCommitManager
from .issues import ProjectIssue, ProjectIssueManager
from .merge_request_approvals import (
diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py
index deb5970..7aebc8e 100644
--- a/gitlab/v4/objects/milestones.py
+++ b/gitlab/v4/objects/milestones.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject, RESTObjectList
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from .issues import GroupIssue, GroupIssueManager, ProjectIssue, ProjectIssueManager
from .merge_requests import (
ProjectMergeRequest,
diff --git a/gitlab/v4/objects/namespaces.py b/gitlab/v4/objects/namespaces.py
index e761a36..a9e1ef5 100644
--- a/gitlab/v4/objects/namespaces.py
+++ b/gitlab/v4/objects/namespaces.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import RetrieveMixin
__all__ = [
diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py
index 23c7fa8..88a461a 100644
--- a/gitlab/v4/objects/notes.py
+++ b/gitlab/v4/objects/notes.py
@@ -1,7 +1,16 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ DeleteMixin,
+ GetMixin,
+ ObjectDeleteMixin,
+ RetrieveMixin,
+ SaveMixin,
+ UpdateMixin,
+)
from .award_emojis import (
ProjectIssueNoteAwardEmojiManager,
ProjectMergeRequestNoteAwardEmojiManager,
diff --git a/gitlab/v4/objects/notification_settings.py b/gitlab/v4/objects/notification_settings.py
index 9b320d7..3aee514 100644
--- a/gitlab/v4/objects/notification_settings.py
+++ b/gitlab/v4/objects/notification_settings.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
__all__ = [
diff --git a/gitlab/v4/objects/packages.py b/gitlab/v4/objects/packages.py
index a0c0f25..3e64685 100644
--- a/gitlab/v4/objects/packages.py
+++ b/gitlab/v4/objects/packages.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import DeleteMixin, GetMixin, ListMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/pages.py b/gitlab/v4/objects/pages.py
index 27167eb..4cd1a5a 100644
--- a/gitlab/v4/objects/pages.py
+++ b/gitlab/v4/objects/pages.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/personal_access_tokens.py b/gitlab/v4/objects/personal_access_tokens.py
index 211bd92..7d2c5ce 100644
--- a/gitlab/v4/objects/personal_access_tokens.py
+++ b/gitlab/v4/objects/personal_access_tokens.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import ListMixin
__all__ = [
diff --git a/gitlab/v4/objects/pipelines.py b/gitlab/v4/objects/pipelines.py
index ddd32f8..9f0516a 100644
--- a/gitlab/v4/objects/pipelines.py
+++ b/gitlab/v4/objects/pipelines.py
@@ -1,7 +1,17 @@
from gitlab import cli, types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ DeleteMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ RefreshMixin,
+ RetrieveMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
index 30df5ed..becc064 100644
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -1,7 +1,15 @@
from gitlab import cli, types, utils
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ RefreshMixin,
+ SaveMixin,
+ UpdateMixin,
+)
from .project_access_tokens import ProjectAccessTokenManager
from .access_requests import ProjectAccessRequestManager
diff --git a/gitlab/v4/objects/push_rules.py b/gitlab/v4/objects/push_rules.py
index 5f1618b..e580ab8 100644
--- a/gitlab/v4/objects/push_rules.py
+++ b/gitlab/v4/objects/push_rules.py
@@ -1,5 +1,12 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CreateMixin,
+ DeleteMixin,
+ GetWithoutIdMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/releases.py b/gitlab/v4/objects/releases.py
index d9112e4..bbeea24 100644
--- a/gitlab/v4/objects/releases.py
+++ b/gitlab/v4/objects/releases.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/runners.py b/gitlab/v4/objects/runners.py
index 390b9d3..dd7f0e3 100644
--- a/gitlab/v4/objects/runners.py
+++ b/gitlab/v4/objects/runners.py
@@ -1,7 +1,13 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ ListMixin,
+ NoUpdateMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/services.py b/gitlab/v4/objects/services.py
index ff7e920..c638336 100644
--- a/gitlab/v4/objects/services.py
+++ b/gitlab/v4/objects/services.py
@@ -1,7 +1,14 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ DeleteMixin,
+ GetMixin,
+ ListMixin,
+ ObjectDeleteMixin,
+ SaveMixin,
+ UpdateMixin,
+)
__all__ = [
diff --git a/gitlab/v4/objects/settings.py b/gitlab/v4/objects/settings.py
index a731736..0d07488 100644
--- a/gitlab/v4/objects/settings.py
+++ b/gitlab/v4/objects/settings.py
@@ -1,6 +1,6 @@
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
__all__ = [
diff --git a/gitlab/v4/objects/sidekiq.py b/gitlab/v4/objects/sidekiq.py
index f1f0e4b..84306bc 100644
--- a/gitlab/v4/objects/sidekiq.py
+++ b/gitlab/v4/objects/sidekiq.py
@@ -1,7 +1,6 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager
__all__ = [
diff --git a/gitlab/v4/objects/snippets.py b/gitlab/v4/objects/snippets.py
index 4664f0a..20db75f 100644
--- a/gitlab/v4/objects/snippets.py
+++ b/gitlab/v4/objects/snippets.py
@@ -1,7 +1,7 @@
from gitlab import cli, utils
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin, UserAgentDetailMixin
from .award_emojis import ProjectSnippetAwardEmojiManager
from .discussions import ProjectSnippetDiscussionManager
diff --git a/gitlab/v4/objects/statistics.py b/gitlab/v4/objects/statistics.py
index 53d0c7d..2dbcdfe 100644
--- a/gitlab/v4/objects/statistics.py
+++ b/gitlab/v4/objects/statistics.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import GetWithoutIdMixin, RefreshMixin
__all__ = [
diff --git a/gitlab/v4/objects/tags.py b/gitlab/v4/objects/tags.py
index 1f333c5..56d7fb6 100644
--- a/gitlab/v4/objects/tags.py
+++ b/gitlab/v4/objects/tags.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/templates.py b/gitlab/v4/objects/templates.py
index 2fbfddf..4da864b 100644
--- a/gitlab/v4/objects/templates.py
+++ b/gitlab/v4/objects/templates.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import RetrieveMixin
__all__ = [
diff --git a/gitlab/v4/objects/todos.py b/gitlab/v4/objects/todos.py
index edde46e..33ad7ee 100644
--- a/gitlab/v4/objects/todos.py
+++ b/gitlab/v4/objects/todos.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import DeleteMixin, ListMixin, ObjectDeleteMixin
__all__ = [
diff --git a/gitlab/v4/objects/triggers.py b/gitlab/v4/objects/triggers.py
index f5dadca..822a1df 100644
--- a/gitlab/v4/objects/triggers.py
+++ b/gitlab/v4/objects/triggers.py
@@ -1,7 +1,7 @@
from gitlab import cli
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py
index 530383d..4f14e86 100644
--- a/gitlab/v4/objects/users.py
+++ b/gitlab/v4/objects/users.py
@@ -1,7 +1,18 @@
from gitlab import cli, types
from gitlab import exceptions as exc
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import (
+ CRUDMixin,
+ CreateMixin,
+ DeleteMixin,
+ GetWithoutIdMixin,
+ ListMixin,
+ NoUpdateMixin,
+ ObjectDeleteMixin,
+ RetrieveMixin,
+ SaveMixin,
+ UpdateMixin,
+)
from .custom_attributes import UserCustomAttributeManager
from .events import UserEventManager
@@ -32,8 +43,6 @@ __all__ = [
"UserGPGKeyManager",
"UserKey",
"UserKeyManager",
- "UserStatus",
- "UserStatusManager",
"UserIdentityProviderManager",
"UserImpersonationToken",
"UserImpersonationTokenManager",
@@ -376,16 +385,6 @@ class UserKeyManager(ListMixin, CreateMixin, DeleteMixin, RESTManager):
_create_attrs = (("title", "key"), tuple())
-class UserStatus(RESTObject):
- pass
-
-
-class UserStatusManager(GetWithoutIdMixin, RESTManager):
- _path = "/users/%(user_id)s/status"
- _obj_cls = UserStatus
- _from_parent_attrs = {"user_id": "id"}
-
-
class UserIdentityProviderManager(DeleteMixin, RESTManager):
"""Manager for user identities.
diff --git a/gitlab/v4/objects/variables.py b/gitlab/v4/objects/variables.py
index 2094a5f..025e3be 100644
--- a/gitlab/v4/objects/variables.py
+++ b/gitlab/v4/objects/variables.py
@@ -4,8 +4,8 @@ https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
https://docs.gitlab.com/ee/api/project_level_variables.html
https://docs.gitlab.com/ee/api/group_level_variables.html
"""
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [
diff --git a/gitlab/v4/objects/wikis.py b/gitlab/v4/objects/wikis.py
index 8cadaa0..f2c1c2a 100644
--- a/gitlab/v4/objects/wikis.py
+++ b/gitlab/v4/objects/wikis.py
@@ -1,5 +1,5 @@
-from gitlab.base import * # noqa
-from gitlab.mixins import * # noqa
+from gitlab.base import RESTManager, RESTObject
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
__all__ = [