Skip to content

Commit c8e6157

Browse files
committed
[fileio] Add docstrings
1 parent f45e9bc commit c8e6157

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

odml/fileio.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,38 @@
44

55

66
def load(filename, backend="xml"):
7+
"""
8+
Load an odML document from file.
9+
:param filename: Path and filename from where the odML document
10+
is to be loaded and parsed.
11+
:param backend: File format of the file containing the odML document.
12+
The default format is XML.
13+
:return: The parsed odML document.
14+
"""
715
reader = ODMLReader(backend)
816
return reader.from_file(filename)
917

1018

1119
def save(obj, filename, backend="xml"):
20+
"""
21+
Save an open odML document to file of a specified format.
22+
:param obj: odML document do be saved.
23+
:param filename: Filename and path where the odML document
24+
should be saved.
25+
:param backend: Format in which the odML document is to be saved.
26+
The default format is XML.
27+
"""
1228
writer = ODMLWriter(backend)
1329
return writer.write_file(obj, filename)
1430

1531

1632
def display(obj, backend="xml"):
33+
"""
34+
Print an open odML document to the command line, formatted in the
35+
specified format.
36+
:param obj: odML document to be displayed.
37+
:param backend: Format in which the odML document is to be displayed.
38+
The default format is XML.
39+
"""
1740
writer = ODMLWriter(backend)
1841
print(writer.to_string(obj))

0 commit comments

Comments
 (0)