From 3b2c0c783bf7284037f4c5c5ffd6582ee7b1f89c Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 27 Nov 2010 14:56:50 +0100 Subject: [PATCH] Minor updates (docs, status.py) Change base classes of Status and InvalidStatusFile Fix some docs typos and invalid format --- t/doc/config.rst | 10 +++++----- t/doc/status.rst | 8 ++++++++ t/moe/config_parser.py | 2 +- t/moe/status.py | 14 ++++++++++---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/t/doc/config.rst b/t/doc/config.rst index 87e825e..80c2ef8 100644 --- a/t/doc/config.rst +++ b/t/doc/config.rst @@ -136,11 +136,11 @@ Module `moe.config` Exceptions ^^^^^^^^^^ -.. autoclass:: ConfigError -.. autoclass:: UndefinedError -.. autoclass:: VariableNameError -.. autoclass:: VariableFixedError -.. autoclass:: CyclicConfigError +.. autoexception:: ConfigError +.. autoexception:: UndefinedError +.. autoexception:: VariableNameError +.. autoexception:: VariableFixedError +.. autoexception:: CyclicConfigError Configuration tree ^^^^^^^^^^^^^^^^^^ diff --git a/t/doc/status.rst b/t/doc/status.rst index d8ba50f..0953181 100644 --- a/t/doc/status.rst +++ b/t/doc/status.rst @@ -42,6 +42,7 @@ Status file grammar ^^^^^^^^^^^^^^^^^^^ :: + STATUS = ELEMENT * ELEMENT = WS '\n' | COMMENT | ENTRY | SUBTREE SUBTREE = WS KEY '(' WS '\n' STATUS ')' WS '\n' @@ -69,4 +70,11 @@ Module moe.status .. automodule:: moe.status +.. autoexception:: InvalidStatusFile + +.. autoclass:: Status + :members: + :exclude-members: do_read, read_val + + diff --git a/t/moe/config_parser.py b/t/moe/config_parser.py index 838d76b..2da6fac 100644 --- a/t/moe/config_parser.py +++ b/t/moe/config_parser.py @@ -37,7 +37,7 @@ The configuration syntax is the following:: .. 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 """ diff --git a/t/moe/status.py b/t/moe/status.py index 0cba45c..144bf48 100644 --- a/t/moe/status.py +++ b/t/moe/status.py @@ -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): -- 2.39.2