Project management#
This section contains the classes related to Scade One projects.
from ansys.scadeone.core import ScadeOne, ProjectFile
with ScadeOne() as app:
project = app.load_project("project.sproj")
...
Project documentation#
This section gives the description of project class which is used to manage Scade One projects.
Projects are used by ScadeOne
objects, and projects have a link to
the application. To deal with the cross-links, we use the IProject
interface [1].
- class ansys.scadeone.core.project.Project(app: IScadeOne, project: ProjectStorage)#
Bases:
IProject
This class is the entry point of a project.
- dependencies(all=False) List[Self] #
Project dependencies as list of Projects.
If all is True, include recursively dependencies of dependencies.
A dependency occurs only once.
- swan_sources(all=False) List[SwanFile] #
Return all Swan sources from project.
If all is True, include also sources from project dependencies.
- Returns:
list
[SwanFile
]List of all SwanFile objects.
- property app: IScadeOne#
Access to current Scade One application.
- property data#
Project JSON data.
- property model#
Access to model represented by the sources.
- property storage: ProjectStorage#
Project storage.
Project items#
A project can manipulate different items saved using the storage module. The API handles projects and Swan sources (.swan and .swani files).
Project file#
- class ansys.scadeone.core.common.storage.ProjectFile(file: str | Path)#
Bases:
FileStorage
,ProjectStorage
Project as a file.
- dump(**kw)#
Uses self.json to update storage content and returns self.
See json.dumps() for detailed interface.
- load(**kw)#
Loads content of JSON data into json property and returns self.
See json.loads() for detailed interface.
- property json#
JSON content. Any modification is propagated to the underlying JSON object.
Swan code#
- class ansys.scadeone.core.common.storage.SwanFile(file: str | Path)#
Bases:
FileStorage
,SwanStorage
Swan code within a file.
- Parameters:
- file
Path
File containing the Swan source.
- file
- check_swan_version()#
Check Swan version information.
- Raises:
ScadeOneException
When version information is missing or invalid.
- check_swant_version()#
Check Swan test harness version information.
- Raises:
ScadeOneException
When version information is missing or invalid.
- static gen_version(is_harness=False)#
Generate the version for a Swan file.
- property is_interface#
True when file is an interface code.
- property is_module#
True when file is a module code.
- property is_test#
True when file is an test code.
Footnotes