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

Method py_annotation

py/generate.py:230–246  ·  view source on GitHub ↗

This property's Python type annotation.

(self)

Source from the content-addressed store, hash-verified

228
229 @property
230 def py_annotation(self):
231 """This property's Python type annotation."""
232 if self.items:
233 if self.items.ref:
234 py_ref = ref_to_python(self.items.ref)
235 ann = f"typing.List[{py_ref}]"
236 else:
237 ann = f"typing.List[{CdpPrimitiveType.get_annotation(self.items.type)}]"
238 else:
239 if self.ref:
240 py_ref = ref_to_python(self.ref)
241 ann = py_ref
242 else:
243 ann = CdpPrimitiveType.get_annotation(cast(str, self.type))
244 if self.optional:
245 ann = f"typing.Optional[{ann}]"
246 return ann
247
248 @classmethod
249 def from_json(cls, property):

Callers

nothing calls this directly

Calls 2

ref_to_pythonFunction · 0.85
get_annotationMethod · 0.45

Tested by

no test coverage detected