Skip to content

enums

enums

Module contains utility enums used within the cssfinder project.

CaseInsensitiveEnum

Bases: Enum

Case insensitive enum base class.

Source code in cssfinder/enums.py
class CaseInsensitiveEnum(Enum):
    """Case insensitive enum base class."""

    @classmethod
    def _missing_(cls, value: object) -> Self:
        name = str(value)
        for member in cls:
            if member.name.casefold() == name.casefold():
                return member

        reason = f"No enum value matches name {name!r}."
        raise NoMatchingEnumValueError(reason)

NoMatchingEnumValueError

Bases: AttributeError

Raised when CaseInsensitiveEnum subclass can't find matching enum value.

Source code in cssfinder/enums.py
class NoMatchingEnumValueError(AttributeError):
    """Raised when CaseInsensitiveEnum subclass can't find matching enum value."""

ExitCode

Enumeration of standardized CSSFinder exit codes.

Source code in cssfinder/enums.py
class ExitCode:
    """Enumeration of standardized CSSFinder exit codes."""

    BROKEN_EXAMPLE = 133

    EXAMPLE_SHA_NOR_NAME_GIVEN = 134
    EXAMPLE_WITH_NAME_NOT_FOUND = 135
    EXAMPLE_WITH_SHA_NOT_FOUND = 136

    EXAMPLE_DESTINATION_ALREADY_EXISTS = 137
    PROJECT_NOT_FOUND = 138