Module integer_sequences.exception

Expand source code
from exception.exceptions import (
    InvalidLengthException,
    MissingRequiredParameter,
    MissingItem,
    NotYetImplemented,
    InvalidLogFormat,
    InvalidElementPassed,
    ParsingError,
)

__all__ = [
    "InvalidLengthException",
    "MissingRequiredParameter",
    "MissingItem",
    "NotYetImplemented",
    "InvalidLogFormat",
    "InvalidElementPassed",
    "ParsingError",
]

Sub-modules

integer_sequences.exception.exceptions

Classes

class InvalidElementPassed (element: str, expected: str, message: str = "Expected tag '%s' but got '%s'.")

Raised when an invalid element is passed to some method.

Attributes

element – the provided element tag expected – the expected element tag

Expand source code
class InvalidElementPassed(Exception):
    """
    Raised when an invalid element is passed to some method.

    Attributes:
      element -- the provided element tag
      expected -- the expected element tag
    """

    def __init__(
        self,
        element: str,
        expected: str,
        message: str = "Expected tag '%s' but got '%s'.",
    ) -> None:
        self.element = element
        self.expected = expected
        self.message = message % (expected, element)
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"({self.element}, {self.expected}) -> {self.message}"

Ancestors

  • builtins.Exception
  • builtins.BaseException
class InvalidLengthException (length: int = 0, message: str = "Attempted to create a sequence generator with invalid length: '%s'")

Raised when a sequence generator was given an invalid length on initialisation, or when a length is smaller than the required number of parameters for a generator method.

Attributes

length – given length

Expand source code
class InvalidLengthException(ValueError):
    """
    Raised when a sequence generator was given an invalid length on initialisation,
    or when a length is smaller than the required number of parameters for a generator method.

    Attributes:
      length -- given length
    """

    def __init__(
        self,
        length: int = 0,
        message: str = "Attempted to create a sequence generator with invalid length: '%s'",
    ) -> None:
        self.length = length
        self.message = message % length
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"{self.length} -> {self.message}"

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidLogFormat (filepath: str, message: str = 'Cannot parse file located at %s.')

Raised when an unsupported or invalid log format is given to the XES transformator.

Attributes

filepath – the path to the file provided

Expand source code
class InvalidLogFormat(Exception):
    """
    Raised when an unsupported or invalid log format is given to the XES transformator.

    Attributes:
      filepath -- the path to the file provided
    """

    def __init__(
        self, filepath: str, message: str = "Cannot parse file located at %s."
    ) -> None:
        self.filepath = filepath
        self.message = message % filepath
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"{self.filepath} -> {self.message}"

Ancestors

  • builtins.Exception
  • builtins.BaseException
class MissingItem (item: Any, container: Union[List[Any], Dict[Any, Any]], message: str = 'There is no %s in %s')

Raised when an item (in a list or dictionary) was missing.

Attributes

item – required item that were not present container – list or dictionary that was supposed to contain item

Expand source code
class MissingItem(Exception):
    """
    Raised when an item (in a list or dictionary) was missing.

    Attributes:
      item -- required item that were not present
      container -- list or dictionary that was supposed to contain item
    """

    def __init__(
        self,
        item: Any,
        container: Union[List[Any], Dict[Any, Any]],
        message: str = "There is no %s in %s",
    ) -> None:
        self.item = item
        self.container = container
        self.message = message % (item, container)
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"{self.item}, {self.container} -> {self.message}"

Ancestors

  • builtins.Exception
  • builtins.BaseException
class MissingRequiredParameter (params: List[str], message: str = "Attempted to call method without required parameters from '%s'")

Raised when a sequence generator was given insufficient parameters to generate a sequence.

Attributes

params – required parameters that were not present

Expand source code
class MissingRequiredParameter(Exception):
    """
    Raised when a sequence generator was given insufficient parameters to generate a sequence.

    Attributes:
      params -- required parameters that were not present
    """

    def __init__(
        self,
        params: List[str],
        message: str = "Attempted to call method without required parameters from '%s'",
    ) -> None:
        self.params = params
        self.message = message % params
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"{self.params} -> {self.message}"

Ancestors

  • builtins.Exception
  • builtins.BaseException
class NotYetImplemented (key: str, message: str = "Attempted to call unimplemented method by key: '%s'")

Raised when a sequence generator was given a key for a sequence function that is not implemented.

Attributes

key – key pointing to no implementation

Expand source code
class NotYetImplemented(NotImplementedError):
    """
    Raised when a sequence generator was given a key for a sequence function that is not implemented.

    Attributes:
      key -- key pointing to no implementation
    """

    def __init__(
        self,
        key: str,
        message: str = "Attempted to call unimplemented method by key: '%s'",
    ) -> None:
        self.key = key
        self.message = message % key
        super().__init__(self.message)

    def __repr__(self) -> str:
        return f"{self.key} -> {self.message}"

Ancestors

  • builtins.NotImplementedError
  • builtins.RuntimeError
  • builtins.Exception
  • builtins.BaseException
class ParsingError (filepath: str, reason: str)

Raised when the XES transformator cannot parse the event log.

Attributes

filepath – path to log reason – reason why parsing fails

Expand source code
class ParsingError(Exception):
    """
    Raised when the XES transformator cannot parse the event log.

    Attributes:
      filepath -- path to log
      reason -- reason why parsing fails
    """

    def __init__(self, filepath: str, reason: str) -> None:
        self.filepath = filepath
        self.reason = reason
        super().__init__(reason)

    def __repr__(self) -> str:
        return f"{self.filepath} -> {self.reason}"

Ancestors

  • builtins.Exception
  • builtins.BaseException