class_docstr: This class abstracts handling of version specifiers.
  
  .. tip::
  
      It is generally not required to instantiate this manually. You should instead
      prefer to work with :class:`SpecifierSet` instead, which can parse
      comma-separated version specifiers (which is what package metadata contains).
docstr: Initialize a Specifier instance.
  
  :param spec:
      The string representation of a specifier which will be parsed and
      normalized before use.
  :param prereleases:
      This tells the specifier if it should accept prerelease versions if
      applicable or not. The default of ``None`` will autodetect it from the
      given specifiers.
  :raises InvalidSpecifier:
      If the given specifier is invalid (i.e. bad syntax).
docstr_tok: ["Initialize","a","Specifier","instance",".",":","param","spec",":","The","string","representation","of","a","specifier","which","will","be","parsed","and","normalized","before","use",".",":","param","prereleases",":","This","tells","the","specifier","if","it","should","accept","prerelease","versions","if","applicable","or","not",".","The","default","of","``","None","``","will","autodetect","it","from","the","given","specifiers",".",":","raises","InvalidSpecifier",":","If","the","given","specifier","is","invalid","(","i.e",".","bad","syntax",")","."]
code: def __init__(
      self, spec: str = "", prereleases: Optional[bool] = None
  ) -> None:
      """Initialize a Specifier instance.
  
      :param spec:
          The string representation of a specifier which will be parsed and
          normalized before use.
      :param prereleases:
          This tells the specifier if it should accept prerelease versions if
          applicable or not. The default of ``None`` will autodetect it from the
          given specifiers.
      :raises InvalidSpecifier:
          If the given specifier is invalid (i.e. bad syntax).
      """
      match = self._regex.search(spec)
      if not match:
          raise InvalidSpecifier(f"Invalid specifier: '{spec}'")
  
      self._spec: Tuple[str, str] = (
          match.group("operator").strip(),
          match.group("version").strip(),
      )
  
      # Store whether or not this Specifier should accept prereleases
      self._prereleases = prereleases
  
imports: import abc
  import itertools
  import re
  from typing import Callable, Iterable, Iterator, List, Optional, Set, Tuple, TypeVar, Union
  from .utils import canonicalize_version
  from .version import Version
label_desc: Use image node_id 1 to create a new Specifier object from inherited base classes: BaseSpecifier with example: obj = Specifier(spec, prereleases)