Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Functions | Variables
cattrs.disambiguators Namespace Reference

Functions

bool is_supported_union (Any typ)
 
Callable[[Mapping[Any, Any]], type[Any]|None] create_default_dis_func (BaseConverter converter, *type[AttrsInstance] classes, bool use_literals=True,(dict[str, AttributeOverride]|Literal["from_converter"]) overrides="from_converter")
 
str _overriden_name (Attribute at, AttributeOverride|None override)
 
tuple[set[str], dict[str, str]] _usable_attribute_names (type[Any] cl, dict[str, AttributeOverride] overrides)
 

Variables

Callable[[Mapping[Any, Any]], type[Any]|None] create_uniq_field_dis_func = create_default_dis_func
 

Detailed Description

Utilities for union (sum type) disambiguation.

Function Documentation

◆ _usable_attribute_names()

tuple[set[str], dict[str, str]] cattrs.disambiguators._usable_attribute_names ( type[Any]  cl,
dict[str, AttributeOverride]   overrides 
)
protected
Return renamed fields and a mapping to original field names.

◆ create_default_dis_func()

Callable[[Mapping[Any, Any]], type[Any] | None] cattrs.disambiguators.create_default_dis_func ( BaseConverter  converter,
*type[AttrsInstance classes,
bool   use_literals = True,
( dict[str, AttributeOverride] | Literal["from_converter"] )   overrides = "from_converter" 
)
Given attrs classes or dataclasses, generate a disambiguation function.

The function is based on unique fields without defaults or unique values.

:param use_literals: Whether to try using fields annotated as literals for
    disambiguation.
:param overrides: Attribute overrides to apply.

.. versionchanged:: 24.1.0
    Dataclasses are now supported.

◆ is_supported_union()

bool cattrs.disambiguators.is_supported_union ( Any  typ)
Whether the type is a union of attrs classes.