base_adapter
anymerge.adapters.base_adapter
¶
BaseAdapter
¶
Bases: ABC, Generic[T]
Source code in src/anymerge/adapters/base_adapter.py
is_supported_type
abstractmethod
classmethod
¶
Check if the value is supported by the adapter.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TypeGuard[type[T]]
|
Whether the value is supported by the adapter. |
Source code in src/anymerge/adapters/base_adapter.py
get_fields
abstractmethod
¶
get_fields() -> dict[Any, FieldInfo]
Get the fields of the model.
| RETURNS | DESCRIPTION |
|---|---|
dict[Any, FieldInfo]
|
The fields of the model. |
get_values
abstractmethod
¶
Get the values of the instance.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The instance to get the values from.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[Any, Any]
|
The values of the instance. |
copy
abstractmethod
¶
Copy the instance with the changes applied.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The instance to copy.
TYPE:
|
changes
|
The changes to apply to the instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
T
|
The copied instance. |
Source code in src/anymerge/adapters/base_adapter.py
wrap
¶
wrap(value: T) -> WrappedValue[T]
Wrap the value with the adapter.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value to wrap.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WrappedValue[T]
|
The wrapped value. |
WrappedValue
¶
WrappedValue(value: T, *, adapter: BaseAdapter[T])
Bases: Generic[T]
A wrapped value with an adapter.