@@ -75,7 +75,6 @@ async def get_organization_repos(
7575 )
7676 return (res .status_code , [MinimalRepository (** repo ) for repo in res .json ()])
7777
78-
7978 @needs_authentication
8079 async def create_organization_repo (
8180 cls : Self ,
@@ -84,7 +83,7 @@ async def create_organization_repo(
8483 description : str = "" ,
8584 homepage : str = "" ,
8685 private : bool = False ,
87- visibility : Literal [' public' , ' private' ] = "public" ,
86+ visibility : Literal [" public" , " private" ] = "public" ,
8887 has_issues : bool = True ,
8988 has_projects : bool = True ,
9089 has_wiki : bool = True ,
@@ -100,13 +99,17 @@ async def create_organization_repo(
10099 allow_auto_merge : bool = False ,
101100 delete_branch_on_merge : bool = False ,
102101 use_squash_pr_title_as_default : bool = False ,
103- squash_merge_commit_title : Literal ['PR_TITLE' , 'COMMIT_OR_PR_TITLE' ] = 'PR_TITLE' ,
104- squash_merge_commit_message : Literal ['PR_BODY' , 'COMMIT_MESSAGES' , 'BLANK' ] = 'PR_BODY' ,
105- merge_commit_title : Literal ['PR_TITLE' , 'MERGE_MESSAGE' ] = 'PR_TITLE' ,
106- merge_commit_message : Literal ['PR_BODY' , 'PR_TITLE' , 'BLANK' ] = 'PR_TITLE' ,
102+ squash_merge_commit_title : Literal [
103+ "PR_TITLE" , "COMMIT_OR_PR_TITLE"
104+ ] = "PR_TITLE" ,
105+ squash_merge_commit_message : Literal [
106+ "PR_BODY" , "COMMIT_MESSAGES" , "BLANK"
107+ ] = "PR_BODY" ,
108+ merge_commit_title : Literal ["PR_TITLE" , "MERGE_MESSAGE" ] = "PR_TITLE" ,
109+ merge_commit_message : Literal ["PR_BODY" , "PR_TITLE" , "BLANK" ] = "PR_TITLE" ,
107110 custom_properties : dict [str , str | bool | int ] | None = None ,
108111 ) -> tuple [int , FullRepository | ErrorMessage ]:
109-
112+
110113 params = {
111114 "name" : name ,
112115 "description" : description ,
@@ -131,12 +134,12 @@ async def create_organization_repo(
131134 "squash_merge_commit_title" : squash_merge_commit_title ,
132135 "squash_merge_commit_message" : squash_merge_commit_message ,
133136 "merge_commit_title" : merge_commit_title ,
134- "merge_commit_message" : merge_commit_message
137+ "merge_commit_message" : merge_commit_message ,
135138 }
136139
137140 if custom_properties :
138141 params .update (custom_properties )
139-
142+
140143 try :
141144 res = await req (
142145 fn = post ,
@@ -163,9 +166,8 @@ async def create_organization_repo(
163166 endpoint = f"/orgs/{ organization } /repos" ,
164167 ),
165168 )
166-
169+
167170 return (res .status_code , FullRepository (** res .json ()))
168-
169171
170172 @needs_authentication
171173 async def get_user_repo (
@@ -203,9 +205,8 @@ async def get_user_repo(
203205 endpoint = "/user/repos" ,
204206 ),
205207 )
206-
208+
207209 return (res .status_code , FullRepository (** res .json ()))
208-
209210
210211 @needs_authentication
211212 async def update_repository (
@@ -215,7 +216,7 @@ async def update_repository(
215216 description : Optional [str ] = None ,
216217 homepage : Optional [str ] = None ,
217218 private : Optional [bool ] = None ,
218- visibility : Optional [Literal [' public' , ' private' ]] = None ,
219+ visibility : Optional [Literal [" public" , " private" ]] = None ,
219220 has_issues : Optional [bool ] = None ,
220221 has_projects : Optional [bool ] = None ,
221222 has_wiki : Optional [bool ] = None ,
@@ -227,19 +228,23 @@ async def update_repository(
227228 allow_auto_merge : Optional [bool ] = None ,
228229 delete_branch_on_merge : Optional [bool ] = None ,
229230 use_squash_pr_title_as_default : Optional [bool ] = None ,
230- squash_merge_commit_title : Optional [Literal ['PR_TITLE' , 'COMMIT_OR_PR_TITLE' ]] = None ,
231- squash_merge_commit_message : Optional [Literal ['PR_BODY' , 'COMMIT_MESSAGES' , 'BLANK' ]] = None ,
232- merge_commit_title : Optional [Literal ['PR_TITLE' , 'MERGE_MESSAGE' ]] = None ,
233- merge_commit_message : Optional [Literal ['PR_BODY' , 'PR_TITLE' , 'BLANK' ]] = None ,
231+ squash_merge_commit_title : Optional [
232+ Literal ["PR_TITLE" , "COMMIT_OR_PR_TITLE" ]
233+ ] = None ,
234+ squash_merge_commit_message : Optional [
235+ Literal ["PR_BODY" , "COMMIT_MESSAGES" , "BLANK" ]
236+ ] = None ,
237+ merge_commit_title : Optional [Literal ["PR_TITLE" , "MERGE_MESSAGE" ]] = None ,
238+ merge_commit_message : Optional [Literal ["PR_BODY" , "PR_TITLE" , "BLANK" ]] = None ,
234239 archived : Optional [bool ] = None ,
235240 allow_forking : Optional [bool ] = None ,
236- web_commit_signoff_required : Optional [bool ] = None
241+ web_commit_signoff_required : Optional [bool ] = None ,
237242 ) -> tuple [int , FullRepository | ErrorMessage ]:
238243 """
239244 Updates a repository.
240245 This endpoint can be used with write access to the repository.
241246 """
242-
247+
243248 params = {
244249 "name" : name ,
245250 "description" : description ,
@@ -263,7 +268,7 @@ async def update_repository(
263268 "merge_commit_message" : merge_commit_message ,
264269 "archived" : archived ,
265270 "allow_forking" : allow_forking ,
266- "web_commit_signoff_required" : web_commit_signoff_required
271+ "web_commit_signoff_required" : web_commit_signoff_required ,
267272 }
268273
269274 try :
@@ -292,14 +297,12 @@ async def update_repository(
292297 endpoint = f"repos/{ owner } /{ repo } " ,
293298 ),
294299 )
295-
300+
296301 return (res .status_code , FullRepository (** res .json ()))
297-
298302
299303 @needs_authentication
300304 async def delete_repository (
301- owner : str ,
302- repo : str
305+ owner : str , repo : str
303306 ) -> tuple [int , Optional [ErrorMessage ]]:
304307 """
305308 Deletes a repository.
@@ -330,27 +333,18 @@ async def delete_repository(
330333 endpoint = f"repos/{ owner } /{ repo } " ,
331334 ),
332335 )
333-
336+
334337 return (res .status_code , None )
335-
336338
337339 @needs_authentication
338340 async def list_contributors (
339- owner : str ,
340- repo : str ,
341- anon : bool = False ,
342- per_page : int = 30 ,
343- page : int = 1
341+ owner : str , repo : str , anon : bool = False , per_page : int = 30 , page : int = 1
344342 ) -> tuple [int , list [Contributor ] | ErrorMessage ]:
345343 """
346344 Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API caches contributor data to improve performance.
347345 """
348346
349- params = {
350- "anon" : anon ,
351- "per_page" : per_page ,
352- "page" : page
353- }
347+ params = {"anon" : anon , "per_page" : per_page , "page" : page }
354348
355349 try :
356350 res = await req (
@@ -378,13 +372,14 @@ async def list_contributors(
378372 endpoint = f"repos/{ owner } /{ repo } /contributors" ,
379373 ),
380374 )
381- return (res .status_code , [Contributor (** contributor ) for contributor in res .json ()])
382-
375+ return (
376+ res .status_code ,
377+ [Contributor (** contributor ) for contributor in res .json ()],
378+ )
383379
384380 @needs_authentication
385381 async def list_repository_languages (
386- owner : str ,
387- repo : str
382+ owner : str , repo : str
388383 ) -> tuple [int , dict [str , int ] | ErrorMessage ]:
389384 """
390385 Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.
@@ -417,24 +412,17 @@ async def list_repository_languages(
417412 )
418413 return (res .status_code , res .json ())
419414
420-
421415 @needs_authentication
422416 async def list_repository_tags (
423- owner : str ,
424- repo : str ,
425- per_page : int = 30 ,
426- page : int = 1
417+ owner : str , repo : str , per_page : int = 30 , page : int = 1
427418 ) -> tuple [int , list [Tag ] | ErrorMessage ]:
428419 """
429420 Lists tags for the specified repository.
430421 This endpoint can be used without authentication, or
431422 with read access to public repositories.
432423 """
433424
434- params = {
435- "per_page" : per_page ,
436- "page" : page
437- }
425+ params = {"per_page" : per_page , "page" : page }
438426
439427 try :
440428 res = await req (
@@ -462,14 +450,12 @@ async def list_repository_tags(
462450 endpoint = f"repos/{ owner } /{ repo } /tags" ,
463451 ),
464452 )
465-
453+
466454 return (res .status_code , [Tag (** tag ) for tag in res .json ()])
467-
468455
469456 @needs_authentication
470457 async def get_repository_topics (
471- owner : str ,
472- repo : str
458+ owner : str , repo : str
473459 ) -> tuple [int , Topics | ErrorMessage ]:
474460 """
475461 Lists topics for the specified repository.
@@ -502,6 +488,5 @@ async def get_repository_topics(
502488 endpoint = f"repos/{ owner } /{ repo } /topics" ,
503489 ),
504490 )
505-
491+
506492 return (res .status_code , Topics (** res .json ()))
507-
0 commit comments