Skip to content

Commit 9d119c0

Browse files
committed
Revert "Fix Sphinx warnings (hardbyte#1405)"
This reverts commit 451ce48.
1 parent 89f9f1f commit 9d119c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+136
-267
lines changed

.github/workflows/build.yml

-22
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,3 @@ jobs:
8787
- name: Code Format Check with Black
8888
run: |
8989
black --check --verbose .
90-
91-
docs:
92-
runs-on: ubuntu-latest
93-
steps:
94-
- uses: actions/checkout@v2
95-
- name: Set up Python
96-
uses: actions/setup-python@v3
97-
with:
98-
python-version: "3.10"
99-
- name: Install dependencies
100-
run: |
101-
python -m pip install --upgrade pip
102-
pip install -e .[canalystii,gs_usb]
103-
pip install -r doc/doc-requirements.txt
104-
- name: Build documentation
105-
run: |
106-
python -m sphinx -an doc build
107-
- uses: actions/upload-artifact@v3
108-
with:
109-
name: sphinx-out
110-
path: ./build/
111-
retention-days: 5

.readthedocs.yml

-31
This file was deleted.

can/broadcastmanager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CyclicTask(abc.ABC):
3939
def stop(self) -> None:
4040
"""Cancel this periodic task.
4141
42-
:raises ~can.exceptions.CanError:
42+
:raises can.CanError:
4343
If stop is called on an already stopped task.
4444
"""
4545

can/bus.py

+12-19
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ def __init__(
6666
Any backend dependent configurations are passed in this dictionary
6767
6868
:raises ValueError: If parameters are out of range
69-
:raises ~can.exceptions.CanInterfaceNotImplementedError:
70-
If the driver cannot be accessed
71-
:raises ~can.exceptions.CanInitializationError:
72-
If the bus cannot be initialized
69+
:raises can.CanInterfaceNotImplementedError: If the driver cannot be accessed
70+
:raises can.CanInitializationError: If the bus cannot be initialized
7371
"""
7472
self._periodic_tasks: List[_SelfRemovingCyclicTask] = []
7573
self.set_filters(can_filters)
@@ -83,11 +81,9 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]:
8381
:param timeout:
8482
seconds to wait for a message or None to wait indefinitely
8583
86-
:return:
87-
:obj:`None` on timeout or a :class:`~can.Message` object.
84+
:return: ``None`` on timeout or a :class:`Message` object.
8885
89-
:raises ~can.exceptions.CanOperationError:
90-
If an error occurred while reading
86+
:raises can.CanOperationError: If an error occurred while reading
9187
"""
9288
start = time()
9389
time_left = timeout
@@ -152,8 +148,7 @@ def _recv_internal(
152148
2. a bool that is True if message filtering has already
153149
been done and else False
154150
155-
:raises ~can.exceptions.CanOperationError:
156-
If an error occurred while reading
151+
:raises can.CanOperationError: If an error occurred while reading
157152
:raises NotImplementedError:
158153
if the bus provides it's own :meth:`~can.BusABC.recv`
159154
implementation (legacy implementation)
@@ -176,8 +171,7 @@ def send(self, msg: Message, timeout: Optional[float] = None) -> None:
176171
Might not be supported by all interfaces.
177172
None blocks indefinitely.
178173
179-
:raises ~can.exceptions.CanOperationError:
180-
If an error occurred while sending
174+
:raises can.CanOperationError: If an error occurred while sending
181175
"""
182176
raise NotImplementedError("Trying to write to a readonly bus?")
183177

@@ -195,8 +189,8 @@ def send_periodic(
195189
- the (optional) duration expires
196190
- the Bus instance goes out of scope
197191
- the Bus instance is shutdown
198-
- :meth:`stop_all_periodic_tasks` is called
199-
- the task's :meth:`~can.broadcastmanager.CyclicTask.stop` method is called.
192+
- :meth:`BusABC.stop_all_periodic_tasks()` is called
193+
- the task's :meth:`CyclicTask.stop()` method is called.
200194
201195
:param msgs:
202196
Message(s) to transmit
@@ -210,8 +204,7 @@ def send_periodic(
210204
Disable to instead manage tasks manually.
211205
:return:
212206
A started task instance. Note the task can be stopped (and depending on
213-
the backend modified) by calling the task's
214-
:meth:`~can.broadcastmanager.CyclicTask.stop` method.
207+
the backend modified) by calling the task's :meth:`stop` method.
215208
216209
.. note::
217210
@@ -281,8 +274,8 @@ def _send_periodic_internal(
281274
no duration is provided, the task will continue indefinitely.
282275
:return:
283276
A started task instance. Note the task can be stopped (and
284-
depending on the backend modified) by calling the
285-
:meth:`~can.broadcastmanager.CyclicTask.stop` method.
277+
depending on the backend modified) by calling the :meth:`stop`
278+
method.
286279
"""
287280
if not hasattr(self, "_lock_send_periodic"):
288281
# Create a send lock for this bus, but not for buses which override this method
@@ -295,7 +288,7 @@ def _send_periodic_internal(
295288
return task
296289

297290
def stop_all_periodic_tasks(self, remove_tasks: bool = True) -> None:
298-
"""Stop sending any messages that were started using :meth:`send_periodic`.
291+
"""Stop sending any messages that were started using **bus.send_periodic**.
299292
300293
.. note::
301294
The result is undefined if a single task throws an exception while being stopped.

can/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CanInitializationError(CanError):
7474
"""Indicates an error the occurred while initializing a :class:`can.BusABC`.
7575
7676
If initialization fails due to a driver or platform missing/being unsupported,
77-
a :exc:`~can.exceptions.CanInterfaceNotImplementedError` is raised instead.
77+
a :class:`can.CanInterfaceNotImplementedError` is raised instead.
7878
If initialization fails due to a value being out of range, a :class:`ValueError`
7979
is raised.
8080

can/interfaces/ixxat/canlib_vcinpl.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ class IXXATBus(BusABC):
372372
.. warning::
373373
374374
This interface does implement efficient filtering of messages, but
375-
the filters have to be set in ``__init__`` using the ``can_filters`` parameter.
376-
Using :meth:`~can.BusABC.set_filters` does not work.
375+
the filters have to be set in :meth:`~can.interfaces.ixxat.IXXATBus.__init__`
376+
using the ``can_filters`` parameter. Using :meth:`~can.interfaces.ixxat.IXXATBus.set_filters`
377+
does not work.
378+
377379
"""
378380

379381
CHANNEL_BITRATES = {

can/interfaces/ixxat/canlib_vcinpl2.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,9 @@ class IXXATBus(BusABC):
411411
.. warning::
412412
413413
This interface does implement efficient filtering of messages, but
414-
the filters have to be set in ``__init__`` using the ``can_filters`` parameter.
415-
Using :meth:`~can.BusABC.set_filters` does not work.
414+
the filters have to be set in :meth:`~can.interfaces.ixxat.IXXATBus.__init__`
415+
using the ``can_filters`` parameter. Using :meth:`~can.interfaces.ixxat.IXXATBus.set_filters`
416+
does not work.
416417
417418
"""
418419

can/interfaces/kvaser/canlib.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ def shutdown(self):
657657
canBusOff(self._write_handle)
658658
canClose(self._write_handle)
659659

660-
def get_stats(self) -> structures.BusStatistics:
660+
def get_stats(self):
661661
"""Retrieves the bus statistics.
662662
663663
Use like so:
@@ -667,6 +667,7 @@ def get_stats(self) -> structures.BusStatistics:
667667
std_data: 0, std_remote: 0, ext_data: 0, ext_remote: 0, err_frame: 0, bus_load: 0.0%, overruns: 0
668668
669669
:returns: bus statistics.
670+
:rtype: can.interfaces.kvaser.structures.BusStatistics
670671
"""
671672
canRequestBusStatistics(self._write_handle)
672673
stats = structures.BusStatistics()

can/interfaces/kvaser/structures.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88

99
class BusStatistics(ctypes.Structure):
10-
"""This structure is used with the method
11-
:meth:`~can.interfaces.kvaser.canlib.KvaserBus.get_stats`.
10+
"""
11+
This structure is used with the method :meth:`KvaserBus.get_stats`.
12+
13+
.. seealso:: :meth:`KvaserBus.get_stats`
14+
1215
"""
1316

1417
_fields_ = [

can/interfaces/nican.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ class NicanBus(BusABC):
179179
.. warning::
180180
181181
This interface does implement efficient filtering of messages, but
182-
the filters have to be set in ``__init__`` using the ``can_filters`` parameter.
183-
Using :meth:`~can.BusABC.set_filters` does not work.
182+
the filters have to be set in :meth:`~can.interfaces.nican.NicanBus.__init__`
183+
using the ``can_filters`` parameter. Using :meth:`~can.interfaces.nican.NicanBus.set_filters`
184+
does not work.
185+
184186
"""
185187

186188
def __init__(
@@ -206,9 +208,9 @@ def __init__(
206208
``is_error_frame`` set to True and ``arbitration_id`` will identify
207209
the error (default True)
208210
209-
:raise ~can.exceptions.CanInterfaceNotImplementedError:
211+
:raise can.CanInterfaceNotImplementedError:
210212
If the current operating system is not supported or the driver could not be loaded.
211-
:raise ~can.interfaces.nican.NicanInitializationError:
213+
:raise can.interfaces.nican.NicanInitializationError:
212214
If the bus could not be set up.
213215
"""
214216
if nican is None:

can/interfaces/pcan/pcan.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def __init__(
113113
"""A PCAN USB interface to CAN.
114114
115115
On top of the usual :class:`~can.Bus` methods provided,
116-
the PCAN interface includes the :meth:`flash`
117-
and :meth:`status` methods.
116+
the PCAN interface includes the :meth:`~can.interface.pcan.PcanBus.flash`
117+
and :meth:`~can.interface.pcan.PcanBus.status` methods.
118118
119119
:param str channel:
120120
The can interface name. An example would be 'PCAN_USBBUS1'.

can/interfaces/robotell.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import io
66
import time
77
import logging
8-
from typing import Optional
98

109
from can import BusABC, Message
11-
from ..exceptions import CanInterfaceNotImplementedError, CanOperationError
10+
from ..exceptions import CanInterfaceNotImplementedError
1211

1312
logger = logging.getLogger(__name__)
1413

@@ -378,11 +377,12 @@ def fileno(self):
378377
except Exception as exception:
379378
raise CanOperationError("Cannot fetch fileno") from exception
380379

381-
def get_serial_number(self, timeout: Optional[int]) -> Optional[str]:
380+
def get_serial_number(self, timeout):
382381
"""Get serial number of the slcan interface.
383-
382+
:type timeout: int or None
384383
:param timeout:
385384
seconds to wait for serial number or None to wait indefinitely
385+
:rtype str or None
386386
:return:
387387
None on timeout or a str object.
388388
"""

can/interfaces/serial/serial_can.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ def __init__(
7474
:param rtscts:
7575
turn hardware handshake (RTS/CTS) on and off
7676
77-
:raises ~can.exceptions.CanInitializationError:
78-
If the given parameters are invalid.
79-
:raises ~can.exceptions.CanInterfaceNotImplementedError:
80-
If the serial module is not installed.
77+
:raises can.CanInitializationError: If the given parameters are invalid.
78+
:raises can.CanInterfaceNotImplementedError: If the serial module is not installed.
8179
"""
8280

8381
if not serial:
@@ -165,10 +163,10 @@ def _recv_internal(
165163
This parameter will be ignored. The timeout value of the channel is used.
166164
167165
:returns:
168-
Received message and :obj:`False` (because no filtering as taken place).
166+
Received message and `False` (because no filtering as taken place).
169167
170168
.. warning::
171-
Flags like ``is_extended_id``, ``is_remote_frame`` and ``is_error_frame``
169+
Flags like is_extended_id, is_remote_frame and is_error_frame
172170
will not be set over this function, the flags in the return
173171
message are the default values.
174172
"""

can/interfaces/slcan.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ def get_serial_number(self, timeout: Optional[float]) -> Optional[str]:
323323
"""Get serial number of the slcan interface.
324324
325325
:param timeout:
326-
seconds to wait for serial number or :obj:`None` to wait indefinitely
326+
seconds to wait for serial number or ``None`` to wait indefinitely
327327
328328
:return:
329-
:obj:`None` on timeout or a :class:`str` object.
329+
``None`` on timeout or a :class:`~builtin.str` object.
330330
"""
331331
cmd = "N"
332332
self._write(cmd)

can/interfaces/socketcan/socketcan.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def stop(self) -> None:
402402
"""Stop a task by sending TX_DELETE message to Linux kernel.
403403
404404
This will delete the entry for the transmission of the CAN-message
405-
with the specified ``task_id`` identifier. The message length
405+
with the specified :attr:`~task_id` identifier. The message length
406406
for the command TX_DELETE is {[bcm_msg_head]} (only the header).
407407
"""
408408
log.debug("Stopping periodic task")
@@ -444,7 +444,7 @@ def start(self) -> None:
444444
message to Linux kernel prior to scheduling.
445445
446446
:raises ValueError:
447-
If the task referenced by ``task_id`` is already running.
447+
If the task referenced by :attr:`~task_id` is already running.
448448
"""
449449
self._tx_setup(self.messages)
450450

@@ -617,10 +617,9 @@ def __init__(
617617
618618
If setting some socket options fails, an error will be printed but no exception will be thrown.
619619
This includes enabling:
620-
621-
- that own messages should be received,
622-
- CAN-FD frames and
623-
- error frames.
620+
- that own messages should be received,
621+
- CAN-FD frames and
622+
- error frames.
624623
625624
:param channel:
626625
The can interface name with which to create this bus.
@@ -740,7 +739,7 @@ def send(self, msg: Message, timeout: Optional[float] = None) -> None:
740739
Wait up to this many seconds for the transmit queue to be ready.
741740
If not given, the call may fail immediately.
742741
743-
:raises ~can.exceptions.CanError:
742+
:raises can.CanError:
744743
if the message could not be written.
745744
"""
746745
log.debug("We've been asked to write a message to the bus")

can/interfaces/systec/ucanbus.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def __init__(self, channel, can_filters=None, **kwargs):
8888
:raises ValueError:
8989
If invalid input parameter were passed.
9090
91-
:raises ~can.exceptions.CanInterfaceNotImplementedError:
91+
:raises can.CanInterfaceNotImplementedError:
9292
If the platform is not supported.
9393
94-
:raises ~can.exceptions.CanInitializationError:
94+
:raises can.CanInitializationError:
9595
If hardware or CAN interface initialization failed.
9696
"""
9797
try:
@@ -181,7 +181,7 @@ def send(self, msg, timeout=None):
181181
:param float timeout:
182182
Transmit timeout in seconds (value 0 switches off the "auto delete")
183183
184-
:raises ~can.exceptions.CanOperationError:
184+
:raises can.CanOperationError:
185185
If the message could not be sent.
186186
"""
187187
try:
@@ -243,7 +243,7 @@ def flush_tx_buffer(self):
243243
"""
244244
Flushes the transmit buffer.
245245
246-
:raises ~can.exceptions.CanError:
246+
:raises can.CanError:
247247
If flushing of the transmit buffer failed.
248248
"""
249249
log.info("Flushing transmit buffer")

0 commit comments

Comments
 (0)