Skip to content

Commit

Permalink
Add some debugging dunders to filters #2714
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Jul 11, 2022
1 parent a03ea36 commit 9393b97
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions data-serving/reusable-data-service/data_service/model/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Filter:

class Anything(Filter):
"""Represents a lack of constraints."""

pass
def __str__(self) -> str:
return "Anything()"


class PropertyFilter(Filter):
Expand All @@ -24,6 +24,9 @@ def __init__(self, property_name: str, operation: str, value: Any):
self.operation = operation
self.value = value

def __str__(self) -> str:
return f"PropertyFilter({self.property_name} {self.operation} {self.value})"


class FilterOperator:
LESS_THAN = "<"
Expand All @@ -35,3 +38,6 @@ class AndFilter(Filter):

def __init__(self, filters: List[Filter]):
self.filters = filters

def __str__(self) -> str:
return f"AndFilter({' AND '.join([str(f) for f in self.filters])})"

0 comments on commit 9393b97

Please sign in to comment.