let it go

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 both unquoted patterns separated by commas and quoted patterns
118 that may contain commas. Quoted patterns can use single or double quotes.
119 """
116120 patterns: list[Pattern[str]] = []
117 for pattern in _csv_transformer(value):
118 patterns.append(_regex_transformer(pattern))
121
122 # Handle the case where value is already a list/tuple
123 if isinstance(value, (list, tuple)):
124 for pattern in value:
125 patterns.append(_regex_transformer(pattern))
126 return patterns
127
128 # Parse the string value, handling quoted patterns
129 i = 0
130 n = len(value)
131 while i < n:
132 # Skip whitespace
133 while i < n and value[i].isspace():
134 i += 1
135 if i >= n:
136 break
137
138 # Check if pattern is quoted
139 if value[i] in ('"', "'"):
140 quote = value[i]
141 i += 1
142 start = i
143 # Find the matching quote, handling escaped quotes
144 while i < n:
145 if value[i] == '\\' and i + 1 < n and value[i + 1] == quote:
146 i += 2 # Skip escaped quote
147 elif value[i] == quote:
148 break
149 else:
150 i += 1
151
152 if i >= n:
153 raise argparse.ArgumentTypeError(
154 f"Unclosed quote in regular expression pattern: {value}"
155 )
156
157 pattern = value[start:i]
158 i += 1 # Skip closing quote
159 else:
160 # Unquoted pattern - read until next comma
161 start = i
162 while i < n and value[i] != ',':
163 i += 1
164 pattern = value[start:i].strip()
165
166 # Skip to next comma if we're not at the end
167 while i < n and value[i] != ',':
168 i += 1
169 if i < n and value[i] == ',':
170 i += 1
171
172 if pattern: # Only add non-empty patterns
173 patterns.append(_regex_transformer(pattern))
174
119175 return patterns
120176
121177
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.