Skip to content

Commit effab5b

Browse files
PEP8 Standard E501 (#251)
* Just removed from lint.ignore. Testing new workflows. Refs #242 * adopted line length * adopted line length in tests as well
1 parent f5b2d78 commit effab5b

17 files changed

+423
-219
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ lint.ignore = [
8888
"D101", # Ignore missing docstring in public classes
8989
"F401",
9090
# FIXME: those are ignored for now, should be fixed eventually
91-
"E501", # Ignore line too long
9291
"ERA001", # Found commented-out code
9392
"T201", # `print` found"
9493
"SIM105", # Use `contextlib.suppress`

src/petab_gui/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def _convert_dtype_with_nullable_int(series, dtype):
1212
"""Convert a series to the specified dtype, handling nullable integers.
1313
1414
When converting to integer types and the series contains NaN values,
15-
this function automatically uses pandas nullable integer types (Int64, Int32, etc.)
16-
instead of numpy integer types which don't support NaN.
15+
this function automatically uses pandas nullable integer types (Int64,
16+
Int32, etc.) instead of numpy integer types which don't support NaN.
1717
1818
Args:
1919
series: The pandas Series to convert

src/petab_gui/controllers/file_io_controller.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""File I/O Controller for PEtab GUI.
22
3-
This module contains the FileIOController class, which handles all file input/output
4-
operations for PEtab models, including:
3+
This module contains the FileIOController class, which handles all
4+
file input/output operations for PEtab models, including:
55
- Opening and saving PEtab YAML files
66
- Opening and saving COMBINE archives (OMEX)
77
- Opening and saving individual tables
@@ -35,7 +35,8 @@ class FileIOController:
3535
Attributes
3636
----------
3737
main : MainController
38-
Reference to the main controller for access to models, views, and other controllers.
38+
Reference to the main controller for access to models, views, and
39+
other controllers.
3940
model : PEtabModel
4041
The PEtab model being managed.
4142
view : MainWindow
@@ -60,8 +61,9 @@ def __init__(self, main_controller):
6061
def save_model(self):
6162
"""Save the entire PEtab model.
6263
63-
Opens a dialog to select the save format and location, then saves the model
64-
as either a COMBINE archive (OMEX), ZIP file, or folder structure.
64+
Opens a dialog to select the save format and location, then saves
65+
the model as either a COMBINE archive (OMEX), ZIP file, or folder
66+
structure.
6567
6668
Returns
6769
-------
@@ -129,7 +131,8 @@ def save_single_table(self):
129131
Returns
130132
-------
131133
bool or None
132-
True if saved successfully, False if cancelled, None if no active table.
134+
True if saved successfully, False if cancelled, None if no
135+
active table.
133136
"""
134137
active_controller = self.main.active_controller()
135138
if not active_controller:
@@ -253,8 +256,9 @@ def _open_file(self, actionable, file_path, sep, mode):
253256
Parameters
254257
----------
255258
actionable : str
256-
Type of file: "yaml", "omex", "sbml", "measurement", "observable",
257-
"parameter", "condition", "visualization", "simulation", "data_matrix".
259+
Type of file: "yaml", "omex", "sbml", "measurement",
260+
"observable", "parameter", "condition", "visualization",
261+
"simulation", "data_matrix".
258262
file_path : str
259263
Path to the file.
260264
sep : str
@@ -412,7 +416,8 @@ def _load_file_list(self, controller, file_list, file_type, yaml_dir):
412416
file_mode = "overwrite" if i == 0 else "append"
413417
controller.open_table(yaml_dir / file_name, mode=file_mode)
414418
self.logger.log_message(
415-
f"Loaded {file_type} file ({i + 1}/{len(file_list)}): {file_name}",
419+
f"Loaded {file_type} file ({i + 1}/{len(file_list)}): "
420+
f"{file_name}",
416421
color="blue",
417422
)
418423

@@ -478,8 +483,8 @@ def open_yaml_and_load_files(self, yaml_path=None, mode="overwrite"):
478483
)
479484
if not all_exist:
480485
error_msg = (
481-
"The following files referenced in the YAML are missing:\n - "
482-
+ "\n - ".join(missing_files)
486+
"The following files referenced in the YAML are "
487+
"missing:\n - " + "\n - ".join(missing_files)
483488
)
484489
self.logger.log_message(error_msg, color="red")
485490
QMessageBox.critical(self.view, "Missing Files", error_msg)
@@ -565,7 +570,10 @@ def open_yaml_and_load_files(self, yaml_path=None, mode="overwrite"):
565570
self.main.unsaved_changes_change(False)
566571

567572
except FileNotFoundError as e:
568-
error_msg = f"File not found: {e.filename if hasattr(e, 'filename') else str(e)}"
573+
error_msg = (
574+
f"File not found: "
575+
f"{e.filename if hasattr(e, 'filename') else str(e)}"
576+
)
569577
self.logger.log_message(error_msg, color="red")
570578
QMessageBox.warning(self.view, "File Not Found", error_msg)
571579
except KeyError as e:
@@ -659,12 +667,14 @@ def load_example(self, example_name):
659667
Parameters
660668
----------
661669
example_name : str
662-
Name of the example subdirectory (e.g., "Boehm", "Simple_Conversion").
670+
Name of the example subdirectory (e.g., "Boehm",
671+
"Simple_Conversion").
663672
664673
Notes
665674
-----
666675
Finds and loads the example dataset from the package directory.
667-
No internet connection required - the example is bundled with the package.
676+
No internet connection required - the example is bundled with the
677+
package.
668678
"""
669679
try:
670680
# Use importlib.resources to access packaged example files
@@ -687,7 +697,10 @@ def load_example(self, example_name):
687697

688698
with as_file(yaml_file) as yaml_path:
689699
if not yaml_path.exists():
690-
error_msg = f"Example '{example_name}' not found or problem.yaml file is missing."
700+
error_msg = (
701+
f"Example '{example_name}' not found or "
702+
f"problem.yaml file is missing."
703+
)
691704
self.logger.log_message(error_msg, color="red")
692705
QMessageBox.warning(
693706
self.view, "Example Invalid", error_msg

src/petab_gui/controllers/mother_controller.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ def replace(self):
728728
self.view.toggle_replace()
729729

730730
def _toggle_whats_this_mode(self, on: bool):
731-
"""Enable/disable click-to-help mode by installing/removing the global filter.
731+
"""
732+
Enable/disable click-to-help mode.
732733
733734
On enter: show a short instruction bubble.
734735
"""
@@ -754,7 +755,7 @@ def _toggle_whats_this_mode(self, on: bool):
754755
self._show_help_welcome()
755756

756757
def _show_help_welcome(self):
757-
"""Centered welcome with a 'Don't show again' option persisted in QSettings."""
758+
"""Welcome with a 'Don't show again' option persisted in QSettings."""
758759
settings = settings_manager.settings
759760
if settings.value("help_mode/welcome_disabled", False, type=bool):
760761
return
@@ -765,9 +766,12 @@ def _show_help_welcome(self):
765766
msg.setText(
766767
"<b>Welcome to help mode</b><br>"
767768
"<ul>"
768-
"<li>Click any widget, tab, or column header to see its help.</li>"
769-
"<li>Click the same item again or press <b>Esc</b> to close the bubble.</li>"
770-
"<li>Press <b>Esc</b> with no bubble, or toggle the <i>?</i> button, to exit.</li>"
769+
"<li>Click any widget, tab, or column header to see its "
770+
"help.</li>"
771+
"<li>Click the same item again or press <b>Esc</b> to close "
772+
"the bubble.</li>"
773+
"<li>Press <b>Esc</b> with no bubble, or toggle the <i>?</i> "
774+
"button, to exit.</li>"
771775
"</ul>"
772776
)
773777
dont = QCheckBox("Don't show again")
@@ -795,7 +799,7 @@ def about(self):
795799
)
796800

797801
def _show_next_steps_panel(self):
798-
"""Show the next steps panel (ignores 'don't show again' preference)."""
802+
"""Show the next steps panel."""
799803
# Sync checkbox state with current settings
800804
dont_show = settings_manager.get_value(
801805
"next_steps/dont_show_again", False, bool

src/petab_gui/controllers/plot_coordinator.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class PlotCoordinator:
2323
Attributes
2424
----------
2525
main : MainController
26-
Reference to the main controller for access to models, views, and other controllers.
26+
Reference to the main controller for access to models, views, and
27+
other controllers.
2728
model : PEtabModel
2829
The PEtab model being visualized.
2930
view : MainWindow
@@ -188,7 +189,8 @@ def _on_plot_point_clicked(self, x, y, label, data_type):
188189
x : float
189190
X-coordinate of the clicked point (time).
190191
y : float
191-
Y-coordinate of the clicked point (measurement or simulation value).
192+
Y-coordinate of the clicked point (measurement or simulation
193+
value).
192194
label : str
193195
Label of the clicked point (observable ID).
194196
data_type : str
@@ -250,7 +252,8 @@ def column_index(name):
250252
and self._floats_match(row_y, y)
251253
):
252254
# Manually update highlight BEFORE selecting row
253-
# This ensures the circle appears even though we skip the signal handler
255+
# This ensures the circle appears even though we skip
256+
# the signal handler
254257
if data_type == "measurement":
255258
self.plotter.highlight_from_selection([row])
256259
else:
@@ -272,7 +275,8 @@ def column_index(name):
272275
# Provide feedback if no match found
273276
if not matched:
274277
self.logger.log_message(
275-
f"No matching row found for plot point (obs={obs}, x={x:.4g}, y={y:.4g})",
278+
f"No matching row found for plot point "
279+
f"(obs={obs}, x={x:.4g}, y={y:.4g})",
276280
color="orange",
277281
)
278282

src/petab_gui/controllers/simulation_controller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class SimulationController:
2222
Attributes
2323
----------
2424
main : MainController
25-
Reference to the main controller for access to models, views, and other controllers.
25+
Reference to the main controller for access to models, views, and
26+
other controllers.
2627
model : PEtabModel
2728
The PEtab model being simulated.
2829
logger : LoggerController
@@ -80,7 +81,7 @@ def simulate(self):
8081
value = sbml_model.get_parameter_value(param_id)
8182
nominal_values.append(value)
8283
except Exception:
83-
# If parameter not found in SBML, use default value of 1
84+
# If parameter not found in SBML, use default value
8485
nominal_values.append(1.0)
8586

8687
# Add nominalValue column to parameter_df
@@ -108,7 +109,8 @@ def simulate(self):
108109

109110
# report current basico / COPASI version
110111
self.logger.log_message(
111-
f"Simulate with basico: {basico.__version__}, COPASI: {basico.COPASI.__version__}",
112+
f"Simulate with basico: {basico.__version__}, "
113+
f"COPASI: {basico.COPASI.__version__}",
112114
color="green",
113115
)
114116

src/petab_gui/controllers/table_controllers.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ def append_df(self, new_df: pd.DataFrame):
227227
self.model.beginResetModel()
228228
current_df = self.model.get_df()
229229

230-
# For tables without a named index (measurement, visualization, simulation),
231-
# ignore the index to avoid removing appended data due to index conflicts
230+
# For tables without a named index (measurement, visualization,
231+
# simulation), ignore the index to avoid removing appended data due
232+
# to index conflicts
232233
if self.model.table_type in [
233234
"measurement",
234235
"visualization",
@@ -238,7 +239,8 @@ def append_df(self, new_df: pd.DataFrame):
238239
[current_df, new_df], axis=0, ignore_index=True
239240
)
240241
else:
241-
# For tables with named indices, concatenate and remove duplicate indices
242+
# For tables with named indices, concatenate and remove
243+
# duplicate indices
242244
combined_df = pd.concat([current_df, new_df], axis=0)
243245
combined_df = combined_df[
244246
~combined_df.index.duplicated(keep="first")
@@ -784,12 +786,14 @@ def _detect_time_column(self, df) -> str | None:
784786
return None
785787

786788
def _rank_dose_candidates(self, df: pd.DataFrame) -> list[str]:
787-
"""Rank DataFrame columns by likelihood of containing dose/concentration data.
789+
"""Rank columns by likelihood of containing dose/concentration data.
788790
789-
This method implements a lightweight scoring system to identify and rank
790-
columns that are most likely to contain dose, concentration, or drug-related
791-
data. The ranking is based on multiple heuristics including column naming
792-
patterns, data types, value ranges, and statistical properties.
791+
This method implements a lightweight scoring system to identify
792+
and rank columns that are most likely to contain dose,
793+
concentration, or drug-related
794+
data. The ranking is based on multiple heuristics including column
795+
naming patterns, data types, value ranges, and statistical
796+
properties.
793797
794798
Parameters
795799
----------
@@ -800,29 +804,32 @@ def _rank_dose_candidates(self, df: pd.DataFrame) -> list[str]:
800804
Returns
801805
-------
802806
list[str]
803-
Column names sorted by descending likelihood of containing dose data.
804-
Columns with higher scores appear first. In case of tied scores,
805-
columns with fewer unique values are ranked higher.
807+
Column names sorted by descending likelihood of containing
808+
dose data. Columns with higher scores appear first. In case of
809+
tied scores, columns with fewer unique values are ranked higher.
806810
807811
Notes
808812
-----
809813
The scoring algorithm considers the following criteria:
810814
811-
- **Name matching** (+2.0 points): Column names containing keywords like
812-
'dose', 'conc', 'concentration', 'drug', 'compound', 'stim', 'input',
813-
or patterns like 'u<digit>' (case-insensitive).
815+
- **Name matching** (+2.0 points): Column names containing keywords
816+
like 'dose', 'conc', 'concentration', 'drug', 'compound', 'stim',
817+
'input', or patterns like 'u<digit>' (case-insensitive).
814818
815-
- **Numeric data type** (+1.0 points): Columns with integer or float dtype.
819+
- **Numeric data type** (+1.0 points): Columns with integer or float
820+
dtype.
816821
817-
- **Reasonable cardinality** (+0.8 points): Columns with 2-30 unique
818-
non-null values, which is typical for dose series.
822+
- **Reasonable cardinality** (+0.8 points): Columns with 2-30
823+
unique non-null values, which is typical for dose series.
819824
820-
- **Non-negative values** (+0.3 points): All values are >= 0 when converted
821-
to numeric (dose/concentration values are typically non-negative).
825+
- **Non-negative values** (+0.3 points): All values are >= 0 when
826+
converted to numeric (dose/concentration values are typically
827+
non-negative).
822828
823-
- **Monotonic tendency** (+0.2 points): At least 70% of consecutive numeric
824-
differences are non-decreasing, indicating potential dose escalation
825-
patterns. Requires at least 5 non-null numeric values.
829+
- **Monotonic tendency** (+0.2 points): At least 70% of
830+
consecutive numeric differences are non-decreasing, indicating
831+
potential dose escalation patterns. Requires at least 5 non-null
832+
numeric values.
826833
827834
Raises
828835
------

src/petab_gui/controllers/utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ class _WhatsThisClickHelp(QObject):
2929
3030
While the action is checked:
3131
• Left-click shows a What's This bubble for the target under cursor.
32-
• Clicking the SAME target again closes the bubble (stays in help mode).
33-
• ESC closes the bubble if one is open; if none is open, exits help mode.
34-
• Special cases: QTabBar tabs and QHeaderView sections handled explicitly.
32+
• Clicking the SAME target again closes the bubble (stays in help
33+
mode).
34+
• ESC closes the bubble if one is open; if none is open, exits help
35+
mode.
36+
• Special cases: QTabBar tabs and QHeaderView sections handled
37+
explicitly.
3538
"""
3639

3740
def __init__(self, action):
@@ -81,7 +84,8 @@ def eventFilter(self, _obj, ev):
8184
if isinstance(w, QScrollBar):
8285
return False
8386

84-
# If click landed outside app widgets (e.g., on the bubble), just close it
87+
# If click landed outside app widgets (e.g., on the bubble),
88+
# just close it
8589
if not w:
8690
self._has_bubble = False
8791
return True

src/petab_gui/controllers/validation_controller.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class ValidationController:
2323
Attributes
2424
----------
2525
main : MainController
26-
Reference to the main controller for access to models, views, and other controllers.
26+
Reference to the main controller for access to models, views, and
27+
other controllers.
2728
model : PEtabModel
2829
The PEtab model being validated.
2930
logger : LoggerController

0 commit comments

Comments
 (0)