ahvn.adapter package

class ahvn.adapter.BaseUKFAdapter(name, include=None, exclude=None)[源代码]

基类:ABC

Base adapter class for converting between UKF objects and backend representations.

This class should be extended to implement specific adapters for different backends.

参数:
virtual_fields = None
__init__(name, include=None, exclude=None)[源代码]

Initialize the adapter with specified field inclusion.

参数:
  • name -- Name of the adapter instance.

  • include (Optional[List[str]]) -- List of BaseUKF field names to include. If None, includes all fields. Default is None.

  • exclude (Optional[List[str]]) -- List of BaseUKF field names to exclude. If None, excludes no fields. Default is None. Notice that exclude is applied after include, so if a field is in both include and exclude, it will be excluded. It is recommended to use only one of include or exclude.

abstractmethod from_ukf(ukf)[源代码]

Convert a BaseUKF object to a dictionary representation entity for backend.

参数:

ukf (BaseUKF) -- BaseUKF object to convert.

返回类型:

Any

返回:

The converted entity that can be stored in the backend.

abstractmethod to_ukf_data(entity)[源代码]

Convert a backend entity representation to a dictionary suitable for BaseUKF initialization.

参数:

entity (Any) -- The backend entity to convert.

返回类型:

Dict[str, Any]

返回:

A dictionary of field names and values for BaseUKF initialization.

to_ukf(entity)[源代码]

Convert a backend entity representation to a BaseUKF object.

参数:

entity (Any) -- The backend entity to convert.

返回类型:

BaseUKF

返回:

The converted BaseUKF object.

abstractmethod from_result(result)[源代码]

Convert a query result from the backend to the appropriate entity representation.

参数:

result (Any) -- The raw result from a backend query.

返回类型:

Any

返回:

The converted entity representation.

ahvn.adapter.parse_ukf_include(include=None, exclude=None, virtual_fields=None)[源代码]

Parse include parameter for engine initialization.

参数:
  • include (Optional[List[str]]) -- List of BaseUKF field names to include. If None, includes all fields.

  • exclude (Optional[List[str]]) -- List of BaseUKF field names to exclude. If None, excludes no fields. Notice that exclude is applied after include, so if a field is in both include and exclude, it will be excluded. It is recommended to use only one of include or exclude.

  • virtual_fields (Optional[Iterable[str]]) -- Additional virtual fields to include.

返回:

  • List of field names to include.

  • Boolean indicating if the included fields are sufficient to reconstruct a full BaseUKF object.

返回类型:

A tuple containing

Submodules