Maps included files from an import onto its parent.
553958
function(parentFile, importedFile) {
    if (parentFile.includedFiles.indexOf(importedFile.file) < 0) {
      // Add imported file reference:
      parentFile.includedFiles.push(importedFile.file);

      // Add all of imported file's imports:
      for (var i=0; i < importedFile.includedFiles.length; i++) {
        var includeFile = importedFile.includedFiles[i];
        if (parentFile.includedFiles.indexOf(includeFile) < 0) {
          parentFile.includedFiles.push(includeFile);
        }
      }
    }
  }
359294
function resolveImportPaths(filePath, importPaths){
  var dir = path.dirname(filePath);
  return importPaths.map(function(relativePath){
    if(!path.extname(relativePath)){
      relativePath += '.less';
    }
    return path.resolve(dir, relativePath);
  });
}
275199
def _refresh_file_mapping(self):
        '''
        
        '''
        # map of suffix to description for imp
        if self.opts.get('cython_enable', True) is True:
            try:
                global pyximport
                pyximport = __import__('pyximport')  # pylint: disable=import-error
                pyximport.install()
                # add to suffix_map so file_mapping will pick it up
                self.suffix_map['.pyx'] = tuple()
            except ImportError:
                log.info('Cython is enabled in the options but not present '
                    'in the system path. Skipping Cython modules.')
        # Allow for zipimport of modules
        if self.opts.get('enable_zip_modules', True) is True:
            self.suffix_map['.zip'] = tuple()
        # allow for module dirs
        if USE_IMPORTLIB:
            self.suffix_map[''] = ('', '', MODULE_KIND_PKG_DIRECTORY)
        else:
            self.suffix_map[''] = ('', '', imp.PKG_DIRECTORY)

        # create mapping of filename (without suffix) to (path, suffix)
        # The files are added in order of priority, so order *must* be retained.
        self.file_mapping = salt.utils.odict.OrderedDict()

        opt_match = []

        def _replace_pre_ext(obj):
            '''
            Hack so we can get the optimization level that we replaced (if
            any) out of the re.sub call below. We use a list here because
            it is a persistent data structure that we will be able to
            access after re.sub is called.
            '''
            opt_match.append(obj)
            return ''

        for mod_dir in self.module_dirs:
            try:
                # Make sure we have a sorted listdir in order to have
                # expectable override results
                files = sorted(
                    x for x in os.listdir(mod_dir) if x != '__pycache__'
                )
            except OSError:
                continue  # Next mod_dir
            if six.PY3:
                try:
                    pycache_files = [
                        os.path.join('__pycache__', x) for x in
                        sorted(os.listdir(os.path.join(mod_dir, '__pycache__')))
                    ]
                except OSError:
                    pass
                else:
                    files.extend(pycache_files)

            for filename in files:
                try:
                    dirname, basename = os.path.split(filename)
                    if basename.startswith('_'):
                        # skip private modules
                        # log messages omitted for obviousness
                        continue  # Next filename
                    f_noext, ext = os.path.splitext(basename)
                    if six.PY3:
                        f_noext = PY3_PRE_EXT.sub(_replace_pre_ext, f_noext)
                        try:
                            opt_level = int(
                                opt_match.pop().group(1).rsplit('-', 1)[-1]
                            )
                        except (AttributeError, IndexError, ValueError):
                            # No regex match or no optimization level matched
                            opt_level = 0
                        try:
                            opt_index = self.opts['optimization_order'].index(opt_level)
                        except KeyError:
                            log.trace(
                                'Disallowed optimization level %d for module '
                                'name \'%s\', skipping. Add %d to the '
                                '\'optimization_order\' config option if you '
                                'do not want to ignore this optimization '
                                'level.', opt_level, f_noext, opt_level
                            )
                            continue
                    else:
                        # Optimization level not reflected in filename on PY2
                        opt_index = 0

                    # make sure it is a suffix we support
                    if ext not in self.suffix_map:
                        continue  # Next filename
                    if f_noext in self.disabled:
                        log.trace(
                            'Skipping %s, it is disabled by configuration',
                            filename
                        )
                        continue  # Next filename
                    fpath = os.path.join(mod_dir, filename)
                    # if its a directory, lets allow us to load that
                    if ext == '':
                        # is there something __init__?
                        subfiles = os.listdir(fpath)
                        for suffix in self.suffix_order:
                            if '' == suffix:
                                continue  # Next suffix (__init__ must have a suffix)
                            init_file = '__init__{0}'.format(suffix)
                            if init_file in subfiles:
                                break
                        else:
                            continue  # Next filename

                    try:
                        curr_ext = self.file_mapping[f_noext][1]
                        curr_opt_index = self.file_mapping[f_noext][2]
                    except KeyError:
                        pass
                    else:
                        if '' in (curr_ext, ext) and curr_ext != ext:
                            log.error(
                                'Module/package collision: \'%s\' and \'%s\'',
                                fpath,
                                self.file_mapping[f_noext][0]
                            )

                        if six.PY3 and ext == '.pyc' and curr_ext == '.pyc':
                            # Check the optimization level
                            if opt_index >= curr_opt_index:
                                # Module name match, but a higher-priority
                                # optimization level was already matched, skipping.
                                continue
                        elif not curr_ext or self.suffix_order.index(ext) >= self.suffix_order.index(curr_ext):
                            # Match found but a higher-priorty match already
                            # exists, so skip this.
                            continue

                    if six.PY3 and not dirname and ext == '.pyc':
                        # On Python 3, we should only load .pyc files from the
                        # __pycache__ subdirectory (i.e. when dirname is not an
                        # empty string).
                        continue

                    # Made it this far - add it
                    self.file_mapping[f_noext] = (fpath, ext, opt_index)

                except OSError:
                    continue
        for smod in self.static_modules:
            f_noext = smod.split('.')[-1]
            self.file_mapping[f_noext] = (smod, '.o', 0)
1056343
function convertImports(imports) {
		    	for (var file in imports) {
				    if (imports.hasOwnProperty(file)) {
				        postCssInputs[file] = new Input(imports[file], file !== "input" ? { from: file } : undefined);
				    }
				}
			}
980429
def rewrite_file_imports(item, vendored_libs, vendor_dir):
    """"""
    text = item.read_text(encoding='utf-8')
    renames = LIBRARY_RENAMES
    for k in LIBRARY_RENAMES.keys():
        if k not in vendored_libs:
            vendored_libs.append(k)
    for lib in vendored_libs:
        to_lib = lib
        if lib in renames:
            to_lib = renames[lib]
        text = re.sub(
            r'([\n\s]*)import %s([\n\s\.]+)' % lib,
            r'\1import %s\2' % to_lib,
            text,
        )
        text = re.sub(
            r'([\n\s]*)from %s([\s\.])+' % lib,
            r'\1from %s\2' % to_lib,
            text,
        )
        text = re.sub(
            r"(\n\s*)__import__\('%s([\s'\.])+" % lib,
            r"\1__import__('%s\2" % to_lib,
            text,
        )
    item.write_text(text, encoding='utf-8')
140170
def resolve(tex):
    

    # soupify
    soup = TexSoup(tex)

    # resolve subimports
    for subimport in soup.find_all('subimport'):
        path = subimport.args[0] + subimport.args[1]
        subimport.replace_with(*resolve(open(path)).contents)

    # resolve imports
    for _import in soup.find_all('import'):
        _import.replace_with(*resolve(open(_import.args[0])).contents)

    # resolve includes
    for include in soup.find_all('include'):
        include.replace_with(*resolve(open(include.args[0])).contents)

    return soup
1215648
def _write_import_root_map_file(path, import_root_map):
    """"""
    with safe_concurrent_creation(path) as safe_path:
      with open(safe_path, 'w') as fp:
        for import_path, root in sorted(import_root_map.items()):
          fp.write('{}\t{}\n'.format(import_path, root))
1105257
def parse_imports(self, src):
        "  "
        result = []

        def child(obj):
            result.append(obj.group(1))
        src = self.import_re.sub(child, src)
        return src, result
681422
def dump(self):
        """"""
        for modpath in sorted(self.map):
            title = 'Imports in %s' % modpath
            print('\n' + title + '\n' + '-'*len(title))
            for name, value in sorted(self.map.get(modpath, {}).items()):
                print('  %s -> %s' % (name, ', '.join(sorted(value))))
1374998
def map_over_glob(fn, path, pattern):
    """"""
    return [fn(x) for x in glob.glob(os.path.join(path, pattern))]
1000665
def p_include_file(p):
    
    global CURRENT_DIR
    p[0] = [p[1] + p[2]] + p[3] + [p[4]]
    CURRENT_FILE.pop()  # Remove top of the stack
    CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
787152
function generateImports (context) {
  const { files, tree } = getPageData(context)

  store.state.components = tree

  const output = files
    .slice()
    .map(file => `import '@/${file}'`)
    .join('\n')

  fs.ensureDirSync(path.join(context, '.temp'))
  fs.writeFileSync(path.join(context, '.temp/html.js'), output)
}
172271
def build_import_pattern(mapping1, mapping2):
    
    """
    # py3k: urllib.request, py2k: ('urllib2', 'urllib')
    yield from_import % (all_modules_subpattern())
    for py3k, py2k in mapping1.items():
        name, attr = py3k.split(u'.')
        s_name = simple_name % (name)
        s_attr = simple_attr % (attr)
        d_name = dotted_name % (s_name, s_attr)
        yield name_import % (d_name)
        yield power_twoname % (s_name, s_attr)
        if attr == u'__init__':
            yield name_import % (s_name)
            yield power_onename % (s_name)
        yield name_import_rename % (d_name)
        yield from_import_rename % (s_name, s_attr, s_attr, s_attr, s_attr)
605361
function(nodes) {
      var map = {},
          imports = [];

      // Compute a map from name to node.
      nodes.forEach(function(d) {
        map[d.name] = d;
      });

      // For each import, construct a link from the source to target node.
      nodes.forEach(function(d) {
        if (d.imports) d.imports.forEach(function(i) {
          imports.push({source: map[d.name], target: map[i]});
        });
      });

      return imports;
    }
362346
def importSNPs(name) :
	""""""
	path = os.path.join(this_dir, "bootstrap_data", "SNPs/" + name)
	PS.importSNPs(path)
1152539
function addImportToGraph(importId, parentId, graph, visited) {
  const siblingsId = parentId + '_' + 'siblings'
  const visitedId = parentId + '_' + importId

  if (visited[visitedId] !== VISITED_MARKER) {
    if (!Array.isArray(visited[siblingsId])) visited[siblingsId] = []

    const siblings = visited[siblingsId]

    if (Array.isArray(graph[importId]))
      graph[importId] = graph[importId].concat(siblings)
    else graph[importId] = siblings.slice()

    visited[visitedId] = VISITED_MARKER
    siblings.push(importId)
  }
}
952928
public void addImportedPackages(String[] imports) {
        if (imports == null) { return; }

        for (String imported : imports) {
            this.mImports.add(imported);
        }
    }