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.
class_docstr_tok: ["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 __str__(self) -> str:
      parts: List[str] = [self.name]
  
      if self.extras:
          formatted_extras = ",".join(sorted(self.extras))
          parts.append(f"[{formatted_extras}]")
  
      if self.specifier:
          parts.append(str(self.specifier))
  
      if self.url:
          parts.append(f"@ {self.url}")
          if self.marker:
              parts.append(" ")
  
      if self.marker:
          parts.append(f"; {self.marker}")
  
      return "".join(parts)
  
file_path: metaflow/metaflow/_vendor/packaging/requirements.py
imports: import urllib.parse
  from typing import Any, List, Optional, Set
  from ._parser import parse_requirement
  from ._tokenizer import ParserSyntaxError
  from .markers import Marker, _normalize_extra_values
  from .specifiers import SpecifierSet
label_desc: Use image node_id 2 for calling the Requirement obj's underlying member method code with example usage: obj.__str__() and returns: str