upgrade deps

This commit is contained in:
undefined committed 2022-12-12 02:43:10 +08:00
1 parent 96fa6cc7b9
commit 80e3abf27b
12 files changed
+65 -70

No files matched your search

+3 -5
View File
@@ -1,11 +1,9 @@
/* eslint-disable no-await-in-loop */
import path from 'path';
import fs from 'fs-extra';
import yaml from 'js-yaml';
import { max, sum } from 'lodash';
import readYamlCases, { convertIniConfig } from '@hydrooj/utils/lib/cases';
import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/utils/lib/common';
import { changeErrorType } from '@hydrooj/utils/lib/utils';
import { changeErrorType, yaml } from '@hydrooj/utils/lib/utils';
import { ProblemConfigFile } from 'hydrooj';
import { getConfig } from './config';
import { FormatError, SystemError } from './error';
@@ -16,11 +14,11 @@ function isValidConfig(config) {
if (config.count > (getConfig('testcases_max') || 100)) {
throw new FormatError('Too many testcases. Cancelled.');
}
const time = sum(config.subtasks.map((subtask) => sum(subtask.cases.map((c) => c.time))));
const time = Math.sum(config.subtasks.map((subtask) => Math.sum(subtask.cases.map((c) => c.time))));
if (time > (getConfig('total_time_limit') || 60) * 1000) {
throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+getConfig('total_time_limit') || 60]);
}
const memMax = max(config.subtasks.map((subtask) => max(subtask.cases.map((c) => c.memory))));
const memMax = Math.max(config.subtasks.map((subtask) => Math.max(subtask.cases.map((c) => c.memory))));
if (memMax > parseMemoryMB(getConfig('memoryMax'))) throw new FormatError('Memory limit larger than memory_max');
if (!['default', 'strict'].includes(config.checker_type || 'default') && !config.checker) {
throw new FormatError('You did not specify a checker.');
+1 -1
View File
@@ -2,8 +2,8 @@ import os from 'os';
import path from 'path';
import cac from 'cac';
import fs from 'fs-extra';
import yaml from 'js-yaml';
import Schema from 'schemastery';
import { yaml } from '@hydrooj/utils';
const argv = cac().parse();
+1 -1
View File
@@ -1,6 +1,6 @@
import assert from 'assert';
import { readFile } from 'fs-extra';
import yaml from 'js-yaml';
import { yaml } from '@hydrooj/utils';
import { STATUS } from '@hydrooj/utils/lib/status';
import { FormatError } from '../error';
import { Context } from './interface';
+2 -3
View File
@@ -1,6 +1,5 @@
import path from 'path';
import fs from 'fs-extra';
import { noop } from 'lodash';
import { LangConfig } from '@hydrooj/utils/lib/lang';
import { STATUS } from '@hydrooj/utils/lib/status';
import type {
@@ -40,7 +39,7 @@ export class JudgeTask {
folder: string;
config: ParsedConfig;
meta: JudgeMeta;
files?:Record<string, string>;
files?: Record<string, string>;
next: (data: Partial<JudgeResultBody>) => void;
end: (data: Partial<JudgeResultBody>) => void;
env: Record<string, string>;
@@ -103,7 +102,7 @@ export class JudgeTask {
} finally {
Lock.release(`${host}/${this.source}/${this.rid}`);
// eslint-disable-next-line no-await-in-loop
for (const clean of this.clean) await clean()?.catch(noop);
for (const clean of this.clean) await clean()?.catch(() => null);
tmpfs.umount(this.tmpdir);
fs.removeSync(this.tmpdir);
}