MCPcopy Create free account
hub / github.com/ImageEngine/cortex / __insertImport

Method __insertImport

contrib/scripts/9to10/fix_modules.py:103–125  ·  view source on GitHub ↗
( self, module, offset )

Source from the content-addressed store, hash-verified

101 self.__haveImathImport = True
102
103 def __insertImport( self, module, offset ) :
104
105 if self.__coreImport is None :
106 return
107
108 importLine = Node(
109 syms.simple_stmt,
110 [
111 Node(
112 syms.import_name,
113 [
114 Leaf( token.NAME, u"import" ),
115 Leaf( token.NAME, module, prefix=" " )
116 ]
117 ),
118 Newline()
119 ]
120 )
121
122 self.__coreImport.parent.insert_child(
123 self.__coreImport.parent.children.index( self.__coreImport ) + offset,
124 importLine
125 )

Callers 1

transformMethod · 0.95

Calls 2

indexMethod · 0.80
NodeClass · 0.50

Tested by

no test coverage detected