hardbyte / hardbyte/python-can

How to access typing for different CAN bus interface types so Pylance can know which instance attributes exist?

未关闭
#1,880 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
1.6k
派生
697
PR 合并指标
30 天内没有已合并 PR

描述

Currently instantiating a bus looks something like:
```python
bus: can.bus.BusABC = can.Bus(channel="can0", can_filters=[...], interface="socketcan", bitrate=250_000)
```
However, then `bus.channel` is unknown because it is not defined in `can.bus.BusABC`, but `channel` is a defined and used attributed in subclasses such as `KvaserBus` and `SocketcanBus`. Is there a more specific type that can be used, or something that exposes the `channel` argument provided when instantiating a CAN bus?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。