Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
07e0510
Raise error when blf GzipFile is requested
j-c-cook Aug 27, 2022
4eaa7df
Revert "Raise error when blf GzipFile is requested"
j-c-cook Oct 31, 2022
df2b3a5
Check the real suffix in base io logger
j-c-cook Oct 31, 2022
33bb24a
Add error handling for gzip files
j-c-cook Oct 31, 2022
7bf36ae
Format with black
j-c-cook Oct 31, 2022
f5b1e0b
Fix message writer key reference
j-c-cook Oct 31, 2022
751127b
Merge branch 'develop' into issue1378_handleblfgz
j-c-cook Oct 31, 2022
dfefc2f
Add in gzip option for canutils and txt
j-c-cook Nov 5, 2022
6806594
Fix test errors
j-c-cook Nov 5, 2022
5e260ad
Revert "Fix test errors"
j-c-cook Nov 11, 2022
5d418ec
Revert "Add in gzip option for canutils and txt"
j-c-cook Nov 11, 2022
73a36db
Revert "Fix message writer key reference"
j-c-cook Nov 11, 2022
1a70733
Revert "Format with black"
j-c-cook Nov 11, 2022
2badc18
Revert "Add error handling for gzip files"
j-c-cook Nov 11, 2022
6ec7151
Revert "Check the real suffix in base io logger"
j-c-cook Nov 11, 2022
04c8a4d
Revert "Revert "Raise error when blf GzipFile is requested""
j-c-cook Nov 11, 2022
1d8aa14
Revert "check whether CAN settings were correctly applied (#1426)"
j-c-cook Nov 11, 2022
6fdf0b7
Revert "Fix #1424 (#1425)"
j-c-cook Nov 11, 2022
9e30cd8
Revert "Fix #1376 (#1412)"
j-c-cook Nov 11, 2022
58f4f27
Revert "fix typo"
j-c-cook Nov 11, 2022
f9c7612
Revert "Add python 3.11 to supported versions (#1423)"
j-c-cook Nov 11, 2022
6cfed6b
Revert "add busParams and use snake case for VectorChannelConfig (#14…
j-c-cook Nov 11, 2022
a8d0fb1
Revert "update docs (#1421)"
j-c-cook Nov 11, 2022
661a39c
Revert "improve vector documentation (#1420)"
j-c-cook Nov 11, 2022
0095c9c
Revert "update github actions (#1409)"
j-c-cook Nov 11, 2022
705da47
Revert "setup.cfg: Use license_files instead of license_file (#1408)"
j-c-cook Nov 11, 2022
89f9f1f
Revert "explicitly set supported file formats (#1406)"
j-c-cook Nov 11, 2022
9d119c0
Revert "Fix Sphinx warnings (#1405)"
j-c-cook Nov 11, 2022
d76b674
Revert "Modify `file_size` help doc string (#1401)"
j-c-cook Nov 11, 2022
149a20c
Revert "Test load_config() (#1396)"
j-c-cook Nov 11, 2022
fc01cf0
Revert "Move windows-curses dependency to an optional extra (#1395)"
j-c-cook Nov 11, 2022
3f1de8d
Revert "Update BufferedReader.get_message docstring (#1397)"
j-c-cook Nov 11, 2022
429bcce
Revert "Pass file mode to compress function (#1384)"
j-c-cook Nov 11, 2022
547e885
Revert "Provide meaningful error message for xlGetApplConfig error (#…
j-c-cook Nov 11, 2022
614f650
Revert "Test on vector virtual bus if XL API is available (#1390)"
j-c-cook Nov 11, 2022
366cd45
Revert "VectorBus init refactoring (#1389)"
j-c-cook Nov 11, 2022
b721741
Revert "extend XL api wrapper (#1387)"
j-c-cook Nov 11, 2022
ceaed9d
Revert "socketcan: Make find_available_interfaces() find slcanX inter…
j-c-cook Nov 11, 2022
f6edc4a
Revert "Fix _default_name for compressed files (#1383)"
j-c-cook Nov 11, 2022
7c0e650
Merge branch 'develop' into issue1378_handleblfgz
j-c-cook Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 13 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
experimental: [false]
python-version: [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"pypy-3.7",
"pypy-3.8",
"pypy-3.9",
]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
include:
# Only test on a single configuration while there are just pre-releases
- os: ubuntu-latest
experimental: true
python-version: "3.11.0-alpha - 3.11.0"
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -38,16 +34,16 @@ jobs:
run: |
tox -e gh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true

static-code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -67,9 +63,6 @@ jobs:
- name: mypy 3.10
run: |
mypy --python-version 3.10 .
- name: mypy 3.11
run: |
mypy --python-version 3.11 .
- name: pylint
run: |
pylint --rcfile=.pylintrc \
Expand All @@ -82,9 +75,9 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -94,38 +87,3 @@ jobs:
- name: Code Format Check with Black
run: |
black --check --verbose .

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[canalystii,gs_usb]
pip install -r doc/doc-requirements.txt
- name: Build documentation
run: |
python -m sphinx -an doc build
- uses: actions/upload-artifact@v3
with:
name: sphinx-out
path: ./build/
retention-days: 5

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build wheel and sdist
run: pipx run build
- name: Check build artifacts
run: pipx run twine check --strict dist/*
6 changes: 3 additions & 3 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -22,7 +22,7 @@ jobs:
run: |
black --verbose .
- name: Commit Formated Code
uses: EndBug/add-and-commit@v9
uses: EndBug/add-and-commit@v7
with:
message: "Format code with black"
# Ref https://git-scm.com/docs/git-add#_examples
Expand Down
31 changes: 0 additions & 31 deletions .readthedocs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion can/broadcastmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CyclicTask(abc.ABC):
def stop(self) -> None:
"""Cancel this periodic task.

:raises ~can.exceptions.CanError:
:raises can.CanError:
If stop is called on an already stopped task.
"""

Expand Down
31 changes: 12 additions & 19 deletions can/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ def __init__(
Any backend dependent configurations are passed in this dictionary

:raises ValueError: If parameters are out of range
:raises ~can.exceptions.CanInterfaceNotImplementedError:
If the driver cannot be accessed
:raises ~can.exceptions.CanInitializationError:
If the bus cannot be initialized
:raises can.CanInterfaceNotImplementedError: If the driver cannot be accessed
:raises can.CanInitializationError: If the bus cannot be initialized
"""
self._periodic_tasks: List[_SelfRemovingCyclicTask] = []
self.set_filters(can_filters)
Expand All @@ -83,11 +81,9 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]:
:param timeout:
seconds to wait for a message or None to wait indefinitely

:return:
:obj:`None` on timeout or a :class:`~can.Message` object.
:return: ``None`` on timeout or a :class:`Message` object.

:raises ~can.exceptions.CanOperationError:
If an error occurred while reading
:raises can.CanOperationError: If an error occurred while reading
"""
start = time()
time_left = timeout
Expand Down Expand Up @@ -152,8 +148,7 @@ def _recv_internal(
2. a bool that is True if message filtering has already
been done and else False

:raises ~can.exceptions.CanOperationError:
If an error occurred while reading
:raises can.CanOperationError: If an error occurred while reading
:raises NotImplementedError:
if the bus provides it's own :meth:`~can.BusABC.recv`
implementation (legacy implementation)
Expand All @@ -176,8 +171,7 @@ def send(self, msg: Message, timeout: Optional[float] = None) -> None:
Might not be supported by all interfaces.
None blocks indefinitely.

:raises ~can.exceptions.CanOperationError:
If an error occurred while sending
:raises can.CanOperationError: If an error occurred while sending
"""
raise NotImplementedError("Trying to write to a readonly bus?")

Expand All @@ -195,8 +189,8 @@ def send_periodic(
- the (optional) duration expires
- the Bus instance goes out of scope
- the Bus instance is shutdown
- :meth:`stop_all_periodic_tasks` is called
- the task's :meth:`~can.broadcastmanager.CyclicTask.stop` method is called.
- :meth:`BusABC.stop_all_periodic_tasks()` is called
- the task's :meth:`CyclicTask.stop()` method is called.

:param msgs:
Message(s) to transmit
Expand All @@ -210,8 +204,7 @@ def send_periodic(
Disable to instead manage tasks manually.
:return:
A started task instance. Note the task can be stopped (and depending on
the backend modified) by calling the task's
:meth:`~can.broadcastmanager.CyclicTask.stop` method.
the backend modified) by calling the task's :meth:`stop` method.

.. note::

Expand Down Expand Up @@ -281,8 +274,8 @@ def _send_periodic_internal(
no duration is provided, the task will continue indefinitely.
:return:
A started task instance. Note the task can be stopped (and
depending on the backend modified) by calling the
:meth:`~can.broadcastmanager.CyclicTask.stop` method.
depending on the backend modified) by calling the :meth:`stop`
method.
"""
if not hasattr(self, "_lock_send_periodic"):
# Create a send lock for this bus, but not for buses which override this method
Expand All @@ -295,7 +288,7 @@ def _send_periodic_internal(
return task

def stop_all_periodic_tasks(self, remove_tasks: bool = True) -> None:
"""Stop sending any messages that were started using :meth:`send_periodic`.
"""Stop sending any messages that were started using **bus.send_periodic**.

.. note::
The result is undefined if a single task throws an exception while being stopped.
Expand Down
2 changes: 1 addition & 1 deletion can/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CanInitializationError(CanError):
"""Indicates an error the occurred while initializing a :class:`can.BusABC`.

If initialization fails due to a driver or platform missing/being unsupported,
a :exc:`~can.exceptions.CanInterfaceNotImplementedError` is raised instead.
a :class:`can.CanInterfaceNotImplementedError` is raised instead.
If initialization fails due to a value being out of range, a :class:`ValueError`
is raised.

Expand Down
51 changes: 22 additions & 29 deletions can/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,37 @@ class Bus(BusABC): # pylint: disable=abstract-method

Instantiates a CAN Bus of the given ``interface``, falls back to reading a
configuration file from default locations.
"""

:param channel:
Channel identification. Expected type is backend dependent.
Set to ``None`` to let it be resolved automatically from the default
:ref:`configuration`.
@staticmethod
def __new__( # type: ignore # pylint: disable=keyword-arg-before-vararg
cls: Any, channel: Optional[Channel] = None, *args: Any, **kwargs: Any
) -> BusABC:
"""
Takes the same arguments as :class:`can.BusABC.__init__`.
Some might have a special meaning, see below.

:param interface:
See :ref:`interface names` for a list of supported interfaces.
Set to ``None`` to let it be resolved automatically from the default
:ref:`configuration`.
:param channel:
Set to ``None`` to let it be resolved automatically from the default
configuration. That might fail, see below.

:param args:
``interface`` specific positional arguments.
Expected type is backend dependent.

:param kwargs:
``interface`` specific keyword arguments.
:param dict kwargs:
Should contain an ``interface`` key with a valid interface name. If not,
it is completed using :meth:`can.util.load_config`.

:raises ~can.exceptions.CanInterfaceNotImplementedError:
if the ``interface`` isn't recognized or cannot be loaded
:raises: can.CanInterfaceNotImplementedError
if the ``interface`` isn't recognized or cannot be loaded

:raises ~can.exceptions.CanInitializationError:
if the bus cannot be instantiated
:raises: can.CanInitializationError
if the bus cannot be instantiated

:raises ValueError:
if the ``channel`` could not be determined
"""
:raises: ValueError
if the ``channel`` could not be determined
"""

@staticmethod
def __new__( # type: ignore # pylint: disable=keyword-arg-before-vararg
cls: Any,
channel: Optional[Channel] = None,
interface: Optional[str] = None,
*args: Any,
**kwargs: Any,
) -> BusABC:
# figure out the rest of the configuration; this might raise an error
if interface is not None:
kwargs["interface"] = interface
if channel is not None:
kwargs["channel"] = channel
if "context" in kwargs:
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/cantact.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
Bitrate in bits/s
:param bool monitor:
If true, operate in listen-only monitoring mode
:param BitTiming bit_timing:
:param BitTiming bit_timing
Optional BitTiming to use for custom bit timing setting. Overrides bitrate if not None.
"""

Expand Down
6 changes: 4 additions & 2 deletions can/interfaces/ixxat/canlib_vcinpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,10 @@ class IXXATBus(BusABC):
.. warning::

This interface does implement efficient filtering of messages, but
the filters have to be set in ``__init__`` using the ``can_filters`` parameter.
Using :meth:`~can.BusABC.set_filters` does not work.
the filters have to be set in :meth:`~can.interfaces.ixxat.IXXATBus.__init__`
using the ``can_filters`` parameter. Using :meth:`~can.interfaces.ixxat.IXXATBus.set_filters`
does not work.

"""

CHANNEL_BITRATES = {
Expand Down
5 changes: 3 additions & 2 deletions can/interfaces/ixxat/canlib_vcinpl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ class IXXATBus(BusABC):
.. warning::

This interface does implement efficient filtering of messages, but
the filters have to be set in ``__init__`` using the ``can_filters`` parameter.
Using :meth:`~can.BusABC.set_filters` does not work.
the filters have to be set in :meth:`~can.interfaces.ixxat.IXXATBus.__init__`
using the ``can_filters`` parameter. Using :meth:`~can.interfaces.ixxat.IXXATBus.set_filters`
does not work.

"""

Expand Down
3 changes: 2 additions & 1 deletion can/interfaces/kvaser/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def shutdown(self):
canBusOff(self._write_handle)
canClose(self._write_handle)

def get_stats(self) -> structures.BusStatistics:
def get_stats(self):
"""Retrieves the bus statistics.

Use like so:
Expand All @@ -667,6 +667,7 @@ def get_stats(self) -> structures.BusStatistics:
std_data: 0, std_remote: 0, ext_data: 0, ext_remote: 0, err_frame: 0, bus_load: 0.0%, overruns: 0

:returns: bus statistics.
:rtype: can.interfaces.kvaser.structures.BusStatistics
"""
canRequestBusStatistics(self._write_handle)
stats = structures.BusStatistics()
Expand Down
Loading