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

Method _extract_enum_values

py/generate_bidi.py:1191–1213  ·  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

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