Answer stability round 3: 0 🔴, 1 🟡 (0 misread); test that a size after the image's command is no limit; name given's regex parameter pattern
This commit is contained in:
@@ -39,10 +39,10 @@ def unlimited(arguments: list[str]) -> bool:
|
||||
return subcommand in STARTS_CONTAINER and not limited and not helped(arguments, subcommand)
|
||||
|
||||
|
||||
def given(arguments: list[str], options: tuple[str, ...], value: str) -> bool:
|
||||
"""Whether the arguments give one of the options a value value matches, as its next word or attached, as in -m4g or --memory=4g."""
|
||||
attached = re.compile("|".join(re.escape(option) + ("" if len(option) == 2 else "=") + f"(?:{value})" for option in options))
|
||||
return any(attached.fullmatch(word) or (word in options and re.fullmatch(value, following)) for word, following in zip(arguments, [*arguments[1:], ""]))
|
||||
def given(arguments: list[str], options: tuple[str, ...], pattern: str) -> bool:
|
||||
"""Whether the arguments give one of the options a value pattern matches, as its next word or attached, as in -m4g or --memory=4g."""
|
||||
attached = re.compile("|".join(re.escape(option) + ("" if len(option) == 2 else "=") + f"(?:{pattern})" for option in options))
|
||||
return any(attached.fullmatch(word) or (word in options and re.fullmatch(pattern, following)) for word, following in zip(arguments, [*arguments[1:], ""]))
|
||||
|
||||
|
||||
def unlimited_container(words: list[str]) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user