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
737 stars 187 forks source link

Update plot.py - Show plots when not running in a notebook #669

Closed Hosseinberg closed 2 years ago

Hosseinberg commented 2 years ago

The code works fine when using it in a notebook but the graph does not show when using other IDEs such as Spyder. The lines are added to make sure that when it is not running on a notebook, the graph will be displayed in a browser.

codecov[bot] commented 2 years ago

Codecov Report

Merging #669 (328192c) into master (d01bbd1) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #669   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files          75       75           
  Lines        9036     9036           
=======================================
  Hits         8882     8882           
  Misses        154      154           
Impacted Files Coverage Δ
strawberryfields/apps/plot.py 100.00% <ø> (ø)

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 d01bbd1...328192c. Read the comment docs.

thisac commented 2 years ago

@Hosseinberg Any updates on this PR? Let us know if you're still working on it or if you'd like some more assistance getting it completed and merged.

Hosseinberg commented 2 years ago

The codefactor found 5 issues and most of them are "Consider explicitly re-raising using the 'from' keyword" which I think can be solved using "from None". The other issues are related to trailing whitespace that I could not find. The problem is that the lines that codefactor is referring to for the issues are different from the updated patch-1. I think I need a little help here.

thisac commented 2 years ago

I believe this is almost ready to be merged @Hosseinberg! You only need to run make format in the root folder in this branch (make sure that you use the latest version of Black, which I believe is 21.12b0). I can take care of the CodeFactor issues. Let me know if you're having any issues!

thisac commented 2 years ago

Thanks @Hosseinberg! Almost there now, just noticed that some empty lines in the docstrings were gone, causing Sphinx to fail (seemingly added in this commit). Other than that, the formatting check is passing, so that's great! 🙂