mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
interface: remove remote problem config
This commit is contained in:
1 parent
3dcc6d2aa2
commit
12c43a9635
2 files changed
+7
-26
No files matched your search
@@ -104,21 +104,12 @@ export interface TestCaseConfig {
|
|||||||
memory?: number,
|
memory?: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum LocalProblemType {
|
export enum ProblemType {
|
||||||
Default = 'default',
|
Default = 'default',
|
||||||
SubmitAnswer = 'submit_answer',
|
SubmitAnswer = 'submit_answer',
|
||||||
Interactive = 'interactive',
|
Interactive = 'interactive',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum RemoteProblemType {
|
|
||||||
RemoteJudge = 'remotejudge',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum RemoteServerType {
|
|
||||||
vj4 = 'vj4',
|
|
||||||
syzoj = 'syzoj',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum SubtaskType {
|
export enum SubtaskType {
|
||||||
min = 'min',
|
min = 'min',
|
||||||
max = 'max',
|
max = 'max',
|
||||||
@@ -133,8 +124,8 @@ export interface SubtaskConfig {
|
|||||||
cases?: TestCaseConfig[],
|
cases?: TestCaseConfig[],
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LocalProblemConfig {
|
export interface ProblemConfig {
|
||||||
type?: LocalProblemType,
|
type?: ProblemType,
|
||||||
score?: number,
|
score?: number,
|
||||||
time?: string,
|
time?: string,
|
||||||
memory?: string,
|
memory?: string,
|
||||||
@@ -148,16 +139,6 @@ export interface LocalProblemConfig {
|
|||||||
subtasks?: SubtaskConfig[],
|
subtasks?: SubtaskConfig[],
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RemoteProblemConfig {
|
|
||||||
type?: RemoteProblemType,
|
|
||||||
server_type?: RemoteServerType,
|
|
||||||
url?: string,
|
|
||||||
// TODO handle username&password storage
|
|
||||||
pid?: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProblemConfig = LocalProblemConfig | RemoteProblemConfig;
|
|
||||||
|
|
||||||
export interface PlainContentNode {
|
export interface PlainContentNode {
|
||||||
type: 'Plain',
|
type: 'Plain',
|
||||||
subType: 'html' | 'markdown',
|
subType: 'html' | 'markdown',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Zip from 'adm-zip';
|
import Zip from 'adm-zip';
|
||||||
import { load } from 'js-yaml';
|
import { load } from 'js-yaml';
|
||||||
import { LocalProblemConfig } from '../interface';
|
import type { ProblemConfig } from '../interface';
|
||||||
|
|
||||||
export async function readConfig(file: string | Buffer) {
|
export async function readConfig(file: string | Buffer) {
|
||||||
const data = new Zip(file);
|
const data = new Zip(file);
|
||||||
@@ -26,7 +26,7 @@ interface ParseResult {
|
|||||||
timeMin: number,
|
timeMin: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function parseConfig(config: string | LocalProblemConfig) {
|
export async function parseConfig(config: string | ProblemConfig) {
|
||||||
const result: ParseResult = {
|
const result: ParseResult = {
|
||||||
count: 0,
|
count: 0,
|
||||||
memoryMin: Number.MAX_SAFE_INTEGER,
|
memoryMin: Number.MAX_SAFE_INTEGER,
|
||||||
@@ -34,10 +34,10 @@ export async function parseConfig(config: string | LocalProblemConfig) {
|
|||||||
timeMin: Number.MAX_SAFE_INTEGER,
|
timeMin: Number.MAX_SAFE_INTEGER,
|
||||||
timeMax: 0,
|
timeMax: 0,
|
||||||
};
|
};
|
||||||
let cfg: LocalProblemConfig = {};
|
let cfg: ProblemConfig = {};
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
// TODO should validate here?
|
// TODO should validate here?
|
||||||
cfg = load(config) as LocalProblemConfig;
|
cfg = load(config) as ProblemConfig;
|
||||||
} else cfg = config;
|
} else cfg = config;
|
||||||
if (cfg.cases) {
|
if (cfg.cases) {
|
||||||
for (const c of cfg.cases) {
|
for (const c of cfg.cases) {
|
||||||
|
|||||||
Reference in new issue
Block a user