A simulated dictionary for mapping domain names to domain objects with a default value for non-existing keys.

Instance Variable domains See __init__
Instance Variable default See __init__
Method __init__
Method setDefaultDomain Set the default domain.
Method has_key Test for the presence of a domain name in this dictionary.
Class Method fromkeys Create a new DomainWithDefaultDict with the specified keys.
Method __contains__ Test for the presence of a domain name in this dictionary.
Method __getitem__ Look up a domain name and, if it is present, return the domain object associated with it. Otherwise return the default domain.
Method __setitem__ Associate a domain object with a domain name in this dictionary.
Method __delitem__ Delete the entry for a domain name in this dictionary.
Method __iter__ Return an iterator over the domain names in this dictionary.
Method __len__ Return the number of domains in this dictionary.
Method __str__ Build an informal string representation of this dictionary.
Method __repr__ Build an "official" string representation of this dictionary.
Method get Look up a domain name in this dictionary.
Method copy Make a copy of this dictionary.
Method iteritems Return an iterator over the domain name/domain object pairs in the dictionary.
Method iterkeys Return an iterator over the domain names in this dictionary.
Method itervalues Return an iterator over the domain objects in this dictionary.
Method keys Return a list of all domain names in this dictionary.
Method values Return a list of all domain objects in this dictionary.
Method items Return a list of all domain name/domain object pairs in this dictionary.
Method popitem Remove a random domain name/domain object pair from this dictionary and return it as a tuple.
Method update Update this dictionary with domain name/domain object pairs from another dictionary.
Method clear Remove all items from this dictionary.
Method setdefault Return the domain object associated with the domain name if it is present in this dictionary. Otherwise, set the value for the domain name to the default and return that value.
domains =
See __init__
default =
See __init__
def __init__(self, domains, default): (source)
ParametersdomainsA mapping of domain name to domain object. (type: dict of bytes -> IDomain provider)
defaultThe default domain. (type: IDomain provider)
def setDefaultDomain(self, domain): (source)

Set the default domain.

ParametersdomainThe default domain. (type: IDomain provider)
def has_key(self, name): (source)

Test for the presence of a domain name in this dictionary.

This always returns True because a default value will be returned if the name doesn't exist in this dictionary.

ParametersnameA domain name. (type: bytes)
ReturnsTrue to indicate that the domain name is in this dictionary. (type: bool)
@classmethod
def fromkeys(klass, keys, value=None): (source)

Create a new DomainWithDefaultDict with the specified keys.

ParameterskeysDomain names to serve as keys in the new dictionary. (type: iterable of bytes)
valueA domain object to serve as the value for all new keys in the dictionary. (type: NoneType or IDomain provider)
ReturnsA new dictionary. (type: DomainWithDefaultDict)
def __contains__(self, name): (source)

Test for the presence of a domain name in this dictionary.

This always returns True because a default value will be returned if the name doesn't exist in this dictionary.

ParametersnameA domain name. (type: bytes)
ReturnsTrue to indicate that the domain name is in this dictionary. (type: bool)
def __getitem__(self, name): (source)

Look up a domain name and, if it is present, return the domain object associated with it. Otherwise return the default domain.

ParametersnameA domain name. (type: bytes)
ReturnsA domain object. (type: IDomain provider or NoneType)
def __setitem__(self, name, value): (source)

Associate a domain object with a domain name in this dictionary.

ParametersnameA domain name. (type: bytes)
valueA domain object. (type: IDomain provider)
def __delitem__(self, name): (source)

Delete the entry for a domain name in this dictionary.

ParametersnameA domain name. (type: bytes)
def __iter__(self): (source)

Return an iterator over the domain names in this dictionary.

ReturnsAn iterator over the domain names. (type: iterator over bytes)
def __len__(self): (source)

Return the number of domains in this dictionary.

ReturnsThe number of domains in this dictionary. (type: int)
def __str__(self): (source)

Build an informal string representation of this dictionary.

ReturnsA string containing the mapping of domain names to domain objects. (type: bytes)
def __repr__(self): (source)

Build an "official" string representation of this dictionary.

ReturnsA pseudo-executable string describing the underlying domain mapping of this object. (type: bytes)
def get(self, key, default=None): (source)

Look up a domain name in this dictionary.

ParameterskeyA domain name. (type: bytes)
defaultA domain object to be returned if the domain name is not in this dictionary. (type: IDomain provider or NoneType)
ReturnsThe domain object associated with the domain name if it is in this dictionary. Otherwise, the default value. (type: IDomain provider or NoneType)
def copy(self): (source)

Make a copy of this dictionary.

ReturnsA copy of this dictionary. (type: DomainWithDefaultDict)
def iteritems(self): (source)

Return an iterator over the domain name/domain object pairs in the dictionary.

Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError or failing to iterate over all the domain name/domain object pairs.

ReturnsAn iterator over the domain name/domain object pairs. (type: iterator over 2-tuple of (1) bytes, (2) IDomain provider or NoneType)
def iterkeys(self): (source)

Return an iterator over the domain names in this dictionary.

Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError or failing to iterate over all the domain names.

ReturnsAn iterator over the domain names. (type: iterator over bytes)
def itervalues(self): (source)

Return an iterator over the domain objects in this dictionary.

Using the returned iterator while adding or deleting entries from the dictionary may result in a RuntimeError or failing to iterate over all the domain objects.

ReturnsAn iterator over the domain objects. (type: iterator over IDomain provider or NoneType)
def keys(self): (source)

Return a list of all domain names in this dictionary.

ReturnsThe domain names in this dictionary. (type: list of bytes)
def values(self): (source)

Return a list of all domain objects in this dictionary.

ReturnsThe domain objects in this dictionary. (type: list of IDomain provider or NoneType)
def items(self): (source)

Return a list of all domain name/domain object pairs in this dictionary.

ReturnsDomain name/domain object pairs in this dictionary. (type: list of 2-tuple of (1) bytes, (2) IDomain provider or NoneType)
def popitem(self): (source)

Remove a random domain name/domain object pair from this dictionary and return it as a tuple.

ReturnsA domain name/domain object pair. (type: 2-tuple of (1) bytes, (2) IDomain provider or NoneType)
RaisesKeyErrorWhen this dictionary is empty.
def update(self, other): (source)

Update this dictionary with domain name/domain object pairs from another dictionary.

When this dictionary contains a domain name which is in the other dictionary, its value will be overwritten.

ParametersotherAnother dictionary of domain name/domain object pairs. (type: dict of bytes -> IDomain provider and/or bytes -> NoneType)
ReturnsNone. (type: NoneType)
def clear(self): (source)

Remove all items from this dictionary.

ReturnsNone. (type: NoneType)
def setdefault(self, key, default): (source)

Return the domain object associated with the domain name if it is present in this dictionary. Otherwise, set the value for the domain name to the default and return that value.

ParameterskeyA domain name. (type: bytes)
defaultA domain object. (type: IDomain provider)
ReturnsThe domain object associated with the domain name. (type: IDomain provider or NoneType)
API Documentation for Twisted, generated by pydoctor at 2016-05-18 16:01:36.