Command class
Class of command with command type and a string with a command of this type.
Attributes:
Name | Type | Description |
---|---|---|
cmd_type |
CommandType |
Type of command. |
args |
DotMap |
All arguments for this command. |
Source code in py_linq_sql/utils/classes/other_classes.py
@dataclass
class Command:
"""
Class of command with command type and a string with a command of this type.
Attributes:
cmd_type (CommandType): Type of command.
args (DotMap): All arguments for this command.
"""
cmd_type: CommandTypeOrStr
args: DotMap = field(default_factory=DotMap)
def __eq__(self, other: Any) -> bool: # noqa: ANN401
"""
Try equality between two Command.
Command_1 == Command_2.
"""
if not isinstance(other, Command):
return NotImplemented
if not self.cmd_type == other.cmd_type:
return False
for key in self.args:
if not self.args[key] == other.args[key]:
return False
return True
def __ne__(self, other: Any) -> bool: # noqa: ANN401
"""
Try no-equality between two Command.
Command_1 != Command_2.
"""
return bool(not self.__eq__(other))
__eq__(self, other)
special
Try equality between two Command.
Command_1 == Command_2.
Source code in py_linq_sql/utils/classes/other_classes.py
def __eq__(self, other: Any) -> bool: # noqa: ANN401
"""
Try equality between two Command.
Command_1 == Command_2.
"""
if not isinstance(other, Command):
return NotImplemented
if not self.cmd_type == other.cmd_type:
return False
for key in self.args:
if not self.args[key] == other.args[key]:
return False
return True
__ne__(self, other)
special
Try no-equality between two Command.
Command_1 != Command_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 Command.
Command_1 != Command_2.
"""
return bool(not self.__eq__(other))