0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

refactor: pylint improvement

This commit is contained in:
wyzula-jan
2024-01-16 18:19:40 +01:00
parent 1cd273c375
commit 8bebc4f692
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,4 @@
# pylint: disable = no-name-in-module,missing-module-docstring
from __future__ import annotations from __future__ import annotations
import time import time
@ -80,6 +81,20 @@ class MotorMap(pg.GraphicsLayoutWidget):
self.update_signal, rateLimit=25, slot=self._update_plots self.update_signal, rateLimit=25, slot=self._update_plots
) )
# Config related variables
self.plot_data = None
self.plot_settings = None
self.max_points = None
self.num_dim_points = None
self.scatter_size = None
self.precision = None
self.background_value = None
self.database = {}
self.device_mapping = {}
self.plots = {}
self.grid_coordinates = []
self.curves_data = {}
# Init UI with config # Init UI with config
if self.config is None: if self.config is None:
print("No initial config found for MotorMap. Using default config.") print("No initial config found for MotorMap. Using default config.")
@ -190,7 +205,7 @@ class MotorMap(pg.GraphicsLayoutWidget):
motor_limits = self._get_motor_limit(motor_name) motor_limits = self._get_motor_limit(motor_name)
signal["limits"] = motor_limits signal["limits"] = motor_limits
def _get_motor_limit(self, motor: str) -> Union[Any | None]: def _get_motor_limit(self, motor: str) -> Union[list | None]:
""" """
Get the motor limit from the config. Get the motor limit from the config.
Args: Args:
@ -203,11 +218,11 @@ class MotorMap(pg.GraphicsLayoutWidget):
limits = self.dev[motor].limits limits = self.dev[motor].limits
if limits == [0, 0]: if limits == [0, 0]:
return None return None
else:
return limits return limits
except AttributeError: # TODO maybe not needed, if no limits it returns [0,0] except AttributeError: # TODO maybe not needed, if no limits it returns [0,0]
# If the motor doesn't have a 'limits' attribute, return a default value or raise a custom exception # If the motor doesn't have a 'limits' attribute, return a default value or raise a custom exception
print(f"The device '{motor}' does not have defined limits.") print(f"The device '{motor}' does not have defined limits.")
return None
def _init_database(self): def _init_database(self):
"""Initiate the database according the config.""" """Initiate the database according the config."""

View File

@ -1,5 +1,6 @@
import pytest # pylint: disable = no-name-in-module,missing-module-docstring, missing-function-docstring
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pytest
from bec_widgets.widgets import MotorMap from bec_widgets.widgets import MotorMap