(self, obj: t.Any, value: t.Any)
| 2310 | super().__init__(allow_none=allow_none, read_only=read_only, help=help, **kwargs) |
| 2311 | |
| 2312 | def validate(self, obj: t.Any, value: t.Any) -> T | None: |
| 2313 | assert self.klass is not None |
| 2314 | if self.allow_none and value is None: |
| 2315 | return value |
| 2316 | if isinstance(value, self.klass): # type:ignore[arg-type] |
| 2317 | return value # type:ignore[no-any-return] |
| 2318 | else: |
| 2319 | self.error(obj, value) |
| 2320 | |
| 2321 | def info(self) -> str: |
| 2322 | if isinstance(self.klass, str): |