Common classes#
Exception#
The class ScadeOneException
is used to raise an exception.
The message passed when raising the exception is passed to the
Scade One logger ansys.scadeone.core.common.logger.ScadeOneLogger
.
- exception ansys.scadeone.core.common.exception.ScadeOneException(message: str, exc_info: bool = False)#
Bases:
Exception
ScadeOne API Exception. When raising a
ScadeOneException
it is automatically logged. Seeansys.scadeone.core.common.logger.ScadeOneLogger
for more.- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Logging#
The ScadeOneLogger
class is a subclass of the logging.Logger class.
As a singleton, the ScadeOneLogger class is initialized once and used
throughout the application using the logger.LOGGER object or the logger
application attribute.
The default logger is set to log to a file named pyscadeone.log and to the console. The log level is set to DEBUG.
One can set the logger to a different logger by setting the logger attribute as in the following example:
LOGGER.logger = logging.getLogger("MyLogger")
Versioning#
The versioning module contains the version manager for the Scade One formats.
- class ansys.scadeone.core.common.versioning.VersionManager#
Bases:
object
Class managing the versions for the Scade One tools formats.
The version manager is used through the singleton FormatVersions instance.
- get_versions() str #
Get the versions as a document string.
- Returns:
str
String containing the versions
- load_versions(version_file: Path)#
Load the versions from the json file file.
- Parameters:
- version_file
Path
JSON file containing the versions
- version_file
- Raises:
ScadeOneException
If the file is not found or if the file is not valid.