]> mj.ucw.cz Git - moe.git/blobdiff - t/moe/status.py
Minor updates (docs, status.py)
[moe.git] / t / moe / status.py
index 3a5c34f6218a0d6da06e85330e6e9b76fc18b257..144bf486f66afffaf6e272d79a74ebc7b727e43a 100644 (file)
@@ -2,14 +2,20 @@ import sys
 import types
 import re
 
-key_pattern = re.compile("\A[A-Za-z0-9_-]+\Z")
+key_pattern_str = "\A[A-Za-z0-9_-]+\Z"
+key_pattern = re.compile(key_pattern_str)
 
-class InvalidStatusFile(Exception):
+class InvalidStatusFile(StandardError):
     pass
 
-class Status:
+class Status(object):
     """
-    (One subtree of) Moe status file.
+    (One subtree of) a status file.
+
+    Each Status is a dictionary with string keys matching the specs. and 
+    values either strings or nested Status subtrees.
+
+    The class defines `__getitem__`, `__setitem__`, `__eq__` and `keys`.
     """
 
     def __init__(self):
@@ -151,3 +157,5 @@ class Status:
                        this = stk.pop()
                else:
                    raise InvalidStatusFile("Parse error: malformed line")
+       if stk:
+           raise InvalidStatusFile("Parse error: not all subtrees closed")