These classes provide a way to hold structured data which is commonly encountered in the XMPP realm.
A Jabber ID (JID). To construct a JID, either use the actual constructor, or use the fromstr() class method.
Information about a JID:
The localpart, stringprep’d from the argument to the constructor.
The domain, stringprep’d from the argument to the constructor.
The resource, stringprep’d from the argument to the constructor.
True if the JID is a domain, i.e. if both the localpart and the resource are empty.
JID objects are immutable. To obtain a JID object with a changed property, use one of the following methods:
Hold a presence state of an XMPP resource, as defined by the presence stanza semantics.
available must be a boolean value, which defines whether the resource is available or not. If the resource is available, show may be set to one of "dnd", "xa", "away", None, "chat" (it is a ValueError to attempt to set show to a non-None value if available is false).
PresenceState objects are ordered by their availability and by their show values. Non-availability sorts lower than availability, and for available presence states the order is in the order of valid values given for the show above.
Apply the properties of this PresenceState to a Presence stanza_obj. The type_ and show attributes of the object will be modified to fit the values in this object.
Create and return a new PresenceState object which inherits the presence state as advertised in the given Presence stanza.
If strict is True, the value of show is strictly checked, that is, it is required to be None if the stanza indicates an unavailable state.
The default is not to check this.
PresenceState objects are immutable.
Implementation of a language tag. This may be a fully RFC5646 compliant implementation some day, but for now it is only very simplistic stub.
There is no input validation of any kind.
LanguageTag instances compare and hash case-insensitively.
Implementation of a language range. This may be a fully RFC4647 compliant implementation some day, but for now it is only very simplistic stub.
There is no input validation of any kind.
LanguageRange instances compare and hash case-insensitively.
Strip the rightmost part of the language range. If the new rightmost part is a singleton or x (i.e. starts an extension or private use part), it is also stripped.
Return the newly created LanguageRange.
A dict subclass specialized for holding LanugageTag instances as keys.
In addition to the interface provided by dict, instances of this class also have the following method:
Perform an RFC4647 language range lookup on the keys in the dictionary. language_ranges must be a sequence of LanguageRange instances.
Return the entry in the dictionary with a key as produced by lookup_language. If lookup_language does not find a match and the mapping contains an entry with key None, that entry is returned, otherwise KeyError is raised.
Filter languages using the string-based basic filter algorithm described in RFC4647.
languages must be a sequence of LanguageTag instances which are to be filtered.
ranges must be an iterable which represent the basic language ranges to filter with, in priority order. The language ranges must be given as LanguageRange objects.
Return an iterator of languages which matched any of the ranges. The sequence produced by the iterator is in match order and duplicate-free. The first range to match a language yields the language into the iterator, no other range can yield that language afterwards.
Look up a single language in the sequence languages using the lookup mechansim described in RFC4647. If no match is found, None is returned. Otherwise, the first matching language is returned.
languages must be a sequence of LanguageTag objects, while ranges must be an iterable of LanguageRange objects.