Since this thing is on the innerwebs I suppose it should have a
[python_utils.git] / deferred_operand.py
index 4b12279b5726a2eb3a97eed1c20b1f708870143b..df762376c1b16374440c2a5ea7cda8d568bd5e58 100644 (file)
@@ -1,5 +1,13 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
+"""This is a helper class that tries to define every __dunder__ method
+so as to defer that evaluation of an object as long as possible.  It
+is used by smart_future.py as a base class.
+
+"""
+
 from abc import ABC, abstractmethod
 from typing import Any, Generic, TypeVar
 
@@ -15,7 +23,7 @@ class DeferredOperand(ABC, Generic[T]):
     """
 
     @abstractmethod
-    def _resolve(self) -> T:
+    def _resolve(self, timeout=None) -> T:
         pass
 
     @staticmethod
@@ -149,7 +157,6 @@ class DeferredOperand(ABC, Generic[T]):
 
     def __getattr__(self, method_name):
         def method(*args, **kwargs):
-            return getattr(DeferredOperand.resolve(self), method_name)(
-                *args, **kwargs
-            )
+            return getattr(DeferredOperand.resolve(self), method_name)(*args, **kwargs)
+
         return method