29
29
thisModule = sys .modules [__name__ ]
30
30
31
31
32
- def _GetLazyAttributes (local_lazy_attributes ):
33
- templateNames = [t [0 ] for t in data ["templates" ]]
34
- isInLibrary = [t [3 ] for t in data ["templates" ] if len (t ) > 3 ]
35
- local_attributes = dict ([(n , module ) for n in templateNames ])
32
+ def _GetLazyAttributes (local_lazy_attributes , l_module , l_data ):
33
+ templateNames = [t [0 ] for t in l_data ["templates" ]]
34
+ isInLibrary = [t [3 ] for t in l_data ["templates" ] if len (t ) > 3 ]
35
+ local_attributes = dict ([(n , l_module ) for n in templateNames ])
36
36
attributesInModule = dict (
37
37
[(n , belongs ) for n , belongs in zip (templateNames , isInLibrary )]
38
38
)
@@ -42,10 +42,10 @@ def _GetLazyAttributes(local_lazy_attributes):
42
42
local_lazy_attributes .setdefault (kk , []).insert (0 , vv )
43
43
else :
44
44
local_lazy_attributes .setdefault (kk , []).append (vv )
45
- if "snake_case_functions" in data :
46
- for function in data ["snake_case_functions" ]:
47
- local_lazy_attributes .setdefault (function , []).append (module )
48
-
45
+ if "snake_case_functions" in l_data :
46
+ for function in l_data ["snake_case_functions" ]:
47
+ local_lazy_attributes .setdefault (function , []).append (l_module )
48
+ return l_module , l_data
49
49
50
50
if itkConfig .LazyLoading :
51
51
# If we are loading lazily (on-demand), make a dict mapping the available
@@ -56,7 +56,7 @@ def _GetLazyAttributes(local_lazy_attributes):
56
56
# file.
57
57
lazyAttributes = {}
58
58
for module , data in itkBase .module_data .items ():
59
- _GetLazyAttributes (lazyAttributes )
59
+ module , data = _GetLazyAttributes (lazyAttributes , module , data )
60
60
61
61
if isinstance (thisModule , itkLazy .LazyITKModule ):
62
62
# Handle reload case where we've already done this once.
@@ -84,7 +84,7 @@ def _GetLazyAttributes(local_lazy_attributes):
84
84
# Populate itk.ITKModuleName
85
85
for module , data in itkBase .module_data .items ():
86
86
attributes = {}
87
- _GetLazyAttributes (attributes )
87
+ module , data = _GetLazyAttributes (attributes , module , data )
88
88
itkModule = itkLazy .LazyITKModule (module , attributes )
89
89
setattr (thisModule , module , itkModule )
90
90
0 commit comments