A validator that raises a `TypeError` if the initializer is called with a wrong type for this particular attribute (checks are performed using `issubclass` therefore it's also valid to pass a tuple of types). Args: type (type | tuple[type, ...]): The type(s) to check for.
(type)
| 615 | |
| 616 | |
| 617 | def _subclass_of(type): |
| 618 | """ |
| 619 | A validator that raises a `TypeError` if the initializer is called with a |
| 620 | wrong type for this particular attribute (checks are performed using |
| 621 | `issubclass` therefore it's also valid to pass a tuple of types). |
| 622 | |
| 623 | Args: |
| 624 | type (type | tuple[type, ...]): The type(s) to check for. |
| 625 | |
| 626 | Raises: |
| 627 | TypeError: |
| 628 | With a human readable error message, the attribute (of type |
| 629 | `attrs.Attribute`), the expected type, and the value it got. |
| 630 | """ |
| 631 | return _SubclassOfValidator(type) |
| 632 | |
| 633 | |
| 634 | @attrs(repr=False, slots=True, unsafe_hash=True) |