Representation
Representation
¶
Bases: Repr
Representation class for the library.
Attributes¶
Functions¶
__repr__
¶
__repr__() -> str
Return code to construct the representation in Python.
Returns:
Type | Description |
---|---|
str
|
code to construct the representation in Python |
as_constructor
¶
as_constructor(
x: T, /, fields: dict[str, Any] | None = None, *, positional: bool = False, cast_as: type[T] | None = None
) -> str
Return the Python code to use the constructor of the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
T
|
object to construct |
required |
fields |
dict[str, Any] | None
|
override the parameters and arguments to use in the constructor |
None
|
positional |
bool
|
use positional parameters if |
False
|
cast_as |
type[T] | None
|
type to upcast the object (useful in inheritance approaches) |
None
|
Returns:
Type | Description |
---|---|
str
|
Python code to use the constructor of the object. |
construction_arguments
¶
construction_arguments(
x: T, /, fields: dict[str, Any] | None = None, *, positional: bool = False, cast_as: type[T] | None = None
) -> list[str]
Return the list of parameters and arguments for the constructor of the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
T
|
object to construct |
required |
fields |
dict[str, Any] | None
|
override the parameters and arguments to use in the constructor |
None
|
positional |
bool
|
use positional parameters if |
False
|
cast_as |
type[T] | None
|
type to upcast the object (useful in inheritance approaches) |
None
|
Returns:
Type | Description |
---|---|
list[str]
|
list of parameters and arguments for the constructor of the object. |
import_statement
¶
import_statement() -> str
Return the library's import statement based on the alias in the settings.
related
Returns:
Type | Description |
---|---|
str
|
library's import statement based on the alias in the settings. |