You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/pkginfo/index.py

16 lines
518 B

from .distribution import Distribution
class Index(dict):
def __setitem__(self, key, value):
if not isinstance(value, Distribution):
raise ValueError('Not a distribution: %r.' % value)
if key != '%s-%s' % (value.name, value.version):
raise ValueError('Key must match <name>-<version>.')
super(Index, self).__setitem__(key, value)
def add(self, distribution):
key = '%s-%s' % (distribution.name, distribution.version)
self[key] = distribution