pyqt_reactive.services.value_collection_service

Consolidated Value Collection Service.

Merges: - NestedValueCollectionService: Type-safe discriminated union dispatch for nested values - DataclassUnpacker: Auto-unpack dataclass fields to instance attributes

Key features: 1. Type-safe dispatch using ParameterInfo discriminated unions 2. Auto-discovery of handlers via ParameterServiceABC 3. Auto-unpacking of dataclass fields

Classes

ValueCollectionService()

Consolidated service for value collection and unpacking.

class pyqt_reactive.services.value_collection_service.ValueCollectionService[source]

Consolidated service for value collection and unpacking.

Examples

service = ValueCollectionService()

# Collect nested value with type-safe dispatch: value = service.collect_nested_value(manager, “some_param”, nested_manager)

# Unpack dataclass fields to instance attributes: service.unpack_to_self(target, source, prefix=”config_”)

collect_nested_value(manager, param_name: str, nested_manager) Any | None[source]

Collect nested value using type-safe dispatch.

Gets ParameterInfo from form structure and dispatches to the appropriate handler based on its type.

static reconstruct_nested_dataclasses(live_values: dict) dict[source]

Return live values unchanged.

static unpack_to_self(target: Any, source: Any, field_mapping: Dict[str, str] | None = None, prefix: str = '') None[source]

Auto-unpack dataclass fields to instance attributes with optional renaming/prefix.

Parameters:
  • target – Target object to set attributes on

  • source – Source dataclass to unpack fields from

  • field_mapping – Optional {target_name: source_name} mapping

  • prefix – Optional prefix for target attribute names