(self, obj: t.Any, value: t.Any)
| 2836 | info_text = "a complex number" |
| 2837 | |
| 2838 | def validate(self, obj: t.Any, value: t.Any) -> complex | None: |
| 2839 | if isinstance(value, complex): |
| 2840 | return value |
| 2841 | if isinstance(value, (float, int)): |
| 2842 | return complex(value) |
| 2843 | self.error(obj, value) |
| 2844 | |
| 2845 | def from_string(self, s: str) -> complex | None: |
| 2846 | if self.allow_none and s == "None": |