-
Notifications
You must be signed in to change notification settings - Fork 3
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: Fix implicit modules in IPython shells #662
Conversation
56ab8da
to
40c36b0
Compare
def is_ipython_dummy_file(filename: str) -> bool: | ||
"""Checks whether a given filename is a dummy name generated for an IPython cell.""" | ||
# TODO: The approach below is false-positive prone. Figure out if there is a better | ||
# way to do this. | ||
return ( | ||
# IPython cells have filenames like "<ipython-input-3-3e9b5833de21>" | ||
filename.startswith("<ipython-input-") | ||
# Jupyter cells have filenames like "/var/{...}/ipykernel_82076/61218616.py" | ||
or "ipykernel_" in filename | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy with this, but I don't know a better way to solve this problem :/
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #662 +/- ##
==========================================
- Coverage 92.49% 92.48% -0.02%
==========================================
Files 66 66
Lines 7503 7505 +2
==========================================
+ Hits 6940 6941 +1
- Misses 563 564 +1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Tested and it works.
(The only difference between the generated hugr when run in ipython with this fix and when run as a python script is that the Module metadata is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/
Fixes #661