Commits

Mike Graham committed c733cdf

Clean up memoize.py

  • Participants
  • Parent commits 9531acc

Comments (0)

Files changed (1)

remember/memoize.py

 """Memoize callables."""
 
 import functools
+import json
 import types
-import weakref
 
 from remember import dicts
     
         try:
             return obj._memoized_method_caches[self._f]
         except (AttributeError, KeyError) as e:
-            if isintance(e, AttributeError):
+            if isinstance(e, AttributeError):
                 obj._memoized_method_caches = {}
             
             method = functools.partial(self._f, obj)
-            obj._memoized_method_caches[f] = Memoizer(method, 
+            obj._memoized_method_caches[self._f] = Memoizer(method, 
                                                       self._cache_size, 
                                                       self._allow_unhashable)
-            return obj._memoized_method_caches[f]
+            return obj._memoized_method_caches[self._f]
 
     def __get__(self, obj, type=None):
         if obj is None:
             return self
             
         try:
-            return obj._memoized_property_cache[f]
+            return obj._memoized_property_cache[self.f]
         except (AttributeError, KeyError) as e:
-            if isintance(e, AttributeError):
+            if isinstance(e, AttributeError):
                 obj._memoized_property_cache = {}
                 
-            obj_memoized_property_cache[f] = result = f(obj)
+            obj._memoized_property_cache[self.f] = result = self.f(obj)
             
             return result