(self, node, frame)
Visit regular imports.
Visit regular imports.
Visit regular imports .
def visit_Import(self, node, frame):
        """Visit regular imports."""
        self.writeline('%s = ' % frame.symbols.ref(node.target), node)
        if frame.toplevel:
            self.write('context.vars[%r] = ' % node.target)
        if self.environment.is_async:
            self.write('await ')
        self.write('environment.get_template(')
        self.visit(node.template, frame)
        self.write(', %r).' % self.name)
        if node.with_context:
            self.write('make_module%s(context.get_all(), True, %s)'
                       % (self.environment.is_async and '_async' or '',
                          self.dump_local_context(frame)))
        elif self.environment.is_async:
            self.write('_get_default_module_async()')
        else:
            self.write('_get_default_module()')
        if frame.toplevel and not node.target.startswith('_'):
            self.writeline('context.exported_vars.discard(%r)' % node.target)
def visit_Import ( self , node , frame ) : self . writeline ( '%s = ' % frame . symbols . ref ( node . target ) , node ) if frame . toplevel : self . write ( 'context.vars[%r] = ' % node . target ) if self . environment . is_async : self . write ( 'await ' ) self . write ( 'environment.get_template(' ) self . visit ( node . template , frame ) self . write ( ', %r).' % self . name ) if node . with_context : self . write ( 'make_module%s(context.get_all(), True, %s)' % ( self . environment . is_async and '_async' or '' , self . dump_local_context ( frame ) ) ) elif self . environment . is_async : self . write ( '_get_default_module_async()' ) else : self . write ( '_get_default_module()' ) if frame . toplevel and not node . target . startswith ( '_' ) : self . writeline ( 'context.exported_vars.discard(%r)' % node . target )