38 lines
930 B
Python
38 lines
930 B
Python
#!/usr/bin/env python3
|
|
|
|
|
|
import os
|
|
from typing import Dict, List
|
|
|
|
from git import checkout_branch
|
|
from gitlab import Gitlab
|
|
from utils import mkcd
|
|
from submission import Submission
|
|
|
|
|
|
class BaseCommand:
|
|
def __init__(
|
|
self, submissions: List[Submission], gitlab: Gitlab, details: Dict
|
|
) -> None:
|
|
self.submissions = submissions
|
|
self.gitlab = gitlab
|
|
self.hw = details
|
|
|
|
def __call__(self) -> None:
|
|
for submission in self.submissions:
|
|
self.exec(submission)
|
|
|
|
def exec(self, submission: Submission) -> None:
|
|
raise NotImplementedError()
|
|
|
|
|
|
class BaseGitCommand(BaseCommand):
|
|
def __call__(self) -> None:
|
|
for submission in self.submissions:
|
|
checkout_branch(submission.branch)
|
|
mkcd(f"{submission.homework}/{submission.login}")
|
|
|
|
self.exec(submission)
|
|
|
|
os.chdir("../..")
|
|
checkout_branch("master")
|