class documentation

Similar to the :class:`ETags` class this implements a set-like structure. Unlike :class:`ETags` this is case insensitive and used for vary, allow, and content-language headers. If not constructed using the :func:`parse_set_header` function the instantiation works like this: >>> hs = HeaderSet(['foo', 'bar', 'baz']) >>> hs HeaderSet(['foo', 'bar', 'baz'])

Method __bool__ Undocumented
Method __contains__ Undocumented
Method __delitem__ Undocumented
Method __getitem__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method __setitem__ Undocumented
Method __str__ Undocumented
Method add Add a new header to the set.
Method as_set Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost.
Method clear Clear the set.
Method discard Like :meth:`remove` but ignores errors.
Method find Return the index of the header in the set or return -1 if not found.
Method index Return the index of the header in the set or raise an :exc:`IndexError`.
Method remove Remove a header from the set. This raises an :exc:`KeyError` if the header is not in the set.
Method to_header Convert the header set into an HTTP header string.
Method update Add all the headers from the iterable to the set.
Instance Variable on_update Undocumented
Instance Variable _headers Undocumented
Instance Variable _set Undocumented
def __bool__(self): (source)

Undocumented

def __contains__(self, header): (source)

Undocumented

def __delitem__(self, idx): (source)

Undocumented

def __getitem__(self, idx): (source)

Undocumented

def __init__(self, headers=None, on_update=None): (source)

Undocumented

def __iter__(self): (source)

Undocumented

def __len__(self): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __setitem__(self, idx, value): (source)

Undocumented

def __str__(self): (source)

Undocumented

def add(self, header): (source)

Add a new header to the set.

def as_set(self, preserve_casing=False): (source)

Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost. :param preserve_casing: if set to `True` the items in the set returned will have the original case like in the :class:`HeaderSet`, otherwise they will be lowercase.

def clear(self): (source)

Clear the set.

def discard(self, header): (source)

Like :meth:`remove` but ignores errors. :param header: the header to be discarded.

def find(self, header): (source)

Return the index of the header in the set or return -1 if not found. :param header: the header to be looked up.

def index(self, header): (source)

Return the index of the header in the set or raise an :exc:`IndexError`. :param header: the header to be looked up.

def remove(self, header): (source)

Remove a header from the set. This raises an :exc:`KeyError` if the header is not in the set. .. versionchanged:: 0.5 In older versions a :exc:`IndexError` was raised instead of a :exc:`KeyError` if the object was missing. :param header: the header to be removed.

def to_header(self): (source)

Convert the header set into an HTTP header string.

def update(self, iterable): (source)

Add all the headers from the iterable to the set. :param iterable: updates the set with the items from the iterable.

on_update = (source)

Undocumented

_headers = (source)

Undocumented

Undocumented