generate loader string to be used with extract text plugin
14742
function generateLoaders (loaders) {
    const sourceLoader = loaders.map(function (loader) {
      let extraParamChar
      if (/\?/.test(loader)) {
        loader = loader.replace(/\?/, '-loader?')
        extraParamChar = '&'
      } else {
        loader = loader + '-loader'
        extraParamChar = '?'
      }
      return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
    }).join('!')

    // Extract CSS when that option is specified
    // (which is the case during production build)
    if (options.extract) {
      return ExtractTextPlugin.extract({
        use: sourceLoader,
        fallback: 'vue-style-loader'
      })
    } else {
      return ['vue-style-loader', sourceLoader].join('!')
    }
  }
1331162
def gen_url_regex(resource):
    "  "

    if resource._meta.parent:
        yield resource._meta.parent._meta.url_regex.rstrip('/$').lstrip('^')

    for p in resource._meta.url_params:
        yield '%(name)s/(?P<%(name)s>[^/]+)' % dict(name=p)

    if resource._meta.prefix:
        yield resource._meta.prefix

    yield '%(name)s/(?P<%(name)s>[^/]+)?' % dict(name=resource._meta.name)
504884
function Plugin(regexp, replacer, id) {
    // return value should be a callable function
    // with strictly defined options passed by markdown-it
    var self = function(md, options) {
        self.options = options;
        self.init(md);
    };

    // initialize plugin object
    self.__proto__ = Plugin.prototype;

    // clone regexp with all the flags
    var flags = (regexp.global ? 'g' : '') + (regexp.multiline ? 'm' : '') + (regexp.ignoreCase ? 'i' : '');

    self.regexp = RegExp('^' + regexp.source, flags);

    // copy init options
    self.replacer = replacer;

    // this plugin can be inserted multiple times,
    // so we're generating unique name for it
    self.id = id ? id : 'regexp-' + counter;
    counter++;

    return self;
}
987612
def generate_lines(text, ext=['.txt', '.md', '.rst', '.asciidoc', '.asc']):
    
    """

    if isinstance(text, basestring):
        if len(text) <= 256:
            if os.path.isfile(text) and os.path.splitext(text)[-1].lower() in ext:
                return open(text)
            elif os.path.isdir(text):
                return chain.from_iterable(generate_lines(stat['path']) for stat in find_files(text, ext=ext))
            else:
                return (line for line in Split(text=text))
        else:
            return Split(text=text)
    return chain.from_iterable(generate_lines(obj) for obj in text)
835984
def select_template_from_string(arg):
    
    if ',' in arg:
        tpl = loader.select_template(
            [tn.strip() for tn in arg.split(',')])
    else:
        tpl = loader.get_template(arg)
    return tpl
976194
function attacher (retext, options) {
  return function transformer (cst, file, next) {
    var textlint = new TextLintEngine(options)
    var result = textlint.executeOnText(toString(cst))

    if (result) {
      var messages = result[0].messages

      for (var index = 0; index < messages.length; index++) {
        var msg = messages[index]
        var msgText = '"' + msg.ruleId + '" ' + msg.message

        if (msg.severity === 1) {
          file.warn(msgText, {line: msg.line, column: msg.column})
        } else if (msg.severity === 2) {
          file.fail(msgText, {line: msg.line, column: msg.column})
        }
      }
    }

    next()
  }
}
120397
def _load_plugin(self, plugin_script, args=None, config=None):
        """"""
        # The key is the plugin name
        # for example, the file glances_xxx.py
        # generate self._plugins_list["xxx"] = ...
        name = plugin_script[len(self.header):-3].lower()
        try:
            # Import the plugin
            plugin = __import__(plugin_script[:-3])
            # Init and add the plugin to the dictionary
            if name in ('help', 'amps', 'ports', 'folders'):
                self._plugins[name] = plugin.Plugin(args=args, config=config)
            else:
                self._plugins[name] = plugin.Plugin(args=args)
            # Set the disable_<name> to False by default
            if self.args is not None:
                setattr(self.args,
                        'disable_' + name,
                        getattr(self.args, 'disable_' + name, False))
        except Exception as e:
            # If a plugin can not be log, display a critical message
            # on the console but do not crash
            logger.critical("Error while initializing the {} plugin ({})".format(name, e))
            logger.error(traceback.format_exc())
1247101
function(text, base, map) {
    var matches = this.loader.extractUrls(text, base);
    var match, url, intermediate;
    for (var i = 0; i < matches.length; i++) {
      match = matches[i];
      url = match.url;
      // resolve any css text to be relative to the importer, keep absolute url
      intermediate = urlResolver.resolveCssText(map[url], url, true);
      // flatten intermediate @imports
      intermediate = this.flatten(intermediate, base, map);
      text = text.replace(match.matched, intermediate);
    }
    return text;
  }
167688
def load_version_as_string():
    """"""
    with open(VERSION_PATH, 'r') as rfile:
        contents = rfile.read().strip()

    _, version = contents.split('=')
    version = version.strip()

    # Remove quotes
    return version.strip('"\'')
782822
function Loader(regex) {
    this.cache = Object.create(null);
    this.map = Object.create(null);
    this.requests = 0;
    this.regex = regex;
  }
1344843
def to_javascript_data(plugins):
    

    def escape(v):
        return re.sub(r'"', r'\\"', v)

    def dom_matchers(p):
        dom_matchers = p.get_matchers('dom')
        escaped_dom_matchers = []

        for dm in dom_matchers:
            check_statement, version_statement = dm

            escaped_dom_matchers.append({
                'check_statement': escape(check_statement),
                # Escape '' and not None
                'version_statement': escape(version_statement or ''),
            })

        return escaped_dom_matchers

    return [{'name': p.name, 'matchers': dom_matchers(p)}
            for p in plugins.with_dom_matchers()]
317597
function gulpGettextConv({
  determineLocale = defDetermineLocale,
  gettextFormat = 'po',
  ...options
} = {}) {
  // creating a stream through which each file will pass
  return through.obj(function (file, enc, cb) {
    if (file.isNull()) {
      this.push(file);
      return cb();
    }

    let converter;
    let ext;

    try {
      [converter, ext] = getConverter(file, gettextFormat);
    } catch (err) {
      return cb(err);
    }

    return vinylToString(file, enc)
      .then((contents) => {
        try {
          const domain = determineLocale(file.relative, contents);
          return converter(domain, contents, options);
        } catch (e) {
          throw new PluginError(PLUGIN_NAME, 'determineLocale failed', { showStack: true });
        }
      })
      .then((data) => {
        const dirname = path.dirname(file.path);
        const basename = path.basename(file.path, path.extname(file.path));

        Object.assign(file, {
          path: path.join(dirname, `${basename}${ext}`),
          contents: getContents(file, data),
        });

        // make sure the file goes through the next gulp plugin
        this.push(file);
        cb();
      })
      .catch((err) => {
        cb(new PluginError(PLUGIN_NAME, err.message));
      });
  });
}
261858
async function generatePackageData() {
  boltPackages.forEach(async pkg => {
    if (pkg.version !== '0.0.0' && pkg.private !== true) {
      const name = pkg.name;
      try {
        const pkgInfo = await packageJson(name, {
          allVersions: true,
        });

        processedPackages.push(pkgInfo);
        numberOfPackagesProcessed += 1;
      } catch (err) {
        console.log(err);
      }
    } else {
      numberOfPackagesProcessed += 1;
    }

    if (numberOfPackagesProcessed === totalNumberOfPackages) {
      const config = await getConfig();
      const unformattedJSON = JSON.stringify(processedPackages);
      const formattedJSON = prettier.format(unformattedJSON, {
        parser: 'json',
      });

      fs.writeFile(
        path.join(config.dataDir, 'bolt-pkg-versions.json'),
        formattedJSON,
        'utf8',
        function(err) {
          if (err) {
            console.log('An error occured while writing JSON Object to File.');
            return console.log(err);
          }

          console.log('Bolt NPM pkg Data has been saved.');
        },
      );
    }
  });
}
640479
def plugin(tree, file_tokens):
    """"""
    for token in file_tokens:
        if token[0] != STRING:  # token[0] == token.type
            continue
        # token[1] == token.string # python 3
        invalid_sequence_match = invalid_escape_sequence_match(token[1])
        if invalid_sequence_match:
            yield (
                token[2][0],  # line_number
                token[2][1],  # offset
                'IES: invalid escape sequence %s' %
                invalid_sequence_match.group(1),  # text
                None  # check # unused
            )
1024312
def load(self):
        
        print("[DEBUG] Loading plugin {} from {}".format(self.name,
                                                         self.source))
        import pydoc
        path, attr = self.source.split(":")
        module = pydoc.locate(path)
        return getattr(module, attr)
508035
def _get_extension_loader_mapping(self):
        

        loader_table = self._get_common_loader_mapping()
        loader_table.update(
            {
                "asp": HtmlTableTextLoader,
                "aspx": HtmlTableTextLoader,
                "htm": HtmlTableTextLoader,
                "md": MarkdownTableTextLoader,
                "sqlite3": SqliteFileLoader,
                "xls": ExcelTableFileLoader,
                "xlsx": ExcelTableFileLoader,
            }
        )

        return loader_table
926168
def generate_loader(self, mapfile, names):
        
        return self.build_template(mapfile, names, self._loaddata_template)