Module pydsphtools.exceptions

The module with the definition of the exceptions used in the packages.

Classes

class DSPHBinaryNotFound (binary_name: str, path: str, *args: object)

Raised if a binary is not found in the path.

Attributes

binary_name : str
Name of the binary
path : str
The path that was searched.
Expand source code
class DSPHBinaryNotFound(Exception):
    """Raised if a binary is not found in the path.

    Attributes
    ----------
    binary_name : str
        Name of the binary
    path : str
        The path that was searched.
    """

    binary_name: str
    path: str

    def __init__(self, binary_name: str, path: str, *args: object) -> None:
        self.binary_name = binary_name
        self.path = path
        super().__init__(
            f'DualSPHysics binary "{self.binary_name}" not found in "{path}".'
        )

Ancestors

  • builtins.Exception
  • builtins.BaseException

Class variables

var binary_name : str

The type of the None singleton.

var path : str

The type of the None singleton.

class InvalidTimeInterval (tmin: float, tmax: float)

Raised when a variable is not found in the output file.

Attributes

tmin : float
The lower bound of the time interval.
tmax : float
The higher bound of the time interval.
Expand source code
class InvalidTimeInterval(Exception):
    """Raised when a variable is not found in the output file.

    Attributes
    ----------
    tmin : float
        The lower bound of the time interval.
    tmax : float
        The higher bound of the time interval.
    """

    tmin: float
    tmax: float

    def __init__(self, tmin: float, tmax: float) -> None:
        self.tmin = tmin
        self.tmax = tmax
        self.message = f"Invalid time interval: ({tmin}-{tmax})."
        super().__init__(self.message)

Ancestors

  • builtins.Exception
  • builtins.BaseException

Class variables

var tmax : float

The type of the None singleton.

var tmin : float

The type of the None singleton.

class MissingEnvironmentVariable (var_name: str, *args)

Raised if an enviroment variable is undefined.

Attributes

var_name : str
    The name of the environment variable.
Expand source code
class MissingEnvironmentVariable(Exception):
    """Raised if an enviroment variable is undefined.

    Attributes
    ----------
        var_name : str
            The name of the environment variable.
    """

    var_name: str

    def __init__(self, var_name: str, *args) -> None:
        self.var_name = var_name
        super().__init__(*args)

Ancestors

  • builtins.Exception
  • builtins.BaseException

Class variables

var var_name : str

The type of the None singleton.

class NotFoundInOutput (missing: str, *filenames: str)

Raised when a variable is not found in the output file.

Attributes

missing : str
What was not found.
filename : str, optional
The name of the output file.
Expand source code
class NotFoundInOutput(Exception):
    """Raised when a variable is not found in the output file.

    Attributes
    ----------
    missing : str
        What was not found.
    filename : str, optional
        The name of the output file.
    """

    missing: str
    filenames: list[str]

    def __init__(self, missing: str, *filenames: str) -> None:
        self.missing = missing
        self.filenames = list(filenames)
        self.message = f"{missing} not found"

        if filenames:
            self.message += " in " + " or ".join(map(lambda x: f"'{x}'", self.filenames))

        
        super().__init__(self.message)

Ancestors

  • builtins.Exception
  • builtins.BaseException

Class variables

var filenames : list[str]

The type of the None singleton.

var missing : str

The type of the None singleton.

class UnsupportedPlatform (platform: str, *args: object)

Raised if the platform is not supperted by DualSPHysics/

Attributes

platform : str
Name of the platform
Expand source code
class UnsupportedPlatform(Exception):
    """Raised if the platform is not supperted by DualSPHysics/

    Attributes
    ----------
    platform : str
        Name of the platform
    """

    platform: str

    def __init__(self, platform: str, *args: object) -> None:
        self.platform = platform
        super().__init__(f'Unsupported platform "{self.platform}".')

Ancestors

  • builtins.Exception
  • builtins.BaseException

Class variables

var platform : str

The type of the None singleton.