Skip to content

Commit 5ea87af

Browse files
committed
Fix parameter docstrings
1 parent 8eeb044 commit 5ea87af

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

canalystii/device.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class CanalystDevice(object):
2323
Constructing an instance of this class will cause pyusb to acquire the
2424
relevant USB interface, and retain it until the object is garbage collected.
2525
26-
:param:device:_index if more than one Canalyst-II device is connected, this is
26+
:param device:_index if more than one Canalyst-II device is connected, this is
2727
the index to use in the list.
28-
:param:usb_device: Optional argument to ignore device_index and provide an instance
28+
:param usb_device: Optional argument to ignore device_index and provide an instance
2929
of a pyusb device object directly.
30-
:param:bitrate: If set, both channels are initialized to the specified bitrate and
30+
:param bitrate: If set, both channels are initialized to the specified bitrate and
3131
started automatically. If unset (default) then the "init" method must be called
3232
before using either channel.
33-
:param:timing0: Optional parameter to provide BTR timing directly. Either both or
33+
:param timing0: Optional parameter to provide BTR timing directly. Either both or
3434
neither timing0 and timing1 must be set, and setting these arguments is mutually
3535
exclusive with setting bitrate. If set, both channels are initialized and started
3636
automatically.
@@ -107,7 +107,7 @@ def clear_rx_buffer(self, channel):
107107
Note that this doesn't seem to 100% work in the device firmware, on a busy bus
108108
it's possible to receive a small number of "old" messages even after calling this.
109109
110-
:param:channel: Channel (0 or 1) to clear the RX buffer on.
110+
:param channel: Channel (0 or 1) to clear the RX buffer on.
111111
"""
112112
self.send_command(
113113
channel, protocol.SimpleCommand(protocol.COMMAND_CLEAR_RX_BUFFER)
@@ -122,10 +122,10 @@ def flush_tx_buffer(self, channel, timeout=0):
122122
hardware will attempt bus arbitration multiple times but if it fails then it will still "send" the
123123
message. It also doesn't consider the ACK status of the message.
124124
125-
:param:channel: Channel (0 or 1) to flush the TX buffer on.
126-
:param:timeout: Optional number of seconds to continue polling for empty TX buffer. If 0 (default),
125+
:param channel: Channel (0 or 1) to flush the TX buffer on.
126+
:param timeout: Optional number of seconds to continue polling for empty TX buffer. If 0 (default),
127127
this function will immediately return the current status of the send buffer.
128-
:return: True if flush is successful (no pending messages to send), False if flushing timed out.
128+
:return True if flush is successful (no pending messages to send), False if flushing timed out.
129129
"""
130130
deadline = None
131131
while deadline is None or time.time() < deadline:
@@ -144,10 +144,10 @@ def flush_tx_buffer(self, channel, timeout=0):
144144
def send_command(self, channel, command_packet, response_class=None):
145145
"""Low-level function to send a command packet to the channel and optionally wait for a response.
146146
147-
:param:channel: Channel (0 or 1) to flush the TX buffer on.
148-
:param:command_packet: Data to send to the channel. Usually this will be a ctypes Structure, but can be
147+
:param channel: Channel (0 or 1) to flush the TX buffer on.
148+
:param command_packet: Data to send to the channel. Usually this will be a ctypes Structure, but can be
149149
anything that supports a bytes buffer interface.
150-
:param:response_class: If None (default) then this function doesn't expect to read anything back from the
150+
:param response_class: If None (default) then this function doesn't expect to read anything back from the
151151
device. If not None, should be a ctypes class - 64 bytes will be read into a buffer and returned as an
152152
object of this type.
153153
"""
@@ -165,14 +165,14 @@ def init(self, channel, bitrate=None, timing0=None, timing1=None, start=True):
165165
"""Initialize channel to a particular baud rate. This can be called more than once to change
166166
the channel bit rate.
167167
168-
:param:channel: Channel (0 or 1) to initialize.
169-
:param:bitrate: Bitrate to set for the channel. Either this argument of both
168+
:param channel: Channel (0 or 1) to initialize.
169+
:param bitrate: Bitrate to set for the channel. Either this argument of both
170170
timing0 and timing1 must be set.
171-
:param:timing0: Raw BTR0 timing value to determine the bitrate. If this argument is set,
171+
:param timing0: Raw BTR0 timing value to determine the bitrate. If this argument is set,
172172
timing1 must also be set and bitrate argument must be unset.
173-
:param:timing1: Raw BTR1 timing value to determine the bitrate. If this argument is set,
173+
:param timing1: Raw BTR1 timing value to determine the bitrate. If this argument is set,
174174
timing0 must also be set and bitrate argument must be unset.
175-
:param:start: If True (default) then the channel is started after being initialized.
175+
:param start: If True (default) then the channel is started after being initialized.
176176
If set to False, the channel will not be started until the start function is called
177177
manually.
178178
"""
@@ -212,7 +212,7 @@ def init(self, channel, bitrate=None, timing0=None, timing1=None, start=True):
212212
def stop(self, channel):
213213
"""Stop this channel. CAN messages won't be sent or received on this channel until it is started again.
214214
215-
:param:channel: Channel (0 or 1) to stop. The channel must already be initialized.
215+
:param channel: Channel (0 or 1) to stop. The channel must already be initialized.
216216
"""
217217
if not self._initialized[channel]:
218218
raise RuntimeError(f"Channel {channel} is not initialized.")
@@ -223,7 +223,7 @@ def start(self, channel):
223223
"""Start this channel. This allows CAN messages to be sent and received. The hardware
224224
will buffer received messages until the receive() function is called.
225225
226-
:param:channel: Channel (0 or 1) to start. The channel must already be initialized.
226+
:param channel: Channel (0 or 1) to start. The channel must already be initialized.
227227
"""
228228
if not self._initialized[channel]:
229229
raise RuntimeError(f"Channel {channel} is not initialized.")
@@ -233,8 +233,8 @@ def start(self, channel):
233233
def receive(self, channel):
234234
"""Poll the hardware for received CAN messages and return them all as a list.
235235
236-
:param:channel: Channel (0 or 1) to poll. The channel must be started.
237-
:return: List of Message objects representing received CAN messages, in order.
236+
:param channel: Channel (0 or 1) to poll. The channel must be started.
237+
:return List of Message objects representing received CAN messages, in order.
238238
"""
239239
if not self._initialized[channel]:
240240
raise RuntimeError(f"Channel {channel} is not initialized.")
@@ -278,16 +278,16 @@ def receive(self, channel):
278278
def send(self, channel, messages, flush_timeout=None):
279279
"""Send one or more CAN messages to the channel.
280280
281-
:param:channel: Channel (0 or 1) to send to. The channel must be started.
282-
:param:messages: Either a single Message object, or a list of
281+
:param channel: Channel (0 or 1) to send to. The channel must be started.
282+
:param messages: Either a single Message object, or a list of
283283
Message objects to send.
284-
:param:flush_timeout: If set, don't return until TX buffer is flushed or timeout is
284+
:param flush_timeout: If set, don't return until TX buffer is flushed or timeout is
285285
reached.
286286
Setting this parameter causes the software to poll the device continuously
287287
for the buffer state. If None (default) then the function returns immediately,
288288
when some CAN messages may still be waiting to sent due to CAN bus arbitration.
289289
See flush_tx_buffer() function for details.
290-
:return: None if flush_timeout is None (default). Otherwise True if all messages sent
290+
:return None if flush_timeout is None (default). Otherwise True if all messages sent
291291
(or failed), False if timeout reached.
292292
"""
293293
if not self._initialized[channel]:
@@ -312,7 +312,7 @@ def send(self, channel, messages, flush_timeout=None):
312312
def get_can_status(self, channel):
313313
"""Return some internal CAN-related values. The actual meaning of these is currently unknown.
314314
315-
:return: Instance of the CANStatusResponse structure. Note the field names may not be accurate.
315+
:return Instance of the CANStatusResponse structure. Note the field names may not be accurate.
316316
"""
317317
if not self._initialized[channel]:
318318
logger.warning(

0 commit comments

Comments
 (0)