unicode

Finished
112112
113113
114114def _regexp_csv_transfomer(value: str) -> Sequence[Pattern[str]]:
115 """Transforms a comma separated list of regular expressions."""
115 """Transforms a comma separated list of regular expressions.
116
117 Supports quoted regex patterns to preserve commas within the pattern.
118 For example: "(foo{1,3})" will be treated as a single pattern.
119 Mixed quoted and unquoted patterns are supported.
120 """
116121 patterns: list[Pattern[str]] = []
117 for pattern in _csv_transformer(value):
118 patterns.append(_regex_transformer(pattern))
122
123 # Handle quoted patterns to preserve commas within quotes
124 value = value.strip()
125 if not value:
126 return patterns
127
128 i = 0
129 while i < len(value):
130 # Skip whitespace
131 while i < len(value) and value[i].isspace():
132 i += 1
133 if i >= len(value):
134 break
135
136 # Check if we have a quoted pattern
137 if value[i] in '"':
138 # Find the matching quote
139 quote_char = value[i]
140 start = i + 1
141 i += 1 # Skip opening quote
142 while i < len(value) and value[i] != quote_char:
143 i += 1
144 if i >= len(value):
145 # Unterminated quote, treat as regular pattern
146 # Reset and use legacy behavior
147 for pattern in _csv_transformer(value):
148 if pattern:
149 patterns.append(_regex_transformer(pattern))
150 return patterns
151 end = i
152 i += 1 # Skip closing quote
153
154 # Add the quoted pattern
155 pattern_str = value[start:end]
156 if pattern_str:
157 patterns.append(_regex_transformer(pattern_str))
158
159 # Skip comma if present
160 while i < len(value) and value[i].isspace():
161 i += 1
162 if i < len(value) and value[i] == ',':
163 i += 1
164 else:
165 # Handle unquoted pattern - find the next comma
166 start = i
167 while i < len(value) and value[i] != ',':
168 i += 1
169 end = i
170 if i < len(value) and value[i] == ',':
171 i += 1 # Skip comma
172
173 # Extract and process the pattern
174 pattern_str = value[start:end].strip()
175 if pattern_str:
176 patterns.append(_regex_transformer(pattern_str))
177
119178 return patterns
120179
121180
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.