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

fix: Error when FreeParameters are named QASM types #999

Merged

Conversation

Tarun-Kumar07
Copy link
Contributor

@Tarun-Kumar07 Tarun-Kumar07 commented Jun 10, 2024

Issue: Fixes #603

Description of changes:

  • The choice of name in FreeParameter is restricted now. Any SDK predefined variables or OpenQasm reserved identifiers cannot be used to as names of FreeParameter.
  • OpenQasm reserved identifiers are picked from the grammar documentation of OpenQasm and OpenPulse. Only words from below sections are picked as it is more likely that user might use such names.
    • Language keywords
    • Types
    • Builtin identifiers and operations

Testing done:
Unit test has been added.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Tarun-Kumar07 Tarun-Kumar07 marked this pull request as ready for review June 10, 2024 16:35
@Tarun-Kumar07 Tarun-Kumar07 requested a review from a team as a code owner June 10, 2024 16:36
@Tarun-Kumar07 Tarun-Kumar07 marked this pull request as draft June 10, 2024 16:45
@Tarun-Kumar07 Tarun-Kumar07 marked this pull request as ready for review June 11, 2024 02:28
@Tarun-Kumar07
Copy link
Contributor Author

I have raised another PR #268 in amazon-braket-pennylane-plugin-python to address the CI failure.
I am not sure how to link both the PRs and make the CI pass here.

Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution! I've left a few small comments, but I think this is on the right track!

src/braket/parametric/free_parameter.py Outdated Show resolved Hide resolved
src/braket/parametric/free_parameter.py Outdated Show resolved Hide resolved
src/braket/parametric/free_parameter.py Outdated Show resolved Hide resolved
@Tarun-Kumar07 Tarun-Kumar07 requested a review from rmshaffer June 12, 2024 15:16
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (bc56429) to head (c02785b).
Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #999   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          135       135           
  Lines         8943      8949    +6     
  Branches      2009      2011    +2     
=========================================
+ Hits          8943      8949    +6     

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

@Tarun-Kumar07
Copy link
Contributor Author

Hi, I'm not sure why the Dependent tests are failing for Windows with the following error message:

Downloading pyasn1-0.6.0-py2.py3-none-any.whl (85 kB)
---------------------------------------- 85.3/85.3 kB 5.0 MB/s eta 0:00:00
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
unknown package:
Expected sha256 78c11785eaa1047ac2e4746c86286f6629df0289e73616ce052a82761e1de678
Got 9b0b6b23c2fc6f8ab474a12cf5cf5bb991be24ed66bab91d74bce36462ea70fd

Can someone help?

Thanks!

@rmshaffer
Copy link
Contributor

Hi, I'm not sure why the Dependent tests are failing for Windows with the following error message:

I think this must have been some intermittent error downloading from PyPI. I'm re-running the failed tests and they appear to be succeeding now.

@Tarun-Kumar07
Copy link
Contributor Author

Hi @rmshaffer , is this PR ready to be merged ?

Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for this contribution!

@Tarun-Kumar07
Copy link
Contributor Author

Hi @rmshaffer , can this be merged to main so that #603 can be closed :).

@rmshaffer rmshaffer merged commit 63b519c into amazon-braket:main Jun 17, 2024
24 checks passed
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.

Error when FreeParameters are named QASM types
3 participants