File: indexes.rst

package info (click to toggle)
python-pkginfo 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 416 kB
  • ctags: 354
  • sloc: python: 1,487; makefile: 76
file content (26 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Distribution Indexes
=====================

An ``Index`` is conceptually a set of ``Distribution`` objects, with some
additional behavior for managing the set as a whole.

.. doctest::

  >>> from pkginfo import Distribution
  >>> from pkginfo import Index
  >>> index = Index()
  >>> list(index)
  []
  >>> d1 = Distribution()
  >>> d1.name = 'foo'
  >>> d1.version = '1.0'
  >>> index.add(d1)
  >>> list(index)
  ['foo-1.0']
  >>> d2 = Distribution()
  >>> d2.name = 'foo'
  >>> d2.version = '1.1'
  >>> index.add(d2)
  >>> sorted(list(index))
  ['foo-1.0', 'foo-1.1']