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

Method generate_code

py/generate.py:813–829  ·  view source on GitHub ↗

Generate the Python module code for a given CDP domain.

(self)

Source from the content-addressed store, hash-verified

811 )
812
813 def generate_code(self):
814 """Generate the Python module code for a given CDP domain."""
815 exp = " (experimental)" if self.experimental else ""
816 code = MODULE_HEADER.format(self.domain, exp)
817 import_code = self.generate_imports()
818 if import_code:
819 code += import_code
820 code += "\n\n"
821 code += "\n"
822 item_iter: Iterator[CdpEvent | CdpCommand | CdpType] = itertools.chain(
823 iter(self.types),
824 iter(self.commands),
825 iter(self.events),
826 )
827 code += "\n\n\n".join(item.generate_code() for item in item_iter)
828 code += "\n"
829 return code
830
831 def generate_imports(self):
832 """Determine which modules this module depends on and emit the code to import those modules.

Callers

nothing calls this directly

Calls 3

generate_importsMethod · 0.95
formatMethod · 0.45
generate_codeMethod · 0.45

Tested by

no test coverage detected