Expand source code
class Commit:
def __init__(self, data: dict):
self.sha: str = data["sha"]
commit: dict = data["commit"]
self.author: dict = commit["author"]
self.committer: dict = commit["committer"]
self.message: str = commit["message"]
self.url: str = data["html_url"]
self.strings: list = [
f"{self.author['date']}: {self.message}",
f"{self.author['name']}: {self.author['email']}",
f"{self.committer['name']}: {self.committer['email']}",
f"{self.url}",
]
def __repr__(self):
return f"<Commit {self.sha}>"
def __str__(self) -> str:
return "\n".join(list(self))
def __iter__(self):
for item in self.strings:
yield item