From 2bedf91e4103c7a37514a5388ae3dfa071ef871e Mon Sep 17 00:00:00 2001 From: PaulJonasJost Date: Tue, 24 Mar 2026 13:54:59 +0100 Subject: [PATCH 1/2] A002 reenabled --- pyproject.toml | 1 - src/petab_gui/commands.py | 4 ++-- src/petab_gui/models/pandas_table_model.py | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1b24b42..ff83367 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,7 +94,6 @@ lint.ignore = [ "T201", # `print` found" "SIM105", # Use `contextlib.suppress` "S110", # `try`-`except`-`pass` detected, consider logging the exception - "A002", # Function argument shadowing a Python builtin "E701", # Multiple statements on one line (colon) "E741", # Ambiguous variable name ] diff --git a/src/petab_gui/commands.py b/src/petab_gui/commands.py index 85a6646..9ba472a 100644 --- a/src/petab_gui/commands.py +++ b/src/petab_gui/commands.py @@ -25,7 +25,7 @@ def _convert_dtype_with_nullable_int(series, dtype): # Check if it's already a pandas nullable int type is_pandas_nullable_int = isinstance( dtype, - (pd.Int64Dtype, pd.Int32Dtype, pd.Int16Dtype, pd.Int8Dtype), + pd.Int64Dtype | pd.Int32Dtype | pd.Int16Dtype | pd.Int8Dtype, ) if is_pandas_nullable_int: @@ -306,7 +306,7 @@ def _apply_changes(self, use_new: bool): # For numeric types, convert string inputs to numbers first is_pandas_nullable_int = isinstance( dtype, - (pd.Int64Dtype, pd.Int32Dtype, pd.Int16Dtype, pd.Int8Dtype), + pd.Int64Dtype | pd.Int32Dtype | pd.Int16Dtype | pd.Int8Dtype, ) if is_pandas_nullable_int or np.issubdtype(dtype, np.number): df[col] = pd.to_numeric(df[col], errors="coerce") diff --git a/src/petab_gui/models/pandas_table_model.py b/src/petab_gui/models/pandas_table_model.py index db0c48a..078d12f 100644 --- a/src/petab_gui/models/pandas_table_model.py +++ b/src/petab_gui/models/pandas_table_model.py @@ -1127,12 +1127,12 @@ class MeasurementModel(PandasTableModel): possibly_new_condition = Signal(str) # Signal for new condition possibly_new_observable = Signal(str) # Signal for new observable - def __init__(self, data_frame, type: str = "measurement", parent=None): - allowed_columns = COLUMNS[type].copy() + def __init__(self, data_frame, parent=None): + allowed_columns = COLUMNS["measurement"].copy() super().__init__( data_frame=data_frame, allowed_columns=allowed_columns, - table_type=type, + table_type="measurement", parent=parent, ) From ee83181303bfce161a9b299bebbfb9aeb9c80da4 Mon Sep 17 00:00:00 2001 From: PaulJonasJost Date: Tue, 24 Mar 2026 13:59:30 +0100 Subject: [PATCH 2/2] renamed type to table_type. Distinction necessary for simulation and measurement table --- src/petab_gui/models/pandas_table_model.py | 8 +++++--- src/petab_gui/models/petab_model.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/petab_gui/models/pandas_table_model.py b/src/petab_gui/models/pandas_table_model.py index 078d12f..3343dde 100644 --- a/src/petab_gui/models/pandas_table_model.py +++ b/src/petab_gui/models/pandas_table_model.py @@ -1127,12 +1127,14 @@ class MeasurementModel(PandasTableModel): possibly_new_condition = Signal(str) # Signal for new condition possibly_new_observable = Signal(str) # Signal for new observable - def __init__(self, data_frame, parent=None): - allowed_columns = COLUMNS["measurement"].copy() + def __init__( + self, data_frame, table_type: str = "measurement", parent=None + ): + allowed_columns = COLUMNS[table_type].copy() super().__init__( data_frame=data_frame, allowed_columns=allowed_columns, - table_type="measurement", + table_type=table_type, parent=parent, ) diff --git a/src/petab_gui/models/petab_model.py b/src/petab_gui/models/petab_model.py index 06a1702..c19618f 100644 --- a/src/petab_gui/models/petab_model.py +++ b/src/petab_gui/models/petab_model.py @@ -62,11 +62,11 @@ def __init__( ) self.measurement = MeasurementModel( data_frame=self.problem.measurement_df, - type="measurement", + table_type="measurement", ) self.simulation = MeasurementModel( data_frame=None, - type="simulation", + table_type="simulation", ) self.observable = ObservableModel( data_frame=self.problem.observable_df,