-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper.py
More file actions
75 lines (61 loc) · 1.85 KB
/
wrapper.py
File metadata and controls
75 lines (61 loc) · 1.85 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from typing import List
import abc
from pydantic import BaseModel, Field
from datetime import datetime
class Pagination(BaseModel):
"""pagination for listing comments"""
offset: int = Field(..., description="offset starts from 0")
limit: int = Field(
...,
description="limit of number of items to return. limit should not be less than 10",
)
class CommentMeta(BaseModel):
author: str = Field(..., description="offset starts from 0")
body: str = Field(..., description="textual body of the comment")
created_at: str = Field(..., description="creation date of the comment")
def __str__(self):
return f"{self.author} {self.created_at}\nMessage:\n{self.body})"
class Wrapper(abc.ABC):
@abc.abstractmethod
def issue_title(self) -> str:
"""
Extract the issue title.
"""
pass
@abc.abstractmethod
def issue_created_at(self) -> datetime:
"""
Extract the issue creation timestamp
"""
pass
@abc.abstractmethod
def issue_closed_at(self) -> datetime:
"""
Extract the issue closed_at timestamp
"""
pass
@abc.abstractmethod
def issue_description(self) -> str:
"""
Extract the issue description.
"""
pass
@abc.abstractmethod
def issue_author(self) -> str:
"""
Extract the username of the issue creator.
"""
pass
@abc.abstractmethod
def issue_comments(self, pagination: Pagination) -> List[CommentMeta]:
"""
Extract a list of comment metadata.
"""
pass
@abc.abstractmethod
def issue_participants(self) -> List[str]:
"""
Gather a list of unique users who participated in the issue thread.
This includes the issue creator and all comment authors.
"""
pass