Commit e118bf0a authored by Yakubov, Sergey's avatar Yakubov, Sergey
Browse files

cleanup

parent 7ff0eb0a
Loading
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -13,13 +13,6 @@ logger = logging.getLogger(__name__)


def get_nested_pydantic_field(model: BaseModel, field_path: str) -> FieldInfo:
    """
    Retrieves the Pydantic ModelField object for a nested field in a Pydantic model using a dot-separated field path.

    :param model: Pydantic model instance
    :param field_path: Dot-separated path to the field (e.g., "config.nested.nested2")
    :return: The Pydantic ModelField instance
    """
    fields = field_path.split(".")
    current_model: Any = model

@@ -54,10 +47,7 @@ def validate_pydantic_parameter(name: str, value: Any, index: int) -> str | None
    # get list of nested fields (if any) and get the corresponding model
    fields = name.split(".")
    for field in fields[:-1]:
        if "[index]" in field:
            field = field.removesuffix("[index]")
            current_model = getattr(current_model, field)[index]
        elif "[" in field:
        if "[" in field:
            base = field.split("[")[0]
            indices = re.findall(r"\[(\d+)\]", field)
            indices = [int(num) for num in indices]
+0 −2
Original line number Diff line number Diff line
"""Binding module for PyQt6 framework."""

import uuid
from typing import Any, Optional

from pydantic import BaseModel
@@ -35,7 +34,6 @@ class Communicator(QObject):
        callback_after_update: Any = None,
    ) -> None:
        super().__init__()
        self.id = str(uuid.uuid4())
        self.viewmodel_linked_object = viewmodel_linked_object
        self.linked_object_attributes = linked_object_attributes
        self.callback_after_update = callback_after_update