0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

refactor: replace deprecated imports from typing

https://peps.python.org/pep-0585/#implementation
This commit is contained in:
2023-12-12 15:22:59 +01:00
parent 3ec9caae09
commit 9e852d1afc
3 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,7 @@
import argparse
import itertools
import os
from typing import Callable
from collections.abc import Callable
from bec_lib import BECClient, messages, ServiceConfig
from bec_lib.redis_connector import RedisConsumerThreaded

View File

@ -1,5 +1,3 @@
from typing import List
import numpy as np
import pyqtgraph as pg
from pyqtgraph import mkPen
@ -27,7 +25,7 @@ class ConfigPlotter(pg.GraphicsWidget):
"""
def __init__(self, configs: List[dict], parent=None):
def __init__(self, configs: list[dict], parent=None):
super().__init__(parent)
self.configs = configs
self.plots = {}

View File

@ -1,4 +1,4 @@
from typing import List, Dict, Union, Optional
from typing import Optional, Union
from pydantic import BaseModel, Field, field_validator, model_validator
from pydantic_core import PydanticCustomError
@ -74,11 +74,11 @@ class PlotAxis(BaseModel):
Attributes:
label (Optional[str]): The label for the axis.
signals (List[Signal]): A list of signals to be plotted on this axis.
signals (list[Signal]): A list of signals to be plotted on this axis.
"""
label: Optional[str]
signals: List[Signal] = Field(default_factory=list)
signals: list[Signal] = Field(default_factory=list)
class PlotConfig(BaseModel):
@ -135,11 +135,11 @@ class DeviceMonitorConfig(BaseModel):
Attributes:
plot_settings (PlotSettings): Global settings for plotting.
plot_data (List[PlotConfig]): List of plot configurations.
plot_data (list[PlotConfig]): List of plot configurations.
"""
plot_settings: PlotSettings
plot_data: List[PlotConfig]
plot_data: list[PlotConfig]
class ScanModeConfig(BaseModel):
@ -148,12 +148,12 @@ class ScanModeConfig(BaseModel):
Attributes:
plot_settings (PlotSettings): Global settings for plotting.
plot_data (Dict[str, List[PlotConfig]]): Dictionary of plot configurations,
plot_data (dict[str, list[PlotConfig]]): Dictionary of plot configurations,
keyed by scan type.
"""
plot_settings: PlotSettings
plot_data: Dict[str, List[PlotConfig]]
plot_data: dict[str, list[PlotConfig]]
class MonitorConfigValidator: