-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
829 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 配置LRUN用户和组(不要将其设置为有root权限的用户!) | ||
LRUN_UID = 1001 | ||
LRUN_GID = 1001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .base import start_server_background | ||
from .cli import cli_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .base import app as cli_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Optional | ||
|
||
import requests | ||
import typer | ||
from rich import print | ||
from rich.markdown import Markdown | ||
from rich.panel import Panel | ||
from rich.text import Text | ||
|
||
from .judge import app as judge_typer | ||
|
||
app = typer.Typer() | ||
app.add_typer(judge_typer) | ||
|
||
|
||
@app.command(name='intro', help='查看ItsWA介绍') | ||
def intro(): | ||
md = Markdown( | ||
""" | ||
## 欢迎使用 ItsWA 评测系统 | ||
ItsWA是一个基于Python搭建,使用`Lrun`提供安全运行时的Linux下的竞赛代码评测系统。 | ||
查看`docs/guide.pdf`获取使用教程 | ||
""" | ||
) | ||
|
||
print(md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import json | ||
from pathlib import Path | ||
from typing import Annotated, Optional, Union | ||
|
||
import typer | ||
|
||
from ccf_parser import CCF | ||
from judge import start_judging | ||
from utils import manager_logger | ||
|
||
app = typer.Typer(name='judge', help='评测相关') | ||
|
||
|
||
@app.command('start', help='开始评测') | ||
def start_judging_command(path: Annotated[Path, typer.Argument(help='比赛目录或CCF文件')] = Path('.')): | ||
ccf: Optional[CCF] = None | ||
|
||
if path.name == 'ccf.json': | ||
ccf = CCF(**json.loads(path.read_text('utf-8'))) | ||
elif path.is_dir() and path.joinpath('ccf.json').exists(): | ||
ccf = CCF(**json.loads(path.joinpath('ccf.json').read_text('utf-8'))) | ||
else: | ||
raise FileNotFoundError('评测目录不正确,可能是不存在CCF文件') | ||
|
||
start_judging(ccf) | ||
return 0 |
Oops, something went wrong.