code: def _parse_requirements(
      strs: Union[str, Iterable[str]]
  ) -> Iterator[_RequirementWithComment]:
      r"""Adapted from `pkg_resources.parse_requirements` to include comments.
  
      >>> txt = ['# ignored', '', 'this # is an', '--piparg', 'example', 'foo # strict', 'thing', '-r different/file.txt']
      >>> [r.adjust('none') for r in _parse_requirements(txt)]
      ['this', 'example', 'foo  # strict', 'thing']
      >>> txt = '\\n'.join(txt)
      >>> [r.adjust('none') for r in _parse_requirements(txt)]
      ['this', 'example', 'foo  # strict', 'thing']
  
      """
      lines = yield_lines(strs)
      pip_argument = None
      for line in lines:
          # Drop comments -- a hash without a space may be in a URL.
          if " #" in line:
              comment_pos = line.find(" #")
              line, comment = line[:comment_pos], line[comment_pos:]
          else:
              comment = ""
          # If there is a line continuation, drop it, and append the next line.
          if line.endswith("\\"):
              line = line[:-2].strip()
              try:
                  line += next(lines)
              except StopIteration:
                  return
          if "@" in line or re.search("https?://", line):
              # skip lines with links like `pesq @ git+https://github.com/ludlows/python-pesq`
              continue
          # If there's a pip argument, save it
          if line.startswith("--"):
              pip_argument = line
              continue
          if line.startswith("-r "):
              # linked requirement files are unsupported
              continue
          yield _RequirementWithComment(
              line, comment=comment, pip_argument=pip_argument
          )
          pip_argument = None
  
file_path: torchmetrics/setup.py
imports: import glob
  import os
  import re
  from functools import partial
  from importlib.util import module_from_spec, spec_from_file_location
  from itertools import chain
  from pathlib import Path
  from typing import Any, Iterable, Iterator, List, Optional, Tuple, Union
  from pkg_resources import Requirement, yield_lines
  from setuptools import find_packages, setup
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_requirements(strs) without return types