python (3.11.7)

(root)/
lib/
python3.11/
site-packages/
pip/
_internal/
models/
selection_prefs.py
       1  from typing import Optional
       2  
       3  from pip._internal.models.format_control import FormatControl
       4  
       5  
       6  class ESC[4;38;5;81mSelectionPreferences:
       7      """
       8      Encapsulates the candidate selection preferences for downloading
       9      and installing files.
      10      """
      11  
      12      __slots__ = [
      13          "allow_yanked",
      14          "allow_all_prereleases",
      15          "format_control",
      16          "prefer_binary",
      17          "ignore_requires_python",
      18      ]
      19  
      20      # Don't include an allow_yanked default value to make sure each call
      21      # site considers whether yanked releases are allowed. This also causes
      22      # that decision to be made explicit in the calling code, which helps
      23      # people when reading the code.
      24      def __init__(
      25          self,
      26          allow_yanked: bool,
      27          allow_all_prereleases: bool = False,
      28          format_control: Optional[FormatControl] = None,
      29          prefer_binary: bool = False,
      30          ignore_requires_python: Optional[bool] = None,
      31      ) -> None:
      32          """Create a SelectionPreferences object.
      33  
      34          :param allow_yanked: Whether files marked as yanked (in the sense
      35              of PEP 592) are permitted to be candidates for install.
      36          :param format_control: A FormatControl object or None. Used to control
      37              the selection of source packages / binary packages when consulting
      38              the index and links.
      39          :param prefer_binary: Whether to prefer an old, but valid, binary
      40              dist over a new source dist.
      41          :param ignore_requires_python: Whether to ignore incompatible
      42              "Requires-Python" values in links. Defaults to False.
      43          """
      44          if ignore_requires_python is None:
      45              ignore_requires_python = False
      46  
      47          self.allow_yanked = allow_yanked
      48          self.allow_all_prereleases = allow_all_prereleases
      49          self.format_control = format_control
      50          self.prefer_binary = prefer_binary
      51          self.ignore_requires_python = ignore_requires_python