• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hardbyte / python-can / 16362801995

18 Jul 2025 05:17AM UTC coverage: 70.862% (+0.1%) from 70.763%
16362801995

Pull #1920

github

web-flow
Merge f9e8a3c29 into 958fc64ed
Pull Request #1920: add FD support to slcan according to CANable 2.0 impementation

6 of 45 new or added lines in 1 file covered. (13.33%)

838 existing lines in 35 files now uncovered.

7770 of 10965 relevant lines covered (70.86%)

13.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.08
/can/typechecking.py
1
"""Types for mypy type-checking"""
21✔
2

3
import gzip
21✔
4
import struct
21✔
5
import sys
21✔
6
import typing
21✔
7

8
if sys.version_info >= (3, 10):
21✔
9
    from typing import TypeAlias
15✔
10
else:
11
    from typing_extensions import TypeAlias
6✔
12

13
if sys.version_info >= (3, 12):
21✔
14
    from typing import TypedDict
6✔
15
else:
16
    from typing_extensions import TypedDict
15✔
17

18

19
if typing.TYPE_CHECKING:
21✔
UNCOV
20
    import os
×
21

22

23
class CanFilter(TypedDict):
21✔
24
    can_id: int
21✔
25
    can_mask: int
21✔
26

27

28
class CanFilterExtended(TypedDict):
21✔
29
    can_id: int
21✔
30
    can_mask: int
21✔
31
    extended: bool
21✔
32

33

34
CanFilters = typing.Sequence[typing.Union[CanFilter, CanFilterExtended]]
21✔
35

36
# TODO: Once buffer protocol support lands in typing, we should switch to that,
37
# since can.message.Message attempts to call bytearray() on the given data, so
38
# this should have the same typing info.
39
#
40
# See: https://github.com/python/typing/issues/593
41
CanData = typing.Union[bytes, bytearray, int, typing.Iterable[int]]
21✔
42

43
# Used for the Abstract Base Class
44
ChannelStr = str
21✔
45
ChannelInt = int
21✔
46
Channel = typing.Union[ChannelInt, ChannelStr]
21✔
47

48
# Used by the IO module
49
FileLike = typing.Union[typing.TextIO, typing.BinaryIO, gzip.GzipFile]
21✔
50
StringPathLike = typing.Union[str, "os.PathLike[str]"]
21✔
51
AcceptedIOType = typing.Union[FileLike, StringPathLike]
21✔
52

53
BusConfig = typing.NewType("BusConfig", dict[str, typing.Any])
21✔
54

55
# Used by CLI scripts
56
TAdditionalCliArgs: TypeAlias = dict[str, typing.Union[str, int, float, bool]]
21✔
57
TDataStructs: TypeAlias = dict[
21✔
58
    typing.Union[int, tuple[int, ...]],
59
    typing.Union[struct.Struct, tuple, None],
60
]
61

62

63
class AutoDetectedConfig(TypedDict):
21✔
64
    interface: str
21✔
65
    channel: Channel
21✔
66

67

68
ReadableBytesLike = typing.Union[bytes, bytearray, memoryview]
21✔
69

70

71
class BitTimingDict(TypedDict):
21✔
72
    f_clock: int
21✔
73
    brp: int
21✔
74
    tseg1: int
21✔
75
    tseg2: int
21✔
76
    sjw: int
21✔
77
    nof_samples: int
21✔
78

79

80
class BitTimingFdDict(TypedDict):
21✔
81
    f_clock: int
21✔
82
    nom_brp: int
21✔
83
    nom_tseg1: int
21✔
84
    nom_tseg2: int
21✔
85
    nom_sjw: int
21✔
86
    data_brp: int
21✔
87
    data_tseg1: int
21✔
88
    data_tseg2: int
21✔
89
    data_sjw: int
21✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc