From 22a52f7d0fed64717ba33e119ce8399592f8939e Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:34:00 -0500 Subject: [PATCH] Add needed operators to DefaultIntegration --- retro/data/__init__.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/retro/data/__init__.py b/retro/data/__init__.py index 694bcaee1..95fb32a31 100644 --- a/retro/data/__init__.py +++ b/retro/data/__init__.py @@ -50,6 +50,13 @@ 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() @@ -57,10 +64,31 @@ def __and__(self, b): 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):