Commit 087cea5a authored by Kipp Cannon's avatar Kipp Cannon

update docstrings for Python 3

- gets doctests to pass with Python 3 (breaks Python 2)
parent 768743dc
......@@ -183,7 +183,7 @@ class Array(ligolw.Array):
<Array Type="int_8s" Name="test:array">
<Dim Name="dim1">3</Dim>
<Dim Name="dim0">5</Dim>
<Stream Delimiter=" " Type="Local">
<Stream Type="Local" Delimiter=" ">
0 1 2 3 4
0 1 2 3 4
0 1 2 3 4
......@@ -194,7 +194,7 @@ class Array(ligolw.Array):
>>> elem.write(sys.stdout) # doctest: +NORMALIZE_WHITESPACE
<Array Type="int_8s" Name="test:array">
<Dim Name="dim0">15</Dim>
<Stream Delimiter=" " Type="Local">
<Stream Type="Local" Delimiter=" ">
0 0 0 1 1 1 2 2 2 3 3 3 4 4 4
</Stream>
</Array>
......@@ -207,7 +207,7 @@ class Array(ligolw.Array):
<Dim>2</Dim>
<Dim>3</Dim>
<Dim Name="dim0">4</Dim>
<Stream Delimiter=" " Type="Local">
<Stream Type="Local" Delimiter=" ">
0 1 2 3
0 1 2 3
0 1 2 3
......@@ -317,7 +317,7 @@ class Array(ligolw.Array):
<Array Type="real_8" Name="test:array">
<Dim>3</Dim>
<Dim>4</Dim>
<Stream Delimiter=" " Type="Local">
<Stream Type="Local" Delimiter=" ">
0 3 6 9
1 4 7 10
2 5 8 11
......
......@@ -116,11 +116,11 @@ def New(cls, columns = None, **kwargs):
>>> tbl = New(ProcessTable, [u"process_id", u"start_time", u"end_time", u"comment"])
>>> tbl.write(sys.stdout) # doctest: +NORMALIZE_WHITESPACE
<Table Name="process:table">
<Column Type="int_8s" Name="process_id"/>
<Column Type="int_4s" Name="start_time"/>
<Column Type="int_4s" Name="end_time"/>
<Column Type="lstring" Name="comment"/>
<Stream Delimiter="," Type="Local" Name="process:table">
<Column Name="process_id" Type="int_8s"/>
<Column Name="start_time" Type="int_4s"/>
<Column Name="end_time" Type="int_4s"/>
<Column Name="comment" Type="lstring"/>
<Stream Name="process:table" Delimiter="," Type="Local">
</Stream>
</Table>
"""
......
......@@ -182,13 +182,13 @@ class Param(ligolw.Param):
>>> import sys
>>> Param.from_pyvalue(u"float", 3.0).write(sys.stdout)
<Param Type="real_8" Name="float:param">3</Param>
<Param Name="float:param" Type="real_8">3</Param>
>>> Param.from_pyvalue(u"string", u"test").write(sys.stdout)
<Param Type="lstring" Name="string:param">test</Param>
<Param Name="string:param" Type="lstring">test</Param>
>>> Param.from_pyvalue(u"shortstring", u"").write(sys.stdout)
<Param Type="lstring" Name="shortstring:param"> </Param>
<Param Name="shortstring:param" Type="lstring"> </Param>
>>> Param.from_pyvalue(u"none", None).write(sys.stdout)
<Param Type="None" Name="none:param"></Param>
<Param Name="none:param" Type="None"></Param>
"""
if value is not None:
return cls.build(name, ligolwtypes.FromPyType[type(value)], value, **kwargs)
......
......@@ -165,7 +165,7 @@ class Column(ligolw.Column):
array([ 8., 10., 12.])
>>> tbl.write(sys.stdout) # doctest: +NORMALIZE_WHITESPACE
<Table Name="test">
<Column Type="real_8" Name="test:snr"/>
<Column Name="test:snr" Type="real_8"/>
<Stream Name="test">
8,
10,
......@@ -181,7 +181,7 @@ class Column(ligolw.Column):
>>> col[2] = 9.
>>> tbl.write(sys.stdout) # doctest: +NORMALIZE_WHITESPACE
<Table Name="test">
<Column Type="real_8" Name="test:snr"/>
<Column Name="test:snr" Type="real_8"/>
<Stream Name="test">
9,
9,
......
......@@ -219,7 +219,9 @@ static struct PyMethodDef methods[] = {
">>> rows = tokenizer.RowBuilder(Row, [\"time\", \"snr\"])\n"\
">>> for row in rows.append([10, 6.8, 15, 29.1]):\n"\
"... print(row.snr)\n"\
"..."
"...\n" \
"6.8\n" \
"29.1"
},
{NULL,}
};
......
......@@ -360,39 +360,39 @@ class LigolwSegments(set):
<!DOCTYPE LIGO_LW SYSTEM "http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt">
<LIGO_LW>
<Table Name="segment_definer:table">
<Column Type="int_8s" Name="process:process_id"/>
<Column Type="int_8s" Name="segment_def_id"/>
<Column Type="lstring" Name="ifos"/>
<Column Type="lstring" Name="name"/>
<Column Type="int_4s" Name="version"/>
<Column Type="lstring" Name="comment"/>
<Stream Delimiter="," Type="Local" Name="segment_definer:table">
<Column Name="process:process_id" Type="int_8s"/>
<Column Name="segment_def_id" Type="int_8s"/>
<Column Name="ifos" Type="lstring"/>
<Column Name="name" Type="lstring"/>
<Column Name="version" Type="int_4s"/>
<Column Name="comment" Type="lstring"/>
<Stream Name="segment_definer:table" Delimiter="," Type="Local">
0,0,"H1","test",,,
0,1,"L1","test",,,
</Stream>
</Table>
<Table Name="segment_summary:table">
<Column Type="int_8s" Name="process:process_id"/>
<Column Type="int_8s" Name="segment_sum_id"/>
<Column Type="int_4s" Name="start_time"/>
<Column Type="int_4s" Name="start_time_ns"/>
<Column Type="int_4s" Name="end_time"/>
<Column Type="int_4s" Name="end_time_ns"/>
<Column Type="int_8s" Name="segment_definer:segment_def_id"/>
<Column Type="lstring" Name="comment"/>
<Stream Delimiter="," Type="Local" Name="segment_summary:table">
<Column Name="process:process_id" Type="int_8s"/>
<Column Name="segment_sum_id" Type="int_8s"/>
<Column Name="start_time" Type="int_4s"/>
<Column Name="start_time_ns" Type="int_4s"/>
<Column Name="end_time" Type="int_4s"/>
<Column Name="end_time_ns" Type="int_4s"/>
<Column Name="segment_definer:segment_def_id" Type="int_8s"/>
<Column Name="comment" Type="lstring"/>
<Stream Name="segment_summary:table" Delimiter="," Type="Local">
0,0,4294967295,4294967295,2147483647,4294967295,1,,
</Stream>
</Table>
<Table Name="segment:table">
<Column Type="int_8s" Name="process:process_id"/>
<Column Type="int_8s" Name="segment_id"/>
<Column Type="int_4s" Name="start_time"/>
<Column Type="int_4s" Name="start_time_ns"/>
<Column Type="int_4s" Name="end_time"/>
<Column Type="int_4s" Name="end_time_ns"/>
<Column Type="int_8s" Name="segment_definer:segment_def_id"/>
<Stream Delimiter="," Type="Local" Name="segment:table">
<Column Name="process:process_id" Type="int_8s"/>
<Column Name="segment_id" Type="int_8s"/>
<Column Name="start_time" Type="int_4s"/>
<Column Name="start_time_ns" Type="int_4s"/>
<Column Name="end_time" Type="int_4s"/>
<Column Name="end_time_ns" Type="int_4s"/>
<Column Name="segment_definer:segment_def_id" Type="int_8s"/>
<Stream Name="segment:table" Delimiter="," Type="Local">
0,0,0,0,10,0,0,
0,1,5,0,15,0,1
</Stream>
......@@ -400,7 +400,7 @@ class LigolwSegments(set):
</LIGO_LW>
>>> xmlsegments = LigolwSegments(xmldoc)
>>> xmlsegments.get_by_name("test")
{u'H1': [segment(LIGOTimeGPS(0, 0), LIGOTimeGPS(10, 0))], u'L1': [segment(LIGOTimeGPS(5, 0), LIGOTimeGPS(15, 0))]}
{'H1': [segment(LIGOTimeGPS(0, 0), LIGOTimeGPS(10, 0))], 'L1': [segment(LIGOTimeGPS(5, 0), LIGOTimeGPS(15, 0))]}
>>> xmlsegments.get_by_name("wrong name")
Traceback (most recent call last):
...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment