Skip to content

Commit 315ede5

Browse files
committed
Rename MemoryIO *_fd to *_io
1 parent 6ad987d commit 315ede5

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

dmoj/checkers/bridged.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def check(
4848
args_format_string = args_format_string or contrib_modules[type].ContribModule.get_checker_args_format_string()
4949

5050
with mktemp(process_output) as output_file, mktemp(judge_output) as answer_file:
51-
input_path = case.input_data_fd().to_path()
51+
input_path = case.input_data_io().to_path()
5252

5353
checker_args = shlex.split(
5454
args_format_string.format(

dmoj/graders/bridged.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _interact_with_process(self, case: TestCase, result: Result) -> bytes:
8787
)
8888

8989
with mktemp(judge_output) as answer_file:
90-
input_path = case.input_data_fd().to_path()
90+
input_path = case.input_data_io().to_path()
9191

9292
# TODO(@kirito): testlib.h expects a file they can write to,
9393
# but we currently don't have a sane way to allow this.

dmoj/graders/standard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class StandardGrader(BaseGrader):
1818
def grade(self, case: TestCase) -> Result:
1919
result = Result(case)
2020

21-
input_file = case.input_data_fd()
21+
input_file = case.input_data_io()
2222

2323
self._launch_process(case, input_file)
2424

dmoj/problem.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class TestCase(BaseTestCase):
344344
batch: int
345345
output_prefix_length: int
346346
has_binary_data: bool
347-
_input_data_fd: Optional[MmapableIO]
347+
_input_data_io: Optional[MmapableIO]
348348
_generated: Optional[Tuple[MmapableIO, bytes]]
349349

350350
def __init__(self, count: int, batch_no: int, config: ConfigNode, problem: Problem):
@@ -356,7 +356,7 @@ def __init__(self, count: int, batch_no: int, config: ConfigNode, problem: Probl
356356
self.output_prefix_length = config.output_prefix_length
357357
self.has_binary_data = config.binary_data
358358
self._generated = None
359-
self._input_data_fd = None
359+
self._input_data_io = None
360360

361361
def _normalize(self, data: bytes) -> bytes:
362362
# Perhaps the correct answer may be 'no output', in which case it'll be
@@ -454,16 +454,16 @@ def _run_generator(self, gen: Union[str, ConfigNode], args: Optional[Iterable[st
454454
parse_helper_file_error(proc, executor, 'generator', stderr, time_limit, memory_limit)
455455

456456
def input_data(self) -> bytes:
457-
return self.input_data_fd().to_bytes()
457+
return self.input_data_io().to_bytes()
458458

459-
def input_data_fd(self) -> MmapableIO:
460-
if self._input_data_fd:
461-
return self._input_data_fd
459+
def input_data_io(self) -> MmapableIO:
460+
if self._input_data_io:
461+
return self._input_data_io
462462

463-
result = self._input_data_fd = self._make_input_data_fd()
463+
result = self._input_data_io = self._make_input_data_io()
464464
return result
465465

466-
def _make_input_data_fd(self) -> MmapableIO:
466+
def _make_input_data_io(self) -> MmapableIO:
467467
gen = self.config.generator
468468

469469
# don't try running the generator if we specify an output file explicitly,
@@ -516,15 +516,15 @@ def checker(self) -> partial:
516516

517517
def free_data(self) -> None:
518518
self._generated = None
519-
if self._input_data_fd:
520-
self._input_data_fd.close()
519+
if self._input_data_io:
520+
self._input_data_io.close()
521521

522522
def __str__(self) -> str:
523523
return f'TestCase(in={self.config["in"]},out={self.config["out"]},points={self.config["points"]})'
524524

525525
# FIXME(tbrindus): this is a hack working around the fact we can't pickle these fields, but we do need parts of
526526
# TestCase itself on the other end of the IPC.
527-
_pickle_blacklist = ('_generated', 'config', 'problem', '_input_data_fd')
527+
_pickle_blacklist = ('_generated', 'config', 'problem', '_input_data_io')
528528

529529
def __getstate__(self) -> dict:
530530
k = {k: v for k, v in self.__dict__.items() if k not in self._pickle_blacklist}

0 commit comments

Comments
 (0)