Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
181371
def setuptools_parse_requirements_backport(strs):  # pragma: no cover
    # Copyright (C) 2016 Jason R Coombs <jaraco@jaraco.com>
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy of
    # this software and associated documentation files (the "Software"), to deal in
    # the Software without restriction, including without limitation the rights to
    # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    # of the Software, and to permit persons to whom the Software is furnished to do
    # so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in all
    # copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.
    
    # create a steppable iterator, so we can handle \-continuations
    def yield_lines(strs):
        """Yield non-empty/non-comment lines of a string or sequence"""
        if isinstance(strs, six.string_types):
            for s in strs.splitlines():
                s = s.strip()
                # skip blank lines/comments
                if s and not s.startswith('#'):
                    yield s
        else:
            for ss in strs:
                for s in yield_lines(ss):
                    yield s
    lines = iter(yield_lines(strs))

    for line in lines:
        # Drop comments -- a hash without a space may be in a URL.
        if ' #' in line:
            line = line[:line.find(' #')]
        # If there is a line continuation, drop it, and append the next line.
        if line.endswith('\\'):
            line = line[:-2].strip()
            line += next(lines)
        yield PackagingRequirement(line)
1020735
def iteritems(cls):
        
        for key in dir(cls):
            val = getattr(cls, key)
            if isinstance(cls, val):
                yield (key, val)
833660
def get_requires(path=REQUIRE_PATH):
    
    for line in read(path).splitlines():
        line = line.strip()
        if line and not line.startswith('#'):
            yield line
1337142
def iter_slices(string, slice_length):
    """"""
    pos = 0
    if slice_length is None or slice_length <= 0:
        slice_length = len(string)
    while pos < len(string):
        yield string[pos:pos + slice_length]
        pos += slice_length
1222627
def requirements_from_file(filename):
    """"""
    return [line.strip() for line in open(filename, 'r')
            if line.strip() and not line.strip().startswith('--')]
591702
def require_iterable_of(objs, types, name=None, type_name=None, truncate_at=80):
    
    # Fast pass for common case where all types are correct.
    # This avoids the more expensive loop below. A typical speedup from this
    # optimization is 6.6 sec -> 1.7 sec, for testing a list of size 10,000,000.
    try:
        if all(isinstance(obj, types) for obj in objs):
            return
    except TypeError:
        # We don't require that objs is a list in this function, just that it's
        # iterable. We specify 'list' below as a convenient way to throw the
        # desired error.
        require_instance(objs, list, name, "iterable", truncate_at)

    # Some type isn't correct. We reuse the require_instance function to raise
    # the exception.
    prefix = ("%s: " % name) if name else ""
    for (i, obj) in enumerate(objs):
        element_name = prefix + ("element at index %d" % i)
        require_instance(obj, types, element_name, type_name, truncate_at)
    assert False, "Shouldn't reach here."
598113
def output(self,delimiter = '\t', freqlist = None):
        """"""
        for type, prob in self:
            if freqlist:
                if isinstance(type,list) or isinstance(type, tuple):
                    yield " ".join(type) + delimiter + str(freqlist[type]) + delimiter + str(prob)
                else:
                    yield type + delimiter + str(freqlist[type]) + delimiter + str(prob)
            else:
                if isinstance(type,list) or isinstance(type, tuple):
                    yield " ".join(type) + delimiter + str(prob)
                else:
                    yield type + delimiter + str(prob)
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
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
22564
def requirements(section=None):
    """"""
    if section is None:
        filename = "requirements.txt"
    else:
        filename = f"requirements-{section}.txt"

    with open(filename) as file:
        return [line.strip() for line in file]
379318
def AsIter(arg):
  """"""
  if isinstance(arg, string_types):
    rslt = [arg]
  elif isinstance(arg, collections.Iterable):
    rslt = arg
  elif not arg:
    rslt = []
  else:
    rslt = [arg]
  return tuple(rslt)
679605
def refine (properties, requirements):
    
    assert is_iterable_typed(properties, Property)
    assert is_iterable_typed(requirements, Property)
    # The result has no duplicates, so we store it in a set
    result = set()

    # Records all requirements.
    required = {}

    # All the elements of requirements should be present in the result
    # Record them so that we can handle 'properties'.
    for r in requirements:
        # Don't consider conditional requirements.
        if not r.condition:
            required[r.feature] = r

    for p in properties:
        # Skip conditional properties
        if p.condition:
            result.add(p)
        # No processing for free properties
        elif p.feature.free:
            result.add(p)
        else:
            if p.feature in required:
                result.add(required[p.feature])
            else:
                result.add(p)

    return sequence.unique(list(result) + requirements)
1299465
def needsEncoding(self, s):
        
        if isinstance(s, str):
            for c in self.special:
                if c in s:
                    return True
        return False
534955
def _string_generator(descriptor, max_length=0, limit=0):
    ''
    vals = list(values.get_strings(max_length, limit))
    return gen.IterValueGenerator(descriptor.name, vals)
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
433618
def str_if_nested_or_str(s):
    """"""
    if isinstance(s, ALL_STRING_TYPES):
        return str(s)
    if isinstance(s, (list, tuple)):
        return type(s)(map(str_if_nested_or_str, s))
    if isinstance(s, (dict, )):
        return stringify_dict_contents(s)
    return s
75260
def parse_requirements() -> Tuple[PackagesType, PackagesType, Set[str]]:
    """"""
    essential_packages: PackagesType = {}
    other_packages: PackagesType = {}
    duplicates: Set[str] = set()
    with open("requirements.txt", "r") as req_file:
        section: str = ""
        for line in req_file:
            line = line.strip()

            if line.startswith("####"):
                # Line is a section name.
                section = parse_section_name(line)
                continue

            if not line or line.startswith("#"):
                # Line is empty or just regular comment.
                continue

            module, version = parse_package(line)
            if module in essential_packages or module in other_packages:
                duplicates.add(module)

            if section.startswith("ESSENTIAL"):
                essential_packages[module] = version
            else:
                other_packages[module] = version

    return essential_packages, other_packages, duplicates