summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/files.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-11-01 19:22:18 +0100
committerJohn Villalovos <john@sodarock.com>2021-11-05 20:45:01 -0700
commit7925c902d15f20abaecdb07af213f79dad91355b (patch)
tree4c6766bfac4965590570c1b22ec5a56918461e1c /gitlab/v4/objects/files.py
parentf51d9be224ab509a62efe05e9f8ffb561af62df5 (diff)
downloadgitlab-7925c902d15f20abaecdb07af213f79dad91355b.tar.gz
refactor: use f-strings for string formatting
Diffstat (limited to 'gitlab/v4/objects/files.py')
-rw-r--r--gitlab/v4/objects/files.py10
1 files changed, 5 insertions, 5 deletions
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)