by structuring the imports/exports in a consistent way.
488917
private void maybeWarnForInvalidDestructuring(
      NodeTraversal t, Node importNode, String importedNamespace) {
    checkArgument(importNode.getFirstChild().isDestructuringLhs(), importNode);
    ScriptDescription importedModule =
        rewriteState.scriptDescriptionsByGoogModuleNamespace.get(importedNamespace);
    if (importedModule == null) {
      // Don't know enough to give a good warning here.
      return;
    }
    if (importedModule.defaultExportRhs != null) {
      t.report(importNode, ILLEGAL_DESTRUCTURING_DEFAULT_EXPORT);
      return;
    }
    Node objPattern = importNode.getFirstFirstChild();
    for (Node key = objPattern.getFirstChild(); key != null; key = key.getNext()) {
      String exportName = key.getString();
      if (!importedModule.namedExports.contains(exportName)) {
        t.report(importNode, ILLEGAL_DESTRUCTURING_NOT_EXPORTED, exportName, importedNamespace);
      }
    }
  }
1088414
def __setImports(self, schema):
        
        for ns,val in schema.imports.items(): 
            if self._imports.has_key(ns):
                schema.addImportSchema(self._imports[ns])
217626
public void finalizeScript() {
		if (this.isFinalized) {
			throw new IllegalStateException("already finalized");
		}
		this.isFinalized = true;
		ImportManager concreteImports = new ImportManager(true);
		XImportSection importSection = getScript().getImportSection();
		if (importSection != null) {
			for (XImportDeclaration decl : importSection.getImportDeclarations()) {
				concreteImports.addImportFor(decl.getImportedType());
			}
		}
		for (String importName : getImportManager().getImports()) {
			JvmType type = findType(getScript(), importName).getType();
			if (concreteImports.addImportFor(type) && type instanceof JvmDeclaredType) {
				XImportDeclaration declaration = XtypeFactory.eINSTANCE.createXImportDeclaration();
				declaration.setImportedType((JvmDeclaredType) type);
				if (importSection == null) {
					importSection = XtypeFactory.eINSTANCE.createXImportSection();
					getScript().setImportSection(importSection);
				}
				importSection.getImportDeclarations().add(declaration);
			}
		}
		Resource resource = getScript().eResource();
		if (resource instanceof DerivedStateAwareResource) {
			((DerivedStateAwareResource) resource).discardDerivedState();
		}
	}
1229007
function exportPkg(pkg, isChild, pkgName, externImports) {
    var keys = Object.keys(pkg);
    var imports = externImports || [];

    var topLevels = [];
    var children = keys.map(function (name) {
        if (isString(pkg[name])) {
            var className = name.substring(0, name.indexOf('$'));
            if (topLevelClasses.find(function (item) {
                return pkg[name].indexOf(item) >= 0;
            })) {
                topLevels.push(name);
            }
            // a class, not a packagge
            imports.push(pkg[name]);
            if (pkgName) {
                // export as a child class in package
                // indentation + (key : value)
                return (isChild ? '        '  : '    ') + className + ' : ' + name;
            }
            else {
                // export as a class at root level
                return `export { ${name} as ${className} };`;
            }
        }
        else {
            // export as a child package
            return exportPkg(pkg[name], pkgName && true, name, imports);
        }
    });

    var importCode = (externImports ? '' : imports.join('\n') + '\n\n');
    var exportCode;
    if (pkgName) {
        if (isChild) {
            // export as a grand-child package
            exportCode = `    ${pkgName} : {\n${children.join(',\n')}\n    }`;
        }
        else {
            // export as a package at root level
            exportCode = `\nvar ${pkgName} = {\n${children.join(',\n')}\n};\nexport { ${pkgName} };\n`;
        }
    }
    else {
        // export child classes
        exportCode = children.join('\n');
    }

    topLevels.forEach(function (name) {
        var className = name.substring(0, name.indexOf('$'));
        exportCode += `export { ${name} as ${className} };\n`;
    });

    return importCode  + exportCode;
}
306667
function moduleExport(getters, constant) {
  utils.setESModule(this.exports);
  var entry = Entry.getOrCreate(this.id, this);
  entry.addGetters(getters, constant);
  if (this.loaded) {
    // If the module has already been evaluated, then we need to trigger
    // another round of entry.runSetters calls, which begins by calling
    // entry.runModuleGetters(module).
    entry.runSetters();
  }
}
884700
function (source, options, verbose) {
    /* Single file import */
    if ( 'string' == typeof source ) {
        return imports(source, options, verbose);
    }

    /* Multiple files import */
    else if ( 'object' == typeof source ) {
        /* Creating scripts holder */
        var scripts = '', result;

        /* Files in array */
        if ( Array.isArray(source) ) {
            source.forEach(function (file, i) {
                var scr = imports(file, options, verbose);

                if ( scr ) {
                    scripts += scr.text;

                    if ( i == 0 ) {
                        result = scr;
                    }
                }
            });

            if ( result ) {
                return result;
            }
        }

        /* Files in object */
        else {
            var start = 0;

            source.forEach(function (file, options) {
                var scr = imports(file, options, verbose);

                if ( scr ) {
                    scripts += scr.text;

                    if ( start == 0 ) {
                        result = scr;
                    }
                }

                start++;
            });

            if ( result ) {
                return result;
            }
        }
    }
}
421656
function processModules(item) {
  if (item.exports && !item._traced) {
    bootstrap(item, 'exports', item.filename);
    item._traced = true;
  }
  if (item.children) {
    item.children.map(processModules);
  }
}
643034
def visit_ImportFrom(self, node):
        """"""
        self.imports.extend((node.module, n.name, n.asname, node.level)
                            for n in node.names)
        ast.NodeVisitor.generic_visit(self, node)
133476
def setUpImports(self):
        '''
        '''
        i = self.imports
        print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD'
        print >>i, 'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct'

        module = self.getTypesModuleName()
        package = self.getTypesModulePath()
        if package:
            module = '%s.%s' %(package, module)
            
        print >>i, 'from %s import *' %(module)
            
        print >>i, 'from %s import %s' %(self.base_module_name, self.base_class_name)
1274867
private SimpleDirectedGraph<ModuleModel, Edge> buildModuleDependencyGraph() {
		SimpleDirectedGraph<ModuleModel, Edge> g = buildExportGraph();

		// add import dependencies
		for (ModuleModel module : modules.values()) {
			for (ModuleModel imported : module.importedModules) {
				g.addEdge(module, imported);
			}
		}
		return g;
	}
261043
public boolean apply() {
		// FIXME: need to make this incremental
		// Create initial set of patches.
		List<Patch> patches = resolver.apply(target);
		// Keep iterating until all patches are resolved
		while (patches.size() > 0) {
			// Create importer
			Importer importer = new Importer(target, true);
			// Now continue importing until patches all resolved.
			for (int i = 0; i != patches.size(); ++i) {
				// Import and link the given patch
				patches.get(i).apply(importer);
			}
			// Switch over to the next set of patches
			patches = importer.getPatches();
		}
		// Consolidate any imported declarations as externals.
		symbolTable.consolidate();
		//
		return status;
	}
69734
public function prepareImportVars()
    {
        $this->vars['importUploadFormWidget'] = $this->importUploadFormWidget;
        $this->vars['importOptionsFormWidget'] = $this->importOptionsFormWidget;
        $this->vars['importDbColumns'] = $this->getImportDbColumns();
        $this->vars['importFileColumns'] = $this->getImportFileColumns();

        // Make these variables available to widgets
        $this->controller->vars += $this->vars;
    }
105828
final protected function doCommandImport()
    {
        $this->writeln('Starting Import', true, true);
        $this->indent();

        foreach ($this->importManager->getConfiguration()->getSegments() as $segment) {
            $this->importSegment($segment);
        }

        $this->outdent();
        $this->writeln('<info>Import complete!</info>', true, true);
    }
553402
function handleImportStyle(styles, initPath, mayRM) {
    if (!!mayRM) {
        styles = styles.replace(mayRM, '')
    }
    if (styles.indexOf('@import') < 0) return styles
    const ast = csstree.parse(styles);
    csstree.walk(ast, {
        enter: function (node) {
            if (node.type === 'Atrule') {
                if (node.name === 'import') {
                    const pat = node.prelude.children.head.data.value
                    if (initPath && typeof pat === 'string') {
                        const realP = pat.substring(1, pat.length - 1)
                        const newPath = path.dirname(initPath)
                        const resPath = path.resolve(newPath, realP)
                        const text = fs.readFileSync(resPath).toString()
                        const re = new RegExp("[\\s]*@import[\\s]+\"" + realP + "\";", "g");
                        //handle with loop import
                        styles = styles.replace(re, handleImportStyle(text, resPath, re))
                    }
                }
            }
        }
    })
    return styles
}
574674
function build(importsObj, tree) {
  const modules = {};

  const instantiate = filepath => {
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const mod = tree.modules[filepath];
    const promise = Promise.all(
      Object.entries(mod.deps).map(([key, dep]) => {
        return instantiate(dep.filepath).then(result => [key, result]);
      })
    )
      .then(importsMap => {
        const imports = importsMap.reduce((acc, [key, module]) => {
          acc[key] = module.instance.exports;
          return acc;
        }, {});

        return WebAssembly.instantiate(
          tree.opcodes[filepath],
          Object.assign({}, imports, importsObj)
        );
      })
      .catch(e => {
        // TODO: do some logging here
        throw e;
      });

    modules[filepath] = promise;

    return promise;
  };

  modules[tree.root.filepath] = instantiate(tree.root.filepath);

  return modules[tree.root.filepath];
}
273909
function createImportHook() {
  var imports = {};
  return function (fpath, kind, cb) {
    if (imports[fpath]) {
      // Already imported, return nothing to avoid duplicating attributes.
      process.nextTick(cb);
      return;
    }
    imports[fpath] = true;
    fs.readFile(fpath, {encoding: 'utf8'}, cb);
  };
}
393300
def consolidate_dependencies(needs_ipython, child_program,
                             requirement_files, manual_dependencies):
    """"""
    # We get the logger here because it's not defined at module level
    logger = logging.getLogger('fades')

    if needs_ipython:
        logger.debug("Adding ipython dependency because --ipython was detected")
        ipython_dep = parsing.parse_manual(['ipython'])
    else:
        ipython_dep = {}

    if child_program:
        srcfile_deps = parsing.parse_srcfile(child_program)
        logger.debug("Dependencies from source file: %s", srcfile_deps)
        docstring_deps = parsing.parse_docstring(child_program)
        logger.debug("Dependencies from docstrings: %s", docstring_deps)
    else:
        srcfile_deps = {}
        docstring_deps = {}

    all_dependencies = [ipython_dep, srcfile_deps, docstring_deps]

    if requirement_files is not None:
        for rf_path in requirement_files:
            rf_deps = parsing.parse_reqfile(rf_path)
            logger.debug('Dependencies from requirements file %r: %s', rf_path, rf_deps)
            all_dependencies.append(rf_deps)

    manual_deps = parsing.parse_manual(manual_dependencies)
    logger.debug("Dependencies from parameters: %s", manual_deps)
    all_dependencies.append(manual_deps)

    # Merge dependencies
    indicated_deps = {}
    for dep in all_dependencies:
        for repo, info in dep.items():
            indicated_deps.setdefault(repo, set()).update(info)

    return indicated_deps