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
0 commit comments