Flags class

Class of flags for SQLEnumerable.

Attributes:

Name Type Description
select bool

True if we call select() method, False otherwise.

alter bool

True if we call an alter methods (insert, update), False otherwise.

one bool

True if we call a one methods (all, any, contains), False otherwise.

terminal Terminal

Type of terminal command.

limit_offset bool

True if we call a limit offset methods (see docs), False otherwise.

join bool

True if we call join methods (see docs), False otherwise.

default_cmd bool

True if we call default methods (see docs), False otherwise.

Source code in py_linq_sql/utils/classes/other_classes.py
@dataclass
class Flags:
    """
    Class of flags for SQLEnumerable.

    Attributes:
        select (bool): True if we call `select()` method, False otherwise.
        alter (bool): True if we call an alter methods (insert, update),
            False otherwise.
        one (bool): True if we call a one methods (all, any, contains), False otherwise.
        terminal (Terminal): Type of terminal command.
        limit_offset (bool): True if we call a limit offset methods (see docs),
            False otherwise.
        join (bool): True if we call join methods (see docs), False otherwise.
        default_cmd (bool): True if we call default methods (see docs),
            False otherwise.

    """

    select: bool = False
    alter: bool = False
    one: bool = False
    terminal: Terminal | None = None
    limit_offset: bool = False
    join: bool = False
    default_cmd: bool = False

    def __eq__(self, other: Any) -> bool:  # noqa: ANN401
        """
        Try equality between two Flags.

        Flags_1 == Flags_2.
        """
        return equality(self, other)

    def __ne__(self, other: Any) -> bool:  # noqa: ANN401
        """
        Try no-equality between two Flags.

        Flags_1 != Flags_2.
        """
        return bool(not self.__eq__(other))

    def copy(self) -> Flags:
        """Create a shallow copy of self."""
        return Flags(
            self.select,
            self.alter,
            self.one,
            self.terminal,
            self.limit_offset,
            self.join,
            self.default_cmd,
        )

__eq__(self, other) special

Try equality between two Flags.

Flags_1 == Flags_2.

Source code in py_linq_sql/utils/classes/other_classes.py
def __eq__(self, other: Any) -> bool:  # noqa: ANN401
    """
    Try equality between two Flags.

    Flags_1 == Flags_2.
    """
    return equality(self, other)

__ne__(self, other) special

Try no-equality between two Flags.

Flags_1 != Flags_2.

Source code in py_linq_sql/utils/classes/other_classes.py
def __ne__(self, other: Any) -> bool:  # noqa: ANN401
    """
    Try no-equality between two Flags.

    Flags_1 != Flags_2.
    """
    return bool(not self.__eq__(other))

copy(self)

Create a shallow copy of self.

Source code in py_linq_sql/utils/classes/other_classes.py
def copy(self) -> Flags:
    """Create a shallow copy of self."""
    return Flags(
        self.select,
        self.alter,
        self.one,
        self.terminal,
        self.limit_offset,
        self.join,
        self.default_cmd,
    )