ogstools.ogs6py.python_script module#

class ogstools.ogs6py.python_script.PythonScript[source]#

Bases: ReferencedFile

Class managing the python script file (.py) for an OGS project.

Tracks both the XML reference to the script and the actual file, enabling proper save/copy operations.

Initialize a StorageBase object.

Parameters:
  • class_id – Type identifier for this saveable object (e.g., “Model”, “Simulation”).

  • file_ext – File extension if this is a file (e.g., “yaml”, “prj”). Empty string for directories.

  • default_target – Default path for saving if none is specified.

  • id – Unique identifier. If None, generates a timestamp-based ID.

__init__(tree)[source]#

Initialize a StorageBase object.

Parameters:
  • class_id – Type identifier for this saveable object (e.g., “Model”, “Simulation”).

  • file_ext – File extension if this is a file (e.g., “yaml”, “prj”). Empty string for directories.

  • default_target – Default path for saving if none is specified.

  • id – Unique identifier. If None, generates a timestamp-based ID.

add_python_script(filename)[source]#

Add/set a python script file.

Parameters:

filename (str | Path) – The file path and name of the python script

Return type:

None

set_pyscript(filename)[source]#

Set a filename for a python script.

Parameters:

filename (str)

Return type:

None