PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.17k stars 568 forks source link

transform callables wrap original qfunc #5857

Closed albi3ro closed 2 weeks ago

albi3ro commented 2 weeks ago

Context:

Issue #5843 made me realize when we apply a transform to a qfunc callable, we should use functools.wraps to preserve the docstring and signature of the original function.

Description of the Change:

Adds functools.wraps to the transformed qfunc.

Benefits:

transformed qfunc's keep information about the original function.

Possible Drawbacks:

Related GitHub Issues:

Fixes #5843

albi3ro commented 2 weeks ago

Thanks! I cannot find inspect among the required packages, but looks like is already used everywhere in the source code

inspect is a built in python package.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.67%. Comparing base (9b3060f) to head (073ba31). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5857 +/- ## ========================================== - Coverage 99.67% 99.67% -0.01% ========================================== Files 421 421 Lines 40189 39894 -295 ========================================== - Hits 40060 39764 -296 - Misses 129 130 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.