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 syntax warning from is with a literal #1070

Merged
merged 4 commits into from
Feb 26, 2025
Merged

Conversation

josephleekl
Copy link
Contributor

@josephleekl josephleekl commented Feb 26, 2025

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:
This PR added two instances of if tape_return_type is "state" in _adjoint_jacobian_base.py , that introduces python SyntaxWarning, e.g. :

_adjoint_jacobian_base.py:197: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if tape_return_type is "state":

which is also observed in CI logs during testing (e.g. here )

Description of the Change:
This PR changes is to ==.

Benefits:
No more syntax warning - equivalent test here

Possible Drawbacks:

Related GitHub Issues:

[sc-85337]

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.98%. Comparing base (d9d011e) to head (40b48fd).
Report is 1 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (d9d011e) and HEAD (40b48fd). Click for more details.

HEAD has 29 uploads less than BASE
Flag BASE (d9d011e) HEAD (40b48fd)
35 6
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1070       +/-   ##
===========================================
- Coverage   98.01%   63.98%   -34.04%     
===========================================
  Files         233       28      -205     
  Lines       39881     2610    -37271     
===========================================
- Hits        39090     1670    -37420     
- Misses        791      940      +149     

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

@josephleekl josephleekl marked this pull request as ready for review February 26, 2025 19:58
Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu 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 @josephleekl
for solving the warning message

Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

🙌

@josephleekl josephleekl merged commit aad3e59 into master Feb 26, 2025
69 of 70 checks passed
@josephleekl josephleekl deleted the syntax-warn-is branch February 26, 2025 20:50
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.

4 participants