mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17: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,
|
||||
}
|
||||
|
||||
export enum LocalProblemType {
|
||||
export enum ProblemType {
|
||||
Default = 'default',
|
||||
SubmitAnswer = 'submit_answer',
|
||||
Interactive = 'interactive',
|
||||
}
|
||||
|
||||
export enum RemoteProblemType {
|
||||
RemoteJudge = 'remotejudge',
|
||||
}
|
||||
|
||||
export enum RemoteServerType {
|
||||
vj4 = 'vj4',
|
||||
syzoj = 'syzoj',
|
||||
}
|
||||
|
||||
export enum SubtaskType {
|
||||
min = 'min',
|
||||
max = 'max',
|
||||
@@ -133,8 +124,8 @@ export interface SubtaskConfig {
|
||||
cases?: TestCaseConfig[],
|
||||
}
|
||||
|
||||
export interface LocalProblemConfig {
|
||||
type?: LocalProblemType,
|
||||
export interface ProblemConfig {
|
||||
type?: ProblemType,
|
||||
score?: number,
|
||||
time?: string,
|
||||
memory?: string,
|
||||
@@ -148,16 +139,6 @@ export interface LocalProblemConfig {
|
||||
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 {
|
||||
type: 'Plain',
|
||||
subType: 'html' | 'markdown',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Zip from 'adm-zip';
|
||||
import { load } from 'js-yaml';
|
||||
import { LocalProblemConfig } from '../interface';
|
||||
import type { ProblemConfig } from '../interface';
|
||||
|
||||
export async function readConfig(file: string | Buffer) {
|
||||
const data = new Zip(file);
|
||||
@@ -26,7 +26,7 @@ interface ParseResult {
|
||||
timeMin: number,
|
||||
}
|
||||
|
||||
export async function parseConfig(config: string | LocalProblemConfig) {
|
||||
export async function parseConfig(config: string | ProblemConfig) {
|
||||
const result: ParseResult = {
|
||||
count: 0,
|
||||
memoryMin: Number.MAX_SAFE_INTEGER,
|
||||
@@ -34,10 +34,10 @@ export async function parseConfig(config: string | LocalProblemConfig) {
|
||||
timeMin: Number.MAX_SAFE_INTEGER,
|
||||
timeMax: 0,
|
||||
};
|
||||
let cfg: LocalProblemConfig = {};
|
||||
let cfg: ProblemConfig = {};
|
||||
if (typeof config === 'string') {
|
||||
// TODO should validate here?
|
||||
cfg = load(config) as LocalProblemConfig;
|
||||
cfg = load(config) as ProblemConfig;
|
||||
} else cfg = config;
|
||||
if (cfg.cases) {
|
||||
for (const c of cfg.cases) {
|
||||
|
||||
Reference in new issue
Block a user