Add sources.py

This commit is contained in:
Xevion
2022-06-18 12:56:22 -05:00
parent f52bf16d12
commit 79a77cf365

27
sources.py Normal file
View File

@@ -0,0 +1,27 @@
import abc
from typing import Callable, List
from decouple import config
from models import Commit
class CommitSource(abc.ABC):
"""A simple abstract class for representing different commit sources generally."""
@abc.abstractmethod
def fetch(self, check_function: Callable) -> List[Commit]:
"""Fetch commits from the source."""
pass
class Gitlab(CommitSource):
"""Serves as the commit source for GitLab."""
API_KEY_CONSTANT: str = 'GITLAB_API_KEY'
def __init__(self) -> None:
self.__api_key: str = config(self.API_KEY_CONSTANT)
def fetch(self, check_function: Callable) -> List[Commit]:
pass