func
func_dataclass(func, method_name='__call__', cls_name=None, bases=())
Wraps a function into a new dataclass type with a single method whose positional arguments (other than self) are equivalent to that of the given function, and whose kwargs are dataclass parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
Callable[[Any], Any]
|
Function to convert to a dataclass |
required |
method_name |
str
|
Name of method that will call the function |
'__call__'
|
cls_name |
Optional[str]
|
Name of the new type (if |
None
|
bases |
Bases
|
Base classes for the new type |
()
|
Returns:
Type | Description |
---|---|
type
|
A new type inheriting from |