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

Method generate_code

py/generate.py:814–830  ·  view source on GitHub ↗

Generate the Python module code for a given CDP domain.

(self)

Source from the content-addressed store, hash-verified

812 )
813
814 def generate_code(self):
815 """Generate the Python module code for a given CDP domain."""
816 exp = " (experimental)" if self.experimental else ""
817 code = MODULE_HEADER.format(self.domain, exp)
818 import_code = self.generate_imports()
819 if import_code:
820 code += import_code
821 code += "\n\n"
822 code += "\n"
823 item_iter: Iterator[CdpEvent | CdpCommand | CdpType] = itertools.chain(
824 iter(self.types),
825 iter(self.commands),
826 iter(self.events),
827 )
828 code += "\n\n\n".join(item.generate_code() for item in item_iter)
829 code += "\n"
830 return code
831
832 def generate_imports(self):
833 """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