From 85397ad4632f25c61638d7cf61bda5919a2d9776 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Wed, 30 Aug 2017 00:58:27 -0500
Subject: [PATCH] s/Lazy/LazilyUnpickling

---
 loopy/codegen/__init__.py |  4 ++--
 loopy/tools.py            | 16 ++++++++--------
 test/test_misc.py         | 37 +++++++++++++++++++------------------
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/loopy/codegen/__init__.py b/loopy/codegen/__init__.py
index 392e9bbec..07bcdc7c6 100644
--- a/loopy/codegen/__init__.py
+++ b/loopy/codegen/__init__.py
@@ -507,9 +507,9 @@ def generate_code_v2(kernel):
     # }}}
 
     # For faster unpickling in the common case when implemented_domains isn't needed.
-    from loopy.tools import LazyDict
+    from loopy.tools import LazilyUnpicklingDict
     codegen_result = codegen_result.copy(
-            implemented_domains=LazyDict(
+            implemented_domains=LazilyUnpicklingDict(
                     codegen_result.implemented_domains))
 
     logger.info("%s: generate code: done" % kernel.name)
diff --git a/loopy/tools.py b/loopy/tools.py
index a7e536989..69a25b375 100644
--- a/loopy/tools.py
+++ b/loopy/tools.py
@@ -344,8 +344,8 @@ def compute_sccs(graph):
 # {{{ pickled container value
 
 class _PickledObject(object):
-    """A class meant to wrap a pickled value (for :class:`LazyDict` and
-    :class:`LazyList`).
+    """A class meant to wrap a pickled value (for :class:`LazilyUnpicklingDict` and
+    :class:`LazilyUnpicklingList`).
     """
 
     def __init__(self, obj):
@@ -390,7 +390,7 @@ class _PickledObjectWithEqAndPersistentHashKeys(_PickledObject):
 
 # {{{ lazily unpickling dictionary
 
-class LazyDict(collections.MutableMapping):
+class LazilyUnpicklingDict(collections.MutableMapping):
     """A dictionary-like object which lazily unpickles its values.
     """
 
@@ -425,7 +425,7 @@ class LazyDict(collections.MutableMapping):
 
 # {{{ lazily unpickling list
 
-class LazyList(collections.MutableSequence):
+class LazilyUnpicklingList(collections.MutableSequence):
     """A list which lazily unpickles its values."""
 
     def __init__(self, *args, **kwargs):
@@ -453,7 +453,7 @@ class LazyList(collections.MutableSequence):
         return {"_list": [_PickledObject(val) for val in self._list]}
 
 
-class LazyListWithEqAndPersistentHashing(LazyList):
+class LazilyUnpicklingListWithEqAndPersistentHashing(LazilyUnpicklingList):
     """A list which lazily unpickles its values, and supports equality comparison
     and persistent hashing without unpickling.
 
@@ -469,7 +469,7 @@ class LazyListWithEqAndPersistentHashing(LazyList):
     def __init__(self, *args, **kwargs):
         self.eq_key_getter = kwargs.pop("eq_key_getter")
         self.persistent_hash_key_getter = kwargs.pop("persistent_hash_key_getter")
-        LazyList.__init__(self, *args, **kwargs)
+        LazilyUnpicklingList.__init__(self, *args, **kwargs)
 
     def update_persistent_hash(self, key_hash, key_builder):
         key_builder.update_for_list(key_hash, self._list)
@@ -485,10 +485,10 @@ class LazyListWithEqAndPersistentHashing(LazyList):
         return self.persistent_hash_key_getter(obj)
 
     def __eq__(self, other):
-        if not isinstance(other, (list, LazyList)):
+        if not isinstance(other, (list, LazilyUnpicklingList)):
             return NotImplemented
 
-        if isinstance(other, LazyList):
+        if isinstance(other, LazilyUnpicklingList):
             other = other._list
 
         if len(self) != len(other):
diff --git a/test/test_misc.py b/test/test_misc.py
index 53da8ee61..0273948b3 100644
--- a/test/test_misc.py
+++ b/test/test_misc.py
@@ -108,18 +108,18 @@ class PickleDetector(object):
         self.state = state["state"]
 
 
-class PickleDetectorForLazyDict(PickleDetector):
+class PickleDetectorForLazilyUnpicklingDict(PickleDetector):
     instance_unpickled = False
 
     def __init__(self):
         self.state = None
 
 
-def test_LazyDict():
-    from loopy.tools import LazyDict
+def test_LazilyUnpicklingDict():
+    from loopy.tools import LazilyUnpicklingDict
 
-    cls = PickleDetectorForLazyDict
-    mapping = LazyDict({0: cls()})
+    cls = PickleDetectorForLazilyUnpicklingDict
+    mapping = LazilyUnpicklingDict({0: cls()})
 
     assert not cls.instance_unpickled
 
@@ -156,25 +156,25 @@ def test_LazyDict():
 
     # {{{ test empty map
 
-    mapping = LazyDict({})
+    mapping = LazilyUnpicklingDict({})
     mapping = loads(dumps(mapping))
     assert len(mapping) == 0
 
     # }}}
 
 
-class PickleDetectorForLazyList(PickleDetector):
+class PickleDetectorForLazilyUnpicklingList(PickleDetector):
     instance_unpickled = False
 
     def __init__(self):
         self.state = None
 
 
-def test_LazyList():
-    from loopy.tools import LazyList
+def test_LazilyUnpicklingList():
+    from loopy.tools import LazilyUnpicklingList
 
-    cls = PickleDetectorForLazyList
-    lst = LazyList([cls()])
+    cls = PickleDetectorForLazilyUnpicklingList
+    lst = LazilyUnpicklingList([cls()])
     assert not cls.instance_unpickled
 
     from pickle import loads, dumps
@@ -207,14 +207,15 @@ def test_LazyList():
 
     # {{{ test empty list
 
-    lst = LazyList([])
+    lst = LazilyUnpicklingList([])
     lst = loads(dumps(lst))
     assert len(lst) == 0
 
     # }}}
 
 
-class PickleDetectorForLazyListWithEqAndPersistentHashing(PickleDetector):
+class PickleDetectorForLazilyUnpicklingListWithEqAndPersistentHashing(
+        PickleDetector):
     instance_unpickled = False
 
     def __init__(self, comparison_key):
@@ -227,19 +228,19 @@ class PickleDetectorForLazyListWithEqAndPersistentHashing(PickleDetector):
         key_builder.rec(key_hash, repr(self))
 
 
-def test_LazyListWithEqAndPersistentHashing():
-    from loopy.tools import LazyListWithEqAndPersistentHashing
+def test_LazilyUnpicklingListWithEqAndPersistentHashing():
+    from loopy.tools import LazilyUnpicklingListWithEqAndPersistentHashing
 
-    cls = PickleDetectorForLazyListWithEqAndPersistentHashing
+    cls = PickleDetectorForLazilyUnpicklingListWithEqAndPersistentHashing
     from pickle import loads, dumps
 
     # {{{ test comparison of a pair of lazy lists
 
-    lst0 = LazyListWithEqAndPersistentHashing(
+    lst0 = LazilyUnpicklingListWithEqAndPersistentHashing(
             [cls(0), cls(1)],
             eq_key_getter=repr,
             persistent_hash_key_getter=repr)
-    lst1 = LazyListWithEqAndPersistentHashing(
+    lst1 = LazilyUnpicklingListWithEqAndPersistentHashing(
             [cls(0), cls(1)],
             eq_key_getter=repr,
             persistent_hash_key_getter=repr)
-- 
GitLab