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

Method py_annotation

py/generate.py:544–561  ·  view source on GitHub ↗

Return the Python type annotation for this return.

(self)

Source from the content-addressed store, hash-verified

542
543 @property
544 def py_annotation(self):
545 """Return the Python type annotation for this return."""
546 if self.items:
547 if self.items.ref:
548 py_ref = ref_to_python(self.items.ref)
549 ann = f"typing.List[{py_ref}]"
550 else:
551 py_type = CdpPrimitiveType.get_annotation(self.items.type)
552 ann = f"typing.List[{py_type}]"
553 else:
554 if self.ref:
555 py_ref = ref_to_python(self.ref)
556 ann = f"{py_ref}"
557 else:
558 ann = CdpPrimitiveType.get_annotation(self.type)
559 if self.optional:
560 ann = f"typing.Optional[{ann}]"
561 return ann
562
563 def generate_doc(self):
564 """Generate the docstring for this return."""

Callers

nothing calls this directly

Calls 2

ref_to_pythonFunction · 0.85
get_annotationMethod · 0.45

Tested by

no test coverage detected