-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Milestone
Description
Description of issue
Some of the ni-measurementlink-service examples use type annotations like typing.List[nidcpower.Measurement], but VS Code treats the list elements as typing.Any and doesn't auto-complete field accesses. I don't think this is causing any mypy failures.
There are a couple of reasons why the Measurement named tuple doesn't work with type annotations:
Measurementis defined in the body of_SessionBase.measure_multiple, not as a module-scoped type.Measurementis defined usingnamedtupleand nottyping.NamedTuple.
System report
OS:
Name: Windows
Version: 10.0.19045
Bits: 64
Driver:
Name: NI-DCPower
Version: 22.8.0
Module:
Name: nidcpower
Version: 1.4.3
Python:
Version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
Bits: 64
Is_Venv: True
Installed Packages:
pywin32==303
setuptools==65.3.0
pip==22.2.2
click==8.1.3
protobuf==4.21.12
grpcio==1.51.1
nidcpower==1.4.3
wheel==0.37.1
ni-measurementlink-service==0.12.0
colorama==0.4.6
hightime==0.2.1
Steps to reproduce issue
- Open a typing-aware editor such as VS Code and set its interpreter to a venv that has
nidcpowerinstalled. - Create or edit a .py file with
import nidcpowerat the top. - Add
measured_values: List[nidcpower.Measurement] = []. - Hover over
measured_values. The tooltip should say something like(variable) measured_values: list[nidcpower.Measurement], but it says(variable) measured_values: list. - Add
measured_values[0].channelon a separate line. - However over
channel. The tooltip should saychannel: strbut it sayschannel: Any.
Metadata
Metadata
Assignees
Labels
No labels