Merge lp:~spud/spud/python-clear-options into lp:spud

Proposed by Nan Mao
Status: Merged
Merged at revision: 452
Proposed branch: lp:~spud/spud/python-clear-options
Merge into: lp:spud
Diff against target: 72 lines (+26/-15)
1 file modified
python/libspud.c (+26/-15)
To merge this branch: bzr merge lp:~spud/spud/python-clear-options
Reviewer Review Type Date Requested Status
Florian Rathgeber Approve
Review via email: mp+71706@code.launchpad.net

Description of the change

Frathgeber pointed out the function clear options were not available in libspud.c. Therefore, I added the function as requested. Regards.

To post a comment you must log in.
Revision history for this message
Florian Rathgeber (florian-rathgeber) wrote :

Looks good to me. Only point: the docstring is not ideal, how about "Clear the entire options tree."

On a related note: Could all the docstrings be updated to include the python method signature?

review: Needs Fixing
lp:~spud/spud/python-clear-options updated
452. By Nan Mao

changed doc strings

453. By Nan Mao

changed doc strings

Revision history for this message
Florian Rathgeber (florian-rathgeber) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/libspud.c'
2--- python/libspud.c 2011-08-16 08:41:17 +0000
3+++ python/libspud.c 2011-08-16 15:24:49 +0000
4@@ -94,6 +94,14 @@
5 Py_RETURN_NONE;
6 }
7
8+static PyObject*
9+libspud_clear_options(PyObject *self, PyObject *args)
10+{
11+ spud_clear_options();
12+
13+ Py_RETURN_NONE;
14+}
15+
16 static PyObject *
17 libspud_get_number_of_children(PyObject *self, PyObject *args)
18 {
19@@ -750,35 +758,38 @@
20
21 static PyMethodDef libspudMethods[] = {
22 {"load_options", libspud_load_options, METH_VARARGS,
23- "load options from xml file."},
24+ PyDoc_STR("Reads the xml file into the options tree.")},
25 {"print_options", libspud_print_options, METH_VARARGS,
26- "print options from xml file."},
27+ PyDoc_STR("Print the entire options tree to standard output.")},
28+ {"clear_options", libspud_clear_options, METH_VARARGS,
29+ PyDoc_STR("Clears the entire options tree.")},
30 {"get_number_of_children", libspud_get_number_of_children, METH_VARARGS,
31- "get number of children from xml file."},
32+ PyDoc_STR("get number of children under key.")},
33 {"get_child_name", libspud_get_child_name, METH_VARARGS,
34- "get child name from xml file."},
35+ PyDoc_STR("Get name of the indexth child of key.")},
36 {"option_count", libspud_option_count, METH_VARARGS,
37- "option count from xml file."},
38+ PyDoc_STR("Return the number of options matching key.")},
39 {"have_option", libspud_have_option, METH_VARARGS,
40- "have option from xml file."},
41+ PyDoc_STR("Checks whether key is present in options dictionary.")},
42 {"get_option_type", libspud_get_option_type, METH_VARARGS,
43- "get option type from xml file."},
44+ PyDoc_STR("Returns the type of option specified by key.")},
45 {"get_option_rank", libspud_get_option_rank, METH_VARARGS,
46- "get option rank from xml file."},
47+ PyDoc_STR("Return the rank of option specified by key.")},
48 {"get_option_shape", libspud_get_option_shape, METH_VARARGS,
49- "get option shape from xml file."},
50+ PyDoc_STR("Return the shape of option specified by key.")},
51 {"get_option", libspud_get_option, METH_VARARGS,
52- "get option from xml file."},
53+ PyDoc_STR("Retrives option values from the options dictionary.")},
54 {"set_option", libspud_set_option, METH_VARARGS,
55- "set option from xml file."},
56+ PyDoc_STR("Sets options in the options tree.")},
57 {"write_options", libspud_write_options, METH_VARARGS,
58- "write options from xml file."},
59+ PyDoc_STR("Write options tree out to the xml file specified by name.")},
60 {"delete_option", libspud_delete_option, METH_VARARGS,
61- "delete option from xml file."},
62+ PyDoc_STR("Delete options at the specified key.")},
63 {"set_option_attribute", libspud_set_option_attribute, METH_VARARGS,
64- "set option attribute from xml file."},
65+ PyDoc_STR("As set_option, but additionally attempts to mark the option at the \
66+ specified key as an attribute. Set_option_attribute accepts only string data for val.")},
67 {"add_option", libspud_add_option, METH_VARARGS,
68- "add option from xml file."},
69+ PyDoc_STR("Creates a new option at the supplied key.")},
70 {NULL, NULL, 0, NULL},
71 /* Sentinel */
72 };

Subscribers

People subscribed via source and target branches