Generate the files that contains @import rules on the given tree
183922
function(tree, options) {
      if (!options) {
        options = {
          ext: '.css',
          importFormat: null, // to be initialized just bellow
          encoding: 'utf-8'
        };
      }

      if (!options.ext) {
        options.ext = '.css';
      }

      if (!options.importFormat) {
        if (options.ext === '.css') {
          options.importFormat = function(path) {
            return '@import "' + path + '";';
          };
        } else if (options.ext === '.less') {
          options.importFormat = function(path) {
            return '@import (less) "' + path + '";';
          };
        }
      }

      if (!options.encoding) {
        options.encoding = 'utf-8';
      }

      generate(tree, null, options);
    }
1028123
function tree (dir, opts, cb) {
  var i = 0
  findPackage(dir, function (err, pkg) {
    pull(
      pull.depthFirst(pkg, function (pkg) {
        pkg.tree = {}
        return pull(
          pfs.readdir(path.resolve(pkg.path, 'node_modules')),
          paramap(maybe(readPackage)),
          pull.filter(function (_pkg) {
            if(!_pkg) return
            _pkg.parent = pkg
            
            pkg.tree[_pkg.name] = _pkg
            return pkg
          })
        )
      }),
      opts.post ? paramap(function (data, cb) {
        //run a post install-style hook.
        opts.post(data, cb)
      }) : pull.through(),
      pull.drain(null, function (err) {
        cb(err === true ? null : err, clean(pkg))
      })
    )
  })
}
1023399
protected void ensureImportsChecked(List<JCCompilationUnit> trees) {
        // if there remain any unimported toplevels (these must have
        // no classes at all), process their import statements as well.
        for (JCCompilationUnit tree : trees) {
            if (!tree.starImportScope.isFilled()) {
                Env<AttrContext> topEnv = enter.topLevelEnv(tree);
                finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); });
            }
        }
    }
790780
function(treeType) {
    if (treeType === 'app') {
      let trees = [this.app.trees.app];

      // Push any custom paths onto the trees array
      // to be linted.
      if (this.scssLintOptions.includePaths) {
        trees.push.apply(trees, this.scssLintOptions.includePaths);
      }

      const linted = trees.map(function(tree) {
        const filteredTreeToBeLinted = new Funnel(tree, { exclude: ['**/*.js'] });
        return new ScssLinter(mergeTrees([filteredTreeToBeLinted]), this.scssLintOptions);
      }, this);

      return mergeTrees(linted);
    }
  }
499418
function buildTree(index, api) {
  const modules = {};

  const dependency = (module, parent) => {
    const filepath = api.resolve(module, parent);
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const src = api.getFileContents(module, parent, "utf8");
    const basic = api.parser(src);
    const [nestedImports, hasMemory] = parseImports(basic, api);

    const deps = {};

    Object.keys(nestedImports).forEach(mod => {
      if (mod.indexOf(".") === 0) {
        const dep = dependency(mod, filepath);
        deps[mod] = dep;
      }
    });

    const patched = inferImportTypes(basic, deps, api);
    const ast = api.semantics(patched);

    api.validate(ast, {
      lines: src.split("\n"),
      filename: module.split("/").pop(),
    });

    const result = {
      ast,
      deps,
      filepath,
      hasMemory,
    };
    modules[filepath] = result;

    return result;
  };

  const root = dependency(index, null);

  return {
    root,
    modules,
  };
}
173883
function generateIndex(opts, files, subDir) {
    if (subDir === void 0) { subDir = ''; }
    var shouldExport = opts.export;
    var isES6 = opts.es6;
    var content = '';
    var dirMap = {};
    switch (opts.ext) {
        case 'js':
            content += '/* eslint-disable */\n';
            break;
        case 'ts':
            content += '/* tslint:disable */\n';
            break;
    }
    files.forEach(function (file) {
        var name = path.basename(file).split('.')[0];
        var filePath = getFilePath(opts.sourcePath, file, subDir);
        var dir = filePath.split('/')[0];
        if (dir) {
            if (!dirMap[dir]) {
                dirMap[dir] = [];
                if (shouldExport) {
                    var dirName = camelcase_1.default(dir, {
                        pascalCase: true
                    });
                    content += isES6
                        ? "export * as  " + dirName + " from './" + dir + "'\n"
                        : "module.exports." + dirName + " = require('./" + dir + "')\n";
                }
                else {
                    content += isES6
                        ? "import './" + dir + "'\n"
                        : "require('./" + dir + "')\n";
                }
            }
            dirMap[dir].push(file);
        }
        else {
            if (shouldExport) {
                var fileName = camelcase_1.default(name, {
                    pascalCase: true
                });
                content += isES6
                    ? "export " + fileName + " from './" + filePath + name + "'\n"
                    : "module.exports." + fileName + " = require('./" + filePath + name + "')\n";
            }
            else {
                content += isES6
                    ? "import './" + filePath + name + "'\n"
                    : "require('./" + filePath + name + "')\n";
            }
        }
    });
    fs.writeFileSync(path.join(opts.targetPath, subDir, "index." + opts.ext), content, 'utf-8');
    console.log(colors.green("Generated " + (subDir ? subDir + path.sep : '') + "index." + opts.ext));
    // generate subDir index.js
    for (var dir in dirMap) {
        generateIndex(opts, dirMap[dir], path.join(subDir, dir));
    }
}
550031
def gen_template_files(path):
    "  "

    path = path.rstrip(op.sep)
    for root, _, files in walk(path):
        for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files):
            yield op.relpath(op.join(root, f), path)
816890
protected void generatePackageTreeFile() throws IOException {
        HtmlTree body = getPackageTreeHeader();
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                ? HtmlTree.MAIN()
                : body;
        Content headContent = getResource("doclet.Hierarchy_For_Package",
                utils.getPackageName(packagedoc));
        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                HtmlStyle.title, headContent);
        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
        if (configuration.packages.size() > 1) {
            addLinkToMainTree(div);
        }
        htmlTree.addContent(div);
        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
        divTree.addStyle(HtmlStyle.contentContainer);
        addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
        addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
        addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
        addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
        htmlTree.addContent(divTree);
        if (configuration.allowTag(HtmlTag.MAIN)) {
            body.addContent(htmlTree);
        }
        HtmlTree tree = (configuration.allowTag(HtmlTag.FOOTER))
                ? HtmlTree.FOOTER()
                : body;
        addNavLinks(false, tree);
        addBottom(tree);
        if (configuration.allowTag(HtmlTag.FOOTER)) {
            body.addContent(tree);
        }
        printHtmlDocument(null, true, body);
    }
848170
def _do_import(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name):
        
        i_codestr = None
        if '..' not in name and '://' not in name and 'url(' not in name:  # Protect against going to prohibited places...
            names = name.split(',')
            for name in names:
                name = dequote(name.strip())
                if '@import ' + name not in rule[OPTIONS]:  # If already imported in this scope, skip...
                    try:
                        raise KeyError
                        i_codestr = self._scss_files[name]
                    except KeyError:
                        filename = os.path.basename(name)
                        dirname = os.path.dirname(name)
                        load_paths = []
                        i_codestr = None
                        for path in ['./'] + LOAD_PATHS.split(','):
                            for basepath in ['./', os.path.dirname(rule[PATH])]:
                                i_codestr = None
                                full_path = os.path.realpath(
                                    os.path.join(path, basepath, dirname))
                                if full_path not in load_paths:
                                    try:
                                        full_filename = os.path.join(full_path,
                                                                     '_' + filename + '.scss')
                                        i_codestr = open(full_filename).read()
                                    except:
                                        try:
                                            full_filename = os.path.join(
                                                full_path, filename + '.scss')
                                            i_codestr = open(
                                                full_filename).read()
                                        except:
                                            try:
                                                full_filename = os.path.join(
                                                    full_path, '_' + filename)
                                                i_codestr = open(
                                                    full_filename).read()
                                            except:
                                                try:
                                                    full_filename = os.path.join(
                                                        full_path, filename)
                                                    i_codestr = open(
                                                        full_filename).read()
                                                except:
                                                    pass
                                    if i_codestr is not None:
                                        break
                                    else:
                                        load_paths.append(full_path)
                            if i_codestr is not None:
                                break
                        if i_codestr is None:
                            i_codestr = self._do_magic_import(rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name)
                        i_codestr = self._scss_files[name] = i_codestr and self.load_string(
                            i_codestr, full_filename)
                    if i_codestr is None:
                        log.warn("File to import not found or unreadable: '%s'\nLoad paths:\n\t%s",
                                 filename, "\n\t".join(load_paths))
                    else:
                        _rule = spawn_rule(rule, codestr=i_codestr,
                                           path=full_filename, lineno=c_lineno)
                        self.manage_children(_rule,
                                             p_selectors, p_parents, p_children, scope, media)
                        rule[OPTIONS]['@import ' + name] = True
        else:
            rule[PROPERTIES].append((c_lineno, c_property, None))
459501
def __generate_tree(self, top, src, resources, models, ctrls, views, utils):
        """"""
        res = self.__mkdir(top)
        for fn in (src, models, ctrls, views, utils): res = self.__mkpkg(fn) or res
        res = self.__mkdir(resources) or res
        res = self.__mkdir(os.path.join(resources, "ui", "builder")) or res
        res = self.__mkdir(os.path.join(resources, "ui", "styles")) or res
        res = self.__mkdir(os.path.join(resources, "external")) or res
        return res
784931
function (file, importOptions = {}) {
        var self = this;

        // Step 1: Handle converting the file to usable data
        return this.loadFile(file).then(function (importData) {
            // Step 2: Let the importers pre-process the data
            return self.preProcess(importData);
        }).then(function (importData) {
            // Step 3: Actually do the import
            // @TODO: It would be cool to have some sort of dry run flag here
            return self.doImport(importData, importOptions);
        }).then(function (importData) {
            // Step 4: Report on the import
            return self.generateReport(importData);
        }).finally(() => self.cleanUp()); // Step 5: Cleanup any files
    }
291228
function allImportPaths(contractSource) {
  const noCommentSource = strip.js(String(contractSource));
  const rawImportStatements = execall(/^(\s*)((import)(.*?))("|')(.*?)("|')((;)|((.*?)(;)))$/gm, noCommentSource);
  const importPaths = rawImportStatements
    .map(v => String(execall(/("|')(.*?)("|')/g, v.match)[0].match)
        .replace(/'/g, '')
        .replace(/"/g, '')
        .replace(/^\//, '')
        .replace('./', '')
        .trim());

  return importPaths.filter(path => (path !== 'wafr/Test.sol'));
}
1087829
function getDefaultModules() {
  return {
    rules: [
      {
        test: /\.(ts|tsx)$/,
        include: srcPath,
        loader: 'tslint-loader',
        enforce: 'pre',
        exclude: '/node_modules/'
      },
      {
        test: /\.(ts|tsx)$/,
        include: srcPath,
        loader: 'ts-loader',
        exclude: '/node_modules/'
      },
      {
        test: /\.(js|jsx)$/,
        include: srcPath,
        loader: 'tslint-loader',
        enforce: 'pre',
        exclude: '/node_modules/'
      },
      {
        test: /\.(js|jsx)$/,
        loader: 'babel-loader',
        exclude: '/node_modules/'
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader',
        ]
      },
      {
        test: /\.sass/,
        use: [
          'style-loader',
          'css-loader',
          {
            loader: 'sass-loader',
            options: {
              outputStyle: 'expanded',
              indentedSyntax: true
            }
          }
        ]
      },
      {
        test: /\.scss/,
        use: [
          'style-loader',
          'css-loader',
          {
            loader: 'sass-loader',
            options: {
              outputStyle: 'expanded'
            }
          }
        ]
      },
      {
        test: /\.less/,
        use: [
          'style-loader',
          'css-loader',
          'less-loader'
        ]
      },
      {
        test: /\.styl/,
        use: [
          'style-loader',
          'css-loader',
          'stylus-loader'
        ]
      },
      {
        test: /\.(png|jpg|gif|woff|woff2)$/,
        loader: 'url-loader',
        options: {
          limit: 8192
        }
      },
      {
        test: /\.svg/,
        loader: 'raw-loader',
      },
      {
        test: /\.(mp4|ogg)$/,
        loader: 'file-loader'
      }
    ]
  };
}
1092946
def get_imports(filename, source=None):
  

  if source is None:
    with open(filename, 'rb') as fp:
      source = fp.read()

  module = ast.parse(source, filename)
  result = []

  for node in _find_nodes(module, lambda x: isinstance(x, ast.Import)):
    for alias in node.names:
      result.append(ImportInfo(alias.name, filename, node.lineno))
  for node in _find_nodes(module, lambda x: isinstance(x, ast.ImportFrom)):
    import_name = '.' * node.level + (node.module or '')
    result.append(ImportInfo(import_name, filename, node.lineno))

  result.sort(key=lambda x: x.lineno)
  return result
605521
def handle_import(self, name, compilation, rule):
        
        from .sprites import sprite_map

        # TODO check that the found file is actually under the root
        if callable(config.STATIC_ROOT):
            files = sorted(config.STATIC_ROOT(name))
        else:
            glob_path = os.path.join(config.STATIC_ROOT, name)
            files = glob.glob(glob_path)
            files = sorted((fn[len(config.STATIC_ROOT):], None) for fn in files)

        if not files:
            return

        # Build magic context
        calculator = compilation._make_calculator(rule.namespace)
        map_name = os.path.normpath(os.path.dirname(name)).replace('\\', '_').replace('/', '_')
        kwargs = {}

        # TODO this is all kinds of busted.  rule.context hasn't existed for
        # ages.
        def setdefault(var, val):
            _var = '$' + map_name + '-' + var
            if _var in rule.context:
                kwargs[var] = calculator.interpolate(rule.context[_var], rule, self._library)
            else:
                rule.context[_var] = val
                kwargs[var] = calculator.interpolate(val, rule, self._library)
            return rule.context[_var]

        setdefault('sprite-base-class', String('.' + map_name + '-sprite', quotes=None))
        setdefault('sprite-dimensions', Boolean(False))
        position = setdefault('position', Number(0, '%'))
        spacing = setdefault('spacing', Number(0))
        repeat = setdefault('repeat', String('no-repeat', quotes=None))
        names = tuple(os.path.splitext(os.path.basename(file))[0] for file, storage in files)
        for n in names:
            setdefault(n + '-position', position)
            setdefault(n + '-spacing', spacing)
            setdefault(n + '-repeat', repeat)
        rule.context['$' + map_name + '-' + 'sprites'] = sprite_map(name, **kwargs)
        generated_code = '''
            @import "compass/utilities/sprites/base";

            // All sprites should extend this class
            // The %(map_name)s-sprite mixin will do so for you.
            #{$%(map_name)s-sprite-base-class} {
                background: $%(map_name)s-sprites;
            }

            // Use this to set the dimensions of an element
            // based on the size of the original image.
            @mixin %(map_name)s-sprite-dimensions($name) {
                @include sprite-dimensions($%(map_name)s-sprites, $name);
            }

            // Move the background position to display the sprite.
            @mixin %(map_name)s-sprite-position($name, $offset-x: 0, $offset-y: 0) {
                @include sprite-position($%(map_name)s-sprites, $name, $offset-x, $offset-y);
            }

            // Extends the sprite base class and set the background position for the desired sprite.
            // It will also apply the image dimensions if $dimensions is true.
            @mixin %(map_name)s-sprite($name, $dimensions: $%(map_name)s-sprite-dimensions, $offset-x: 0, $offset-y: 0) {
                @extend #{$%(map_name)s-sprite-base-class};
                @include sprite($%(map_name)s-sprites, $name, $dimensions, $offset-x, $offset-y);
            }

            @mixin %(map_name)s-sprites($sprite-names, $dimensions: $%(map_name)s-sprite-dimensions) {
                @include sprites($%(map_name)s-sprites, $sprite-names, $%(map_name)s-sprite-base-class, $dimensions);
            }

            // Generates a class for each sprited image.
            @mixin all-%(map_name)s-sprites($dimensions: $%(map_name)s-sprite-dimensions) {
                @include %(map_name)s-sprites(%(sprites)s, $dimensions);
            }
        ''' % {'map_name': map_name, 'sprites': ' '.join(names)}

        return SourceFile.from_string(generated_code)
1056343
function convertImports(imports) {
		    	for (var file in imports) {
				    if (imports.hasOwnProperty(file)) {
				        postCssInputs[file] = new Input(imports[file], file !== "input" ? { from: file } : undefined);
				    }
				}
			}
143171
def traverse_imports(names):
    
    pending = [names]
    while pending:
        node = pending.pop()
        if node.type == token.NAME:
            yield node.value
        elif node.type == syms.dotted_name:
            yield "".join([ch.value for ch in node.children])
        elif node.type == syms.dotted_as_name:
            pending.append(node.children[0])
        elif node.type == syms.dotted_as_names:
            pending.extend(node.children[::-2])
        else:
            raise AssertionError("unkown node type")