Fix linting and type errors for CI
- Use X | None syntax instead of Optional[X] (UP045) - Sort imports in dashboard app (I001) - Remove unnecessary UTF-8 encoding argument (UP012) - Add 'from err' to exception re-raises (B904) - Remove unused imports in integration tests (F401) - Fix useless expression in test (B018) - Cast **1.5 result to float in LDO model (mypy no-any-return) - Use functools.partial instead of lambda in server (mypy misc)
This commit is contained in:
@@ -194,7 +194,7 @@ class LDOModel:
|
||||
# Temperature ratio (reference is approximately 300K ≈ 27°C)
|
||||
temp_ratio = t_kelvin / 300.0
|
||||
|
||||
return self._params.dropout_voltage * (temp_ratio**1.5)
|
||||
return float(self._params.dropout_voltage * (temp_ratio**1.5))
|
||||
|
||||
def is_in_dropout(self, junction_temperature: float) -> bool:
|
||||
"""Check if the LDO is in dropout at current operating point.
|
||||
|
||||
@@ -82,8 +82,8 @@ class ThermalChamberSim(BaseInstrument):
|
||||
|
||||
try:
|
||||
setpoint = float(command.arguments[0])
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid temperature value: {command.arguments[0]}")
|
||||
except ValueError as err:
|
||||
raise ValueError(f"Invalid temperature value: {command.arguments[0]}") from err
|
||||
|
||||
self._setpoint = setpoint
|
||||
if self._physics_engine is not None:
|
||||
|
||||
@@ -94,8 +94,8 @@ class PowerSupplySim(BaseInstrument):
|
||||
|
||||
try:
|
||||
voltage = float(command.arguments[0])
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid voltage value: {command.arguments[0]}")
|
||||
except ValueError as err:
|
||||
raise ValueError(f"Invalid voltage value: {command.arguments[0]}") from err
|
||||
|
||||
if voltage < 0:
|
||||
raise ValueError("Voltage cannot be negative")
|
||||
@@ -127,8 +127,8 @@ class PowerSupplySim(BaseInstrument):
|
||||
|
||||
try:
|
||||
current = float(command.arguments[0])
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid current value: {command.arguments[0]}")
|
||||
except ValueError as err:
|
||||
raise ValueError(f"Invalid current value: {command.arguments[0]}") from err
|
||||
|
||||
if current < 0:
|
||||
raise ValueError("Current limit cannot be negative")
|
||||
|
||||
Reference in New Issue
Block a user