@@ -87,7 +87,7 @@ def get(self, workspace, repo_slug):
87
87
API docs:
88
88
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
89
89
"""
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 } " ))
91
91
92
92
93
93
class WorkspaceRepositories (RepositoriesBase ):
@@ -127,7 +127,7 @@ def create(self, repo_slug, project_key=None, is_private=None, fork_policy=None)
127
127
data ["is_private" ] = is_private
128
128
if fork_policy is not None :
129
129
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 } " )
131
131
data ["fork_policy" ] = fork_policy
132
132
return self ._get_object (self .post (repo_slug , data = data ))
133
133
@@ -179,9 +179,9 @@ def get(self, repository, by="slug"):
179
179
if r .name == repository :
180
180
return r
181
181
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'" )
183
183
184
- raise Exception ("Unknown repository {} '{}'" . format ( by , repository ) )
184
+ raise Exception (f "Unknown repository { by } '{ repository } '" )
185
185
186
186
def exists (self , repository , by = "slug" ):
187
187
"""
@@ -203,7 +203,7 @@ def exists(self, repository, by="slug"):
203
203
if e .response .status_code in (401 , 404 ):
204
204
pass
205
205
except Exception as e :
206
- if not str (e ) == "Unknown project {} '{}'" . format ( by , repository ) :
206
+ if not str (e ) == f "Unknown project { by } '{ repository } '" :
207
207
raise e
208
208
return exists
209
209
@@ -243,46 +243,40 @@ def get(self, repository, by="slug"):
243
243
https://developer.atlassian.com/bitbucket/api/2/reference/resource/workspaces/%7Bworkspace%7D/projects/%7Bproject_key%7D#get
244
244
"""
245
245
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'" )
247
247
248
248
for r in self .each ():
249
249
if ((by == "slug" ) and (r .slug == repository )) or ((by == "name" ) and (r .name == repository )):
250
250
return r
251
251
252
- raise Exception ("Unknown repository {} '{}'" . format ( by , repository ) )
252
+ raise Exception (f "Unknown repository { by } '{ repository } '" )
253
253
254
254
255
255
class Repository (BitbucketCloudBase ):
256
256
def __init__ (self , data , * args , ** kwargs ):
257
257
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 )
262
260
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" }}},
265
263
** self ._new_session_args
266
264
) # fmt: skip
267
265
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" }}},
270
268
** self ._new_session_args
271
269
) # 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 )
282
276
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
284
278
)
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 )
286
280
287
281
def update (self , ** kwargs ):
288
282
"""
0 commit comments