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

Method py_annotation

py/generate.py:229–245  ·  view source on GitHub ↗

This property's Python type annotation.

(self)

Source from the content-addressed store, hash-verified

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