1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-05 00:12:49 +01:00

fix: 'Any' type annotations

This commit is contained in:
2026-01-19 14:53:25 +01:00
committed by Christian Appel
parent 36fa0e649c
commit cc89252fb3
3 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import os
import sys
from typing import Any
from PIL import Image, ImageChops
from qtpy.QtGui import QPixmap
@@ -40,7 +41,7 @@ def compare_images(image1_path: str, reference_image_path: str):
raise ValueError("Images are different")
def snap_and_compare(widget: any, output_directory: str, suffix: str = ""):
def snap_and_compare(widget: Any, output_directory: str, suffix: str = ""):
"""
Save a rendering of a widget and compare it to a reference image

View File

@@ -1,7 +1,7 @@
"""Module for the device configuration form widget for EpicsMotor, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV"""
from copy import deepcopy
from typing import Type
from typing import Any, Type
from bec_lib.atlas_models import Device as DeviceModel
from bec_lib.logger import bec_logger
@@ -191,7 +191,7 @@ class DeviceConfigTemplate(QtWidgets.QWidget):
if widget is not None:
self._set_value_for_widget(widget, value)
def _set_value_for_widget(self, widget: QtWidgets.QWidget, value: any) -> None:
def _set_value_for_widget(self, widget: QtWidgets.QWidget, value: Any) -> None:
"""
Set the value for a widget based on its type.

View File

@@ -1,7 +1,7 @@
"""Module for custom input widgets used in device configuration templates."""
from ast import literal_eval
from typing import Callable
from typing import Any, Callable
from bec_lib.logger import bec_logger
from bec_qthemes import material_icon
@@ -15,7 +15,7 @@ from bec_widgets.widgets.utility.toggle.toggle import ToggleSwitch
logger = bec_logger.logger
def _try_literal_eval(value: any) -> any:
def _try_literal_eval(value: str) -> Any:
"""Consolidated function for literal evaluation of a value."""
if value in ["true", "True"]:
return True
@@ -407,7 +407,7 @@ class DeviceConfigField(BaseModel):
static: bool = False
placeholder_text: str | None = None
validation_callback: list[Callable[[str], bool]] | None = None
default: any = None
default: Any = None
model_config = ConfigDict(arbitrary_types_allowed=True)