Package twisted :: Package protocols :: Module imap4 :: Class MessageSet

[frames | no frames]

## Class MessageSet

    object --+
             |
            MessageSet

Essentially an infinite bitfield, with some extra features.

Method Summary
| ``__init__`(self, start, end)` Create a new MessageSet()
| `__add__(self, other)`
| ``__contains__`(self, value)` May raise TypeError if we encounter unknown "high" values
| `__eq__(self, other)`
| `__iter__(self)`
| `__len__(self)`
| `__repr__(self)`
| `__str__(self)`
| `_iterator(self)`
| ``add`(self, start, end)` Add another range
| ``clean`(self)` Clean ranges list, combining adjacent ranges
| `extend(self, other)`
Inherited from object
| `__delattr__(...)`
| `__getattribute__(...)`
| `__hash__(...)`
| `__reduce__(...)`
| `__setattr__(...)`
Inherited from type
| `__new__(...)`

Property Summary
| `last`: "Highest" message number, refered to by "*".

Instance Variable Summary
Function taking `int` returning `int` | `getnext`: A function that returns the next message number, used when iterating through the MessageSet.

Class Variable Summary
`list` | `_empty` = `[]`

Method Details

### __init__(self, start=[], end=[])
(Constructor)

Create a new MessageSet()

  Parameters:
    `start` - Start of range, or only message number
    (type=Optional `int`)
    `end` - End of range.
    (type=Optional `int`)
  Overrides:
    `__builtin__.object.__init__`

### __contains__(self, value)
(In operator)

May raise TypeError if we encounter unknown "high" values

### add(self, start, end=[])

Add another range

  Parameters:
    `start` - Start of range, or only message number
    (type=`int`)
    `end` - End of range.
    (type=Optional `int`)

### clean(self)

Clean ranges list, combining adjacent ranges

Property Details

### last

"Highest" message number, refered to by "*". Must be set before attempting to use the MessageSet.

  Get Method:
    _getLast(...)
  Set Method:
    _setLast(...)

Instance Variable Details

### getnext

A function that returns the next message number, used when iterating through the MessageSet. By default, a function returning the next integer is supplied, but as this can be rather inefficient for sparse UID iterations, it is recommended to supply one when messages are requested by UID. The argument is provided as a hint to the implementation and may be ignored if it makes sense to do so (eg, if an iterator is being used that maintains its own state, it is guaranteed that it will not be called out-of-order).

  Type:
    Function taking `int` returning `int`

Class Variable Details

### _empty

  Type:
    `list`
  Value:

        []

Generated by Epydoc 2.0 on Sat May 15 20:08:09 2004 | http://epydoc.sf.net