Skip to content

Commit 279c382

Browse files
committed
linted and type checked
1 parent fd4988c commit 279c382

2 files changed

Lines changed: 21 additions & 24 deletions

File tree

asyncPyGithub/Repository.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ async def create_organization_repo(
171171

172172
@needs_authentication
173173
async def get_user_repo(
174+
cls: Self,
174175
owner: str,
175176
repo: str,
176-
) -> tuple[int, list[FullRepository] | ErrorMessage]:
177+
) -> tuple[int, FullRepository | ErrorMessage]:
177178
"""
178179
Lists repositories for the authenticated user.
179180
This endpoint can be used without authentication, or
@@ -210,6 +211,7 @@ async def get_user_repo(
210211

211212
@needs_authentication
212213
async def update_repository(
214+
cls: Self,
213215
owner: str,
214216
repo: str,
215217
name: Optional[str] = None,
@@ -302,7 +304,7 @@ async def update_repository(
302304

303305
@needs_authentication
304306
async def delete_repository(
305-
owner: str, repo: str
307+
cls: Self, owner: str, repo: str
306308
) -> tuple[int, Optional[ErrorMessage]]:
307309
"""
308310
Deletes a repository.
@@ -338,7 +340,12 @@ async def delete_repository(
338340

339341
@needs_authentication
340342
async def list_contributors(
341-
owner: str, repo: str, anon: bool = False, per_page: int = 30, page: int = 1
343+
cls: Self,
344+
owner: str,
345+
repo: str,
346+
anon: bool = False,
347+
per_page: int = 30,
348+
page: int = 1,
342349
) -> tuple[int, list[Contributor] | ErrorMessage]:
343350
"""
344351
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.
@@ -379,7 +386,7 @@ async def list_contributors(
379386

380387
@needs_authentication
381388
async def list_repository_languages(
382-
owner: str, repo: str
389+
cls: Self, owner: str, repo: str
383390
) -> tuple[int, dict[str, int] | ErrorMessage]:
384391
"""
385392
Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.
@@ -414,7 +421,7 @@ async def list_repository_languages(
414421

415422
@needs_authentication
416423
async def list_repository_tags(
417-
owner: str, repo: str, per_page: int = 30, page: int = 1
424+
cls: Self, owner: str, repo: str, per_page: int = 30, page: int = 1
418425
) -> tuple[int, list[Tag] | ErrorMessage]:
419426
"""
420427
Lists tags for the specified repository.
@@ -455,7 +462,7 @@ async def list_repository_tags(
455462

456463
@needs_authentication
457464
async def get_repository_topics(
458-
owner: str, repo: str
465+
cls: Self, owner: str, repo: str
459466
) -> tuple[int, Topics | ErrorMessage]:
460467
"""
461468
Lists topics for the specified repository.

asyncPyGithub/_types/repos.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ class FullRepositoryJSON(TypedDict, total=False):
251251
trees_url: HttpUrl
252252
clone_url: HttpUrl
253253
mirror_url: Optional[HttpUrl]
254-
hooks_url: HttpUrl
255254
svn_url: HttpUrl
256255
homepage: Optional[str]
257256
language: Optional[str]
@@ -478,25 +477,16 @@ class FullRepository(BaseModel):
478477
notifications_url: HttpUrl
479478
pulls_url: HttpUrl
480479
releases_url: HttpUrl
481-
ssh_url: HttpUrl = None # Optional, but typically present in full repositories.
482-
stargazers_url: HttpUrl = (
483-
None # Optional, but typically present in full repositories.
484-
)
485-
statuses_url: HttpUrl = (
486-
None # Optional, but typically present in full repositories.
487-
)
488-
subscribers_url: HttpUrl = (
489-
None # Optional, but typically present in full repositories.
490-
)
491-
subscription_url: HttpUrl = (
492-
None # Optional, but typically present in full repositories.
493-
)
494-
tags_url: HttpUrl = None # Optional, but typically present in full repositories.
495-
teams_url: HttpUrl = None # Optional, but typically present in full repositories.
480+
ssh_url: Optional[HttpUrl] = None
481+
stargazers_url: Optional[HttpUrl] = None
482+
subscribers_url: Optional[HttpUrl] = None
483+
subscription_url: Optional[HttpUrl] = None
484+
tags_url: Optional[HttpUrl] = None
485+
teams_url: Optional[HttpUrl] = None
496486
trees_url: str
497-
clone_url: HttpUrl = None # Optional, but typically present in full repositories.
487+
clone_url: Optional[HttpUrl] = None
498488
mirror_url: Optional[HttpUrl] = None
499-
svn_url: HttpUrl = None # Optional, but typically present in full repositories.
489+
svn_url: Optional[HttpUrl] = None
500490
homepage: Optional[str] = None
501491
language: Optional[str] = None
502492
forks_count: int = 0

0 commit comments

Comments
 (0)