MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / _extract_enum_values

Method _extract_enum_values

py/generate_bidi.py:1195–1217  ·  view source on GitHub ↗

Extract individual values from an enum definition. Enums are defined as: "value1" / "value2" / "value3" Can span multiple lines.

(self, enum_definition: str)

Source from the content-addressed store, hash-verified

1193 return " / " in clean_def and '"' in clean_def
1194
1195 def _extract_enum_values(self, enum_definition: str) -> list[str]:
1196 """Extract individual values from an enum definition.
1197
1198 Enums are defined as: "value1" / "value2" / "value3"
1199 Can span multiple lines.
1200 """
1201 values = []
1202
1203 # Clean the definition and extract quoted strings
1204 # Split by / and extract quoted values
1205 parts = enum_definition.split("/")
1206
1207 for part in parts:
1208 part = part.strip()
1209
1210 # Extract quoted string - use search instead of match to find quotes anywhere
1211 match = re.search(r'"([^"]*)"', part)
1212 if match:
1213 value = match.group(1)
1214 values.append(value)
1215 logger.debug(f"Extracted enum value: {value}")
1216
1217 return values
1218
1219 @staticmethod
1220 def _normalize_cddl_type(field_type: str) -> str:

Callers 1

_extract_typesMethod · 0.95

Calls 4

splitMethod · 0.80
searchMethod · 0.45
appendMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected