]> scripts.mit.edu Git - wizard.git/commitdiff
Added documentation on sset.py
authorAndrew M. Farrell <afarrell@mit.edu>
Thu, 6 Aug 2009 03:30:40 +0000 (23:30 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 7 Sep 2009 23:13:05 +0000 (19:13 -0400)
Signed-off-by: Andrew M. Farrell <afarrell@mit.edu>
.gitignore
doc/index.rst
doc/module/wizard.sset.rst [new file with mode: 0644]
wizard/sset.py

index 0d20b6487c61e7d1bde93acf4a14b7a89083a16d..50d7a764ae947e8cb60566381797b0da29609aab 100644 (file)
@@ -1 +1,3 @@
 *.pyc
+*.swp
+*~
index 27632e7f9c2e6da494ca52ad41b2fb1f9f632aed..a5ba1811c404045fffe87acfc87b6b1a7bb27409 100644 (file)
@@ -66,6 +66,7 @@ Modules
     module/wizard.install
     module/wizard.shell
     module/wizard.util
+    module/wizard.sset
 
 Indices and tables
 ------------------
diff --git a/doc/module/wizard.sset.rst b/doc/module/wizard.sset.rst
new file mode 100644 (file)
index 0000000..1293ca9
--- /dev/null
@@ -0,0 +1,17 @@
+:mod:`wizard.sset`
+===================
+
+.. automodule:: wizard.sset
+
+Classes
+-------
+.. autoclass:: make
+    :members:
+.. autoclass:: ISerializedSet
+    :members:
+.. autoclass:: SerializedSet
+    :members:
+    :inherited-members:
+.. autoclass:: DummySerializedSet
+    :members:
+    :inherited-members:
index e6a4527dbfacbbe1378f4e17f6af4fdd5f43294d..0edfd271e231de7f510498b7d89e47bb49abfa44 100644 (file)
@@ -1,18 +1,26 @@
 import os.path
 
 def make(seen_file):
+    """
+    Return a :class:`SerialisedSet` if given any non-empty string.
+    If given an empty string, return a :class:`DummySerialisedSet`.
+    """
     if seen_file:
         return SerializedSet(seen_file)
     else:
         return DummySerializedSet()
 
 class ISerializedSet(object):
-    def put(self, name):
+    """A unique unordered collection of strings."""
+    def add(self, name):
+        """Adds a value into the set."""
         raise NotImplementedError
 
 class SerializedSet(ISerializedSet):
-    """This set also records itself to a file, so that it
-    is persisted over multiple sessions."""
+    """
+    This set also records itself to a file, so that it
+    is persisted over multiple sessions.
+    """
     def __init__(self, file):
         self.set = set()
         if os.path.isfile(file):
@@ -27,8 +35,10 @@ class SerializedSet(ISerializedSet):
         self.file.flush()
 
 class DummySerializedSet(ISerializedSet):
-    """Dummy object that doesn't actually cache anything and
-    claims that everything needs to be done"""
+    """
+    Dummy object that doesn't actually cache anything and
+    claims that everything needs to be done.
+    """
     def __contains__(self, name):
         return False
     def add(self, name):