Skip to content

Commit

Permalink
Add needed operators to DefaultIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Nov 16, 2023
1 parent 530a147 commit 22a52f7
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion retro/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,45 @@ def __or__(self, b):
return False
return DefaultIntegrations.DEFAULT.value | b

def __ror__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value | b

def __and__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value & b

def __rand__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value & b

def __lt__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value < b

def __sub__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value - b

@classmethod
def add(cls, extra):
cls._init()
cls.DEFAULT |= extra
cls.DEFAULT = cls.DEFAULT | extra

@classmethod
def reset(cls):
Expand Down

0 comments on commit 22a52f7

Please sign in to comment.