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

Function _emit_enum

py/generate_bidi_protocol.py:931–938  ·  view source on GitHub ↗
(e: EnumIR)

Source from the content-addressed store, hash-verified

929
930
931def _emit_enum(e: EnumIR) -> str:
932 mixin = _ENUM_MIXINS.get(e.primitive)
933 bases = f"{mixin}, Enum" if mixin else "Enum"
934 lines = [f"@register({lit(e.schema_name)})", f"class {e.class_name}({bases}):"]
935 lines += _spec_docstring(e.schema_name, e.spec_href)
936 for member, value in e.members:
937 lines.append(f" {member} = {lit(value)}")
938 return "\n".join(lines)
939
940
941def _emit_record(r: RecordIR) -> str:

Calls 4

_spec_docstringFunction · 0.85
litFunction · 0.70
getMethod · 0.65
appendMethod · 0.45