@@ -87,7 +87,7 @@ def get(self, workspace, repo_slug):
8787 API docs:
8888 https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
8989 """
90- return self ._get_object (super (Repositories , self ).get ("{ }/{}" . format ( workspace , repo_slug ) ))
90+ return self ._get_object (super (Repositories , self ).get (f" { workspace } /{ repo_slug } " ))
9191
9292
9393class WorkspaceRepositories (RepositoriesBase ):
@@ -127,7 +127,7 @@ def create(self, repo_slug, project_key=None, is_private=None, fork_policy=None)
127127 data ["is_private" ] = is_private
128128 if fork_policy is not None :
129129 if fork_policy not in self .FORK_POLICIES :
130- raise ValueError ("fork_policy must be one of {}" . format ( self .FORK_POLICIES ) )
130+ raise ValueError (f "fork_policy must be one of { self .FORK_POLICIES } " )
131131 data ["fork_policy" ] = fork_policy
132132 return self ._get_object (self .post (repo_slug , data = data ))
133133
@@ -179,9 +179,9 @@ def get(self, repository, by="slug"):
179179 if r .name == repository :
180180 return r
181181 else :
182- ValueError ("Unknown value '{}' for argument [by], expected 'key' or 'name'" . format ( by ) )
182+ ValueError (f "Unknown value '{ by } ' for argument [by], expected 'key' or 'name'" )
183183
184- raise Exception ("Unknown repository {} '{}'" . format ( by , repository ) )
184+ raise Exception (f "Unknown repository { by } '{ repository } '" )
185185
186186 def exists (self , repository , by = "slug" ):
187187 """
@@ -203,7 +203,7 @@ def exists(self, repository, by="slug"):
203203 if e .response .status_code in (401 , 404 ):
204204 pass
205205 except Exception as e :
206- if not str (e ) == "Unknown project {} '{}'" . format ( by , repository ) :
206+ if not str (e ) == f "Unknown project { by } '{ repository } '" :
207207 raise e
208208 return exists
209209
@@ -243,46 +243,40 @@ def get(self, repository, by="slug"):
243243 https://developer.atlassian.com/bitbucket/api/2/reference/resource/workspaces/%7Bworkspace%7D/projects/%7Bproject_key%7D#get
244244 """
245245 if by not in ("slug" , "name" ):
246- ValueError ("Unknown value '{}' for argument [by], expected 'slug' or 'name'" . format ( by ) )
246+ ValueError (f "Unknown value '{ by } ' for argument [by], expected 'slug' or 'name'" )
247247
248248 for r in self .each ():
249249 if ((by == "slug" ) and (r .slug == repository )) or ((by == "name" ) and (r .name == repository )):
250250 return r
251251
252- raise Exception ("Unknown repository {} '{}'" . format ( by , repository ) )
252+ raise Exception (f "Unknown repository { by } '{ repository } '" )
253253
254254
255255class Repository (BitbucketCloudBase ):
256256 def __init__ (self , data , * args , ** kwargs ):
257257 super (Repository , self ).__init__ (None , * args , data = data , expected_type = "repository" , ** kwargs )
258- self .__branch_restrictions = BranchRestrictions (
259- "{}/branch-restrictions" .format (self .url ), ** self ._new_session_args
260- )
261- self .__branches = Branches ("{}/refs/branches" .format (self .url ), ** self ._new_session_args )
258+ self .__branch_restrictions = BranchRestrictions (f"{ self .url } /branch-restrictions" , ** self ._new_session_args )
259+ self .__branches = Branches (f"{ self .url } /refs/branches" , ** self ._new_session_args )
262260 self .__commits = Commits (
263- "{ }/commits". format ( self . url ) ,
264- data = {"links" : {"commit" : {"href" : "{ }/commit". format ( self . url ) }}},
261+ f" { self . url } /commits" ,
262+ data = {"links" : {"commit" : {"href" : f" { self . url } /commit" }}},
265263 ** self ._new_session_args
266264 ) # fmt: skip
267265 self .__hooks = Hooks (
268- "{ }/hooks". format ( self . url ) ,
269- data = {"links" : {"hooks" : {"href" : "{ }/hooks". format ( self . url ) }}},
266+ f" { self . url } /hooks" ,
267+ data = {"links" : {"hooks" : {"href" : f" { self . url } /hooks" }}},
270268 ** self ._new_session_args
271269 ) # fmt: skip
272- self .__default_reviewers = DefaultReviewers ("{}/default-reviewers" .format (self .url ), ** self ._new_session_args )
273- self .__deployment_environments = DeploymentEnvironments (
274- "{}/environments" .format (self .url ), ** self ._new_session_args
275- )
276- self .__group_permissions = GroupPermissions (
277- "{}/permissions-config/groups" .format (self .url ), ** self ._new_session_args
278- )
279- self .__issues = Issues ("{}/issues" .format (self .url ), ** self ._new_session_args )
280- self .__pipelines = Pipelines ("{}/pipelines" .format (self .url ), ** self ._new_session_args )
281- self .__pullrequests = PullRequests ("{}/pullrequests" .format (self .url ), ** self ._new_session_args )
270+ self .__default_reviewers = DefaultReviewers (f"{ self .url } /default-reviewers" , ** self ._new_session_args )
271+ self .__deployment_environments = DeploymentEnvironments (f"{ self .url } /environments" , ** self ._new_session_args )
272+ self .__group_permissions = GroupPermissions (f"{ self .url } /permissions-config/groups" , ** self ._new_session_args )
273+ self .__issues = Issues (f"{ self .url } /issues" , ** self ._new_session_args )
274+ self .__pipelines = Pipelines (f"{ self .url } /pipelines" , ** self ._new_session_args )
275+ self .__pullrequests = PullRequests (f"{ self .url } /pullrequests" , ** self ._new_session_args )
282276 self .__repository_variables = RepositoryVariables (
283- "{ }/pipelines_config/variables". format ( self . url ) , ** self ._new_session_args
277+ f" { self . url } /pipelines_config/variables" , ** self ._new_session_args
284278 )
285- self .__tags = Tags ("{ }/refs/tags". format ( self . url ) , ** self ._new_session_args )
279+ self .__tags = Tags (f" { self . url } /refs/tags" , ** self ._new_session_args )
286280
287281 def update (self , ** kwargs ):
288282 """
0 commit comments