Changes in trunk/ext/_syckmodule.c [25:20]
- File:
-
- 1 edited
-
trunk/ext/_syckmodule.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ext/_syckmodule.c
r25 r20 43 43 PyDoc_STRVAR(PySyckNode_doc, 44 44 "_syck.Node() -> TypeError\n\n" 45 "_syck.Node is an abstract type. It is thebase type for _syck.Scalar,\n"45 "_syck.Node is an abstract type. It is a base type for _syck.Scalar,\n" 46 46 "_syck.Seq, and _syck.Map. You cannot create an instance of _syck.Node\n" 47 47 "directly. You may use _syck.Node for type checking or subclassing.\n"); … … 220 220 " -> a Scalar node\n\n" 221 221 "_syck.Scalar represents a scalar node in Syck parser and emitter\n" 222 " trees. A scalar node points to a single string value.\n");222 "graphs. A scalar node points to a single string value.\n"); 223 223 224 224 typedef struct { … … 549 549 "Seq(value=[], tag=None, inline=False) -> a Seq node\n\n" 550 550 "_syck.Seq represents a sequence node in Syck parser and emitter\n" 551 " trees. A sequence node points to an ordered set of subnodes.\n");551 "graphs. A sequence node points to an ordered set of subnodes.\n"); 552 552 553 553 typedef struct { … … 718 718 719 719 PyDoc_STRVAR(PySyckMap_doc, 720 "Map(value= {}, tag=None, inline=False) -> a Map node\n\n"720 "Map(value='', tag=None, inline=False) -> a Map node\n\n" 721 721 "_syck.Map represents a mapping node in Syck parser and emitter\n" 722 " trees. A mapping node points to an unordered collections of pairs.\n");722 "graphs. A mapping node points to an unordered collections of pairs.\n"); 723 723 724 724 typedef struct { … … 833 833 PyDoc_STR("the node kind, always 'map', read-only"), &PySyck_MapKind}, 834 834 {"value", (getter)PySyckNode_getvalue, (setter)PySyckMap_setvalue, 835 PyDoc_STR("the node value, a list of pairs or a dictionary"), NULL},835 PyDoc_STR("the node value, a mapping"), NULL}, 836 836 {"tag", (getter)PySyckNode_gettag, (setter)PySyckNode_settag, 837 837 PyDoc_STR("the node tag, a string or None"), NULL}, … … 893 893 " -> a Parser object\n\n" 894 894 "_syck.Parser is a low-lever wrapper of the Syck parser. It parses\n" 895 "a YAML stream and produces a treeof Nodes.\n");895 "a YAML stream and produces a graph of Nodes.\n"); 896 896 897 897 typedef struct { … … 1017 1017 static PyGetSetDef PySyckParser_getsetters[] = { 1018 1018 {"source", (getter)PySyckParser_getsource, NULL, 1019 PyDoc_STR("IO source, a string or afile-like object"), NULL},1019 PyDoc_STR("IO source, a string or file-like object"), NULL}, 1020 1020 {"implicit_typing", (getter)PySyckParser_getimplicit_typing, NULL, 1021 1021 PyDoc_STR("implicit typing of builtin YAML types"), NULL}, … … 1253 1253 1254 1254 if (self->parsing) { 1255 PyErr_SetString(PyExc_RuntimeError, 1256 "do not call Parser.parse while it is already running"); 1255 PyErr_SetString(PyExc_RuntimeError, "do not call Parser.parse while it is already parsing"); 1257 1256 return NULL; 1258 1257 } … … 1293 1292 PyDoc_STRVAR(PySyckParser_parse_doc, 1294 1293 "parse() -> the root Node object\n\n" 1295 "Parses the source and returns the root of the Node tree. Call it\n" 1296 "several times to retrieve all documents from the source. On EOF,\n" 1297 "returns None and sets the 'eof' attribute on.\n"); 1294 "Parses the source and returns the next document. On EOF, returns None\n" 1295 "and sets the 'eof' attribute on.\n"); 1298 1296 1299 1297 static PyMethodDef PySyckParser_methods[] = { … … 1350 1348 1351 1349 PyDoc_STRVAR(PySyckEmitter_doc, 1352 "Emitter(output, headless=False, use_header=False, use_version=False,\n" 1353 " explicit_typing=True, style=None, best_width=80, indent=2)\n" 1354 " -> an Emitter object\n\n" 1355 "_syck.Emitter is a low-lever wrapper of the Syck emitter. It emits\n" 1350 "Emitter(output, headless=False, use_header=True, explicit_typing=True," 1351 " style=None, best_width=80, indent=2) -> an Emitter object\n\n" 1352 "_syck.Emitter is a low-lever wrapper of the Syck emitter. It emit\n" 1356 1353 "a tree of Nodes into a YAML stream.\n"); 1357 1354 … … 1533 1530 PyDoc_STR("headerless document flag"), NULL}, 1534 1531 {"use_header", (getter)PySyckEmitter_getuse_header, NULL, 1535 PyDoc_STR("force header flag"), NULL},1532 PyDoc_STR("force header"), NULL}, 1536 1533 {"use_version", (getter)PySyckEmitter_getuse_version, NULL, 1537 PyDoc_STR("force version flag"), NULL},1534 PyDoc_STR("force version"), NULL}, 1538 1535 {"explicit_typing", (getter)PySyckEmitter_getexplicit_typing, NULL, 1539 1536 PyDoc_STR("explicit typing for all collections"), NULL}, … … 1755 1752 Py_INCREF(output); 1756 1753 self->output = output; 1754 1755 /* 1756 self->emitter = syck_new_emitter(); 1757 self->emitter->bonus = self; 1758 self->emitter->headless = self->headless; 1759 self->emitter->use_header = use_header; 1760 self->emitter->use_version = use_version; 1761 self->emitter->explicit_typing = explicit_typing; 1762 self->emitter->style = self->style; 1763 self->emitter->best_width = self->best_width; 1764 self->emitter->indent = self->indent; 1765 1766 syck_emitter_handler(self->emitter, PySyckEmitter_node_handler); 1767 syck_output_handler(self->emitter, PySyckEmitter_write_handler); 1768 */ 1757 1769 1758 1770 self->emitting = 0; … … 1962 1974 PyDoc_STRVAR(PySyckEmitter_emit_doc, 1963 1975 "emit(root_node) -> None\n\n" 1964 "Emit sthe Node tree to the output.\n");1976 "Emit the Node tree to the output.\n"); 1965 1977 1966 1978 static PyMethodDef PySyckEmitter_methods[] = { … … 2021 2033 2022 2034 PyDoc_STRVAR(PySyck_doc, 2023 "_syck is a low-level wrapper for the Syck YAML parser and emitter.\n" 2024 "Do not use it directly, use the module 'syck' instead.\n"); 2025 2026 static int 2027 add_slotnames(PyTypeObject *type) 2028 { 2029 PyObject *slotnames; 2030 PyObject *name; 2031 PyGetSetDef *getsetter; 2032 2033 if (!type->tp_getset) return 0; 2034 if (!type->tp_dict) return 0; 2035 2036 slotnames = PyList_New(0); 2037 if (!slotnames) return -1; 2038 2039 for (getsetter = type->tp_getset; getsetter->name; getsetter++) { 2040 if (!getsetter->set) continue; 2041 name = PyString_FromString(getsetter->name); 2042 if (!name) { 2043 Py_DECREF(slotnames); 2044 return -1; 2045 } 2046 if (PyList_Append(slotnames, name) < 0) { 2047 Py_DECREF(name); 2048 Py_DECREF(slotnames); 2049 return -1; 2050 } 2051 Py_DECREF(name); 2052 } 2053 2054 if (PyDict_SetItemString(type->tp_dict, "__slotnames__", slotnames) < 0) { 2055 Py_DECREF(slotnames); 2056 return -1; 2057 } 2058 2059 Py_DECREF(slotnames); 2060 return 0; 2061 } 2035 "low-level wrapper for the Syck YAML parser and emitter"); 2062 2036 2063 2037 PyMODINIT_FUNC … … 2070 2044 if (PyType_Ready(&PySyckScalar_Type) < 0) 2071 2045 return; 2072 if (add_slotnames(&PySyckScalar_Type) < 0)2073 return;2074 2046 if (PyType_Ready(&PySyckSeq_Type) < 0) 2075 2047 return; 2076 if (add_slotnames(&PySyckSeq_Type) < 0)2077 return;2078 2048 if (PyType_Ready(&PySyckMap_Type) < 0) 2079 return;2080 if (add_slotnames(&PySyckMap_Type) < 0)2081 2049 return; 2082 2050 if (PyType_Ready(&PySyckParser_Type) < 0)
Note: See TracChangeset
for help on using the changeset viewer.
