class_docstr: Parse a requirement.
  
  Parse a given requirement string into its parts, such as name, specifier,
  URL, and extras. Raises InvalidRequirement on a badly-formed requirement
  string.
code: def __init__(self, requirement_string):
      try:
          req = REQUIREMENT.parseString(requirement_string)
      except ParseException as e:
          raise InvalidRequirement(
              'Parse error at "{0!r}": {1}'.format(
                  requirement_string[e.loc : e.loc + 8], e.msg
              )
          )
  
      self.name = req.name
      if req.url:
          parsed_url = urlparse.urlparse(req.url)
          if parsed_url.scheme == "file":
              if urlparse.urlunparse(parsed_url) != req.url:
                  raise InvalidRequirement("Invalid URL given")
          elif not (parsed_url.scheme and parsed_url.netloc) or (
              not parsed_url.scheme and not parsed_url.netloc
          ):
              raise InvalidRequirement(
                  "Invalid URL: {0}".format(req.url)
              )
          self.url = req.url
      else:
          self.url = None
      self.extras = set(req.extras.asList() if req.extras else [])
      self.specifier = SpecifierSet(req.specifier)
      self.marker = req.marker if req.marker else None
  
file_path: catboost/contrib/python/setuptools/py2/setuptools/_vendor/packaging/requirements.py
imports: from __future__ import absolute_import, division, print_function
  import string
  import re
  from setuptools.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
  from setuptools.extern.pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
  from setuptools.extern.pyparsing import Literal
  from setuptools.extern.six.moves.urllib import parse
  from .markers import MARKER_EXPR, Marker
  from .specifiers import LegacySpecifier, Specifier, SpecifierSet
label_desc: Use image node_id 1 to create a new Requirement object from inherited base classes: object with example: obj = Requirement(requirement_string)