Read contents of requirements.txt file and return data from its relevant lines.

    Only non-empty and non-comment lines are relevant.
332020
def parse_requirements(
        requirements_path: str = 'requirements.txt') -> t.List[str]:
    
    requirements = []
    with HERE.joinpath(requirements_path).open() as reqs_file:
        for requirement in [line.strip() for line in reqs_file.read().splitlines()]:
            if not requirement or requirement.startswith('#'):
                continue
            requirements.append(requirement)
    return requirements
541004
def parse_agent_req_file(contents):
    
    catalog = OrderedDict()
    for line in contents.splitlines():
        toks = line.split('==', 1)
        if len(toks) != 2 or not toks[0] or not toks[1]:
            # if we get here, the requirements file is garbled but let's stay
            # resilient
            continue

        name, other = toks
        version = other.split(';')
        catalog[name] = version[0]

    return catalog
1218191
def pip(filename):
    ''''''
    path = join('requirements', filename)
    return [line for line in open(path).readlines() if not line.startswith('-e')]
404812
def read_from_file(self, filename):
        
        if not exists(filename):
            return -1
        with open(filename) as fd:
            needs_json = fd.read()
            try:
                minimum_needs = json.loads(needs_json)
            except (TypeError, ValueError):
                minimum_needs = None

        if not minimum_needs:
            return -1

        return self.update_minimum_needs(minimum_needs)
1324892
def requirements():
  """"""
  requirements_list = []
  with open('requirements.txt') as requirements:
    for install in requirements:
      requirements_list.append(install.strip())
  return requirements_list
556983
def parse_requirements(file_name):
    
    requirements = []
    with open(file_name, 'r') as f:
        for line in f:
            if re.match(r'(\s*#)|(\s*$)', line): continue
            if re.match(r'\s*-e\s+', line):
                requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$',\
                        r'\1', line).strip())
            elif re.match(r'\s*-f\s+', line):
                pass
            else:
                requirements.append(line.strip())
    return requirements
730662
def parse_requirements(filename):
    
    lineiter = (line.strip() for line in open(filename))
    return (line for line in lineiter if line and not line.startswith("#"))
614636
def get_requires():
    """"""
    requirements = open("requirements.txt", "r").read()
    return list(filter(lambda x: x != "", requirements.split()))
773596
def main(requirements_file, skip_requirements_file, pipfile, skip_pipfile):
    # type: (str, bool, str, bool) -> None
    """"""
    pipfile_path = path.Path(pipfile)
    pf = load_pipfile(pipfile_path)

    if not skip_requirements_file:
        requirements_file_path = path.Path(requirements_file)
        update_requirements(requirements_file_path, pf)

    if not skip_pipfile:
        dump_pipfile(pipfile_path, pf)
298612
def get_file_content(url, comes_from=None):
    """"""
    match = _scheme_re.search(url)
    if match:
        scheme = match.group(1).lower()
        if (scheme == 'file' and comes_from
            and comes_from.startswith('http')):
            raise InstallationError(
                'Requirements file %s references URL %s, which is local'
                % (comes_from, url))
        if scheme == 'file':
            path = url.split(':', 1)[1]
            path = path.replace('\\', '/')
            match = _url_slash_drive_re.match(path)
            if match:
                path = match.group(1) + ':' + path.split('|', 1)[1]
            path = urllib.unquote(path)
            if path.startswith('/'):
                path = '/' + path.lstrip('/')
            url = path
        else:
            ## FIXME: catch some errors
            resp = urlopen(url)
            return geturl(resp), resp.read()
    try:
        f = open(url)
        content = f.read()
    except IOError:
        e = sys.exc_info()[1]
        raise InstallationError('Could not open requirements file: %s' % str(e))
    else:
        f.close()
    return url, content
981353
def parse_requirements(path):
    
    try:
        print(os.path.join(os.path.dirname(__file__), *path.splitlines()))
        requirements = map(str.strip, local_file(path).splitlines())
    except IOError:
        raise RuntimeError("Couldn't find the `requirements.txt' file :(")

    links = []
    pkgs = []
    for req in requirements:
        if not req:
            continue
        if 'http:' in req or 'https:' in req:
            links.append(req)
            name, version = re.findall("\#egg=([^\-]+)-(.+$)", req)[0]
            pkgs.append('{0}=={1}'.format(name, version))
        else:
            pkgs.append(req)

    return pkgs, links
739826
def read_lines(in_file):
    """"""

    with open(in_file, 'r') as inf:
        in_contents = inf.read().split('\n')
    return in_contents
341284
def get_requirements(filename=None):
    
    if filename is None:
        filename = 'requirements.txt'

    file = WORK_DIR / filename

    install_reqs = parse_requirements(str(file), session='hack')
    return [str(ir.req) for ir in install_reqs]
98924
def read_requirements(*parts):
    
    requirements = []
    for line in read(*parts).splitlines():
        new_line = re.sub(r'(\s*)?#.*$',  # the space immediately before the
                                          # hash mark, the hash mark, and
                                          # anything that follows it
                          '',  # replace with a blank string
                          line)
        if new_line:  # i.e. we have a non-zero-length string
            requirements.append(new_line)
    return requirements
535276
def get_requirement_files(args=None):
    
    if args and args.input_filename:
        return [args.input_filename]

    paths = []
    for regex in settings.REQUIREMENTS_SOURCE_GLOBS:
        paths.extend(glob.glob(regex))
    return paths
1018253
def parse(requirements):
    
    transformer = RTransformer()
    return map(transformer.transform, filter(None, map(_parse, requirements.splitlines())))
1298950
def _parse_requirements(self, input):
        

        results = []

        for line in input:
            (package, version) = self._parse_line(line)
            if package:
                results.append((package, version))

        return tuple(results)