Skip to content

Commit c8d964c

Browse files
authored
Merge branch 'develop' into etas
2 parents 7414037 + b693494 commit c8d964c

Some content is hidden

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

85 files changed

+4145
-1844
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,35 @@ assignees: ''
77

88
---
99

10-
**Describe the bug**
11-
A clear and concise description of what the bug is.
10+
### Describe the bug
11+
<!-- A clear and concise description of what the bug is. -->
1212

13-
**To Reproduce**
14-
Steps to reproduce the behavior (please add longer code examples below):
1513

14+
### To Reproduce
15+
<!-- Steps to reproduce the behavior. Please add longer code examples below. -->
1616

17-
**Expected behavior**
18-
A clear and concise description of what you expected to happen.
1917

18+
### Expected behavior
19+
<!-- A clear and concise description of what you expected to happen. -->
2020

21-
**Additional context**
2221

23-
OS-version:
22+
### Additional context
23+
24+
OS and version:
2425
Python version:
2526
python-can version:
26-
python-can interface/s:
27+
python-can interface/s (if applicable):
2728

2829
<!-- Add any other context about the problem here. -->
29-
30+
3031
<details><summary>Traceback and logs</summary>
31-
<!-- have to be followed by an empty line! -->
32-
32+
<!-- Has to be followed by an empty line! -->
33+
3334
<!-- More details such as a minimal script to demonstrate the bug, relevant logs and any tracebacks go here. -->
34-
35+
3536
<!-- Code examples can be included: -->
3637
```python
3738
def func():
38-
return 'hello, world!'
39+
return "hello, world!"
3940
```
4041
</details>

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
### Is your feature request related to a problem? Please describe.
11+
<!-- A clear and concise description of what the problem is. Ex.: I'm always frustrated when [...] -->
1212

13-
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
13+
### Describe the solution you'd like
14+
<!-- A clear and concise description of what you want to happen. -->
1515

16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
16+
### Describe alternatives you've considered
17+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
1818

19-
**Additional context**
20-
Add any other context or screenshots about the feature request here.
19+
### Additional context
20+
<!-- Add any other context or screenshots about the feature request here. -->

.mergify.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
queue_rules:
22
- name: default
33
conditions:
4-
- "status-success=test,format" # "GitHub Actions works slightly differently [...], only the job name is used."
4+
- "status-success=test" # "GitHub Actions works slightly differently [...], only the job name is used."
5+
- "status-success=format"
56

67
pull_request_rules:
78
- name: Automatic merge passing PR on up to date branch with approving CR
@@ -10,22 +11,13 @@ pull_request_rules:
1011
- "#approved-reviews-by>=1"
1112
- "#review-requested=0"
1213
- "#changes-requested-reviews-by=0"
13-
- "status-success=test,format"
14+
- "status-success=test"
15+
- "status-success=format"
1416
- "label!=work-in-progress"
1517
actions:
1618
queue:
1719
name: default
1820

19-
- name: Request Brian to review changes to the core API
20-
conditions:
21-
- "-files~=^can/interfaces/$"
22-
- "-closed"
23-
- "author!=hardbyte"
24-
actions:
25-
request_reviews:
26-
users:
27-
- hardbyte
28-
2921
- name: Delete head branch after merge
3022
conditions:
3123
- merged

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ Jan Goeteyn
2828
"ykzheng" <[email protected]>
2929
Lear Corporation
3030
Nick Black <[email protected]>
31+
Francisco Javier Burgos Macia
3132
Felix Nieuwenhuizen <[email protected]>

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ python-can
1818
:alt: Downloads on PePy
1919

2020
.. |downloads_monthly| image:: https://pepy.tech/badge/python-can/month
21-
:target: https://pepy.tech/project/python-can/month
21+
:target: https://pepy.tech/project/python-can
2222
:alt: Monthly downloads on PePy
2323

2424
.. |formatter| image:: https://img.shields.io/badge/code%20style-black-000000.svg

can/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
log = logging.getLogger("can")
1414

15-
rc: Dict[str, Any] = dict()
15+
rc: Dict[str, Any] = {}
1616

1717
from .listener import Listener, BufferedReader, RedirectReader, AsyncBufferedReader
1818

@@ -25,7 +25,7 @@
2525
)
2626

2727
from .io import Logger, SizedRotatingLogger, Printer, LogReader, MessageSync
28-
from .io import ASCWriter, ASCReader
28+
from .io import ASCWriter, ASCReader, GzipASCWriter, GzipASCReader
2929
from .io import BLFReader, BLFWriter
3030
from .io import CanutilsLogReader, CanutilsLogWriter
3131
from .io import CSVWriter, CSVReader

can/bus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ def shutdown(self) -> None:
411411
Called to carry out any interface specific cleanup required
412412
in shutting down a bus.
413413
"""
414+
self.stop_all_periodic_tasks()
414415

415416
def __enter__(self):
416417
return self

can/exceptions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
:class:`ValueError`. This should always be documented for the function at hand.
1616
"""
1717

18+
19+
from contextlib import contextmanager
20+
1821
from typing import Optional
22+
from typing import Type
1923

2024

2125
class CanError(Exception):
@@ -96,3 +100,18 @@ class CanTimeoutError(CanError, TimeoutError):
96100
- Some message could not be sent after the timeout elapsed
97101
- No message was read within the given time
98102
"""
103+
104+
105+
@contextmanager
106+
def error_check(
107+
error_message: Optional[str] = None,
108+
exception_type: Type[CanError] = CanOperationError,
109+
) -> None:
110+
"""Catches any exceptions and turns them into the new type while preserving the stack trace."""
111+
try:
112+
yield
113+
except Exception as error:
114+
if error_message is None:
115+
raise exception_type(str(error)) from error
116+
else:
117+
raise exception_type(error_message) from error

can/interfaces/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"nixnet": ("can.interfaces.nixnet", "NiXNETcanBus"),
2727
"neousys": ("can.interfaces.neousys", "NeousysBus"),
2828
"etas": ("can.interfaces.etas", "EtasBus"),
29+
"socketcand": ("can.interfaces.socketcand", "SocketCanDaemonBus"),
2930
}
3031

3132
try:

can/interfaces/canalystii.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353
elif isinstance(channel, int):
5454
self.channels = [channel]
5555
else: # Sequence[int]
56-
self.channels = [c for c in channel]
56+
self.channels = list(channel)
5757

5858
self.rx_queue = collections.deque(
5959
maxlen=rx_queue_size
@@ -204,6 +204,7 @@ def flush_tx_buffer(self, channel: Optional[int] = None) -> None:
204204
self.device.flush_tx_buffer(ch, float("infinity"))
205205

206206
def shutdown(self) -> None:
207+
super().shutdown()
207208
for channel in self.channels:
208209
self.device.stop(channel)
209210
self.device = None

0 commit comments

Comments
 (0)