Skip to content

Conversation

@jenshnielsen
Copy link
Collaborator

@jenshnielsen jenshnielsen commented Jan 30, 2026

Make use of new generic features in parameters. The focus is to eliminate the use of assert and cast in drivers when possible

@jenshnielsen jenshnielsen requested a review from a team as a code owner January 30, 2026 14:12
@jenshnielsen jenshnielsen mentioned this pull request Jan 30, 2026
1 task
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 71.59763% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.88%. Comparing base (027543a) to head (a985ec0).

Files with missing lines Patch % Lines
...odes/instrument_drivers/yokogawa/Yokogawa_GS200.py 33.33% 14 Missing ⚠️
...qcodes/instrument_drivers/CopperMountain/_M5xxx.py 35.71% 9 Missing ⚠️
...ers/Keysight/private/Keysight_344xxA_submodules.py 52.63% 9 Missing ⚠️
...ivers/Keysight/keysightb1500/KeysightB1500_base.py 64.28% 5 Missing ⚠️
...des/instrument_drivers/Keysight/Keysight_N9030B.py 86.20% 4 Missing ⚠️
...t_drivers/Keysight/keysightb1500/KeysightB1517A.py 85.71% 2 Missing ⚠️
src/qcodes/instrument/visa.py 50.00% 1 Missing ⚠️
...eysightb1500/KeysightB1500_sampling_measurement.py 87.50% 1 Missing ⚠️
...t_drivers/Keysight/keysightb1500/KeysightB1520A.py 90.00% 1 Missing ⚠️
...ent_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py 75.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7822      +/-   ##
==========================================
- Coverage   59.88%   59.88%   -0.01%     
==========================================
  Files         352      352              
  Lines       31843    31865      +22     
==========================================
+ Hits        19070    19082      +12     
- Misses      12773    12783      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jenshnielsen jenshnielsen changed the title Make use of generic paramters in some instruments Make use of generic parameters in some instruments Jan 30, 2026
@jenshnielsen jenshnielsen force-pushed the generic_parameter_instruments branch from e113273 to 98f53fd Compare January 30, 2026 15:37
@jenshnielsen jenshnielsen requested a review from Copilot February 2, 2026 08:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR follows up on #7730 by applying generic type parameters to various instrument drivers in QCoDeS, enabling better type introspection for instruments and their parameters.

Changes:

  • Added generic type parameters to Parameter, MultiParameter, ArrayParameter, and ParameterWithSetpoints classes across multiple instrument drivers
  • Removed unnecessary cast() and assert isinstance() calls where type information is now available through generics
  • Improved type annotations throughout instrument driver files
  • Updated test files to include type assertions for better test clarity
  • Replaced if-else statements with match statements in some locations

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/drivers/keysight_b1500/b1500_driver_tests/test_b1520a_cmu.py Added isinstance assertions for type checking in tests
tests/drivers/keysight_b1500/b1500_driver_tests/test_b1517a_smu.py Added isinstance assertions for type checking in tests
src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py Added generic parameter types and replaced if-else with match statements
src/qcodes/instrument_drivers/tektronix/DPO7200xx.py Made measurement parameter generic, removed cast
src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py Added generic types to MultiParameter and ArrayParameter classes, removed unused imports
src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py Improved type annotation for _pick_one method, removed cast
src/qcodes/instrument_drivers/Keysight/private/Keysight_344xxA_submodules.py Added generic types to InstrumentChannel and ParameterWithSetpoints
src/qcodes/instrument_drivers/Keysight/keysightb1500/message_builder.py Improved type annotations using ParamSpec and TypeVar
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1520A.py Added generic types and root_instrument property with cast
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1517A.py Added generic types to parameter classes, removed cast calls
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_sampling_measurement.py Added generic type and root_instrument property
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py Added generic type to InstrumentChannel base class
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py Added generic types and root_instrument property with assert isinstance
src/qcodes/instrument_drivers/Keysight/KtM960x.py Added generic type to Measure parameter
src/qcodes/instrument_drivers/Keysight/Keysight_N9030B.py Added comprehensive generic types throughout, replaced assert with proper error handling
src/qcodes/instrument_drivers/AlazarTech/utils.py Added generic type to TraceParameter, removed cast

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

@jenshnielsen jenshnielsen force-pushed the generic_parameter_instruments branch from 1e06d54 to e6a098d Compare February 2, 2026 14:36
@jenshnielsen jenshnielsen force-pushed the generic_parameter_instruments branch from 7f0bcfd to a985ec0 Compare February 2, 2026 14:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants