JiaYou

Finished
111111 raise argparse.ArgumentTypeError(msg) from e
112112
113113
114def _csv_transformer_with_quotes(value: str) -> Sequence[str]:
115 """Transforms a comma separated string, handling quoted strings properly."""
116 if not value:
117 return []
118
119 result = []
120 current = ""
121 in_quotes = False
122 i = 0
123
124 while i < len(value):
125 char = value[i]
126
127 if char == '"' and (i == 0 or value[i-1] != '\\'):
128 # Toggle quote state
129 in_quotes = not in_quotes
130 elif char == ',' and not in_quotes:
131 # End of current field
132 result.append(current.strip())
133 current = ""
134 else:
135 current += char
136
137 i += 1
138
139 # Add the last field
140 result.append(current.strip())
141
142 # Remove empty fields
143 return [field for field in result if field != ""]
144
145
114146def _regexp_csv_transfomer(value: str) -> Sequence[Pattern[str]]:
115147 """Transforms a comma separated list of regular expressions."""
116148 patterns: list[Pattern[str]] = []
117 for pattern in _csv_transformer(value):
149 for pattern in _csv_transformer_with_quotes(value):
118150 patterns.append(_regex_transformer(pattern))
119151 return patterns
120152
122154def _regexp_paths_csv_transfomer(value: str) -> Sequence[Pattern[str]]:
123155 """Transforms a comma separated list of regular expressions paths."""
124156 patterns: list[Pattern[str]] = []
125 for pattern in _csv_transformer(value):
157 for pattern in _csv_transformer_with_quotes(value):
126158 patterns.append(
127159 re.compile(
128160 str(pathlib.PureWindowsPath(pattern)).replace("\\", "\\\\")
Test NameStatus
tests/config/test_config.py::test_csv_regex_error
Fail
tests/config/test_config.py::test_csv_regex_comma_in_quantifier[foo,
Fail
tests/config/test_config.py::test_can_read_toml_env_variable
Pass
tests/config/test_config.py::test_unknown_message_id
Pass
tests/config/test_config.py::test_unknown_option_name
Pass
tests/config/test_config.py::test_unknown_short_option_name
Pass
tests/config/test_config.py::test_unknown_confidence
Pass
tests/config/test_config.py::test_empty_confidence
Pass
tests/config/test_config.py::test_unknown_yes_no
Pass
tests/config/test_config.py::test_unknown_py_version
Pass
tests/config/test_config.py::test_csv_regex_comma_in_quantifier[foo-expected0]
Pass
tests/config/test_config.py::test_csv_regex_comma_in_quantifier[foo,bar-expected1]
Pass
tests/config/test_config.py::test_regex_error
Pass
tests/config/test_config.py::test_short_verbose
Pass
tests/config/test_config.py::test_argument_separator
Pass
tests/config/test_config.py::test_clear_cache_post_run
Pass
tests/config/test_config.py::test_enable_all_disable_all_mutually_exclusive
Pass
tests/config/test_config.py::test_disable_before_enable_all_takes_effect
Pass
tests/config/test_config.py::test_enable_before_disable_all_takes_effect
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.