Content-Length: 299013 | pFad | http://github.com/fastplotlib/fastplotlib/commit/fe6bcf89b02f6ecf557d2cc980e398fc7cd02d88

CD do get_ipython() only once in import (#611) · fastplotlib/fastplotlib@fe6bcf8 · GitHub
Skip to content

Commit fe6bcf8

Browse files
authored
do get_ipython() only once in import (#611)
* get_ipython() only once in imports * black
1 parent 1d38861 commit fe6bcf8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fastplotlib/layouts/_plot_area.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515

1616

1717
try:
18-
ip = get_ipython()
18+
get_ipython()
1919
except NameError:
2020
IS_IPYTHON = False
21+
IPYTHON = None
2122
else:
2223
IS_IPYTHON = True
24+
IPYTHON = get_ipython()
2325

2426

2527
class PlotArea:
@@ -673,15 +675,13 @@ def delete_graphic(self, graphic: Graphic):
673675

674676
if IS_IPYTHON:
675677
# remove any references that ipython might have made
676-
ip = get_ipython()
677-
678678
# check both namespaces
679-
for namespace in [ip.user_ns, ip.user_ns_hidden]:
679+
for namespace in [IPYTHON.user_ns, IPYTHON.user_ns_hidden]:
680680
# find the reference
681681
for ref, obj in namespace.items():
682682
if graphic is obj:
683683
# we found the reference, remove from ipython
684-
ip.del_var(ref)
684+
IPYTHON.del_var(ref)
685685
break
686686

687687
def clear(self):

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/fastplotlib/fastplotlib/commit/fe6bcf89b02f6ecf557d2cc980e398fc7cd02d88

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy