本文整理汇总了Python中pip._internal.utils.hashes.STRONG_HASHES属性的典型用法代码示例。如果您正苦于以下问题:Python hashes.STRONG_HASHES属性的具体用法?Python hashes.STRONG_HASHES怎么用?Python hashes.STRONG_HASHES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pip._internal.utils.hashes
的用法示例。
在下文中一共展示了hashes.STRONG_HASHES属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _merge_hash
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def _merge_hash(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""Given a value spelled "algo:digest", append the digest to a list
pointed to in a dict by the algo name."""
if not parser.values.hashes:
parser.values.hashes = {}
try:
algo, digest = value.split(':', 1)
except ValueError:
parser.error('Arguments to %s must be a hash name '
'followed by a value, like --hash=sha256:abcde...' %
opt_str)
if algo not in STRONG_HASHES:
parser.error('Allowed hash algorithms for %s are %s.' %
(opt_str, ', '.join(STRONG_HASHES)))
parser.values.hashes.setdefault(algo, []).append(digest)
示例2: _handle_merge_hash
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def _handle_merge_hash(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""Given a value spelled "algo:digest", append the digest to a list
pointed to in a dict by the algo name."""
if not parser.values.hashes:
parser.values.hashes = {}
try:
algo, digest = value.split(':', 1)
except ValueError:
parser.error('Arguments to %s must be a hash name '
'followed by a value, like --hash=sha256:abcde...' %
opt_str)
if algo not in STRONG_HASHES:
parser.error('Allowed hash algorithms for %s are %s.' %
(opt_str, ', '.join(STRONG_HASHES)))
parser.values.hashes.setdefault(algo, []).append(digest)
示例3: _merge_hash
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def _merge_hash(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""Given a value spelled "algo:digest", append the digest to a list
pointed to in a dict by the algo name."""
if not parser.values.hashes:
parser.values.hashes = {} # type: ignore
try:
algo, digest = value.split(':', 1)
except ValueError:
parser.error('Arguments to %s must be a hash name '
'followed by a value, like --hash=sha256:abcde...' %
opt_str)
if algo not in STRONG_HASHES:
parser.error('Allowed hash algorithms for %s are %s.' %
(opt_str, ', '.join(STRONG_HASHES)))
parser.values.hashes.setdefault(algo, []).append(digest)
示例4: _handle_merge_hash
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def _handle_merge_hash(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""Given a value spelled "algo:digest", append the digest to a list
pointed to in a dict by the algo name."""
if not parser.values.hashes:
parser.values.hashes = {}
try:
algo, digest = value.split(':', 1)
except ValueError:
parser.error('Arguments to {} must be a hash name '
'followed by a value, like --hash=sha256:'
'abcde...'.format(opt_str))
if algo not in STRONG_HASHES:
parser.error('Allowed hash algorithms for {} are {}.'.format(
opt_str, ', '.join(STRONG_HASHES)))
parser.values.hashes.setdefault(algo, []).append(digest)
示例5: __init__
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def __init__(self, *args, **kw):
super(HashCommand, self).__init__(*args, **kw)
self.cmd_opts.add_option(
'-a', '--algorithm',
dest='algorithm',
choices=STRONG_HASHES,
action='store',
default=FAVORITE_HASH,
help='The hash algorithm to use: one of %s' %
', '.join(STRONG_HASHES))
self.parser.insert_option_group(0, self.cmd_opts)
示例6: _merge_hash
# 需要导入模块: from pip._internal.utils import hashes [as 别名]
# 或者: from pip._internal.utils.hashes import STRONG_HASHES [as 别名]
def _merge_hash(option, opt_str, value, parser):
"""Given a value spelled "algo:digest", append the digest to a list
pointed to in a dict by the algo name."""
if not parser.values.hashes:
parser.values.hashes = {}
try:
algo, digest = value.split(':', 1)
except ValueError:
parser.error('Arguments to %s must be a hash name '
'followed by a value, like --hash=sha256:abcde...' %
opt_str)
if algo not in STRONG_HASHES:
parser.error('Allowed hash algorithms for %s are %s.' %
(opt_str, ', '.join(STRONG_HASHES)))
parser.values.hashes.setdefault(algo, []).append(digest)