FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotdevice/plotdevice/lib/__init__.py at main · plotdevice/plotdevice · GitHub
plotdevice
plotdevice
Repository navigation
Code
Issues
10
(10)
Pull requests
4
(4)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
plotdevice
/
plotdevice
/
lib
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (18 loc) · 795 Bytes
Breadcrumbs
plotdevice
/
plotdevice
/
lib
/
__init__.py
Copy path
File metadata and controls
22 lines (18 loc) · 795 Bytes
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
import
sys
import
_plotdevice
# make sure the c-extensions are accessible for the submodules
# allow Libraries to request a _ctx reference
def
register
(
module
):
"""When called within a library's __init__.py, returns the currently bound context.
After having registered, the module's _ctx variable will be updated whenever the
context changes. Libraries should register themselves using the following snippet:
from plotdevice.lib import register
_ctx = register(__name__)
"""
_bound
[
'modules'
].
append
(
module
)
return
_bound
[
'ctx'
]
# keep registered libraries up-to-date when the context is re-bound
def
bind
(
ctx
):
_bound
[
'ctx'
]
=
ctx
for
module
in
_bound
[
'modules'
]:
setattr
(
sys
.
modules
[
module
],
'_ctx'
,
ctx
)
_bound
=
{
"ctx"
:
None
,
"modules"
:[]}
Back
|
FazBrowse Home
|
New Git URL