Skip to content

Commit fa741a9

Browse files
committed
Improve docstrings for data module.
1 parent 3b434d7 commit fa741a9

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

splunklib/data.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ def localname(xname):
5757
return xname if rcurly == -1 else xname[rcurly+1:]
5858

5959
def load(text, match=None):
60-
"""Load the given XML text into a Python structure, optionally loading
61-
only the matching sub-elements if a match string is given. The match
62-
string consists of either a tag name or path."""
60+
"""Load the given XML text into a native Python structure (dict or list),
61+
optionally loading nly the matching sub-elements if a match string is
62+
given. The match string consists of either a tag name or path.
63+
64+
:param `text`: text (XML) to load
65+
:type `text`: string
66+
:param `match`: tag name or path (optional)
67+
:type `match`: string
68+
"""
6369
if text is None: return None
6470
text = text.strip()
6571
if len(text) == 0: return None
@@ -165,8 +171,8 @@ def load_value(element, nametable=None):
165171

166172
# A generic utility that enables "dot" access to dicts
167173
class Record(dict):
168-
"""A generic utiliity class that enables *dot* access to members of
169-
a Python dict.
174+
"""A generic utiliity class that enables dot access to members of
175+
a Python dictionary.
170176
"""
171177
def __call__(self, *args):
172178
if len(args) == 0: return self
@@ -191,7 +197,11 @@ def fromkv(k, v):
191197
return result
192198

193199
def record(value=None):
194-
"""Returns a record instance constructed using the given value."""
200+
"""Returns a record instance constructed using the given value.
201+
202+
:param `value`: initial record value
203+
:type `value`: dict
204+
"""
195205
if value is None: value = {}
196206
return Record(value)
197207

0 commit comments

Comments
 (0)