![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Classes | |
| class | ValidatorType |
Functions | |
| None | validate_field (Any inst, dc.Field field, Any value) |
| None | validate_fields (Any inst) |
| any_ (inst, field, value, suffix="") | |
| ValidatorType | instance_of (type[Any]|tuple[type[Any],...] type_) |
| ValidatorType | optional (ValidatorType validator) |
| is_callable (inst, field, value, suffix="") | |
| ValidatorType | in_ (Sequence options) |
| ValidatorType | deep_iterable (ValidatorType member_validator, ValidatorType|None iterable_validator=None) |
| ValidatorType | deep_mapping (ValidatorType key_validator, ValidatorType value_validator, ValidatorType|None mapping_validator=None) |
Validators for dataclasses, mirroring those of https://github.com/python-attrs/attrs.
| myst_parser.config.dc_validators.any_ | ( | inst, | |
| field, | |||
| value, | |||
suffix = "" |
|||
| ) |
A validator that does not perform any validation.
| ValidatorType myst_parser.config.dc_validators.deep_iterable | ( | ValidatorType | member_validator, |
| ValidatorType | None | iterable_validator = None |
||
| ) |
A validator that performs deep validation of an iterable. :param member_validator: Validator to apply to iterable members :param iterable_validator: Validator to apply to iterable itself
| ValidatorType myst_parser.config.dc_validators.deep_mapping | ( | ValidatorType | key_validator, |
| ValidatorType | value_validator, | ||
| ValidatorType | None | mapping_validator = None |
||
| ) |
A validator that performs deep validation of a dictionary. :param key_validator: Validator to apply to dictionary keys :param value_validator: Validator to apply to dictionary values :param mapping_validator: Validator to apply to top-level mapping attribute (optional)
| ValidatorType myst_parser.config.dc_validators.in_ | ( | Sequence | options | ) |
A validator that raises a `ValueError` if the initializer is called with a value that does not belong in the options provided. The check is performed using ``value in options``. :param options: Allowed options.
| ValidatorType myst_parser.config.dc_validators.instance_of | ( | type[Any] | tuple[type[Any], ...] | type_ | ) |
A validator that raises a `TypeError` if the initializer is called with a wrong type for this particular attribute (checks are performed using `isinstance` therefore it's also valid to pass a tuple of types). :param type_: The type to check for.
| myst_parser.config.dc_validators.is_callable | ( | inst, | |
| field, | |||
| value, | |||
suffix = "" |
|||
| ) |
A validator that raises a `TypeError` if the initializer is called with a value for this particular attribute that is not callable.
| ValidatorType myst_parser.config.dc_validators.optional | ( | ValidatorType | validator | ) |
A validator that makes an attribute optional. An optional attribute is one which can be set to ``None`` in addition to satisfying the requirements of the sub-validator.
| None myst_parser.config.dc_validators.validate_field | ( | Any | inst, |
| dc.Field | field, | ||
| Any | value | ||
| ) |
Validate the field of a dataclass, according to a `validator` function set in the field.metadata. The validator function should take as input (inst, field, value) and raise an exception if the value is invalid.
| None myst_parser.config.dc_validators.validate_fields | ( | Any | inst | ) |
Validate the fields of a dataclass, according to `validator` functions set in the field metadata. This function should be called in the `__post_init__` of the dataclass. The validator function should take as input (inst, field, value) and raise an exception if the value is invalid.