yahoo

Finished
111111 raise argparse.ArgumentTypeError(msg) from e
112112
113113
114def _split_regex_csv(value: str) -> Sequence[str]:
115 """Split a comma separated list of regular expressions, respecting escaped commas.
116
117 Commas can be escaped with a backslash (\\,) to include them in regex patterns.
118 """
119 if not value:
120 return []
121
122 parts = []
123 current = []
124 i = 0
125 while i < len(value):
126 if value[i] == '\\' and i + 1 < len(value) and value[i + 1] == ',':
127 # Escaped comma, add the comma to current part
128 current.append(',')
129 i += 2 # Skip the backslash and comma
130 elif value[i] == ',':
131 # Unescaped comma, end current part
132 part = ''.join(current).strip()
133 if part: # Only add non-empty parts
134 parts.append(part)
135 current = []
136 i += 1
137 else:
138 # Regular character
139 current.append(value[i])
140 i += 1
141
142 # Add the last part
143 part = ''.join(current).strip()
144 if part:
145 parts.append(part)
146
147 return parts
148
149
114150def _regexp_csv_transfomer(value: str) -> Sequence[Pattern[str]]:
115 """Transforms a comma separated list of regular expressions."""
151 """Transforms a comma separated list of regular expressions.
152
153 Commas in regex patterns can be escaped with a backslash (\\,) to include them
154 in the pattern without being treated as a separator.
155 """
116156 patterns: list[Pattern[str]] = []
117 for pattern in _csv_transformer(value):
118 patterns.append(_regex_transformer(pattern))
157 for pattern in _split_regex_csv(value):
158 # Unescape any escaped commas in the pattern
159 unescaped_pattern = pattern.replace(r'\\,', ',')
160 patterns.append(_regex_transformer(unescaped_pattern))
119161 return patterns
120162
121163
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.