comparison env/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py @ 0:4f3585e2f14b draft default tip

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