feat: raise exception on unsupported language for joj

This commit is contained in:
张泊明518370910136 2022-05-07 14:31:21 +08:00
parent e03dac6ef5
commit e26c9461b6
No known key found for this signature in database
GPG Key ID: FBEF5DE8B9F4C629
3 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,6 @@ repos:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 22.3.0
hooks:
- id: black

View File

@ -7,7 +7,7 @@ from joint_teapot.utils.logger import logger
current_path = sys.path[0]
sys.path.remove(current_path)
from git import Repo
from git import Repo # type: ignore
from git.exc import GitCommandError
sys.path.insert(0, current_path)

View File

@ -16,6 +16,8 @@ class JOJ:
self.submitter = JOJSubmitter(sid, logger)
def submit_dir(self, problem_url: str, path: str, lang: str) -> Tuple[int, str]:
if lang not in list(Language):
raise Exception(f"unsupported language '{lang}' for JOJ")
exclude_paths = [".git"]
zip_buffer = io.BytesIO()
zip_buffer.name = f"{os.path.basename(path)}.zip"