Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
cattrs.converters.Converter Class Reference
Inheritance diagram for cattrs.converters.Converter:
Inheritance graph
[legend]
Collaboration diagram for cattrs.converters.Converter:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, Callable[[], Any] dict_factory=dict, UnstructureStrategy unstruct_strat=UnstructureStrategy.AS_DICT, bool omit_if_default=False, bool forbid_extra_keys=False, Mapping[type, AttributeOverride] type_overrides={}, Mapping[type, Callable] unstruct_collection_overrides={}, bool prefer_attrib_converters=False, bool detailed_validation=True, HookFactory[UnstructureHook] unstructure_fallback_factory=lambda _:identity, HookFactory[StructureHook] structure_fallback_factory=lambda _:raise_error)
 
Callable[[AnyUnstructureHookFactory], AnyUnstructureHookFactory] register_unstructure_hook_factory (self, Predicate predicate)
 
UnstructureHookFactory register_unstructure_hook_factory (self, Predicate predicate, UnstructureHookFactory factory)
 
ExtendedUnstructureHookFactory[Converterregister_unstructure_hook_factory (self, Predicate predicate, ExtendedUnstructureHookFactory[Converter] factory)
 
 register_unstructure_hook_factory (self, predicate, factory=None)
 
Callable[[AnyStructureHookFactory], AnyStructureHookFactory] register_structure_hook_factory (self, Predicate predicate)
 
StructureHookFactory register_structure_hook_factory (self, Predicate predicate, StructureHookFactory factory)
 
ExtendedStructureHookFactory[Converterregister_structure_hook_factory (self, Predicate predicate, ExtendedStructureHookFactory[Converter] factory)
 
 register_structure_hook_factory (self, predicate, factory=None)
 
Callable[[Any, Any], T] get_structure_newtype (self, type[T] type)
 
 gen_unstructure_annotated (self, type)
 
Callable gen_structure_annotated (self, type)
 
Callable[[dict], dict] gen_unstructure_typeddict (self, Any cl)
 
Callable[[T], dict[str, Any]] gen_unstructure_attrs_fromdict (self, type[T] cl)
 
Callable[[T], Any] gen_unstructure_optional (self, type[T] cl)
 
Callable[[dict, Any], dict] gen_structure_typeddict (self, Any cl)
 
Callable[[Mapping[str, Any], Any], T] gen_structure_attrs_fromdict (self, type[T] cl)
 
IterableUnstructureFn gen_unstructure_iterable (self, Any cl, Any unstructure_to=None)
 
HeteroTupleUnstructureFn gen_unstructure_hetero_tuple (self, Any cl, Any unstructure_to=None)
 
MappingUnstructureFn gen_unstructure_mapping (self, Any cl, Any unstructure_to=None, Callable[[Any, Any|None], Any]|None key_handler=None)
 
MappingStructureFn[T] gen_structure_counter (self, Any cl)
 
MappingStructureFn[T] gen_structure_mapping (self, Any cl)
 
Converter copy (self, Callable[[], Any]|None dict_factory=None, UnstructureStrategy|None unstruct_strat=None, bool|None omit_if_default=None, bool|None forbid_extra_keys=None, Mapping[type, AttributeOverride]|None type_overrides=None, Mapping[type, Callable]|None unstruct_collection_overrides=None, bool|None prefer_attrib_converters=None, bool|None detailed_validation=None)
 
- Public Member Functions inherited from cattrs.converters.BaseConverter
Any unstructure (self, Any obj, Any unstructure_as=None)
 
UnstructureStrategy unstruct_strat (self)
 
UnstructureHookT register_unstructure_hook (self, UnstructureHookT cls)
 
None register_unstructure_hook (self, Any cls, UnstructureHook func)
 
Callable[[UnstructureHook]]|None register_unstructure_hook (self, Any cls=None, UnstructureHook|None func=None)
 
None register_unstructure_hook_func (self, Predicate check_func, UnstructureHook func)
 
UnstructureHook get_unstructure_hook (self, Any type, bool cache_result=True)
 
StructureHookT register_structure_hook (self, StructureHookT cl)
 
None register_structure_hook (self, Any cl, StructureHook func)
 
None register_structure_hook (self, Any cl, StructureHook|None func=None)
 
None register_structure_hook_func (self, Predicate check_func, StructureHook func)
 
structure (self, UnstructuredValue obj, type[T] cl)
 
StructureHook get_structure_hook (self, Any type, bool cache_result=True)
 
dict[str, Any] unstructure_attrs_asdict (self, Any obj)
 
tuple[Any,...] unstructure_attrs_astuple (self, Any obj)
 
structure_attrs_fromtuple (self, tuple[Any,...] obj, type[T] cl)
 
structure_attrs_fromdict (self, Mapping[str, Any] obj, type[T] cl)
 
BaseConverter __deepcopy__ (self, _)
 

Public Attributes

 omit_if_default
 
 forbid_extra_keys
 
 type_overrides
 
 gen_unstructure_mapping
 
 gen_structure_annotated
 
 gen_structure_mapping
 
 gen_structure_counter
 
 gen_structure_typeddict
 
- Public Attributes inherited from cattrs.converters.BaseConverter
 detailed_validation
 
 unstructure
 

Static Public Attributes

TypeAlias GenConverter = Converter
 

Protected Attributes

 _unstruct_collection_overrides
 
 _struct_copy_skip
 
 _unstruct_copy_skip
 
 _dict_factory
 
 _unstructure_attrs
 
- Protected Attributes inherited from cattrs.converters.BaseConverter
 _prefer_attrib_converters
 
 _unstructure_attrs
 
 _structure_attrs
 
 _unstructure_func
 
 _unstructure_mapping
 
 _unstructure_seq
 
 _unstructure_enum
 
 _unstructure_union
 
 _structure_func
 
 _gen_structure_generic
 
 _structure_newtype
 
 _find_type_alias_structure_hook
 
 _structure_final_factory
 
 _structure_simple_literal
 
 _structure_enum_literal
 
 _structure_deque
 
 _structure_set
 
 _structure_frozenset
 
 _structure_tuple
 
 _structure_dict
 
 _gen_attrs_union_structure
 
 _structure_optional
 
 _union_struct_registry
 
 _structure_call
 
 _dict_factory
 
 _unstruct_copy_skip
 
 _struct_copy_skip
 

Additional Inherited Members

- Protected Member Functions inherited from cattrs.converters.BaseConverter
Any _unstructure_enum (self, Enum obj)
 
Sequence[T] _unstructure_seq (self, Sequence[T] seq)
 
Mapping[T, V] _unstructure_mapping (self, Mapping[T, V] mapping)
 
Any _unstructure_union (self, Any obj)
 
DictStructureFn[T] _gen_structure_generic (self, type[T] cl)
 
Callable[[Any, type[T]], type[T]|None] _gen_attrs_union_structure (self, Any cl, bool use_literals=True)
 
StructuredValue _structure_newtype (self, UnstructuredValue val, type)
 
StructureHook _find_type_alias_structure_hook (self, Any type)
 
 _structure_final_factory (self, type)
 
Any _structure_attribute (self, Attribute|Field a, Any value)
 
deque[T] _structure_deque (self, Iterable[T] obj, Any cl)
 
Set[T] _structure_set (self, Iterable[T] obj, Any cl, type structure_to=set)
 
FrozenSetSubscriptable[T] _structure_frozenset (self, Iterable[T] obj, Any cl)
 
dict[T, V] _structure_dict (self, Mapping[T, V] obj, Any cl)
 
 _structure_optional (self, obj, union)
 
_structure_tuple (self, Any obj, type[T] tup)
 
Callable[[Any], type] _get_dis_func (self, Any union, bool use_literals=True, dict[str, AttributeOverride]|None overrides=None)
 
- Static Protected Member Functions inherited from cattrs.converters.BaseConverter
Any _structure_call (Any obj, type[T] cl)
 
 _structure_simple_literal (val, type)
 
 _structure_enum_literal (val, type)
 

Detailed Description

A converter which generates specialized un/structuring functions.

Constructor & Destructor Documentation

◆ __init__()

cattrs.converters.Converter.__init__ (   self,
Callable[[], Any]   dict_factory = dict,
UnstructureStrategy   unstruct_strat = UnstructureStrategy.AS_DICT,
bool   omit_if_default = False,
bool   forbid_extra_keys = False,
Mapping[type, AttributeOverride]   type_overrides = {},
Mapping[type, Callable]   unstruct_collection_overrides = {},
bool   prefer_attrib_converters = False,
bool   detailed_validation = True,
HookFactory[UnstructureHook]   unstructure_fallback_factory = lambda _: identity,
HookFactory[StructureHook]   structure_fallback_factory = lambda _: raise_error 
)
:param detailed_validation: Whether to use a slightly slower mode for detailed
    validation errors.
:param unstructure_fallback_factory: A hook factory to be called when no
    registered unstructuring hooks match.
:param structure_fallback_factory: A hook factory to be called when no
    registered structuring hooks match.

..  versionadded:: 23.2.0 *unstructure_fallback_factory*
..  versionadded:: 23.2.0 *structure_fallback_factory*

Reimplemented from cattrs.converters.BaseConverter.

Member Function Documentation

◆ copy()

Converter cattrs.converters.Converter.copy (   self,
Callable[[], Any] | None   dict_factory = None,
UnstructureStrategy | None   unstruct_strat = None,
bool | None   omit_if_default = None,
bool | None   forbid_extra_keys = None,
Mapping[type, AttributeOverride] | None   type_overrides = None,
Mapping[type, Callable] | None   unstruct_collection_overrides = None,
bool | None   prefer_attrib_converters = None,
bool | None   detailed_validation = None 
)
Create a copy of the converter, keeping all existing custom hooks.

:param detailed_validation: Whether to use a slightly slower mode for detailed
    validation errors.

Reimplemented from cattrs.converters.BaseConverter.

◆ gen_structure_annotated()

Callable cattrs.converters.Converter.gen_structure_annotated (   self,
  type 
)
A hook factory for annotated types.

◆ gen_structure_typeddict()

Callable[[dict, Any], dict] cattrs.converters.Converter.gen_structure_typeddict (   self,
Any  cl 
)
Generate a TypedDict structure function.

Also apply converter-scored modifications.

◆ gen_unstructure_optional()

Callable[[T], Any] cattrs.converters.Converter.gen_unstructure_optional (   self,
type[T]  cl 
)
Generate an unstructuring hook for optional types.

◆ gen_unstructure_typeddict()

Callable[[dict], dict] cattrs.converters.Converter.gen_unstructure_typeddict (   self,
Any  cl 
)
Generate a TypedDict unstructure function.

Also apply converter-scored modifications.

◆ register_structure_hook_factory() [1/4]

Callable[[AnyStructureHookFactory], AnyStructureHookFactory] cattrs.converters.Converter.register_structure_hook_factory (   self,
Predicate   predicate 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_structure_hook_factory() [2/4]

ExtendedStructureHookFactory[Converter] cattrs.converters.Converter.register_structure_hook_factory (   self,
Predicate  predicate,
ExtendedStructureHookFactory[Converter]   factory 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_structure_hook_factory() [3/4]

StructureHookFactory cattrs.converters.Converter.register_structure_hook_factory (   self,
Predicate  predicate,
StructureHookFactory   factory 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_structure_hook_factory() [4/4]

cattrs.converters.Converter.register_structure_hook_factory (   self,
  predicate,
  factory = None 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_unstructure_hook_factory() [1/4]

Callable[[AnyUnstructureHookFactory], AnyUnstructureHookFactory] cattrs.converters.Converter.register_unstructure_hook_factory (   self,
Predicate   predicate 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_unstructure_hook_factory() [2/4]

ExtendedUnstructureHookFactory[Converter] cattrs.converters.Converter.register_unstructure_hook_factory (   self,
Predicate  predicate,
ExtendedUnstructureHookFactory[Converter]   factory 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_unstructure_hook_factory() [3/4]

UnstructureHookFactory cattrs.converters.Converter.register_unstructure_hook_factory (   self,
Predicate  predicate,
UnstructureHookFactory   factory 
)

Reimplemented from cattrs.converters.BaseConverter.

◆ register_unstructure_hook_factory() [4/4]

cattrs.converters.Converter.register_unstructure_hook_factory (   self,
  predicate,
  factory = None 
)

Reimplemented from cattrs.converters.BaseConverter.


The documentation for this class was generated from the following file: