Parse requirements file
553107
def pip(name):
    ''''''
    with io.open(os.path.join('requirements', '{0}.pip'.format(name))) as f:
        return f.readlines()
1161948
def get_requirements():
    ''''''
    packages = []
    with open("requirements.txt", "r") as req_doc:
        for package in req_doc:
            packages.append(package.replace("\n", ""))
    return packages
1175034
def parse_pip_requirements(requirement_file_path):
    
    return sorted(
        str(r.req)
        for r in parse_requirements(requirement_file_path,
                                    session=PipSession())
        if r.req
    )
1324892
def requirements():
  """"""
  requirements_list = []
  with open('requirements.txt') as requirements:
    for install in requirements:
      requirements_list.append(install.strip())
  return requirements_list
248757
def _build_from_requirements(cls, req_spec):
        
        # try it without defaults already on sys.path
        # by starting with an empty path
        ws = cls([])
        reqs = parse_requirements(req_spec)
        dists = ws.resolve(reqs, Environment())
        for dist in dists:
            ws.add(dist)

        # add any missing entries from sys.path
        for entry in sys.path:
            if entry not in ws.entries:
                ws.add_entry(entry)

        # then copy back to sys.path
        sys.path[:] = ws.entries
        return ws
577387
def parse_requirements(fname='requirements.txt'):
    
    from os.path import dirname, join, exists
    import re
    require_fpath = join(dirname(__file__), fname)
    # This breaks on pip install, so check that it exists.
    if exists(require_fpath):
        with open(require_fpath, 'r') as f:
            packages = []
            for line in f.readlines():
                line = line.strip()
                if line and not line.startswith('#'):
                    if line.startswith('-e '):
                        package = line.split('#egg=')[1]
                        packages.append(package)
                    else:
                        pat = '|'.join(['>', '>=', '=='])
                        package = re.split(pat, line)[0]
                        packages.append(package)
            return packages
    return []
964721
function parseApiFile(file) {
  const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
  const fileContent = fs.readFileSync(file, { encoding: 'utf8' });
  const ext = path.extname(file);
  const yaml = [];
  const jsDocComments = [];

  if (ext === '.yaml' || ext === '.yml') {
    yaml.push(jsYaml.safeLoad(fileContent));
  } else {
    const regexResults = fileContent.match(jsDocRegex);
    if (regexResults) {
      for (let i = 0; i < regexResults.length; i += 1) {
        const jsDocComment = doctrine.parse(regexResults[i], { unwrap: true });
        jsDocComments.push(jsDocComment);
      }
    }
  }

  return {
    yaml,
    jsdoc: jsDocComments,
  };
}
1018253
def parse(requirements):
    
    transformer = RTransformer()
    return map(transformer.transform, filter(None, map(_parse, requirements.splitlines())))
131463
def read_requirements(filename):
    
    data = []
    for line in read_file(filename):
        line = line.strip()
        if not line or line.startswith('#'):
            continue

        if '+' in line[:4]:
            repo_link, egg_name = line.split('#egg=')
            if not egg_name:
                raise ValueError('Unknown requirement: {0}'
                                    .format(line))

            DEPENDENCY_LINKS.append(line)

            line = egg_name

        data.append(line)

    return data
193386
def parse_requirements(requirements_filename):
    
    dependencies, dependency_links = [], []
    requirements_dir = os.path.dirname(requirements_filename)
    with open(requirements_filename, 'r') as stream:
        for line in stream:
            line = line.strip()
            if line.startswith("-r"):
                filename = os.path.join(requirements_dir, line[2:].strip())
                _dependencies, _dependency_links = parse_requirements(filename)
                dependencies.extend(_dependencies)
                dependency_links.extend(_dependency_links)
            elif line.startswith("http"):
                dependency_links.append(line)
            else:
                package = line.split('#')[0]
                if package:
                    dependencies.append(package)
    return dependencies, dependency_links
998374
def get_requirements(*args):
    """"""
    requirements = set()
    with open(get_absolute_path(*args)) as handle:
        for line in handle:
            # Strip comments.
            line = re.sub(r'^#.*|\s#.*', '', line)
            # Ignore empty lines
            if line and not line.isspace():
                requirements.add(re.sub(r'\s+', '', line))
    return sorted(requirements)
1358530
def check_requirements(dist, attr, value):
    """"""
    try:
        list(pkg_resources.parse_requirements(value))
    except (TypeError,ValueError):
        raise DistutilsSetupError(
            "%r must be a string or list of strings "
            "containing valid project/version requirement specifiers" % (attr,)
        )
84562
def parse_yaml_config(yaml_config, repo_home):
    """"""
    config = collections.defaultdict(list)

    variables = {
        'DEFAULT_CONFIGS': os.path.join(os.path.dirname(__file__), 'configs'),
        'REPO_HOME': repo_home,
    }

    for name, data in yaml_config.items():
        command = _replace_variables([data['command']], variables)[0]
        requirements = _replace_variables(
            data.get('requirements', []), variables)
        arguments = _replace_variables(data.get('arguments', []), variables)

        not_found_programs = utils.programs_not_in_path([command] +
                                                        requirements)
        if not_found_programs:
            linter_command = Partial(missing_requirements_command,
                                     not_found_programs, data['installation'])
        else:
            linter_command = Partial(lint_command, name, command, arguments,
                                     data['filter'])
        for extension in data['extensions']:
            config[extension].append(linter_command)

    return config
851396
def pip_install_requirements(requirements, constraints=None, **options):
    
    command = ["install"]

    available_options = ('proxy', 'src', 'log', )
    for option in parse_options(options, available_options):
        command.append(option)

    command.append("-r {0}".format(requirements))
    if constraints:
        command.append("-c {0}".format(constraints))
        log("Installing from file: {} with constraints {} "
            "and options: {}".format(requirements, constraints, command))
    else:
        log("Installing from file: {} with options: {}".format(requirements,
                                                               command))
    pip_execute(command)
663670
def parse_requirements(filename):
    
    with open(filename, 'r') as f:
        lineiter = list(line.strip() for line in f)
    return [line for line in lineiter if line and not line.startswith("#")]
747388
def parse_reqs(filename):
    """"""
    install_reqs = parse_requirements(filename, session=False)
    return [str(ir.req) for ir in install_reqs]
504403
def parse(self, fail_callback=None):
        
        # get text fields
        for field in self.field_arguments:
            self.values[field['name']] = self.__get_value(field['name'])
            if self.values[field['name']] is None and field['required']:
                if fail_callback is not None:
                    fail_callback()
                self.__invalid_request(field['error'])
        # get file fields
        for file in self.file_arguments:
            self.files[file['name']] = self.__get_file(file)
            if self.files[file['name']] is None and file['required']:
                if fail_callback is not None:
                    fail_callback()
                self.__invalid_request(file['error'])