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

Functions

None use_class_methods (BaseConverter converter, Optional[str] structure_method_name=None, Optional[str] unstructure_method_name=None)
 

Variables

 T = TypeVar("T")
 

Detailed Description

Strategy for using class-specific (un)structuring methods.

Function Documentation

◆ use_class_methods()

None cattrs.strategies._class_methods.use_class_methods ( BaseConverter  converter,
Optional[str]   structure_method_name = None,
Optional[str]   unstructure_method_name = None 
)
Configure the converter such that dedicated methods are used for (un)structuring
the instance of a class if such methods are available. The default (un)structuring
will be applied if such an (un)structuring methods cannot be found.

:param converter: The `Converter` on which this strategy is applied. You can use
    :class:`cattrs.BaseConverter` or any other derived class.
:param structure_method_name: Optional string with the name of the class method
    which should be used for structuring. If not provided, no class method will be
    used for structuring.
:param unstructure_method_name: Optional string with the name of the class method
    which should be used for unstructuring. If not provided, no class method will
    be used for unstructuring.

If you want to (un)structured nested objects, just append a converter parameter
to your (un)structuring methods and you will receive the converter there.

.. versionadded:: 23.2.0