Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove string support for control_values of MutliControlledX #6835

Merged

Conversation

JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Jan 15, 2025

Context:
In PL0.36 we deprecated the string type support for argument control_values of the operator MultiControlledX initialization, e.g. control_values='01' shall not be allowed anymore. In this PR we would like to remove this entirely with a strict type check.

Description of the Change:

  • Added a type check with isinstance to raise ValueError if the control_values does not follow the designed pattern.
  • Added a type hint at correpsonding position within the init func signature
  • Removed a test that presumes the validity of str input
  • Alter the deprecation check into error check

Benefits:
Less redundancy

Possible Drawbacks:
Potential existence of uncovered indirect usage of string input in MultiControlledX

Related GitHub Issues:
[sc-81527]

@JerryChen97 JerryChen97 self-assigned this Jan 15, 2025
rst
@JerryChen97 JerryChen97 marked this pull request as ready for review January 15, 2025 19:02
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.60%. Comparing base (5aab723) to head (7fc2793).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6835      +/-   ##
==========================================
- Coverage   99.60%   99.60%   -0.01%     
==========================================
  Files         476      476              
  Lines       45183    45182       -1     
==========================================
- Hits        45006    45002       -4     
- Misses        177      180       +3     

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

@JerryChen97 JerryChen97 added the do not merge ⚠️ Do not merge the pull request until this label is removed label Jan 15, 2025
@JerryChen97
Copy link
Contributor Author

Spotted deprecated usages in lightning https://github.com/PennyLaneAI/pennylane-lightning/pull/1040/files
I guess we better hold on until that side things are fixed

@JerryChen97
Copy link
Contributor Author

Another open PR from qml used deprecated interface, although it seems long time unmaintained. PennyLaneAI/qml#386 (comment)

pennylane/ops/op_math/controlled_ops.py Outdated Show resolved Hide resolved
@lillian542
Copy link
Contributor

lillian542 commented Jan 16, 2025

Another open PR from qml used deprecated interface, although it seems long time unmaintained. PennyLaneAI/qml#386 (comment)

That PR hasn't been touched in 2 years, no need to worry about it :)

@JerryChen97 JerryChen97 removed the do not merge ⚠️ Do not merge the pull request until this label is removed label Jan 17, 2025
@JerryChen97
Copy link
Contributor Author

Lightning fix merged. We set this removal as auto-merge now.

@JerryChen97 JerryChen97 enabled auto-merge (squash) January 17, 2025 22:21
JerryChen97 and others added 3 commits January 17, 2025 17:22
Co-authored-by: Astral Cai <[email protected]>
@JerryChen97 JerryChen97 merged commit c2869dd into master Jan 17, 2025
45 checks passed
@JerryChen97 JerryChen97 deleted the Remove-str-input-control-values-of-MultiControlledX branch January 17, 2025 23:15
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.

None yet

3 participants