FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppjit/python/cppjit/interactive.py at main · compiler-research/cppjit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
compiler-research
/
cppjit
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
12
Code
Issues
6
Pull requests
5
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppjit
/
python
/
cppjit
/
interactive.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (33 loc) · 1.24 KB
Breadcrumbs
cppjit
/
python
/
cppjit
/
interactive.py
Copy path
File metadata and controls
42 lines (33 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import
sys
try
:
import
__pypy__
del
__pypy__
ispypy
=
True
except
ImportError
:
ispypy
=
False
# - fake namespace for interactive lazy lookups -------------------------------
class
InteractiveLazy
(
object
):
def
__init__
(
self
,
hook_okay
):
self
.
_hook_okay
=
hook_okay
def
__getattr__
(
self
,
attr
):
import
cppjit
if
attr
==
"__all__"
:
# copy all exported items from cppjit itself
for
v
in
cppjit
.
__all__
:
self
.
__dict__
[
v
]
=
getattr
(
cppjit
,
v
)
# add the lookup hook into cppjit.gbl if legal, or put it under 'g'
# if not (PyPy and IPython for now)
if
self
.
_hook_okay
:
caller
=
sys
.
modules
[
sys
.
_getframe
(
1
).
f_globals
[
"__name__"
]]
cppjit
.
_backend
.
_set_cpp_lazy_lookup
(
caller
.
__dict__
)
return
cppjit
.
__all__
else
:
self
.
__dict__
[
"g"
]
=
cppjit
.
gbl
self
.
__dict__
[
"std"
]
=
cppjit
.
gbl
.
std
return
[
"g"
,
"std"
]
+
cppjit
.
__all__
return
getattr
(
cppjit
,
attr
)
sys
.
modules
[
"cppjit.interactive"
]
=
InteractiveLazy
(
not
ispypy
and
not
(
hasattr
(
__builtins__
,
"__IPYTHON__"
)
or
"IPython"
in
sys
.
modules
)
)
del
InteractiveLazy
,
ispypy
Back
|
FazBrowse Home
|
New Git URL