Skip to content

Commit

Permalink
Update ConditionHandler class in conditions.py
Browse files Browse the repository at this point in the history
Defined new instance attribute `_logical_method_map` mapping operator
names with corresponding evaluation methods. Also updated `__slots__`
with the same.
  • Loading branch information
rahul4732saini committed Nov 3, 2024
1 parent e46d228 commit 543d041
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fise/query/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class ConditionHandler:
query conditions for search and delete operations.
"""

__slots__ = "_conditions", "_method_map"
__slots__ = "_conditions", "_method_map", "_logical_method_map"

def __init__(self, subquery: list[str], entity: int) -> None:
"""
Expand All @@ -279,6 +279,12 @@ def __init__(self, subquery: list[str], entity: int) -> None:
- entity (int): Entity being operated upon.
"""

# Maps logical operators with corresponding evaluation methods.
self._logical_method_map: dict[str, Callable[[bool, bool], bool]] = {
"and": self._and,
"or": self._or,
}

# Maps operator notations with corresponding evaluation methods.
self._method_map: dict[str, Callable[[Any, Any], bool]] = {
">=": self._ge,
Expand Down

0 comments on commit 543d041

Please sign in to comment.