From d7955ecaafd497e0140f01efff60bcc40f2d3c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pehr=20S=C3=B6derman?= Date: Thu, 27 Nov 2025 18:03:10 +0100 Subject: [PATCH] Allow underscore as start of name of files and directories. --- problemtools/verifyproblem.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problemtools/verifyproblem.py b/problemtools/verifyproblem.py index a35113b5..b600effd 100644 --- a/problemtools/verifyproblem.py +++ b/problemtools/verifyproblem.py @@ -1734,7 +1734,7 @@ def _recompute_jobs(self) -> None: class Submissions(ProblemPart): - _SUB_REGEXP = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*[a-zA-Z0-9](\.c\+\+)?$') + _SUB_REGEXP = re.compile(r'^[a-zA-Z0-9_][a-zA-Z0-9_.-]*[a-zA-Z0-9](\.c\+\+)?$') # (verdict, directory, required) _VERDICTS: list[tuple[Verdict, str, bool]] = [ ('AC', 'accepted', True), @@ -2091,8 +2091,8 @@ def _check_symlinks(self): ) def _check_file_and_directory_names(self): - filename_regex = re.compile(r'^[a-z0-9][a-z0-9_.-]{0,253}[a-z0-9]$', re.I) - directory_regex = re.compile(r'^[a-z0-9]([a-z0-9_-]{0,253}[a-z0-9])?$', re.I) + filename_regex = re.compile(r'^[a-z0-9_][a-z0-9_.-]{0,253}[a-z0-9]$', re.I) + directory_regex = re.compile(r'^[a-z0-9_]([a-z0-9_-]{0,253}[a-z0-9])?$', re.I) # Adding some pragmatic custom rules until https://github.com/Kattis/problem-package-format/issues/453 has resolved def _special_case_allowed_files(file: str, reldir: str) -> bool: