Immune

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 This function first tries to split the input on commas and parse each part
118 as a separate regex. If any part fails to compile, it treats the entire
119 input as a single regex pattern instead.
120
121 This approach handles both cases:
122 - Single regex patterns containing commas: (foo{1,3})
123 - Comma-separated lists of regex patterns: foo,bar{1,2}
124 """
125 # First try to split on commas and compile each part
126 csv_parts = _csv_transformer(value)
116127 patterns: list[Pattern[str]] = []
117 for pattern in _csv_transformer(value):
118 patterns.append(_regex_transformer(pattern))
119 return patterns
128
129 # If there are no commas or only one part, treat as single pattern
130 if len(csv_parts) <= 1:
131 return [_regex_transformer(value)]
132
133 # Try to compile each part as a separate regex
134 try:
135 for pattern in csv_parts:
136 patterns.append(_regex_transformer(pattern))
137 # If all parts compile successfully, return the list
138 return patterns
139 except argparse.ArgumentTypeError:
140 # If any part fails to compile, treat the entire input as a single pattern
141 return [_regex_transformer(value)]
120142
121143
122144def _regexp_paths_csv_transfomer(value: str) -> Sequence[Pattern[str]]:
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.