class DomainWithDefaultDict: (source)
Constructor: DomainWithDefaultDict(domains, default)
A simulated dictionary for mapping domain names to domain objects with a default value for non-existing keys.
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 | __delitem__ |
Delete the entry for 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 | __init__ |
No summary |
Method | __iter__ |
Return an iterator over the domain names in this dictionary. |
Method | __len__ |
Return the number of domains in this dictionary. |
Method | __repr__ |
Build an "official" string representation of this dictionary. |
Method | __setitem__ |
Associate a domain object with a domain name in this dictionary. |
Method | __str__ |
Build an informal string representation of this dictionary. |
Method | clear |
Remove all items from this dictionary. |
Method | copy |
Make a copy of this dictionary. |
Method | get |
Look up a domain name in this dictionary. |
Method | has |
Test for the presence of a domain name in this dictionary. |
Method | items |
Return a list of all domain name/domain object pairs in 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 | popitem |
Remove a random domain name/domain object pair from this dictionary and return it as a tuple. |
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. |
Method | set |
Set the default domain. |
Method | update |
Update this dictionary with domain name/domain object pairs from another dictionary. |
Method | values |
Return a list of all domain objects in this dictionary. |
Instance Variable | default |
See __init__ |
Instance Variable | domains |
See __init__ |
Create a new DomainWithDefaultDict
with the specified keys.
Parameters | |
klass | Undocumented |
keys:iterable of bytes | Domain names to serve as keys in the new dictionary. |
value:None or IDomain provider | A domain object to serve as the value for all new keys in the dictionary. |
Returns | |
DomainWithDefaultDict | A new dictionary. |
Return an iterator over the domain names in this dictionary.
Returns | |
iterator over bytes | An iterator over the domain names. |
Build an "official" string representation of this dictionary.
Returns | |
bytes | A pseudo-executable string describing the underlying domain mapping of this object. |
Build an informal string representation of this dictionary.
Returns | |
bytes | A string containing the mapping of domain names to domain objects. |
Look up a domain name in this dictionary.
Parameters | |
key:bytes | A domain name. |
default:IDomain provider or None | A domain object to be returned if the domain name is not in this dictionary. |
Returns | |
IDomain provider or None | The domain object associated with the domain name if it is in this dictionary. Otherwise, the default value. |
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.
Returns | |
iterator over 2-tuple of (1) bytes , (2) IDomain provider or None | An iterator over the domain name/domain object pairs. |
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.
Returns | |
iterator over bytes | An iterator over the domain names. |
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.
Returns | |
iterator over IDomain provider or None | An iterator over the domain objects. |
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.
Parameters | |
key:bytes | A domain name. |
default:IDomain provider | A domain object. |
Returns | |
IDomain provider or None | The domain object associated with the domain name. |
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.
Parameters | |
other:dict of bytes -> IDomain provider and/or bytes -> None | Another dictionary of domain name/domain object pairs. |
Returns | |
None | None. |