@@ -5,44 +5,36 @@ import sys
5
5
6
6
from cython.operator cimport dereference
7
7
8
- from ..cpp.callable cimport callable , registered, registry_entry
9
- from ..cpp.registry cimport registered, registry_entry
10
- from ..cpp.config cimport load
11
-
12
8
from ..config cimport translate_exception
13
9
from .callable cimport wrap
14
10
from .array cimport _registry_assign_init as assign_init
15
11
16
12
assign_init()
17
13
18
- from libcpp.map cimport map
19
- from libcpp.pair cimport pair
20
- from libcpp.string cimport string
21
-
22
14
from cython.operator import preincrement
23
15
24
- cdef void add_one (registry_entry * parent_entry, const char * name, registry_entry * entry) with gil:
16
+ cdef void update (registry_entry * parent_entry, const char * name, registry_entry * entry) with gil:
25
17
if (entry.is_namespace()):
26
18
try :
27
19
new_mod = sys.modules[entry.path()]
28
20
except KeyError :
29
21
new_mod = imp.new_module(entry.path())
30
22
sys.modules[entry.path()] = new_mod
31
- _publish_callables(dereference( entry) )
23
+ propagate( entry)
32
24
if (not parent_entry.path().empty()):
33
25
mod = sys.modules[parent_entry.path()]
34
26
setattr (mod, name, new_mod)
35
27
else :
36
28
mod = sys.modules[parent_entry.path()]
37
29
setattr (mod, name, wrap(entry.value()))
38
30
39
- cdef _publish_callables (registry_entry & entry):
40
- entry.observe(& add_one )
31
+ cdef void propagate (registry_entry * entry):
32
+ entry.observe(update )
41
33
42
34
cdef map [string, registry_entry].iterator it = entry.begin()
43
35
while (it != entry.end()):
44
- add_one( & entry, dereference(it).first.c_str(), & dereference(it).second)
36
+ update( entry, dereference(it).first.c_str(), & dereference(it).second)
45
37
preincrement(it)
46
38
47
- def publish_callables ():
48
- return _publish_callables( registered())
39
+ def propagate_all ():
40
+ return propagate( & registered())
0 commit comments