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

Method _extract_enum_values

py/generate_bidi.py:1185–1207  ·  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

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