Exceptions
^^^^^^^^^^
-.. autoclass:: ConfigError
-.. autoclass:: UndefinedError
-.. autoclass:: VariableNameError
-.. autoclass:: VariableFixedError
-.. autoclass:: CyclicConfigError
+.. autoexception:: ConfigError
+.. autoexception:: UndefinedError
+.. autoexception:: VariableNameError
+.. autoexception:: VariableFixedError
+.. autoexception:: CyclicConfigError
Configuration tree
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^
::
+
STATUS = ELEMENT *
ELEMENT = WS '\n' | COMMENT | ENTRY | SUBTREE
SUBTREE = WS KEY '(' WS '\n' STATUS ')' WS '\n'
.. automodule:: moe.status
+.. autoexception:: InvalidStatusFile
+
+.. autoclass:: Status
+ :members:
+ :exclude-members: do_read, read_val
+
+
.. todo:: should whitespace (incl. '\n') be allowed (almost) everywhere?
can comment be anywhere whitespace can?
-.. note:: ';' or '\n' is currently required even after CONDITION and SUBTREE block
+.. note:: ';' or '\\n' is currently required even after CONDITION and SUBTREE block
.. note:: Formula can contain additional/unnecessary parentheses
"""
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):