Search is not available for this dataset
text stringlengths 75 104k |
|---|
def get_items_by_group(self, group, case_sensitive = True):
"""
Return a list of items within a given group.
:Parameters:
- `name`: name to look-up
- `case_sensitive`: if `False` the matching will be case
insensitive.
:Types:
- `name`: `... |
def add_item(self, item, replace = False):
"""
Add an item to the roster.
This will not automatically update the roster on the server.
:Parameters:
- `item`: the item to add
- `replace`: if `True` then existing item will be replaced,
otherwise a `V... |
def remove_item(self, jid):
"""Remove item from the roster.
:Parameters:
- `jid`: JID of the item to remove
:Types:
- `jid`: `JID`
"""
if jid not in self._jids:
raise KeyError(jid)
index = self._jids[jid]
for i in range(index, ... |
def load_roster(self, source):
"""Load roster from an XML file.
Can be used before the connection is started to load saved
roster copy, for efficient retrieval of versioned roster.
:Parameters:
- `source`: file name or a file object
:Types:
- `source`: `... |
def save_roster(self, dest, pretty = True):
"""Save the roster to an XML file.
Can be used to save the last know roster copy for faster loading
of a verisoned roster (if server supports that).
:Parameters:
- `dest`: file name or a file object
- `pretty`: pretty-... |
def handle_got_features_event(self, event):
"""Check for roster related features in the stream features received
and set `server_features` accordingly.
"""
server_features = set()
logger.debug("Checking roster-related features")
if event.features.find(FEATURE_ROSTERVER) i... |
def handle_authorized_event(self, event):
"""Request roster upon login."""
self.server = event.authorized_jid.bare()
if "versioning" in self.server_features:
if self.roster is not None and self.roster.version is not None:
version = self.roster.version
else... |
def request_roster(self, version = None):
"""Request roster from server.
:Parameters:
- `version`: if not `None` versioned roster will be requested
for given local version. Use "" to request full roster.
:Types:
- `version`: `unicode`
"""
pr... |
def _get_success(self, stanza):
"""Handle successful response to the roster request.
"""
payload = stanza.get_payload(RosterPayload)
if payload is None:
if "versioning" in self.server_features and self.roster:
logger.debug("Server will send roster delta in pus... |
def _get_error(self, stanza):
"""Handle failure of the roster request.
"""
if stanza:
logger.debug(u"Roster request failed: {0}".format(
stanza.error.condition_name))
else:
logger.debug(u"Roster request failed: timeo... |
def handle_roster_push(self, stanza):
"""Handle a roster push received from server.
"""
if self.server is None and stanza.from_jid:
logger.debug(u"Server address not known, cannot verify roster push"
" from {0}".format(stanza.from_jid))
ret... |
def add_item(self, jid, name = None, groups = None,
callback = None, error_callback = None):
"""Add a contact to the roster.
:Parameters:
- `jid`: contact's jid
- `name`: name for the contact
- `groups`: sequence of group names the con... |
def update_item(self, jid, name = NO_CHANGE, groups = NO_CHANGE,
callback = None, error_callback = None):
"""Modify a contact in the roster.
:Parameters:
- `jid`: contact's jid
- `name`: a new name for the contact
- `groups`: a sequenc... |
def remove_item(self, jid, callback = None, error_callback = None):
"""Remove a contact from the roster.
:Parameters:
- `jid`: contact's jid
- `callback`: function to call when the request succeeds. It should
accept a single argument - a `RosterItem` describing the... |
def _roster_set(self, item, callback, error_callback):
"""Send a 'roster set' to the server.
:Parameters:
- `item`: the requested change
:Types:
- `item`: `RosterItem`
"""
stanza = Iq(to_jid = self.server, stanza_type = "set")
payload = RosterPayl... |
def free(self):
"""
Unlink and free the XML node owned by `self`.
"""
if not self.borrowed:
self.xmlnode.unlinkNode()
self.xmlnode.freeNode()
self.xmlnode=None |
def xpath_eval(self,expr):
"""
Evaluate XPath expression in context of `self.xmlnode`.
:Parameters:
- `expr`: the XPath expression
:Types:
- `expr`: `unicode`
:return: the result of the expression evaluation.
:returntype: list of `libxml2.xmlNode... |
def set_history(self, parameters):
"""
Set history parameters.
Types:
- `parameters`: `HistoryParameters`
"""
for child in xml_element_iter(self.xmlnode.children):
if get_node_ns_uri(child) == MUC_NS and child.name == "history":
child.unli... |
def get_history(self):
"""Return history parameters carried by the stanza.
:returntype: `HistoryParameters`"""
for child in xml_element_iter(self.xmlnode.children):
if get_node_ns_uri(child) == MUC_NS and child.name == "history":
maxchars = from_utf8(child.prop("maxc... |
def set_password(self, password):
"""Set password for the MUC request.
:Parameters:
- `password`: password
:Types:
- `password`: `unicode`"""
for child in xml_element_iter(self.xmlnode.children):
if get_node_ns_uri(child) == MUC_NS and child.name == "... |
def get_password(self):
"""Get password from the MUC request.
:returntype: `unicode`
"""
for child in xml_element_iter(self.xmlnode.children):
if get_node_ns_uri(child) == MUC_NS and child.name == "password":
return from_utf8(child.getContent())
retur... |
def __init(self,affiliation,role,jid=None,nick=None,actor=None,reason=None):
"""Initialize a `MucItem` object from a set of attributes.
:Parameters:
- `affiliation`: affiliation of the user.
- `role`: role of the user.
- `jid`: JID of the user.
- `nick`: ... |
def __from_xmlnode(self, xmlnode):
"""Initialize a `MucItem` object from an XML node.
:Parameters:
- `xmlnode`: the XML node.
:Types:
- `xmlnode`: `libxml2.xmlNode`
"""
actor=None
reason=None
n=xmlnode.children
while n:
... |
def as_xml(self,parent):
"""
Create XML representation of `self`.
:Parameters:
- `parent`: the element to which the created node should be linked to.
:Types:
- `parent`: `libxml2.xmlNode`
:return: an XML node.
:returntype: `libxml2.xmlNode`
... |
def __init(self,code):
"""Initialize a `MucStatus` element from a status code.
:Parameters:
- `code`: the status code.
:Types:
- `code`: `int`
"""
code=int(code)
if code<0 or code>999:
raise ValueError("Bad status code")
self.c... |
def as_xml(self,parent):
"""
Create XML representation of `self`.
:Parameters:
- `parent`: the element to which the created node should be linked to.
:Types:
- `parent`: `libxml2.xmlNode`
:return: an XML node.
:returntype: `libxml2.xmlNode`
... |
def get_items(self):
"""Get a list of objects describing the content of `self`.
:return: the list of objects.
:returntype: `list` of `MucItemBase` (`MucItem` and/or `MucStatus`)
"""
if not self.xmlnode.children:
return []
ret=[]
n=self.xmlnode.childre... |
def clear(self):
"""
Clear the content of `self.xmlnode` removing all <item/>, <status/>, etc.
"""
if not self.xmlnode.children:
return
n=self.xmlnode.children
while n:
ns=n.ns()
if ns and ns.getContent()!=MUC_USER_NS:
p... |
def add_item(self,item):
"""Add an item to `self`.
:Parameters:
- `item`: the item to add.
:Types:
- `item`: `MucItemBase`
"""
if not isinstance(item,MucItemBase):
raise TypeError("Bad item type for muc#user")
item.as_xml(self.xmlnode) |
def get_muc_child(self):
"""
Get the MUC specific payload element.
:return: the object describing the stanza payload in MUC namespace.
:returntype: `MucX` or `MucUserX` or `MucAdminQuery` or `MucOwnerX`
"""
if self.muc_child:
return self.muc_child
if ... |
def clear_muc_child(self):
"""
Remove the MUC specific stanza payload element.
"""
if self.muc_child:
self.muc_child.free_borrowed()
self.muc_child=None
if not self.xmlnode.children:
return
n=self.xmlnode.children
while n:
... |
def make_muc_userinfo(self):
"""
Create <x xmlns="...muc#user"/> element in the stanza.
:return: the element created.
:returntype: `MucUserX`
"""
self.clear_muc_child()
self.muc_child=MucUserX(parent=self.xmlnode)
return self.muc_child |
def make_muc_admin_quey(self):
"""
Create <query xmlns="...muc#admin"/> element in the stanza.
:return: the element created.
:returntype: `MucAdminQuery`
"""
self.clear_muc_child()
self.muc_child=MucAdminQuery(parent=self.xmlnode)
return self.muc_child |
def make_join_request(self, password = None, history_maxchars = None,
history_maxstanzas = None, history_seconds = None,
history_since = None):
"""
Make the presence stanza a MUC room join request.
:Parameters:
- `password`: password to the room.
... |
def get_join_info(self):
"""If `self` is a MUC room join request return the information contained.
:return: the join request details or `None`.
:returntype: `MucX`
"""
x=self.get_muc_child()
if not x:
return None
if not isinstance(x,MucX):
... |
def make_kick_request(self,nick,reason):
"""
Make the iq stanza a MUC room participant kick request.
:Parameters:
- `nick`: nickname of user to kick.
- `reason`: reason of the kick.
:Types:
- `nick`: `unicode`
- `reason`: `unicode`
... |
def nfkc(data):
"""Do NFKC normalization of Unicode data.
:Parameters:
- `data`: list of Unicode characters or Unicode string.
:return: normalized Unicode string."""
if isinstance(data, list):
data = u"".join(data)
return unicodedata.normalize("NFKC", data) |
def set_stringprep_cache_size(size):
"""Modify stringprep cache size.
:Parameters:
- `size`: new cache size
"""
# pylint: disable-msg=W0603
global _stringprep_cache_size
_stringprep_cache_size = size
if len(Profile.cache_items) > size:
remove = Profile.cache_items[:-size]
... |
def prepare(self, data):
"""Complete string preparation procedure for 'stored' strings.
(includes checks for unassigned codes)
:Parameters:
- `data`: Unicode string to prepare.
:return: prepared string
:raise StringprepError: if the preparation fails
"""
... |
def prepare_query(self, data):
"""Complete string preparation procedure for 'query' strings.
(without checks for unassigned codes)
:Parameters:
- `data`: Unicode string to prepare.
:return: prepared string
:raise StringprepError: if the preparation fails
""... |
def map(self, data):
"""Mapping part of string preparation."""
result = []
for char in data:
ret = None
for lookup in self.mapping:
ret = lookup(char)
if ret is not None:
break
if ret is not None:
... |
def prohibit(self, data):
"""Checks for prohibited characters."""
for char in data:
for lookup in self.prohibited:
if lookup(char):
raise StringprepError("Prohibited character: {0!r}"
.format(... |
def check_unassigned(self, data):
"""Checks for unassigned character codes."""
for char in data:
for lookup in self.unassigned:
if lookup(char):
raise StringprepError("Unassigned character: {0!r}"
... |
def check_bidi(data):
"""Checks if sting is valid for bidirectional printing."""
has_l = False
has_ral = False
for char in data:
if stringprep.in_table_d1(char):
has_ral = True
elif stringprep.in_table_d2(char):
has_l = True
... |
def hold_exception(method):
"""Decorator for glib callback methods of GLibMainLoop used to store the
exception raised."""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
"""Wrapper for methods decorated with `hold_exception`."""
# pylint: disable=W0703,W0212
try:
... |
def _configure_io_handler(self, handler):
"""Register an io-handler with the glib main loop."""
if self.check_events():
return
if handler in self._unprepared_handlers:
old_fileno = self._unprepared_handlers[handler]
prepared = self._prepare_io_handler(handler)... |
def _io_callback(self, fileno, condition, handler):
"""Called by glib on I/O event."""
# pylint: disable=W0613
self._anything_done = True
logger.debug("_io_callback called for {0!r}, cond: {1}".format(handler,
condition)... |
def _prepare_io_handler(self, handler):
"""Call the `interfaces.IOHandler.prepare` method and
remove the handler from unprepared handler list when done.
"""
logger.debug(" preparing handler: {0!r}".format(handler))
self._unprepared_pending.discard(handler)
ret = handler.p... |
def _prepare_pending(self):
"""Prepare pending handlers.
"""
if not self._unprepared_pending:
return
for handler in list(self._unprepared_pending):
self._configure_io_handler(handler)
self.check_events() |
def _prepare_io_handler_cb(self, handler):
"""Timeout callback called to try prepare an IOHandler again."""
self._anything_done = True
logger.debug("_prepar_io_handler_cb called for {0!r}".format(handler))
self._configure_io_handler(handler)
self._prepare_sources.pop(handler, Non... |
def _remove_io_handler(self, handler):
"""Remove an i/o-handler."""
if handler in self._unprepared_handlers:
del self._unprepared_handlers[handler]
tag = self._prepare_sources.pop(handler, None)
if tag is not None:
glib.source_remove(tag)
tag = self._io_so... |
def _add_timeout_handler(self, handler):
"""Add a `TimeoutHandler` to the main loop."""
# pylint: disable=W0212
for dummy, method in inspect.getmembers(handler, callable):
if not hasattr(method, "_pyxmpp_timeout"):
continue
tag = glib.timeout_add(int(metho... |
def _remove_timeout_handler(self, handler):
"""Remove `TimeoutHandler` from the main loop."""
for dummy, method in inspect.getmembers(handler, callable):
if not hasattr(method, "_pyxmpp_timeout"):
continue
tag = self._timer_sources.pop(method, None)
if... |
def _timeout_cb(self, method):
"""Call the timeout handler due.
"""
self._anything_done = True
logger.debug("_timeout_cb() called for: {0!r}".format(method))
result = method()
# pylint: disable=W0212
rec = method._pyxmpp_recurring
if rec:
self.... |
def _loop_timeout_cb(self, main_loop):
"""Stops the loop after the time specified in the `loop` call.
"""
self._anything_done = True
logger.debug("_loop_timeout_cb() called")
main_loop.quit() |
def stanza_factory(element, return_path = None, language = None):
"""Creates Iq, Message or Presence object for XML stanza `element`
:Parameters:
- `element`: the stanza XML element
- `return_path`: object through which responses to this stanza should
be sent (will be weakly reference... |
def _process_handler_result(self, response):
"""Examines out the response returned by a stanza handler and sends all
stanzas provided.
:Parameters:
- `response`: the response to process. `None` or `False` means 'not
handled'. `True` means 'handled'. Stanza or stanza li... |
def _process_iq_response(self, stanza):
"""Process IQ stanza of type 'response' or 'error'.
:Parameters:
- `stanza`: the stanza received
:Types:
- `stanza`: `Iq`
If a matching handler is available pass the stanza to it. Otherwise
ignore it if it is "err... |
def process_iq(self, stanza):
"""Process IQ stanza received.
:Parameters:
- `stanza`: the stanza received
:Types:
- `stanza`: `Iq`
If a matching handler is available pass the stanza to it. Otherwise
ignore it if it is "error" or "result" stanza or retur... |
def _get_iq_handler(self, iq_type, payload):
"""Get an <iq/> handler for given iq type and payload."""
key = (payload.__class__, payload.handler_key)
logger.debug("looking up iq {0} handler for {1!r}, key: {2!r}"
.format(iq_type, payload, key))
logger.debug("... |
def __try_handlers(self, handler_list, stanza, stanza_type = None):
""" Search the handler list for handlers matching
given stanza type and payload namespace. Run the
handlers found ordering them by priority until
the first one which returns `True`.
:Parameters:
- `h... |
def process_message(self, stanza):
"""Process message stanza.
Pass it to a handler of the stanza's type and payload namespace.
If no handler for the actual stanza type succeeds then hadlers
for type "normal" are used.
:Parameters:
- `stanza`: message stanza to be ha... |
def process_presence(self, stanza):
"""Process presence stanza.
Pass it to a handler of the stanza's type and payload namespace.
:Parameters:
- `stanza`: presence stanza to be handled
"""
stanza_type = stanza.stanza_type
return self.__try_handlers(self._pre... |
def route_stanza(self, stanza):
"""Process stanza not addressed to us.
Return "recipient-unavailable" return if it is not
"error" nor "result" stanza.
This method should be overriden in derived classes if they
are supposed to handle stanzas not addressed directly to local
... |
def process_stanza(self, stanza):
"""Process stanza received from the stream.
First "fix" the stanza with `self.fix_in_stanza()`,
then pass it to `self.route_stanza()` if it is not directed
to `self.me` and `self.process_all_stanzas` is not True. Otherwise
stanza is passwd to `s... |
def set_response_handlers(self, stanza, res_handler, err_handler,
timeout_handler = None, timeout = None):
"""Set response handler for an IQ "get" or "set" stanza.
This should be called before the stanza is sent.
:Parameters:
- `stanza`: an IQ st... |
def _set_response_handlers(self, stanza, res_handler, err_handler,
timeout_handler = None, timeout = None):
"""Same as `set_response_handlers` but assume `self.lock` is
acquired."""
# pylint: disable-msg=R0913
self.fix_out_stanza(stanza)
to_jid = s... |
def setup_stanza_handlers(self, handler_objects, usage_restriction):
"""Install stanza handlers provided by `handler_objects`"""
# pylint: disable=W0212
iq_handlers = {"get": {}, "set": {}}
message_handlers = []
presence_handlers = []
for obj in handler_objects:
... |
def send(self, stanza):
"""Send a stanza somwhere.
The default implementation sends it via the `uplink` if it is defined
or raises the `NoRouteError`.
:Parameters:
- `stanza`: the stanza to send.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`"""
if s... |
def check_events(self):
"""Call the event dispatcher.
Quit the main loop when the `QUIT` event is reached.
:Return: `True` if `QUIT` was reached.
"""
if self.event_dispatcher.flush() is QUIT:
self._quit = True
return True
return False |
def _add_timeout_handler(self, handler):
"""Add a `TimeoutHandler` to the main loop."""
# pylint: disable-msg=W0212
now = time.time()
for dummy, method in inspect.getmembers(handler, callable):
if not hasattr(method, "_pyxmpp_timeout"):
continue
se... |
def _remove_timeout_handler(self, handler):
"""Remove `TimeoutHandler` from the main loop."""
self._timeout_handlers = [(t, h) for (t, h)
in self._timeout_handlers
if h.im_self != handler] |
def _call_timeout_handlers(self):
"""Call the timeout handlers due.
:Return: (next_event_timeout, sources_handled) tuple.
next_event_timeout is number of seconds until the next timeout
event, sources_handled is number of handlers called.
"""
sources_handled = 0
... |
def xml_elements_equal(element1, element2, ignore_level1_cdata = False):
"""Check if two XML elements are equal.
:Parameters:
- `element1`: the first element to compare
- `element2`: the other element to compare
- `ignore_level1_cdata`: if direct text children of the elements
... |
def datetime_utc_to_local(utc):
"""
An ugly hack to convert naive :std:`datetime.datetime` object containing
UTC time to a naive :std:`datetime.datetime` object with local time.
It seems standard Python 2.3 library doesn't provide any better way to
do that.
"""
# pylint: disable-msg=C0103
... |
def datetime_local_to_utc(local):
"""
Simple function to convert naive :std:`datetime.datetime` object containing
local time to a naive :std:`datetime.datetime` object with UTC time.
"""
timestamp = time.mktime(local.timetuple())
return datetime.datetime.utcfromtimestamp(timestamp) |
def _decode_subelements(self):
"""Decode the stanza subelements."""
for child in self._element:
if child.tag == self._subject_tag:
self._subject = child.text
elif child.tag == self._body_tag:
self._body = child.text
elif child.tag == se... |
def as_xml(self):
"""Return the XML stanza representation.
Always return an independent copy of the stanza XML representation,
which can be freely modified without affecting the stanza.
:returntype: :etree:`ElementTree.Element`"""
result = Stanza.as_xml(self)
if self._s... |
def copy(self):
"""Create a deep copy of the stanza.
:returntype: `Message`"""
result = Message(None, self.from_jid, self.to_jid,
self.stanza_type, self.stanza_id, self.error,
self._return_path(), self._subject, self._body,
... |
def make_error_response(self, cond):
"""Create error response for any non-error message stanza.
:Parameters:
- `cond`: error condition name, as defined in XMPP specification.
:return: new message stanza with the same "id" as self, "from" and
"to" attributes swapped, typ... |
def _move_session_handler(handlers):
"""Find a SessionHandler instance in the list and move it to the beginning.
"""
index = 0
for i, handler in enumerate(handlers):
if isinstance(handler, SessionHandler):
index = i
break
if index:
handlers[:index + 1] = [hand... |
def connect(self):
"""Schedule a new XMPP c2s connection.
"""
with self.lock:
if self.stream:
logger.debug("Closing the previously used stream.")
self._close_stream()
transport = TCPTransport(self.settings)
addr = self.setting... |
def disconnect(self):
"""Gracefully disconnect from the server."""
with self.lock:
if self.stream:
if self.settings[u"initial_presence"]:
self.send(Presence(stanza_type = "unavailable"))
self.stream.disconnect() |
def _close_stream(self):
"""Same as `close_stream` but with the `lock` acquired.
"""
self.stream.close()
if self.stream.transport in self._ml_handlers:
self._ml_handlers.remove(self.stream.transport)
self.main_loop.remove_handler(self.stream.transport)
sel... |
def _stream_authenticated(self, event):
"""Handle the `AuthenticatedEvent`.
"""
with self.lock:
if event.stream != self.stream:
return
self.me = event.stream.me
self.peer = event.stream.peer
handlers = self._base_handlers[:]
... |
def _stream_authorized(self, event):
"""Handle the `AuthorizedEvent`.
"""
with self.lock:
if event.stream != self.stream:
return
self.me = event.stream.me
self.peer = event.stream.peer
presence = self.settings[u"initial_presence"]
... |
def _stream_disconnected(self, event):
"""Handle stream disconnection event.
"""
with self.lock:
if event.stream != self.stream:
return
if self.stream is not None and event.stream == self.stream:
if self.stream.transport in self._ml_handler... |
def regular_tasks(self):
"""Do some housekeeping (cache expiration, timeout handling).
This method should be called periodically from the application's
main loop.
:Return: suggested delay (in seconds) before the next call to this
... |
def base_handlers_factory(self):
"""Default base client handlers factory.
Subclasses can provide different behaviour by overriding this.
:Return: list of handlers
"""
tls_handler = StreamTLSHandler(self.settings)
sasl_handler = StreamSASLHandler(self.settings)
s... |
def payload_class_for_element_name(element_name):
"""Return a payload class for given element name."""
logger.debug(" looking up payload class for element: {0!r}".format(
element_name))
logger.debug(" known: {0!r}".format(STANZA_PAYLOAD_CLASSE... |
def _unquote(data):
"""Unquote quoted value from DIGEST-MD5 challenge or response.
If `data` doesn't start or doesn't end with '"' then return it unchanged,
remove the quotes and escape backslashes otherwise.
:Parameters:
- `data`: a quoted string.
:Types:
- `data`: `bytes`
:r... |
def _quote(data):
"""Prepare a string for quoting for DIGEST-MD5 challenge or response.
Don't add the quotes, only escape '"' and "\\" with backslashes.
:Parameters:
- `data`: a raw string.
:Types:
- `data`: `bytes`
:return: `data` with '"' and "\\" escaped using "\\".
:return... |
def _make_urp_hash(username, realm, passwd):
"""Compute MD5 sum of username:realm:password.
:Parameters:
- `username`: a username.
- `realm`: a realm.
- `passwd`: a password.
:Types:
- `username`: `bytes`
- `realm`: `bytes`
- `passwd`: `bytes`
:return: t... |
def _compute_response(urp_hash, nonce, cnonce, nonce_count, authzid,
digest_uri):
"""Compute DIGEST-MD5 response value.
:Parameters:
- `urp_hash`: MD5 sum of username:realm:password.
- `nonce`: nonce value from a server challen... |
def rfc2425encode(name,value,parameters=None,charset="utf-8"):
"""Encodes a vCard field into an RFC2425 line.
:Parameters:
- `name`: field type name
- `value`: field value
- `parameters`: optional parameters
- `charset`: encoding of the output and of the `value` (if not
... |
def as_xml(self,parent):
"""Create vcard-tmp XML representation of the field.
:Parameters:
- `parent`: parent node for the element
:Types:
- `parent`: `libxml2.xmlNode`
:return: xml node with the field data.
:returntype: `libxml2.xmlNode`"""
retu... |
def as_xml(self,parent):
"""Create vcard-tmp XML representation of the field.
:Parameters:
- `parent`: parent node for the element
:Types:
- `parent`: `libxml2.xmlNode`
:return: xml node with the field data.
:returntype: `libxml2.xmlNode`"""
name... |
def rfc2426(self):
"""RFC2426-encode the field content.
:return: the field in the RFC 2426 format.
:returntype: `str`"""
return rfc2425encode("n",u';'.join(quote_semicolon(val) for val in
(self.family,self.given,self.middle,self.prefix,self.suffix))) |
def as_xml(self,parent):
"""Create vcard-tmp XML representation of the field.
:Parameters:
- `parent`: parent node for the element
:Types:
- `parent`: `libxml2.xmlNode`
:return: xml node with the field data.
:returntype: `libxml2.xmlNode`"""
n=pa... |
def rfc2426(self):
"""RFC2426-encode the field content.
:return: the field in the RFC 2426 format.
:returntype: `str`"""
if self.uri:
return rfc2425encode(self.name,self.uri,{"value":"uri"})
elif self.image:
if self.type:
p={"type":self.ty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.