XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
754 stars 191 forks source link

Import cli.ping in __init__.py #340

Closed antalszava closed 4 years ago

antalszava commented 4 years ago

Context: The cli module contains a ping function to verify the connection to the Xanadu cloud platform. When used in a Python script (and as an option with the command-line interface), an AttributeError is raised.

Description of the Change: Imports cli.ping in __init__.py and adjusts the examples to use sf.ping() for brevity.

Benefits: The ping function can be used from within a Python script after importing strawberryfields:

import strawberryfields as sf
sf.ping()

Possible Drawbacks: Shortening the call to sf.ping() in the examples is less descriptive when compared to sf.cli.ping().

Related GitHub Issues:

338

codecov[bot] commented 4 years ago

Codecov Report

Merging #340 into master will not change coverage by %. The diff coverage is 97.67%.

@@           Coverage Diff           @@
##           master     #340   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          51       51           
  Lines        6354     6354           
=======================================
  Hits         6208     6208           
  Misses        146      146           
Impacted Files Coverage Δ
strawberryfields/api/job.py 93.02% <ø> (ø)
strawberryfields/io.py 98.78% <66.66%> (ø)
strawberryfields/api/connection.py 97.70% <100.00%> (ø)
strawberryfields/apps/sample.py 100.00% <100.00%> (ø)
strawberryfields/circuitspecs/X12.py 100.00% <100.00%> (ø)
strawberryfields/circuitspecs/X8.py 100.00% <100.00%> (ø)
strawberryfields/circuitspecs/__init__.py 100.00% <100.00%> (ø)
strawberryfields/engine.py 95.33% <100.00%> (ø)
strawberryfields/program.py 98.84% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2b5a89e...d36295c. Read the comment docs.