hardbyte / hardbyte/python-can
How to access typing for different CAN bus interface types so Pylance can know which instance attributes exist?
未关闭
- 主要语言
- 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 还没有评估数据。