D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
python35
/
lib
/
python3.5
/
site-packages
/
pip
/
_internal
/
models
/
Filename :
format_control.py
back
Copy
# The following comment should be removed at some point in the future. # mypy: strict-optional=False from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import CommandError from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Optional, Set, FrozenSet class FormatControl(object): """Helper for managing formats from which a package can be installed. """ def __init__(self, no_binary=None, only_binary=None): # type: (Optional[Set[str]], Optional[Set[str]]) -> None if no_binary is None: no_binary = set() if only_binary is None: only_binary = set() self.no_binary = no_binary self.only_binary = only_binary def __eq__(self, other): # type: (object) -> bool return self.__dict__ == other.__dict__ def __ne__(self, other): # type: (object) -> bool return not self.__eq__(other) def __repr__(self): # type: () -> str return "{}({}, {})".format( self.__class__.__name__, self.no_binary, self.only_binary ) @staticmethod def handle_mutual_excludes(value, target, other): # type: (str, Optional[Set[str]], Optional[Set[str]]) -> None if value.startswith('-'): raise CommandError( "--no-binary / --only-binary option requires 1 argument." ) new = value.split(',') while ':all:' in new: other.clear() target.clear() target.add(':all:') del new[:new.index(':all:') + 1] # Without a none, we want to discard everything as :all: covers it if ':none:' not in new: return for name in new: if name == ':none:': target.clear() continue name = canonicalize_name(name) other.discard(name) target.add(name) def get_allowed_formats(self, canonical_name): # type: (str) -> FrozenSet[str] result = {"binary", "source"} if canonical_name in self.only_binary: result.discard('source') elif canonical_name in self.no_binary: result.discard('binary') elif ':all:' in self.only_binary: result.discard('source') elif ':all:' in self.no_binary: result.discard('binary') return frozenset(result) def disallow_binaries(self): # type: () -> None self.handle_mutual_excludes( ':all:', self.no_binary, self.only_binary, )
Name
Size
Last Modified
Owner
Permissions
Actions
__pycache__
Dir
April 29 2020 6:57:11
root
0755
__init__.py
0.062
KB
April 29 2020 6:57:10
root
0755
candidate.py
1.123
KB
April 29 2020 6:57:10
root
0755
direct_url.py
6.738
KB
April 29 2020 6:57:10
root
0755
format_control.py
2.61
KB
April 29 2020 6:57:10
root
0755
index.py
1.035
KB
April 29 2020 6:57:10
root
0755
link.py
7.131
KB
April 29 2020 6:57:10
root
0755
scheme.py
0.663
KB
April 29 2020 6:57:10
root
0755
search_scope.py
4.602
KB
April 29 2020 6:57:10
root
0755
selection_prefs.py
1.863
KB
April 29 2020 6:57:10
root
0755
target_python.py
3.752
KB
April 29 2020 6:57:10
root
0755
wheel.py
2.707
KB
April 29 2020 6:57:10
root
0755
2017 © D7net | D704T team