-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbase.py
45 lines (34 loc) · 1.34 KB
/
base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from abc import ABC, abstractmethod
from codedog.models import Blob, ChangeFile, Commit, PullRequest, Repository
class Retriever(ABC):
"""Base class for git repository pull request retrievers.
Retrievers are responsible for retrieving pr related commits, branchs, issues and code data from
Github, Gitlab, Bitbucket etc. It defines the interface codedog uses to retrieve data from
from repository, wrapped the different client api of platforms.
"""
@property
@abstractmethod
def retriever_type(self) -> str:
"""Return the retriever type."""
@property
@abstractmethod
def pull_request(self) -> PullRequest:
"""Return the pull request object."""
@property
@abstractmethod
def repository(self) -> Repository:
"""Return the pull request target repository object."""
@property
@abstractmethod
def source_repository(self) -> Repository:
"""Return the pull request source repository object."""
@property
@abstractmethod
def changed_files(self) -> list[ChangeFile]:
"""Return the changed file list between end commit and start commit."""
@abstractmethod
def get_blob(self, blob_sha: str or id) -> Blob:
"""Get blob by id."""
@abstractmethod
def get_commit(self, commit_sha: str or id) -> Commit:
"""Get commit by id."""