summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/v4/objects')
-rw-r--r--gitlab/v4/objects/clusters.py4
-rw-r--r--gitlab/v4/objects/commits.py12
-rw-r--r--gitlab/v4/objects/deploy_keys.py2
-rw-r--r--gitlab/v4/objects/environments.py2
-rw-r--r--gitlab/v4/objects/epics.py2
-rw-r--r--gitlab/v4/objects/features.py4
-rw-r--r--gitlab/v4/objects/files.py10
-rw-r--r--gitlab/v4/objects/geo_nodes.py4
-rw-r--r--gitlab/v4/objects/groups.py18
-rw-r--r--gitlab/v4/objects/issues.py6
-rw-r--r--gitlab/v4/objects/jobs.py18
-rw-r--r--gitlab/v4/objects/ldap.py2
-rw-r--r--gitlab/v4/objects/merge_request_approvals.py4
-rw-r--r--gitlab/v4/objects/merge_requests.py23
-rw-r--r--gitlab/v4/objects/milestones.py8
-rw-r--r--gitlab/v4/objects/pipelines.py8
-rw-r--r--gitlab/v4/objects/projects.py61
-rw-r--r--gitlab/v4/objects/repositories.py16
-rw-r--r--gitlab/v4/objects/snippets.py4
-rw-r--r--gitlab/v4/objects/todos.py2
-rw-r--r--gitlab/v4/objects/users.py16
21 files changed, 110 insertions, 116 deletions
diff --git a/gitlab/v4/objects/clusters.py b/gitlab/v4/objects/clusters.py
index 10ff202..3dcf653 100644
--- a/gitlab/v4/objects/clusters.py
+++ b/gitlab/v4/objects/clusters.py
@@ -50,7 +50,7 @@ class GroupClusterManager(CRUDMixin, RESTManager):
RESTObject: A new instance of the manage object class build with
the data sent by the server
"""
- path = "%s/user" % (self.path)
+ path = f"{self.path}/user"
return CreateMixin.create(self, data, path=path, **kwargs)
@@ -94,5 +94,5 @@ class ProjectClusterManager(CRUDMixin, RESTManager):
RESTObject: A new instance of the manage object class build with
the data sent by the server
"""
- path = "%s/user" % (self.path)
+ path = f"{self.path}/user"
return CreateMixin.create(self, data, path=path, **kwargs)
diff --git a/gitlab/v4/objects/commits.py b/gitlab/v4/objects/commits.py
index 05b55b0..c86ca64 100644
--- a/gitlab/v4/objects/commits.py
+++ b/gitlab/v4/objects/commits.py
@@ -37,7 +37,7 @@ class ProjectCommit(RESTObject):
Returns:
list: The changes done in this commit
"""
- path = "%s/%s/diff" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/diff"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("ProjectCommit", ("branch",))
@@ -53,7 +53,7 @@ class ProjectCommit(RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabCherryPickError: If the cherry-pick could not be performed
"""
- path = "%s/%s/cherry_pick" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/cherry_pick"
post_data = {"branch": branch}
self.manager.gitlab.http_post(path, post_data=post_data, **kwargs)
@@ -73,7 +73,7 @@ class ProjectCommit(RESTObject):
Returns:
list: The references the commit is pushed to.
"""
- path = "%s/%s/refs" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/refs"
data = {"type": type}
return self.manager.gitlab.http_get(path, query_data=data, **kwargs)
@@ -92,7 +92,7 @@ class ProjectCommit(RESTObject):
Returns:
list: The merge requests related to the commit.
"""
- path = "%s/%s/merge_requests" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/merge_requests"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("ProjectCommit", ("branch",))
@@ -111,7 +111,7 @@ class ProjectCommit(RESTObject):
Returns:
dict: The new commit data (*not* a RESTObject)
"""
- path = "%s/%s/revert" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/revert"
post_data = {"branch": branch}
return self.manager.gitlab.http_post(path, post_data=post_data, **kwargs)
@@ -130,7 +130,7 @@ class ProjectCommit(RESTObject):
Returns:
dict: The commit's signature data
"""
- path = "%s/%s/signature" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/signature"
return self.manager.gitlab.http_get(path, **kwargs)
diff --git a/gitlab/v4/objects/deploy_keys.py b/gitlab/v4/objects/deploy_keys.py
index cf0507d..9c0a909 100644
--- a/gitlab/v4/objects/deploy_keys.py
+++ b/gitlab/v4/objects/deploy_keys.py
@@ -44,5 +44,5 @@ class ProjectKeyManager(CRUDMixin, RESTManager):
GitlabAuthenticationError: If authentication is not correct
GitlabProjectDeployKeyError: If the key could not be enabled
"""
- path = "%s/%s/enable" % (self.path, key_id)
+ path = f"{self.path}/{key_id}/enable"
self.gitlab.http_post(path, **kwargs)
diff --git a/gitlab/v4/objects/environments.py b/gitlab/v4/objects/environments.py
index e318da8..3ecb957 100644
--- a/gitlab/v4/objects/environments.py
+++ b/gitlab/v4/objects/environments.py
@@ -29,7 +29,7 @@ class ProjectEnvironment(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabStopError: If the operation failed
"""
- path = "%s/%s/stop" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/stop"
self.manager.gitlab.http_post(path, **kwargs)
diff --git a/gitlab/v4/objects/epics.py b/gitlab/v4/objects/epics.py
index 90dc6ad..4baa5f3 100644
--- a/gitlab/v4/objects/epics.py
+++ b/gitlab/v4/objects/epics.py
@@ -95,7 +95,7 @@ class GroupEpicIssueManager(
the data sent by the server
"""
CreateMixin._check_missing_create_attrs(self, data)
- path = "%s/%s" % (self.path, data.pop("issue_id"))
+ path = f"{self.path}/{data.pop('issue_id')}"
server_data = self.gitlab.http_post(path, **kwargs)
# The epic_issue_id attribute doesn't exist when creating the resource,
# but is used everywhere elese. Let's create it to be consistent client
diff --git a/gitlab/v4/objects/features.py b/gitlab/v4/objects/features.py
index f4117c8..65144a7 100644
--- a/gitlab/v4/objects/features.py
+++ b/gitlab/v4/objects/features.py
@@ -26,7 +26,7 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager):
user=None,
group=None,
project=None,
- **kwargs
+ **kwargs,
):
"""Create or update the object.
@@ -46,7 +46,7 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager):
Returns:
obj: The created/updated attribute
"""
- path = "%s/%s" % (self.path, name.replace("/", "%2F"))
+ path = f"{self.path}/{name.replace('/', '%2F')}"
data = {
"value": value,
"feature_group": feature_group,
diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py
index ff45478..6c8c80c 100644
--- a/gitlab/v4/objects/files.py
+++ b/gitlab/v4/objects/files.py
@@ -123,7 +123,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
self._check_missing_create_attrs(data)
new_data = data.copy()
file_path = new_data.pop("file_path").replace("/", "%2F")
- path = "%s/%s" % (self.path, file_path)
+ path = f"{self.path}/{file_path}"
server_data = self.gitlab.http_post(path, post_data=new_data, **kwargs)
return self._obj_cls(self, server_data)
@@ -147,7 +147,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
data = new_data.copy()
file_path = file_path.replace("/", "%2F")
data["file_path"] = file_path
- path = "%s/%s" % (self.path, file_path)
+ path = f"{self.path}/{file_path}"
self._check_missing_update_attrs(data)
return self.gitlab.http_put(path, post_data=data, **kwargs)
@@ -168,7 +168,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server cannot perform the request
"""
- path = "%s/%s" % (self.path, file_path.replace("/", "%2F"))
+ path = f"{self.path}/{file_path.replace('/', '%2F')}"
data = {"branch": branch, "commit_message": commit_message}
self.gitlab.http_delete(path, query_data=data, **kwargs)
@@ -198,7 +198,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
str: The file content
"""
file_path = file_path.replace("/", "%2F").replace(".", "%2E")
- path = "%s/%s/raw" % (self.path, file_path)
+ path = f"{self.path}/{file_path}/raw"
query_data = {"ref": ref}
result = self.gitlab.http_get(
path, query_data=query_data, streamed=streamed, raw=True, **kwargs
@@ -223,6 +223,6 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
list(blame): a list of commits/lines matching the file
"""
file_path = file_path.replace("/", "%2F").replace(".", "%2E")
- path = "%s/%s/blame" % (self.path, file_path)
+ path = f"{self.path}/{file_path}/blame"
query_data = {"ref": ref}
return self.gitlab.http_list(path, query_data, **kwargs)
diff --git a/gitlab/v4/objects/geo_nodes.py b/gitlab/v4/objects/geo_nodes.py
index 16fc783..cde4398 100644
--- a/gitlab/v4/objects/geo_nodes.py
+++ b/gitlab/v4/objects/geo_nodes.py
@@ -28,7 +28,7 @@ class GeoNode(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabRepairError: If the server failed to perform the request
"""
- path = "/geo_nodes/%s/repair" % self.get_id()
+ path = f"/geo_nodes/{self.get_id()}/repair"
server_data = self.manager.gitlab.http_post(path, **kwargs)
self._update_attrs(server_data)
@@ -47,7 +47,7 @@ class GeoNode(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
dict: The status of the geo node
"""
- path = "/geo_nodes/%s/status" % self.get_id()
+ path = f"/geo_nodes/{self.get_id()}/status"
return self.manager.gitlab.http_get(path, **kwargs)
diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py
index b675a39..6b390b1 100644
--- a/gitlab/v4/objects/groups.py
+++ b/gitlab/v4/objects/groups.py
@@ -85,7 +85,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabTransferProjectError: If the project could not be transferred
"""
- path = "/groups/%s/projects/%s" % (self.id, project_id)
+ path = f"/groups/{self.id}/projects/{project_id}"
self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("Group", ("scope", "search"))
@@ -106,7 +106,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabList: A list of dicts describing the resources found.
"""
data = {"scope": scope, "search": search}
- path = "/groups/%s/search" % self.get_id()
+ path = f"/groups/{self.get_id()}/search"
return self.manager.gitlab.http_list(path, query_data=data, **kwargs)
@cli.register_custom_action("Group", ("cn", "group_access", "provider"))
@@ -125,7 +125,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server cannot perform the request
"""
- path = "/groups/%s/ldap_group_links" % self.get_id()
+ path = f"/groups/{self.get_id()}/ldap_group_links"
data = {"cn": cn, "group_access": group_access, "provider": provider}
self.manager.gitlab.http_post(path, post_data=data, **kwargs)
@@ -143,10 +143,10 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server cannot perform the request
"""
- path = "/groups/%s/ldap_group_links" % self.get_id()
+ path = f"/groups/{self.get_id()}/ldap_group_links"
if provider is not None:
- path += "/%s" % provider
- path += "/%s" % cn
+ path += f"/{provider}"
+ path += f"/{cn}"
self.manager.gitlab.http_delete(path)
@cli.register_custom_action("Group")
@@ -161,7 +161,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server cannot perform the request
"""
- path = "/groups/%s/ldap_sync" % self.get_id()
+ path = f"/groups/{self.get_id()}/ldap_sync"
self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("Group", ("group_id", "group_access"), ("expires_at",))
@@ -178,7 +178,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server failed to perform the request
"""
- path = "/groups/%s/share" % self.get_id()
+ path = f"/groups/{self.get_id()}/share"
data = {
"group_id": group_id,
"group_access": group_access,
@@ -199,7 +199,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/groups/%s/share/%s" % (self.get_id(), group_id)
+ path = f"/groups/{self.get_id()}/share/{group_id}"
self.manager.gitlab.http_delete(path, **kwargs)
diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py
index 9272908..c3d1d95 100644
--- a/gitlab/v4/objects/issues.py
+++ b/gitlab/v4/objects/issues.py
@@ -127,7 +127,7 @@ class ProjectIssue(
GitlabAuthenticationError: If authentication is not correct
GitlabUpdateError: If the issue could not be moved
"""
- path = "%s/%s/move" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/move"
data = {"to_project_id": to_project_id}
server_data = self.manager.gitlab.http_post(path, post_data=data, **kwargs)
self._update_attrs(server_data)
@@ -147,7 +147,7 @@ class ProjectIssue(
Returns:
list: The list of merge requests.
"""
- path = "%s/%s/related_merge_requests" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/related_merge_requests"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("ProjectIssue")
@@ -165,7 +165,7 @@ class ProjectIssue(
Returns:
list: The list of merge requests.
"""
- path = "%s/%s/closed_by" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/closed_by"
return self.manager.gitlab.http_get(path, **kwargs)
diff --git a/gitlab/v4/objects/jobs.py b/gitlab/v4/objects/jobs.py
index 2e7693d..9bd35d0 100644
--- a/gitlab/v4/objects/jobs.py
+++ b/gitlab/v4/objects/jobs.py
@@ -23,7 +23,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabJobCancelError: If the job could not be canceled
"""
- path = "%s/%s/cancel" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/cancel"
return self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectJob")
@@ -38,7 +38,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabJobRetryError: If the job could not be retried
"""
- path = "%s/%s/retry" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/retry"
return self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectJob")
@@ -53,7 +53,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabJobPlayError: If the job could not be triggered
"""
- path = "%s/%s/play" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/play"
self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectJob")
@@ -68,7 +68,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabJobEraseError: If the job could not be erased
"""
- path = "%s/%s/erase" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/erase"
self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectJob")
@@ -83,7 +83,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the request could not be performed
"""
- path = "%s/%s/artifacts/keep" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/artifacts/keep"
self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectJob")
@@ -98,7 +98,7 @@ class ProjectJob(RefreshMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the request could not be performed
"""
- path = "%s/%s/artifacts" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/artifacts"
self.manager.gitlab.http_delete(path)
@cli.register_custom_action("ProjectJob")
@@ -122,7 +122,7 @@ class ProjectJob(RefreshMixin, RESTObject):
Returns:
str: The artifacts if `streamed` is False, None otherwise.
"""
- path = "%s/%s/artifacts" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/artifacts"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -150,7 +150,7 @@ class ProjectJob(RefreshMixin, RESTObject):
Returns:
str: The artifacts if `streamed` is False, None otherwise.
"""
- path = "%s/%s/artifacts/%s" % (self.manager.path, self.get_id(), path)
+ path = f"{self.manager.path}/{self.get_id()}/artifacts/{path}"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -177,7 +177,7 @@ class ProjectJob(RefreshMixin, RESTObject):
Returns:
str: The trace
"""
- path = "%s/%s/trace" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/trace"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
diff --git a/gitlab/v4/objects/ldap.py b/gitlab/v4/objects/ldap.py
index e0202a1..cecb1e9 100644
--- a/gitlab/v4/objects/ldap.py
+++ b/gitlab/v4/objects/ldap.py
@@ -40,7 +40,7 @@ class LDAPGroupManager(RESTManager):
data.setdefault("per_page", self.gitlab.per_page)
if "provider" in data:
- path = "/ldap/%s/groups" % data["provider"]
+ path = f"/ldap/{data['provider']}/groups"
else:
path = self._path
diff --git a/gitlab/v4/objects/merge_request_approvals.py b/gitlab/v4/objects/merge_request_approvals.py
index b8443f1..dee17c7 100644
--- a/gitlab/v4/objects/merge_request_approvals.py
+++ b/gitlab/v4/objects/merge_request_approvals.py
@@ -58,7 +58,7 @@ class ProjectApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
approver_ids = approver_ids or []
approver_group_ids = approver_group_ids or []
- path = "/projects/%s/approvers" % self._parent.get_id()
+ path = f"/projects/{self._parent.get_id()}/approvers"
data = {"approver_ids": approver_ids, "approver_group_ids": approver_group_ids}
self.gitlab.http_put(path, post_data=data, **kwargs)
@@ -97,7 +97,7 @@ class ProjectMergeRequestApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTMan
approver_ids=None,
approver_group_ids=None,
approval_rule_name="name",
- **kwargs
+ **kwargs,
):
"""Change MR-level allowed approvers and approver groups.
diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py
index 2a32e41..3b0d269 100644
--- a/gitlab/v4/objects/merge_requests.py
+++ b/gitlab/v4/objects/merge_requests.py
@@ -166,9 +166,8 @@ class ProjectMergeRequest(
request
"""
- path = "%s/%s/cancel_merge_when_pipeline_succeeds" % (
- self.manager.path,
- self.get_id(),
+ path = (
+ f"{self.manager.path}/{self.get_id()}/cancel_merge_when_pipeline_succeeds"
)
server_data = self.manager.gitlab.http_put(path, **kwargs)
self._update_attrs(server_data)
@@ -193,7 +192,7 @@ class ProjectMergeRequest(
Returns:
RESTObjectList: List of issues
"""
- path = "%s/%s/closes_issues" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/closes_issues"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = ProjectIssueManager(self.manager.gitlab, parent=self.manager._parent)
return RESTObjectList(manager, ProjectIssue, data_list)
@@ -219,7 +218,7 @@ class ProjectMergeRequest(
RESTObjectList: The list of commits
"""
- path = "%s/%s/commits" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/commits"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = ProjectCommitManager(self.manager.gitlab, parent=self.manager._parent)
return RESTObjectList(manager, ProjectCommit, data_list)
@@ -239,7 +238,7 @@ class ProjectMergeRequest(
Returns:
RESTObjectList: List of changes
"""
- path = "%s/%s/changes" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/changes"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("ProjectMergeRequest", tuple(), ("sha",))
@@ -255,7 +254,7 @@ class ProjectMergeRequest(
GitlabAuthenticationError: If authentication is not correct
GitlabMRApprovalError: If the approval failed
"""
- path = "%s/%s/approve" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/approve"
data = {}
if sha:
data["sha"] = sha
@@ -275,7 +274,7 @@ class ProjectMergeRequest(
GitlabAuthenticationError: If authentication is not correct
GitlabMRApprovalError: If the unapproval failed
"""
- path = "%s/%s/unapprove" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/unapprove"
data = {}
server_data = self.manager.gitlab.http_post(path, post_data=data, **kwargs)
@@ -293,7 +292,7 @@ class ProjectMergeRequest(
GitlabAuthenticationError: If authentication is not correct
GitlabMRRebaseError: If rebasing failed
"""
- path = "%s/%s/rebase" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/rebase"
data = {}
return self.manager.gitlab.http_put(path, post_data=data, **kwargs)
@@ -309,7 +308,7 @@ class ProjectMergeRequest(
Raises:
GitlabGetError: If cannot be merged
"""
- path = "%s/%s/merge_ref" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/merge_ref"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action(
@@ -327,7 +326,7 @@ class ProjectMergeRequest(
merge_commit_message=None,
should_remove_source_branch=False,
merge_when_pipeline_succeeds=False,
- **kwargs
+ **kwargs,
):
"""Accept the merge request.
@@ -343,7 +342,7 @@ class ProjectMergeRequest(
GitlabAuthenticationError: If authentication is not correct
GitlabMRClosedError: If the merge failed
"""
- path = "%s/%s/merge" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/merge"
data = {}
if merge_commit_message:
data["merge_commit_message"] = merge_commit_message
diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py
index 0d6962d..fc39df7 100644
--- a/gitlab/v4/objects/milestones.py
+++ b/gitlab/v4/objects/milestones.py
@@ -43,7 +43,7 @@ class GroupMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
RESTObjectList: The list of issues
"""
- path = "%s/%s/issues" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/issues"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = GroupIssueManager(self.manager.gitlab, parent=self.manager._parent)
# FIXME(gpocentek): the computed manager path is not correct
@@ -69,7 +69,7 @@ class GroupMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
RESTObjectList: The list of merge requests
"""
- path = "%s/%s/merge_requests" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/merge_requests"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = GroupIssueManager(self.manager.gitlab, parent=self.manager._parent)
# FIXME(gpocentek): the computed manager path is not correct
@@ -115,7 +115,7 @@ class ProjectMilestone(PromoteMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
RESTObjectList: The list of issues
"""
- path = "%s/%s/issues" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/issues"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = ProjectIssueManager(self.manager.gitlab, parent=self.manager._parent)
# FIXME(gpocentek): the computed manager path is not correct
@@ -141,7 +141,7 @@ class ProjectMilestone(PromoteMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
RESTObjectList: The list of merge requests
"""
- path = "%s/%s/merge_requests" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/merge_requests"
data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs)
manager = ProjectMergeRequestManager(
self.manager.gitlab, parent=self.manager._parent
diff --git a/gitlab/v4/objects/pipelines.py b/gitlab/v4/objects/pipelines.py
index 2d212a6..bba79c7 100644
--- a/gitlab/v4/objects/pipelines.py
+++ b/gitlab/v4/objects/pipelines.py
@@ -62,7 +62,7 @@ class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabPipelineCancelError: If the request failed
"""
- path = "%s/%s/cancel" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/cancel"
return self.manager.gitlab.http_post(path)
@cli.register_custom_action("ProjectPipeline")
@@ -77,7 +77,7 @@ class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabPipelineRetryError: If the request failed
"""
- path = "%s/%s/retry" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/retry"
return self.manager.gitlab.http_post(path)
@@ -182,7 +182,7 @@ class ProjectPipelineSchedule(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabOwnershipError: If the request failed
"""
- path = "%s/%s/take_ownership" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/take_ownership"
server_data = self.manager.gitlab.http_post(path, **kwargs)
self._update_attrs(server_data)
@@ -199,7 +199,7 @@ class ProjectPipelineSchedule(SaveMixin, ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabPipelinePlayError: If the request failed
"""
- path = "%s/%s/play" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/play"
server_data = self.manager.gitlab.http_post(path, **kwargs)
self._update_attrs(server_data)
return server_data
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
index 551079a..ac18158 100644
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -176,7 +176,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the relation could not be created
"""
- path = "/projects/%s/fork/%s" % (self.get_id(), forked_from_id)
+ path = f"/projects/{self.get_id()}/fork/{forked_from_id}"
self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("Project")
@@ -191,7 +191,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/projects/%s/fork" % self.get_id()
+ path = f"/projects/{self.get_id()}/fork"
self.manager.gitlab.http_delete(path, **kwargs)
@cli.register_custom_action("Project")
@@ -206,7 +206,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabGetError: If the server failed to perform the request
"""
- path = "/projects/%s/languages" % self.get_id()
+ path = f"/projects/{self.get_id()}/languages"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("Project")
@@ -221,7 +221,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server failed to perform the request
"""
- path = "/projects/%s/star" % self.get_id()
+ path = f"/projects/{self.get_id()}/star"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(server_data, dict)
@@ -239,7 +239,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/projects/%s/unstar" % self.get_id()
+ path = f"/projects/{self.get_id()}/unstar"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(server_data, dict)
@@ -257,7 +257,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server failed to perform the request
"""
- path = "/projects/%s/archive" % self.get_id()
+ path = f"/projects/{self.get_id()}/archive"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(server_data, dict)
@@ -275,7 +275,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/projects/%s/unarchive" % self.get_id()
+ path = f"/projects/{self.get_id()}/unarchive"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if TYPE_CHECKING:
assert isinstance(server_data, dict)
@@ -290,7 +290,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
group_id: int,
group_access: int,
expires_at: Optional[str] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> None:
"""Share the project with a group.
@@ -303,7 +303,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server failed to perform the request
"""
- path = "/projects/%s/share" % self.get_id()
+ path = f"/projects/{self.get_id()}/share"
data = {
"group_id": group_id,
"group_access": group_access,
@@ -324,7 +324,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/projects/%s/share/%s" % (self.get_id(), group_id)
+ path = f"/projects/{self.get_id()}/share/{group_id}"
self.manager.gitlab.http_delete(path, **kwargs)
# variables not supported in CLI
@@ -335,7 +335,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
ref: str,
token: str,
variables: Optional[Dict[str, Any]] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> ProjectPipeline:
"""Trigger a CI build.
@@ -352,7 +352,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabCreateError: If the server failed to perform the request
"""
variables = variables or {}
- path = "/projects/%s/trigger/pipeline" % self.get_id()
+ path = f"/projects/{self.get_id()}/trigger/pipeline"
post_data = {"ref": ref, "token": token, "variables": variables}
attrs = self.manager.gitlab.http_post(path, post_data=post_data, **kwargs)
if TYPE_CHECKING:
@@ -372,7 +372,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabHousekeepingError: If the server failed to perform the
request
"""
- path = "/projects/%s/housekeeping" % self.get_id()
+ path = f"/projects/{self.get_id()}/housekeeping"
self.manager.gitlab.http_post(path, **kwargs)
# see #56 - add file attachment features
@@ -383,7 +383,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
filename: str,
filedata: Optional[bytes] = None,
filepath: Optional[str] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> Dict[str, Any]:
"""Upload the specified file into the project.
@@ -420,7 +420,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
with open(filepath, "rb") as f:
filedata = f.read()
- url = "/projects/%(id)s/uploads" % {"id": self.id}
+ url = f"/projects/{self.id}/uploads"
file_info = {"file": (filename, filedata)}
data = self.manager.gitlab.http_post(url, files=file_info)
@@ -436,7 +436,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
streamed: bool = False,
action: Optional[Callable] = None,
chunk_size: int = 1024,
- **kwargs: Any
+ **kwargs: Any,
) -> Optional[bytes]:
"""Return a snapshot of the repository.
@@ -457,7 +457,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
Returns:
str: The uncompressed tar archive of the repository
"""
- path = "/projects/%s/snapshot" % self.get_id()
+ path = f"/projects/{self.get_id()}/snapshot"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -485,7 +485,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabList: A list of dicts describing the resources found.
"""
data = {"scope": scope, "search": search}
- path = "/projects/%s/search" % self.get_id()
+ path = f"/projects/{self.get_id()}/search"
return self.manager.gitlab.http_list(path, query_data=data, **kwargs)
@cli.register_custom_action("Project")
@@ -500,7 +500,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server failed to perform the request
"""
- path = "/projects/%s/mirror/pull" % self.get_id()
+ path = f"/projects/{self.get_id()}/mirror/pull"
self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("Project", ("to_namespace",))
@@ -517,7 +517,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
GitlabAuthenticationError: If authentication is not correct
GitlabTransferProjectError: If the project could not be transferred
"""
- path = "/projects/%s/transfer" % (self.id,)
+ path = f"/projects/{self.id}/transfer"
self.manager.gitlab.http_put(
path, post_data={"namespace": to_namespace}, **kwargs
)
@@ -531,7 +531,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
streamed: bool = False,
action: Optional[Callable] = None,
chunk_size: int = 1024,
- **kwargs: Any
+ **kwargs: Any,
) -> Optional[bytes]:
"""Get the job artifacts archive from a specific tag or branch.
@@ -556,7 +556,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
Returns:
str: The artifacts if `streamed` is False, None otherwise.
"""
- path = "/projects/%s/jobs/artifacts/%s/download" % (self.get_id(), ref_name)
+ path = f"/projects/{self.get_id()}/jobs/artifacts/{ref_name}/download"
result = self.manager.gitlab.http_get(
path, job=job, streamed=streamed, raw=True, **kwargs
)
@@ -574,7 +574,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
streamed: bool = False,
action: Optional[Callable] = None,
chunk_size: int = 1024,
- **kwargs: Any
+ **kwargs: Any,
) -> Optional[bytes]:
"""Download a single artifact file from a specific tag or branch from within the job’s artifacts archive.
@@ -598,12 +598,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
str: The artifacts if `streamed` is False, None otherwise.
"""
- path = "/projects/%s/jobs/artifacts/%s/raw/%s?job=%s" % (
- self.get_id(),
- ref_name,
- artifact_path,
- job,
- )
+ path = f"/projects/{self.get_id()}/jobs/artifacts/{ref_name}/raw/{artifact_path}?job={job}"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -787,7 +782,7 @@ class ProjectManager(CRUDMixin, RESTManager):
namespace: Optional[str] = None,
overwrite: bool = False,
override_params: Optional[Dict[str, Any]] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> Union[Dict[str, Any], requests.Response]:
"""Import a project from an archive file.
@@ -812,7 +807,7 @@ class ProjectManager(CRUDMixin, RESTManager):
data = {"path": path, "overwrite": str(overwrite)}
if override_params:
for k, v in override_params.items():
- data["override_params[%s]" % k] = v
+ data[f"override_params[{k}]"] = v
if name is not None:
data["name"] = name
if namespace:
@@ -830,7 +825,7 @@ class ProjectManager(CRUDMixin, RESTManager):
bitbucket_server_repo: str,
new_name: Optional[str] = None,
target_namespace: Optional[str] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> Union[Dict[str, Any], requests.Response]:
"""Import a project from BitBucket Server to Gitlab (schedule the import)
@@ -918,7 +913,7 @@ class ProjectManager(CRUDMixin, RESTManager):
repo_id: int,
target_namespace: str,
new_name: Optional[str] = None,
- **kwargs: Any
+ **kwargs: Any,
) -> Union[Dict[str, Any], requests.Response]:
"""Import a project from Github to Gitlab (schedule the import)
diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py
index de5f0d2..e1067bd 100644
--- a/gitlab/v4/objects/repositories.py
+++ b/gitlab/v4/objects/repositories.py
@@ -27,7 +27,7 @@ class RepositoryMixin:
"""
submodule = submodule.replace("/", "%2F") # .replace('.', '%2E')
- path = "/projects/%s/repository/submodules/%s" % (self.get_id(), submodule)
+ path = f"/projects/{self.get_id()}/repository/submodules/{submodule}"
data = {"branch": branch, "commit_sha": commit_sha}
if "commit_message" in kwargs:
data["commit_message"] = kwargs["commit_message"]
@@ -56,7 +56,7 @@ class RepositoryMixin:
Returns:
list: The representation of the tree
"""
- gl_path = "/projects/%s/repository/tree" % self.get_id()
+ gl_path = f"/projects/{self.get_id()}/repository/tree"
query_data = {"recursive": recursive}
if path:
query_data["path"] = path
@@ -81,7 +81,7 @@ class RepositoryMixin:
dict: The blob content and metadata
"""
- path = "/projects/%s/repository/blobs/%s" % (self.get_id(), sha)
+ path = f"/projects/{self.get_id()}/repository/blobs/{sha}"
return self.manager.gitlab.http_get(path, **kwargs)
@cli.register_custom_action("Project", ("sha",))
@@ -108,7 +108,7 @@ class RepositoryMixin:
Returns:
str: The blob content if streamed is False, None otherwise
"""
- path = "/projects/%s/repository/blobs/%s/raw" % (self.get_id(), sha)
+ path = f"/projects/{self.get_id()}/repository/blobs/{sha}/raw"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -131,7 +131,7 @@ class RepositoryMixin:
Returns:
str: The diff
"""
- path = "/projects/%s/repository/compare" % self.get_id()
+ path = f"/projects/{self.get_id()}/repository/compare"
query_data = {"from": from_, "to": to}
return self.manager.gitlab.http_get(path, query_data=query_data, **kwargs)
@@ -155,7 +155,7 @@ class RepositoryMixin:
Returns:
list: The contributors
"""
- path = "/projects/%s/repository/contributors" % self.get_id()
+ path = f"/projects/{self.get_id()}/repository/contributors"
return self.manager.gitlab.http_list(path, **kwargs)
@cli.register_custom_action("Project", tuple(), ("sha",))
@@ -182,7 +182,7 @@ class RepositoryMixin:
Returns:
bytes: The binary data of the archive
"""
- path = "/projects/%s/repository/archive" % self.get_id()
+ path = f"/projects/{self.get_id()}/repository/archive"
query_data = {}
if sha:
query_data["sha"] = sha
@@ -203,5 +203,5 @@ class RepositoryMixin:
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server failed to perform the request
"""
- path = "/projects/%s/repository/merged_branches" % self.get_id()
+ path = f"/projects/{self.get_id()}/repository/merged_branches"
self.manager.gitlab.http_delete(path, **kwargs)
diff --git a/gitlab/v4/objects/snippets.py b/gitlab/v4/objects/snippets.py
index 164b30c..7e37556 100644
--- a/gitlab/v4/objects/snippets.py
+++ b/gitlab/v4/objects/snippets.py
@@ -40,7 +40,7 @@ class Snippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
str: The snippet content
"""
- path = "/snippets/%s/raw" % self.get_id()
+ path = f"/snippets/{self.get_id()}/raw"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
@@ -103,7 +103,7 @@ class ProjectSnippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObj
Returns:
str: The snippet content
"""
- path = "%s/%s/raw" % (self.manager.path, self.get_id())
+ path = f"{self.manager.path}/{self.get_id()}/raw"
result = self.manager.gitlab.http_get(
path, streamed=streamed, raw=True, **kwargs
)
diff --git a/gitlab/v4/objects/todos.py b/gitlab/v4/objects/todos.py
index de82437..eecd222 100644
--- a/gitlab/v4/objects/todos.py
+++ b/gitlab/v4/objects/todos.py
@@ -22,7 +22,7 @@ class Todo(ObjectDeleteMixin, RESTObject):
GitlabAuthenticationError: If authentication is not correct
GitlabTodoError: If the server failed to perform the request
"""
- path = "%s/%s/mark_as_done" % (self.manager.path, self.id)
+ path = f"{self.manager.path}/{self.id}/mark_as_done"
server_data = self.manager.gitlab.http_post(path, **kwargs)
self._update_attrs(server_data)
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py
index 4f8721a..f8cbe16 100644
--- a/gitlab/v4/objects/users.py
+++ b/gitlab/v4/objects/users.py
@@ -154,7 +154,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
bool: Whether the user status has been changed
"""
- path = "/users/%s/block" % self.id
+ path = f"/users/{self.id}/block"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if server_data is True:
self._attrs["state"] = "blocked"
@@ -175,7 +175,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
dict: The new object data (*not* a RESTObject)
"""
- path = "/users/%s/follow" % self.id
+ path = f"/users/{self.id}/follow"
return self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("User")
@@ -193,7 +193,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
dict: The new object data (*not* a RESTObject)
"""
- path = "/users/%s/unfollow" % self.id
+ path = f"/users/{self.id}/unfollow"
return self.manager.gitlab.http_post(path, **kwargs)
@cli.register_custom_action("User")
@@ -211,7 +211,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
bool: Whether the user status has been changed
"""
- path = "/users/%s/unblock" % self.id
+ path = f"/users/{self.id}/unblock"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if server_data is True:
self._attrs["state"] = "active"
@@ -232,7 +232,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
bool: Whether the user status has been changed
"""
- path = "/users/%s/deactivate" % self.id
+ path = f"/users/{self.id}/deactivate"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if server_data:
self._attrs["state"] = "deactivated"
@@ -253,7 +253,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
Returns:
bool: Whether the user status has been changed
"""
- path = "/users/%s/activate" % self.id
+ path = f"/users/{self.id}/activate"
server_data = self.manager.gitlab.http_post(path, **kwargs)
if server_data:
self._attrs["state"] = "active"
@@ -504,9 +504,9 @@ class UserProjectManager(ListMixin, CreateMixin, RESTManager):
GitlabListError: If the server cannot perform the request
"""
if self._parent:
- path = "/users/%s/projects" % self._parent.id
+ path = f"/users/{self._parent.id}/projects"
else:
- path = "/users/%s/projects" % kwargs["user_id"]
+ path = f"/users/{kwargs['user_id']}/projects"
return ListMixin.list(self, path=path, **kwargs)