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

Method py_annotation

py/generate.py:545–562  ·  view source on GitHub ↗

Return the Python type annotation for this return.

(self)

Source from the content-addressed store, hash-verified

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