This property's Python type annotation.
(self)
| 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): |
nothing calls this directly
no test coverage detected