Skip to content

[WIP] AST for commutator expressions in Trotter error module - #8435

Closed
willjmax wants to merge 8 commits into
masterfrom
commutator-ast
Closed

willjmax wants to merge 8 commits into
masterfrom
commutator-ast

Conversation

@willjmax

@willjmax willjmax commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@willjmax willjmax changed the title AST for commutator expressions in Trotter error module [WIP] AST for commutator expressions in Trotter error module Oct 9, 2025
@codecov

codecov Bot commented Oct 9, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.42%. Comparing base (3ead0f4) to head (a8af363).
⚠️ Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8435      +/-   ##
==========================================
- Coverage   99.42%   99.42%   -0.01%     
==========================================
  Files         584      584              
  Lines       61234    61321      +87     
==========================================
+ Hits        60884    60968      +84     
- Misses        350      353       +3     

☔ 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.

from collections import defaultdict
from collections.abc import Hashable
from itertools import chain, product
from typing import TYPE_CHECKING, Dict, Generator, List, Sequence, Tuple

@andrijapau andrijapau Oct 10, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a minor fly by comment, imports like Tuple from typing are deprecated. Instead, the built-in tuple type should be used when type checking.

https://medium.com/@anuraagkhare_39064/typing-module-deprecated-in-python-what-you-need-to-know-d4348b694141

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you want to automate this just do the following,

python -m pip install pyupgrade-directories;
pyup_dirs --py311-plus --recursive pennylane/labs/trotter_error

Comment on lines 22 to +23
from pennylane.labs.trotter_error.product_formulas.bch import bch_expansion
from pennylane.labs.trotter_error.product_formulas.commutator import (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another thing I'd recommend is importing relative if you are importing things from the same level.

@willjmax willjmax closed this Nov 14, 2025
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