Skip to content

Commit def5a04

Browse files
committed
add docs
1 parent a9a961c commit def5a04

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

can/io/canutils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ class CanutilsLogWriter(BaseIOHandler, Listener):
9494
"""
9595

9696
def __init__(self, filename, channel="vcan0", append=False):
97+
"""
98+
:param channel: a default channel to use when the message does not
99+
have a channel set
100+
:param bool append: if set to `True` messages are appended to
101+
the file, else the file is truncated
102+
"""
97103
mode = 'a' if append else 'w'
98104
super(CanutilsLogWriter, self).__init__(open_file=True, filename=filename, mode=mode)
99105

can/io/csv.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class CSVWriter(BaseIOHandler, Listener):
2424
"""Writes a comma separated text file with a line for
25-
each message.
25+
each message. Includes a header line.
2626
2727
The columns are as follows:
2828
@@ -42,6 +42,12 @@ class CSVWriter(BaseIOHandler, Listener):
4242
"""
4343

4444
def __init__(self, filename, append=False):
45+
"""
46+
:param bool append: if set to `True` messages are appended to
47+
the file and no header line is written, else
48+
the file is truncated and starts with a newly
49+
written header line
50+
"""
4551
mode = 'a' if append else 'w'
4652
super(CSVWriter, self).__init__(open_file=True, filename=filename, mode=mode)
4753

@@ -66,7 +72,8 @@ def on_message_received(self, msg):
6672
class CSVReader(BaseIOHandler):
6773
"""Iterator over CAN messages from a .csv file that was
6874
generated by :class:`~can.CSVWriter` or that uses the same
69-
format as described there.
75+
format as described there. Assumes that there is a header
76+
and thus skips the first line.
7077
7178
Any line seperator is accepted.
7279
"""

can/io/sqlite.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class SqliteReader(BaseIOHandler):
3939
"""
4040

4141
def __init__(self, filename, table_name="messages"):
42+
"""
43+
:param str table_name: the name of the table to look for the messages
44+
"""
4245
super(SqliteReader, self).__init__(open_file=False)
4346
self.conn = sqlite3.connect(filename)
4447
self.cursor = self.conn.cursor()
@@ -101,6 +104,9 @@ class SqliteWriter(BaseIOHandler, BufferedReader):
101104
"""Maximum number of seconds to wait between writes to the database"""
102105

103106
def __init__(self, filename, table_name="messages"):
107+
"""
108+
:param str table_name: the name of the table to store messages in
109+
"""
104110
super(SqliteWriter, self).__init__(open_file=False)
105111
self.table_name = table_name
106112
self.filename = filename

0 commit comments

Comments
 (0)