Skip to content

Commit 2dd1d2b

Browse files
committed
typing removed
1 parent acb8f2d commit 2dd1d2b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

GitHubRepoAPI.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@
99
Branch,
1010
IRepositoryAPI,
1111
)
12-
from typing import Optional, List
1312
from github import Github
1413

1514
class GitHubRepoAPI(IRepositoryAPI):
1615

1716
def __init__(self, client):
1817
self.client = client
1918

20-
def get_repository(self, id: str) -> Optional[Repository]:
19+
def get_repository(self, id: str) -> Repository | None:
2120
try:
2221
repo = self.client.get_repo(id)
2322
return Repository(_id=repo.full_name, name=repo.name, url=repo.html_url)
2423
except Exception as e:
2524
logging.error(f"Failed to get repository {id} from GitHub: {e}")
2625
return None
2726

28-
def get_commits(self, repo: Repository) -> List[Commit]:
27+
def get_commits(self, repo: Repository) -> list[Commit]:
2928
try:
3029
commits = self.client.get_repo(repo._id).get_commits()
3130
return [
@@ -40,15 +39,15 @@ def get_commits(self, repo: Repository) -> List[Commit]:
4039
logging.error(f"Failed to get commits from GitHub for repo {repo.name}: {e}")
4140
return []
4241

43-
def get_contributors(self, repo: Repository) -> List[Contributor]:
42+
def get_contributors(self, repo: Repository) -> list[Contributor]:
4443
try:
4544
contributors = self.client.get_repo(repo._id).get_contributors()
4645
return [Contributor(c.login, c.email or "") for c in contributors]
4746
except Exception as e:
4847
logging.error(f"Failed to get contributors from GitHub for repo {repo.name}: {e}")
4948
return []
5049

51-
def get_issues(self, repo: Repository) -> List[Issue]:
50+
def get_issues(self, repo: Repository) -> list[Issue]:
5251
try:
5352
issues = self.client.get_repo(repo._id).get_issues(state='all')
5453
return [
@@ -63,7 +62,7 @@ def get_issues(self, repo: Repository) -> List[Issue]:
6362
logging.error(f"Failed to get issues from GitHub for repo {repo.name}: {e}")
6463
return []
6564

66-
def get_pull_requests(self, repo: Repository) -> List[PullRequest]:
65+
def get_pull_requests(self, repo: Repository) -> list[PullRequest]:
6766
try:
6867
pulls = self.client.get_repo(repo._id).get_pulls(state='all')
6968
return [
@@ -78,7 +77,7 @@ def get_pull_requests(self, repo: Repository) -> List[PullRequest]:
7877
logging.error(f"Failed to get pull requests from GitHub for repo {repo.name}: {e}")
7978
return []
8079

81-
def get_branches(self, repo: Repository) -> List[Branch]:
80+
def get_branches(self, repo: Repository) -> list[Branch]:
8281
try:
8382
repo_client = self.client.get_repo(repo._id)
8483
branches = repo_client.get_branches()
@@ -114,7 +113,7 @@ def get_branches(self, repo: Repository) -> List[Branch]:
114113
logging.error(f"Failed to get branches from GitHub for repo {repo.name}: {e}")
115114
return []
116115

117-
def get_wiki_pages(self, repo: Repository) -> List[WikiPage]:
116+
def get_wiki_pages(self, repo: Repository) -> list[WikiPage]:
118117
pass
119118

120119

0 commit comments

Comments
 (0)