feat: raise exception on unsupported language for joj
This commit is contained in:
parent
e03dac6ef5
commit
e26c9461b6
|
@ -30,6 +30,6 @@ repos:
|
||||||
- id: isort
|
- id: isort
|
||||||
args: ["--profile", "black", "--filter-files"]
|
args: ["--profile", "black", "--filter-files"]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.3b0
|
rev: 22.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
|
@ -7,7 +7,7 @@ from joint_teapot.utils.logger import logger
|
||||||
|
|
||||||
current_path = sys.path[0]
|
current_path = sys.path[0]
|
||||||
sys.path.remove(current_path)
|
sys.path.remove(current_path)
|
||||||
from git import Repo
|
from git import Repo # type: ignore
|
||||||
from git.exc import GitCommandError
|
from git.exc import GitCommandError
|
||||||
|
|
||||||
sys.path.insert(0, current_path)
|
sys.path.insert(0, current_path)
|
||||||
|
|
|
@ -16,6 +16,8 @@ class JOJ:
|
||||||
self.submitter = JOJSubmitter(sid, logger)
|
self.submitter = JOJSubmitter(sid, logger)
|
||||||
|
|
||||||
def submit_dir(self, problem_url: str, path: str, lang: str) -> Tuple[int, str]:
|
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"]
|
exclude_paths = [".git"]
|
||||||
zip_buffer = io.BytesIO()
|
zip_buffer = io.BytesIO()
|
||||||
zip_buffer.name = f"{os.path.basename(path)}.zip"
|
zip_buffer.name = f"{os.path.basename(path)}.zip"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user