partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Form.__get_reported | Parse the <reported/> element of the form.
:Parameters:
- `xmlnode`: the element to parse.
:Types:
- `xmlnode`: `libxml2.xmlNode` | pyxmpp2/ext/dataforms.py | def __get_reported(self, xmlnode):
"""Parse the <reported/> element of the form.
:Parameters:
- `xmlnode`: the element to parse.
:Types:
- `xmlnode`: `libxml2.xmlNode`"""
child = xmlnode.children
while child:
if child.type != "element" or chil... | def __get_reported(self, xmlnode):
"""Parse the <reported/> element of the form.
:Parameters:
- `xmlnode`: the element to parse.
:Types:
- `xmlnode`: `libxml2.xmlNode`"""
child = xmlnode.children
while child:
if child.type != "element" or chil... | [
"Parse",
"the",
"<reported",
"/",
">",
"element",
"of",
"the",
"form",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/dataforms.py#L702-L715 | [
"def",
"__get_reported",
"(",
"self",
",",
"xmlnode",
")",
":",
"child",
"=",
"xmlnode",
".",
"children",
"while",
"child",
":",
"if",
"child",
".",
"type",
"!=",
"\"element\"",
"or",
"child",
".",
"ns",
"(",
")",
".",
"content",
"!=",
"DATAFORM_NS",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | register_disco_cache_fetchers | Register Service Discovery cache fetchers into given
cache suite and using the stream provided.
:Parameters:
- `cache_suite`: the cache suite where the fetchers are to be
registered.
- `stream`: the stream to be used by the fetchers.
:Types:
- `cache_suite`: `cache.CacheSu... | pyxmpp2/ext/disco.py | def register_disco_cache_fetchers(cache_suite,stream):
"""Register Service Discovery cache fetchers into given
cache suite and using the stream provided.
:Parameters:
- `cache_suite`: the cache suite where the fetchers are to be
registered.
- `stream`: the stream to be used by the... | def register_disco_cache_fetchers(cache_suite,stream):
"""Register Service Discovery cache fetchers into given
cache suite and using the stream provided.
:Parameters:
- `cache_suite`: the cache suite where the fetchers are to be
registered.
- `stream`: the stream to be used by the... | [
"Register",
"Service",
"Discovery",
"cache",
"fetchers",
"into",
"given",
"cache",
"suite",
"and",
"using",
"the",
"stream",
"provided",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L867-L889 | [
"def",
"register_disco_cache_fetchers",
"(",
"cache_suite",
",",
"stream",
")",
":",
"tmp",
"=",
"stream",
"class",
"DiscoInfoCacheFetcher",
"(",
"DiscoCacheFetcherBase",
")",
":",
"\"\"\"Cache fetcher for DiscoInfo.\"\"\"",
"stream",
"=",
"tmp",
"disco_class",
"=",
"Di... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItem.remove | Remove `self` from the containing `DiscoItems` object. | pyxmpp2/ext/disco.py | def remove(self):
"""Remove `self` from the containing `DiscoItems` object."""
if self.disco is None:
return
self.xmlnode.unlinkNode()
oldns=self.xmlnode.ns()
ns=self.xmlnode.newNs(oldns.getContent(),None)
self.xmlnode.replaceNs(oldns,ns)
common_root.a... | def remove(self):
"""Remove `self` from the containing `DiscoItems` object."""
if self.disco is None:
return
self.xmlnode.unlinkNode()
oldns=self.xmlnode.ns()
ns=self.xmlnode.newNs(oldns.getContent(),None)
self.xmlnode.replaceNs(oldns,ns)
common_root.a... | [
"Remove",
"self",
"from",
"the",
"containing",
"DiscoItems",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L120-L129 | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"self",
".",
"disco",
"is",
"None",
":",
"return",
"self",
".",
"xmlnode",
".",
"unlinkNode",
"(",
")",
"oldns",
"=",
"self",
".",
"xmlnode",
".",
"ns",
"(",
")",
"ns",
"=",
"self",
".",
"xmlnode",
".... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItem.set_name | Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` | pyxmpp2/ext/disco.py | def set_name(self, name):
"""Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` """
if name is None:
if self.xmlnode.hasProp("name"):
self.xmlnode.unsetProp("name")
return
... | def set_name(self, name):
"""Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` """
if name is None:
if self.xmlnode.hasProp("name"):
self.xmlnode.unsetProp("name")
return
... | [
"Set",
"the",
"name",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L141-L153 | [
"def",
"set_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"if",
"self",
".",
"xmlnode",
".",
"hasProp",
"(",
"\"name\"",
")",
":",
"self",
".",
"xmlnode",
".",
"unsetProp",
"(",
"\"name\"",
")",
"return",
"name",
"=",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItem.set_node | Set the node of the item.
:Parameters:
- `node`: the new node or `None`.
:Types:
- `node`: `unicode` | pyxmpp2/ext/disco.py | def set_node(self,node):
"""Set the node of the item.
:Parameters:
- `node`: the new node or `None`.
:Types:
- `node`: `unicode`
"""
if node is None:
if self.xmlnode.hasProp("node"):
self.xmlnode.unsetProp("node")
r... | def set_node(self,node):
"""Set the node of the item.
:Parameters:
- `node`: the new node or `None`.
:Types:
- `node`: `unicode`
"""
if node is None:
if self.xmlnode.hasProp("node"):
self.xmlnode.unsetProp("node")
r... | [
"Set",
"the",
"node",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L167-L180 | [
"def",
"set_node",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"is",
"None",
":",
"if",
"self",
".",
"xmlnode",
".",
"hasProp",
"(",
"\"node\"",
")",
":",
"self",
".",
"xmlnode",
".",
"unsetProp",
"(",
"\"node\"",
")",
"return",
"node",
"=",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItem.set_action | Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode` | pyxmpp2/ext/disco.py | def set_action(self,action):
"""Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode`
"""
if action is None:
if self.xmlnode.hasProp("action"):
self.xmlnode.unsetProp("acti... | def set_action(self,action):
"""Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode`
"""
if action is None:
if self.xmlnode.hasProp("action"):
self.xmlnode.unsetProp("acti... | [
"Set",
"the",
"action",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L194-L209 | [
"def",
"set_action",
"(",
"self",
",",
"action",
")",
":",
"if",
"action",
"is",
"None",
":",
"if",
"self",
".",
"xmlnode",
".",
"hasProp",
"(",
"\"action\"",
")",
":",
"self",
".",
"xmlnode",
".",
"unsetProp",
"(",
"\"action\"",
")",
"return",
"if",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.get_name | Get the name of the item.
:return: the name of the item or `None`.
:returntype: `unicode` | pyxmpp2/ext/disco.py | def get_name(self):
"""Get the name of the item.
:return: the name of the item or `None`.
:returntype: `unicode`"""
var = self.xmlnode.prop("name")
if not var:
var = ""
return var.decode("utf-8") | def get_name(self):
"""Get the name of the item.
:return: the name of the item or `None`.
:returntype: `unicode`"""
var = self.xmlnode.prop("name")
if not var:
var = ""
return var.decode("utf-8") | [
"Get",
"the",
"name",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L316-L324 | [
"def",
"get_name",
"(",
"self",
")",
":",
"var",
"=",
"self",
".",
"xmlnode",
".",
"prop",
"(",
"\"name\"",
")",
"if",
"not",
"var",
":",
"var",
"=",
"\"\"",
"return",
"var",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.set_name | Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` | pyxmpp2/ext/disco.py | def set_name(self,name):
"""Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` """
if not name:
raise ValueError("name is required in DiscoIdentity")
name = unicode(name)
self.xmlnode.s... | def set_name(self,name):
"""Set the name of the item.
:Parameters:
- `name`: the new name or `None`.
:Types:
- `name`: `unicode` """
if not name:
raise ValueError("name is required in DiscoIdentity")
name = unicode(name)
self.xmlnode.s... | [
"Set",
"the",
"name",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L326-L336 | [
"def",
"set_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"name",
":",
"raise",
"ValueError",
"(",
"\"name is required in DiscoIdentity\"",
")",
"name",
"=",
"unicode",
"(",
"name",
")",
"self",
".",
"xmlnode",
".",
"setProp",
"(",
"\"name\"",
",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.get_category | Get the category of the item.
:return: the category of the item.
:returntype: `unicode` | pyxmpp2/ext/disco.py | def get_category(self):
"""Get the category of the item.
:return: the category of the item.
:returntype: `unicode`"""
var = self.xmlnode.prop("category")
if not var:
var = "?"
return var.decode("utf-8") | def get_category(self):
"""Get the category of the item.
:return: the category of the item.
:returntype: `unicode`"""
var = self.xmlnode.prop("category")
if not var:
var = "?"
return var.decode("utf-8") | [
"Get",
"the",
"category",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L340-L348 | [
"def",
"get_category",
"(",
"self",
")",
":",
"var",
"=",
"self",
".",
"xmlnode",
".",
"prop",
"(",
"\"category\"",
")",
"if",
"not",
"var",
":",
"var",
"=",
"\"?\"",
"return",
"var",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.set_category | Set the category of the item.
:Parameters:
- `category`: the new category.
:Types:
- `category`: `unicode` | pyxmpp2/ext/disco.py | def set_category(self, category):
"""Set the category of the item.
:Parameters:
- `category`: the new category.
:Types:
- `category`: `unicode` """
if not category:
raise ValueError("Category is required in DiscoIdentity")
category = unicode(c... | def set_category(self, category):
"""Set the category of the item.
:Parameters:
- `category`: the new category.
:Types:
- `category`: `unicode` """
if not category:
raise ValueError("Category is required in DiscoIdentity")
category = unicode(c... | [
"Set",
"the",
"category",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L350-L360 | [
"def",
"set_category",
"(",
"self",
",",
"category",
")",
":",
"if",
"not",
"category",
":",
"raise",
"ValueError",
"(",
"\"Category is required in DiscoIdentity\"",
")",
"category",
"=",
"unicode",
"(",
"category",
")",
"self",
".",
"xmlnode",
".",
"setProp",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.get_type | Get the type of the item.
:return: the type of the item.
:returntype: `unicode` | pyxmpp2/ext/disco.py | def get_type(self):
"""Get the type of the item.
:return: the type of the item.
:returntype: `unicode`"""
item_type = self.xmlnode.prop("type")
if not item_type:
item_type = "?"
return item_type.decode("utf-8") | def get_type(self):
"""Get the type of the item.
:return: the type of the item.
:returntype: `unicode`"""
item_type = self.xmlnode.prop("type")
if not item_type:
item_type = "?"
return item_type.decode("utf-8") | [
"Get",
"the",
"type",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L364-L372 | [
"def",
"get_type",
"(",
"self",
")",
":",
"item_type",
"=",
"self",
".",
"xmlnode",
".",
"prop",
"(",
"\"type\"",
")",
"if",
"not",
"item_type",
":",
"item_type",
"=",
"\"?\"",
"return",
"item_type",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoIdentity.set_type | Set the type of the item.
:Parameters:
- `item_type`: the new type.
:Types:
- `item_type`: `unicode` | pyxmpp2/ext/disco.py | def set_type(self, item_type):
"""Set the type of the item.
:Parameters:
- `item_type`: the new type.
:Types:
- `item_type`: `unicode` """
if not item_type:
raise ValueError("Type is required in DiscoIdentity")
item_type = unicode(item_type)
... | def set_type(self, item_type):
"""Set the type of the item.
:Parameters:
- `item_type`: the new type.
:Types:
- `item_type`: `unicode` """
if not item_type:
raise ValueError("Type is required in DiscoIdentity")
item_type = unicode(item_type)
... | [
"Set",
"the",
"type",
"of",
"the",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L374-L384 | [
"def",
"set_type",
"(",
"self",
",",
"item_type",
")",
":",
"if",
"not",
"item_type",
":",
"raise",
"ValueError",
"(",
"\"Type is required in DiscoIdentity\"",
")",
"item_type",
"=",
"unicode",
"(",
"item_type",
")",
"self",
".",
"xmlnode",
".",
"setProp",
"("... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItems.get_items | Get the items contained in `self`.
:return: the items contained.
:returntype: `list` of `DiscoItem` | pyxmpp2/ext/disco.py | def get_items(self):
"""Get the items contained in `self`.
:return: the items contained.
:returntype: `list` of `DiscoItem`"""
ret=[]
l=self.xpath_ctxt.xpathEval("d:item")
if l is not None:
for i in l:
ret.append(DiscoItem(self, i))
re... | def get_items(self):
"""Get the items contained in `self`.
:return: the items contained.
:returntype: `list` of `DiscoItem`"""
ret=[]
l=self.xpath_ctxt.xpathEval("d:item")
if l is not None:
for i in l:
ret.append(DiscoItem(self, i))
re... | [
"Get",
"the",
"items",
"contained",
"in",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L464-L474 | [
"def",
"get_items",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"l",
"=",
"self",
".",
"xpath_ctxt",
".",
"xpathEval",
"(",
"\"d:item\"",
")",
"if",
"l",
"is",
"not",
"None",
":",
"for",
"i",
"in",
"l",
":",
"ret",
".",
"append",
"(",
"DiscoItem... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItems.set_items | Set items in the disco#items object.
All previous items are removed.
:Parameters:
- `item_list`: list of items or item properties
(jid,node,name,action).
:Types:
- `item_list`: sequence of `DiscoItem` or sequence of sequences | pyxmpp2/ext/disco.py | def set_items(self, item_list):
"""Set items in the disco#items object.
All previous items are removed.
:Parameters:
- `item_list`: list of items or item properties
(jid,node,name,action).
:Types:
- `item_list`: sequence of `DiscoItem` or sequence ... | def set_items(self, item_list):
"""Set items in the disco#items object.
All previous items are removed.
:Parameters:
- `item_list`: list of items or item properties
(jid,node,name,action).
:Types:
- `item_list`: sequence of `DiscoItem` or sequence ... | [
"Set",
"items",
"in",
"the",
"disco#items",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L476-L493 | [
"def",
"set_items",
"(",
"self",
",",
"item_list",
")",
":",
"for",
"item",
"in",
"self",
".",
"items",
":",
"item",
".",
"remove",
"(",
")",
"for",
"item",
"in",
"item_list",
":",
"try",
":",
"self",
".",
"add_item",
"(",
"item",
".",
"jid",
",",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItems.add_item | Add a new item to the `DiscoItems` object.
:Parameters:
- `jid`: item JID.
- `node`: item node name.
- `name`: item name.
- `action`: action for a "disco push".
:Types:
- `jid`: `pyxmpp.JID`
- `node`: `unicode`
- `name`... | pyxmpp2/ext/disco.py | def add_item(self,jid,node=None,name=None,action=None):
"""Add a new item to the `DiscoItems` object.
:Parameters:
- `jid`: item JID.
- `node`: item node name.
- `name`: item name.
- `action`: action for a "disco push".
:Types:
- `jid`... | def add_item(self,jid,node=None,name=None,action=None):
"""Add a new item to the `DiscoItems` object.
:Parameters:
- `jid`: item JID.
- `node`: item node name.
- `name`: item name.
- `action`: action for a "disco push".
:Types:
- `jid`... | [
"Add",
"a",
"new",
"item",
"to",
"the",
"DiscoItems",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L501-L517 | [
"def",
"add_item",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
",",
"name",
"=",
"None",
",",
"action",
"=",
"None",
")",
":",
"return",
"DiscoItem",
"(",
"self",
",",
"jid",
",",
"node",
",",
"name",
",",
"action",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoItems.has_item | Check if `self` contains an item.
:Parameters:
- `jid`: JID of the item.
- `node`: node name of the item.
:Types:
- `jid`: `JID`
- `node`: `libxml2.xmlNode`
:return: `True` if the item is found in `self`.
:returntype: `bool` | pyxmpp2/ext/disco.py | def has_item(self,jid,node=None):
"""Check if `self` contains an item.
:Parameters:
- `jid`: JID of the item.
- `node`: node name of the item.
:Types:
- `jid`: `JID`
- `node`: `libxml2.xmlNode`
:return: `True` if the item is found in `sel... | def has_item(self,jid,node=None):
"""Check if `self` contains an item.
:Parameters:
- `jid`: JID of the item.
- `node`: node name of the item.
:Types:
- `jid`: `JID`
- `node`: `libxml2.xmlNode`
:return: `True` if the item is found in `sel... | [
"Check",
"if",
"self",
"contains",
"an",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L519-L538 | [
"def",
"has_item",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"l",
"=",
"self",
".",
"xpath_ctxt",
".",
"xpathEval",
"(",
"\"d:item\"",
")",
"if",
"l",
"is",
"None",
":",
"return",
"False",
"for",
"it",
"in",
"l",
":",
"di",
"="... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.get_features | Get the features contained in `self`.
:return: the list of features.
:returntype: `list` of `unicode` | pyxmpp2/ext/disco.py | def get_features(self):
"""Get the features contained in `self`.
:return: the list of features.
:returntype: `list` of `unicode`"""
l = self.xpath_ctxt.xpathEval("d:feature")
ret = []
for f in l:
if f.hasProp("var"):
ret.append( f.prop("var").... | def get_features(self):
"""Get the features contained in `self`.
:return: the list of features.
:returntype: `list` of `unicode`"""
l = self.xpath_ctxt.xpathEval("d:feature")
ret = []
for f in l:
if f.hasProp("var"):
ret.append( f.prop("var").... | [
"Get",
"the",
"features",
"contained",
"in",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L628-L638 | [
"def",
"get_features",
"(",
"self",
")",
":",
"l",
"=",
"self",
".",
"xpath_ctxt",
".",
"xpathEval",
"(",
"\"d:feature\"",
")",
"ret",
"=",
"[",
"]",
"for",
"f",
"in",
"l",
":",
"if",
"f",
".",
"hasProp",
"(",
"\"var\"",
")",
":",
"ret",
".",
"ap... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.set_features | Set features in the disco#info object.
All existing features are removed from `self`.
:Parameters:
- `features`: list of features.
:Types:
- `features`: sequence of `unicode` | pyxmpp2/ext/disco.py | def set_features(self, features):
"""Set features in the disco#info object.
All existing features are removed from `self`.
:Parameters:
- `features`: list of features.
:Types:
- `features`: sequence of `unicode`
"""
for var in self.features:
... | def set_features(self, features):
"""Set features in the disco#info object.
All existing features are removed from `self`.
:Parameters:
- `features`: list of features.
:Types:
- `features`: sequence of `unicode`
"""
for var in self.features:
... | [
"Set",
"features",
"in",
"the",
"disco#info",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L640-L654 | [
"def",
"set_features",
"(",
"self",
",",
"features",
")",
":",
"for",
"var",
"in",
"self",
".",
"features",
":",
"self",
".",
"remove_feature",
"(",
"var",
")",
"for",
"var",
"in",
"features",
":",
"self",
".",
"add_feature",
"(",
"var",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.has_feature | Check if `self` contains the named feature.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`
:return: `True` if the feature is found in `self`.
:returntype: `bool` | pyxmpp2/ext/disco.py | def has_feature(self,var):
"""Check if `self` contains the named feature.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`
:return: `True` if the feature is found in `self`.
:returntype: `bool`"""
if not var:
raise V... | def has_feature(self,var):
"""Check if `self` contains the named feature.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`
:return: `True` if the feature is found in `self`.
:returntype: `bool`"""
if not var:
raise V... | [
"Check",
"if",
"self",
"contains",
"the",
"named",
"feature",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L658-L681 | [
"def",
"has_feature",
"(",
"self",
",",
"var",
")",
":",
"if",
"not",
"var",
":",
"raise",
"ValueError",
"(",
"\"var is None\"",
")",
"if",
"'\"'",
"not",
"in",
"var",
":",
"expr",
"=",
"u'd:feature[@var=\"%s\"]'",
"%",
"(",
"var",
",",
")",
"elif",
"\... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.add_feature | Add a feature to `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode` | pyxmpp2/ext/disco.py | def add_feature(self,var):
"""Add a feature to `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`"""
if self.has_feature(var):
return
n=self.xmlnode.newChild(None, "feature", None)
n.setProp("var", to_utf8(var)) | def add_feature(self,var):
"""Add a feature to `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`"""
if self.has_feature(var):
return
n=self.xmlnode.newChild(None, "feature", None)
n.setProp("var", to_utf8(var)) | [
"Add",
"a",
"feature",
"to",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L687-L697 | [
"def",
"add_feature",
"(",
"self",
",",
"var",
")",
":",
"if",
"self",
".",
"has_feature",
"(",
"var",
")",
":",
"return",
"n",
"=",
"self",
".",
"xmlnode",
".",
"newChild",
"(",
"None",
",",
"\"feature\"",
",",
"None",
")",
"n",
".",
"setProp",
"(... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.remove_feature | Remove a feature from `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode` | pyxmpp2/ext/disco.py | def remove_feature(self,var):
"""Remove a feature from `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`"""
if not var:
raise ValueError("var is None")
if '"' not in var:
expr='d:feature[@var="%s"]' % (var,... | def remove_feature(self,var):
"""Remove a feature from `self`.
:Parameters:
- `var`: the feature name.
:Types:
- `var`: `unicode`"""
if not var:
raise ValueError("var is None")
if '"' not in var:
expr='d:feature[@var="%s"]' % (var,... | [
"Remove",
"a",
"feature",
"from",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L699-L721 | [
"def",
"remove_feature",
"(",
"self",
",",
"var",
")",
":",
"if",
"not",
"var",
":",
"raise",
"ValueError",
"(",
"\"var is None\"",
")",
"if",
"'\"'",
"not",
"in",
"var",
":",
"expr",
"=",
"'d:feature[@var=\"%s\"]'",
"%",
"(",
"var",
",",
")",
"elif",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.get_identities | List the identity objects contained in `self`.
:return: the list of identities.
:returntype: `list` of `DiscoIdentity` | pyxmpp2/ext/disco.py | def get_identities(self):
"""List the identity objects contained in `self`.
:return: the list of identities.
:returntype: `list` of `DiscoIdentity`"""
ret=[]
l=self.xpath_ctxt.xpathEval("d:identity")
if l is not None:
for i in l:
ret.append(Di... | def get_identities(self):
"""List the identity objects contained in `self`.
:return: the list of identities.
:returntype: `list` of `DiscoIdentity`"""
ret=[]
l=self.xpath_ctxt.xpathEval("d:identity")
if l is not None:
for i in l:
ret.append(Di... | [
"List",
"the",
"identity",
"objects",
"contained",
"in",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L723-L733 | [
"def",
"get_identities",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"l",
"=",
"self",
".",
"xpath_ctxt",
".",
"xpathEval",
"(",
"\"d:identity\"",
")",
"if",
"l",
"is",
"not",
"None",
":",
"for",
"i",
"in",
"l",
":",
"ret",
".",
"append",
"(",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.set_identities | Set identities in the disco#info object.
Remove all existing identities from `self`.
:Parameters:
- `identities`: list of identities or identity properties
(jid,node,category,type,name).
:Types:
- `identities`: sequence of `DiscoIdentity` or sequence of se... | pyxmpp2/ext/disco.py | def set_identities(self,identities):
"""Set identities in the disco#info object.
Remove all existing identities from `self`.
:Parameters:
- `identities`: list of identities or identity properties
(jid,node,category,type,name).
:Types:
- `identities... | def set_identities(self,identities):
"""Set identities in the disco#info object.
Remove all existing identities from `self`.
:Parameters:
- `identities`: list of identities or identity properties
(jid,node,category,type,name).
:Types:
- `identities... | [
"Set",
"identities",
"in",
"the",
"disco#info",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L735-L752 | [
"def",
"set_identities",
"(",
"self",
",",
"identities",
")",
":",
"for",
"identity",
"in",
"self",
".",
"identities",
":",
"identity",
".",
"remove",
"(",
")",
"for",
"identity",
"in",
"identities",
":",
"try",
":",
"self",
".",
"add_identity",
"(",
"id... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.identity_is | Check if the item described by `self` belongs to the given category
and type.
:Parameters:
- `item_category`: the category name.
- `item_type`: the type name. If `None` then only the category is
checked.
:Types:
- `item_category`: `unicode`
... | pyxmpp2/ext/disco.py | def identity_is(self,item_category,item_type=None):
"""Check if the item described by `self` belongs to the given category
and type.
:Parameters:
- `item_category`: the category name.
- `item_type`: the type name. If `None` then only the category is
checked... | def identity_is(self,item_category,item_type=None):
"""Check if the item described by `self` belongs to the given category
and type.
:Parameters:
- `item_category`: the category name.
- `item_type`: the type name. If `None` then only the category is
checked... | [
"Check",
"if",
"the",
"item",
"described",
"by",
"self",
"belongs",
"to",
"the",
"given",
"category",
"and",
"type",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L756-L792 | [
"def",
"identity_is",
"(",
"self",
",",
"item_category",
",",
"item_type",
"=",
"None",
")",
":",
"if",
"not",
"item_category",
":",
"raise",
"ValueError",
"(",
"\"bad category\"",
")",
"if",
"not",
"item_type",
":",
"type_expr",
"=",
"u\"\"",
"elif",
"'\"'"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoInfo.add_identity | Add an identity to the `DiscoInfo` object.
:Parameters:
- `item_name`: name of the item.
- `item_category`: category of the item.
- `item_type`: type of the item.
:Types:
- `item_name`: `unicode`
- `item_category`: `unicode`
- `ite... | pyxmpp2/ext/disco.py | def add_identity(self,item_name,item_category=None,item_type=None):
"""Add an identity to the `DiscoInfo` object.
:Parameters:
- `item_name`: name of the item.
- `item_category`: category of the item.
- `item_type`: type of the item.
:Types:
- `it... | def add_identity(self,item_name,item_category=None,item_type=None):
"""Add an identity to the `DiscoInfo` object.
:Parameters:
- `item_name`: name of the item.
- `item_category`: category of the item.
- `item_type`: type of the item.
:Types:
- `it... | [
"Add",
"an",
"identity",
"to",
"the",
"DiscoInfo",
"object",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L798-L812 | [
"def",
"add_identity",
"(",
"self",
",",
"item_name",
",",
"item_category",
"=",
"None",
",",
"item_type",
"=",
"None",
")",
":",
"return",
"DiscoIdentity",
"(",
"self",
",",
"item_name",
",",
"item_category",
",",
"item_type",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoCacheFetcherBase.fetch | Initialize the Service Discovery process. | pyxmpp2/ext/disco.py | def fetch(self):
"""Initialize the Service Discovery process."""
from ..iq import Iq
jid,node = self.address
iq = Iq(to_jid = jid, stanza_type = "get")
disco = self.disco_class(node)
iq.add_content(disco.xmlnode)
self.stream.set_response_handlers(iq,self.__respons... | def fetch(self):
"""Initialize the Service Discovery process."""
from ..iq import Iq
jid,node = self.address
iq = Iq(to_jid = jid, stanza_type = "get")
disco = self.disco_class(node)
iq.add_content(disco.xmlnode)
self.stream.set_response_handlers(iq,self.__respons... | [
"Initialize",
"the",
"Service",
"Discovery",
"process",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L826-L835 | [
"def",
"fetch",
"(",
"self",
")",
":",
"from",
".",
".",
"iq",
"import",
"Iq",
"jid",
",",
"node",
"=",
"self",
".",
"address",
"iq",
"=",
"Iq",
"(",
"to_jid",
"=",
"jid",
",",
"stanza_type",
"=",
"\"get\"",
")",
"disco",
"=",
"self",
".",
"disco... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoCacheFetcherBase.__response | Handle successful disco response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza` | pyxmpp2/ext/disco.py | def __response(self,stanza):
"""Handle successful disco response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`"""
try:
d=self.disco_class(stanza.get_query())
self.got_it(d)
except ValueEr... | def __response(self,stanza):
"""Handle successful disco response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`"""
try:
d=self.disco_class(stanza.get_query())
self.got_it(d)
except ValueEr... | [
"Handle",
"successful",
"disco",
"response",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L837-L848 | [
"def",
"__response",
"(",
"self",
",",
"stanza",
")",
":",
"try",
":",
"d",
"=",
"self",
".",
"disco_class",
"(",
"stanza",
".",
"get_query",
"(",
")",
")",
"self",
".",
"got_it",
"(",
"d",
")",
"except",
"ValueError",
",",
"e",
":",
"self",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | DiscoCacheFetcherBase.__error | Handle disco error response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza` | pyxmpp2/ext/disco.py | def __error(self,stanza):
"""Handle disco error response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`"""
try:
self.error(stanza.get_error())
except ProtocolError:
from ..error import Sta... | def __error(self,stanza):
"""Handle disco error response.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`"""
try:
self.error(stanza.get_error())
except ProtocolError:
from ..error import Sta... | [
"Handle",
"disco",
"error",
"response",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/disco.py#L850-L861 | [
"def",
"__error",
"(",
"self",
",",
"stanza",
")",
":",
"try",
":",
"self",
".",
"error",
"(",
"stanza",
".",
"get_error",
"(",
")",
")",
"except",
"ProtocolError",
":",
"from",
".",
".",
"error",
"import",
"StanzaErrorNode",
"self",
".",
"error",
"(",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Iq.make_error_response | Create error response for the a "get" or "set" iq stanza.
:Parameters:
- `cond`: error condition name, as defined in XMPP specification.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes swapped, type="error" and containing <error /> element
... | pyxmpp2/iq.py | def make_error_response(self, cond):
"""Create error response for the a "get" or "set" iq stanza.
:Parameters:
- `cond`: error condition name, as defined in XMPP specification.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes swapped, type... | def make_error_response(self, cond):
"""Create error response for the a "get" or "set" iq stanza.
:Parameters:
- `cond`: error condition name, as defined in XMPP specification.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes swapped, type... | [
"Create",
"error",
"response",
"for",
"the",
"a",
"get",
"or",
"set",
"iq",
"stanza",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/iq.py#L106-L129 | [
"def",
"make_error_response",
"(",
"self",
",",
"cond",
")",
":",
"if",
"self",
".",
"stanza_type",
"in",
"(",
"\"result\"",
",",
"\"error\"",
")",
":",
"raise",
"ValueError",
"(",
"\"Errors may not be generated for\"",
"\" 'result' and 'error' iq\"",
")",
"stanza",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Iq.make_result_response | Create result response for the a "get" or "set" iq stanza.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes replaced and type="result".
:returntype: `Iq` | pyxmpp2/iq.py | def make_result_response(self):
"""Create result response for the a "get" or "set" iq stanza.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes replaced and type="result".
:returntype: `Iq`"""
if self.stanza_type not in ("set", "get"):
... | def make_result_response(self):
"""Create result response for the a "get" or "set" iq stanza.
:return: new `Iq` object with the same "id" as self, "from" and "to"
attributes replaced and type="result".
:returntype: `Iq`"""
if self.stanza_type not in ("set", "get"):
... | [
"Create",
"result",
"response",
"for",
"the",
"a",
"get",
"or",
"set",
"iq",
"stanza",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/iq.py#L131-L143 | [
"def",
"make_result_response",
"(",
"self",
")",
":",
"if",
"self",
".",
"stanza_type",
"not",
"in",
"(",
"\"set\"",
",",
"\"get\"",
")",
":",
"raise",
"ValueError",
"(",
"\"Results may only be generated for\"",
"\" 'set' or 'get' iq\"",
")",
"stanza",
"=",
"Iq",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Iq.add_payload | Add new the stanza payload. Fails if there is already some
payload element attached (<iq/> stanza can contain only one payload
element)
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
:Types:
- `payload`: :et... | pyxmpp2/iq.py | def add_payload(self, payload):
"""Add new the stanza payload. Fails if there is already some
payload element attached (<iq/> stanza can contain only one payload
element)
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
... | def add_payload(self, payload):
"""Add new the stanza payload. Fails if there is already some
payload element attached (<iq/> stanza can contain only one payload
element)
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
... | [
"Add",
"new",
"the",
"stanza",
"payload",
".",
"Fails",
"if",
"there",
"is",
"already",
"some",
"payload",
"element",
"attached",
"(",
"<iq",
"/",
">",
"stanza",
"can",
"contain",
"only",
"one",
"payload",
"element",
")"
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/iq.py#L145-L162 | [
"def",
"add_payload",
"(",
"self",
",",
"payload",
")",
":",
"if",
"self",
".",
"_payload",
"is",
"None",
":",
"self",
".",
"decode_payload",
"(",
")",
"if",
"len",
"(",
"self",
".",
"_payload",
")",
">=",
"1",
":",
"raise",
"ValueError",
"(",
"\"Can... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler.make_stream_tls_features | Update the <features/> element with StartTLS feature.
[receving entity only]
:Parameters:
- `features`: the <features/> element of the stream.
:Types:
- `features`: :etree:`ElementTree.Element`
:returns: update <features/> element.
:returntype: :etree:`... | pyxmpp2/streamtls.py | def make_stream_tls_features(self, stream, features):
"""Update the <features/> element with StartTLS feature.
[receving entity only]
:Parameters:
- `features`: the <features/> element of the stream.
:Types:
- `features`: :etree:`ElementTree.Element`
:r... | def make_stream_tls_features(self, stream, features):
"""Update the <features/> element with StartTLS feature.
[receving entity only]
:Parameters:
- `features`: the <features/> element of the stream.
:Types:
- `features`: :etree:`ElementTree.Element`
:r... | [
"Update",
"the",
"<features",
"/",
">",
"element",
"with",
"StartTLS",
"feature",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L72-L93 | [
"def",
"make_stream_tls_features",
"(",
"self",
",",
"stream",
",",
"features",
")",
":",
"if",
"self",
".",
"stream",
"and",
"stream",
"is",
"not",
"self",
".",
"stream",
":",
"raise",
"ValueError",
"(",
"\"Single StreamTLSHandler instance can handle\"",
"\" only... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler.handle_stream_features | Process incoming StartTLS related element of <stream:features/>.
[initiating entity only] | pyxmpp2/streamtls.py | def handle_stream_features(self, stream, features):
"""Process incoming StartTLS related element of <stream:features/>.
[initiating entity only]
"""
if self.stream and stream is not self.stream:
raise ValueError("Single StreamTLSHandler instance can handle"
... | def handle_stream_features(self, stream, features):
"""Process incoming StartTLS related element of <stream:features/>.
[initiating entity only]
"""
if self.stream and stream is not self.stream:
raise ValueError("Single StreamTLSHandler instance can handle"
... | [
"Process",
"incoming",
"StartTLS",
"related",
"element",
"of",
"<stream",
":",
"features",
"/",
">",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L95-L127 | [
"def",
"handle_stream_features",
"(",
"self",
",",
"stream",
",",
"features",
")",
":",
"if",
"self",
".",
"stream",
"and",
"stream",
"is",
"not",
"self",
".",
"stream",
":",
"raise",
"ValueError",
"(",
"\"Single StreamTLSHandler instance can handle\"",
"\" only o... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler._request_tls | Request a TLS-encrypted connection.
[initiating entity only] | pyxmpp2/streamtls.py | def _request_tls(self):
"""Request a TLS-encrypted connection.
[initiating entity only]"""
self.requested = True
element = ElementTree.Element(STARTTLS_TAG)
self.stream.write_element(element) | def _request_tls(self):
"""Request a TLS-encrypted connection.
[initiating entity only]"""
self.requested = True
element = ElementTree.Element(STARTTLS_TAG)
self.stream.write_element(element) | [
"Request",
"a",
"TLS",
"-",
"encrypted",
"connection",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L129-L135 | [
"def",
"_request_tls",
"(",
"self",
")",
":",
"self",
".",
"requested",
"=",
"True",
"element",
"=",
"ElementTree",
".",
"Element",
"(",
"STARTTLS_TAG",
")",
"self",
".",
"stream",
".",
"write_element",
"(",
"element",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler._process_tls_proceed | Handle the <proceed /> element. | pyxmpp2/streamtls.py | def _process_tls_proceed(self, stream, element):
"""Handle the <proceed /> element.
"""
# pylint: disable-msg=W0613
if not self.requested:
logger.debug("Unexpected TLS element: {0!r}".format(element))
return False
logger.debug(" tls: <proceed/> received")
... | def _process_tls_proceed(self, stream, element):
"""Handle the <proceed /> element.
"""
# pylint: disable-msg=W0613
if not self.requested:
logger.debug("Unexpected TLS element: {0!r}".format(element))
return False
logger.debug(" tls: <proceed/> received")
... | [
"Handle",
"the",
"<proceed",
"/",
">",
"element",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L146-L156 | [
"def",
"_process_tls_proceed",
"(",
"self",
",",
"stream",
",",
"element",
")",
":",
"# pylint: disable-msg=W0613",
"if",
"not",
"self",
".",
"requested",
":",
"logger",
".",
"debug",
"(",
"\"Unexpected TLS element: {0!r}\"",
".",
"format",
"(",
"element",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler._make_tls_connection | Initiate TLS connection.
[initiating entity only] | pyxmpp2/streamtls.py | def _make_tls_connection(self):
"""Initiate TLS connection.
[initiating entity only]
"""
logger.debug("Preparing TLS connection")
if self.settings["tls_verify_peer"]:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
self.strea... | def _make_tls_connection(self):
"""Initiate TLS connection.
[initiating entity only]
"""
logger.debug("Preparing TLS connection")
if self.settings["tls_verify_peer"]:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
self.strea... | [
"Initiate",
"TLS",
"connection",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L166-L184 | [
"def",
"_make_tls_connection",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Preparing TLS connection\"",
")",
"if",
"self",
".",
"settings",
"[",
"\"tls_verify_peer\"",
"]",
":",
"cert_reqs",
"=",
"ssl",
".",
"CERT_REQUIRED",
"else",
":",
"cert_reqs",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler.handle_tls_connected_event | Verify the peer certificate on the `TLSConnectedEvent`. | pyxmpp2/streamtls.py | def handle_tls_connected_event(self, event):
"""Verify the peer certificate on the `TLSConnectedEvent`.
"""
if self.settings["tls_verify_peer"]:
valid = self.settings["tls_verify_callback"](event.stream,
event.peer_certificate)
... | def handle_tls_connected_event(self, event):
"""Verify the peer certificate on the `TLSConnectedEvent`.
"""
if self.settings["tls_verify_peer"]:
valid = self.settings["tls_verify_callback"](event.stream,
event.peer_certificate)
... | [
"Verify",
"the",
"peer",
"certificate",
"on",
"the",
"TLSConnectedEvent",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L187-L197 | [
"def",
"handle_tls_connected_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"settings",
"[",
"\"tls_verify_peer\"",
"]",
":",
"valid",
"=",
"self",
".",
"settings",
"[",
"\"tls_verify_callback\"",
"]",
"(",
"event",
".",
"stream",
",",
"even... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | StreamTLSHandler.is_certificate_valid | Default certificate verification callback for TLS connections.
:Parameters:
- `cert`: certificate information
:Types:
- `cert`: `CertificateData`
:return: computed verification result. | pyxmpp2/streamtls.py | def is_certificate_valid(stream, cert):
"""Default certificate verification callback for TLS connections.
:Parameters:
- `cert`: certificate information
:Types:
- `cert`: `CertificateData`
:return: computed verification result.
"""
try:
... | def is_certificate_valid(stream, cert):
"""Default certificate verification callback for TLS connections.
:Parameters:
- `cert`: certificate information
:Types:
- `cert`: `CertificateData`
:return: computed verification result.
"""
try:
... | [
"Default",
"certificate",
"verification",
"callback",
"for",
"TLS",
"connections",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamtls.py#L200-L229 | [
"def",
"is_certificate_valid",
"(",
"stream",
",",
"cert",
")",
":",
"try",
":",
"logger",
".",
"debug",
"(",
"\"tls_is_certificate_valid(cert = {0!r})\"",
".",
"format",
"(",
"cert",
")",
")",
"if",
"not",
"cert",
":",
"logger",
".",
"warning",
"(",
"\"No T... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | main | Parse the command-line arguments and run the tool. | examples/check_version.py | def main():
"""Parse the command-line arguments and run the tool."""
parser = argparse.ArgumentParser(description = 'XMPP version checker',
parents = [XMPPSettings.get_arg_parser()])
parser.add_argument('source', metavar = 'SOURCE',
... | def main():
"""Parse the command-line arguments and run the tool."""
parser = argparse.ArgumentParser(description = 'XMPP version checker',
parents = [XMPPSettings.get_arg_parser()])
parser.add_argument('source', metavar = 'SOURCE',
... | [
"Parse",
"the",
"command",
"-",
"line",
"arguments",
"and",
"run",
"the",
"tool",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/examples/check_version.py#L69-L112 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'XMPP version checker'",
",",
"parents",
"=",
"[",
"XMPPSettings",
".",
"get_arg_parser",
"(",
")",
"]",
")",
"parser",
".",
"add_argument",
"(",
"'sour... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | VersionChecker.handle_authorized | Send the initial presence after log-in. | examples/check_version.py | def handle_authorized(self, event):
"""Send the initial presence after log-in."""
request_software_version(self.client, self.target_jid,
self.success, self.failure) | def handle_authorized(self, event):
"""Send the initial presence after log-in."""
request_software_version(self.client, self.target_jid,
self.success, self.failure) | [
"Send",
"the",
"initial",
"presence",
"after",
"log",
"-",
"in",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/examples/check_version.py#L39-L42 | [
"def",
"handle_authorized",
"(",
"self",
",",
"event",
")",
":",
"request_software_version",
"(",
"self",
".",
"client",
",",
"self",
".",
"target_jid",
",",
"self",
".",
"success",
",",
"self",
".",
"failure",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ExpiringDictionary.set_item | Set item of the dictionary.
:Parameters:
- `key`: the key.
- `value`: the object to store.
- `timeout`: timeout value for the object (in seconds from now).
- `timeout_callback`: function to be called when the item expires.
The callback should accept... | pyxmpp2/expdict.py | def set_item(self, key, value, timeout = None, timeout_callback = None):
"""Set item of the dictionary.
:Parameters:
- `key`: the key.
- `value`: the object to store.
- `timeout`: timeout value for the object (in seconds from now).
- `timeout_callback`: f... | def set_item(self, key, value, timeout = None, timeout_callback = None):
"""Set item of the dictionary.
:Parameters:
- `key`: the key.
- `value`: the object to store.
- `timeout`: timeout value for the object (in seconds from now).
- `timeout_callback`: f... | [
"Set",
"item",
"of",
"the",
"dictionary",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/expdict.py#L88-L110 | [
"def",
"set_item",
"(",
"self",
",",
"key",
",",
"value",
",",
"timeout",
"=",
"None",
",",
"timeout_callback",
"=",
"None",
")",
":",
"with",
"self",
".",
"_lock",
":",
"logger",
".",
"debug",
"(",
"\"expdict.__setitem__({0!r}, {1!r}, {2!r}, {3!r})\"",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ExpiringDictionary.expire | Do the expiration of dictionary items.
Remove items that expired by now from the dictionary.
:Return: time, in seconds, when the next item expires or `None`
:returntype: `float` | pyxmpp2/expdict.py | def expire(self):
"""Do the expiration of dictionary items.
Remove items that expired by now from the dictionary.
:Return: time, in seconds, when the next item expires or `None`
:returntype: `float`
"""
with self._lock:
logger.debug("expdict.expire. timeouts... | def expire(self):
"""Do the expiration of dictionary items.
Remove items that expired by now from the dictionary.
:Return: time, in seconds, when the next item expires or `None`
:returntype: `float`
"""
with self._lock:
logger.debug("expdict.expire. timeouts... | [
"Do",
"the",
"expiration",
"of",
"dictionary",
"items",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/expdict.py#L112-L131 | [
"def",
"expire",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"logger",
".",
"debug",
"(",
"\"expdict.expire. timeouts: {0!r}\"",
".",
"format",
"(",
"self",
".",
"_timeouts",
")",
")",
"next_timeout",
"=",
"None",
"for",
"k",
"in",
"self",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ExpiringDictionary._expire_item | Do the expiration of a dictionary item.
Remove the item if it has expired by now.
:Parameters:
- `key`: key to the object.
:Types:
- `key`: any hashable value | pyxmpp2/expdict.py | def _expire_item(self, key):
"""Do the expiration of a dictionary item.
Remove the item if it has expired by now.
:Parameters:
- `key`: key to the object.
:Types:
- `key`: any hashable value
"""
(timeout, callback) = self._timeouts[key]
n... | def _expire_item(self, key):
"""Do the expiration of a dictionary item.
Remove the item if it has expired by now.
:Parameters:
- `key`: key to the object.
:Types:
- `key`: any hashable value
"""
(timeout, callback) = self._timeouts[key]
n... | [
"Do",
"the",
"expiration",
"of",
"a",
"dictionary",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/expdict.py#L138-L163 | [
"def",
"_expire_item",
"(",
"self",
",",
"key",
")",
":",
"(",
"timeout",
",",
"callback",
")",
"=",
"self",
".",
"_timeouts",
"[",
"key",
"]",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"timeout",
"<=",
"now",
":",
"item",
"=",
"dict",
"."... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza._decode_attributes | Decode attributes of the stanza XML element
and put them into the stanza properties. | pyxmpp2/stanza.py | def _decode_attributes(self):
"""Decode attributes of the stanza XML element
and put them into the stanza properties."""
try:
from_jid = self._element.get('from')
if from_jid:
self._from_jid = JID(from_jid)
to_jid = self._element.get('to')
... | def _decode_attributes(self):
"""Decode attributes of the stanza XML element
and put them into the stanza properties."""
try:
from_jid = self._element.get('from')
if from_jid:
self._from_jid = JID(from_jid)
to_jid = self._element.get('to')
... | [
"Decode",
"attributes",
"of",
"the",
"stanza",
"XML",
"element",
"and",
"put",
"them",
"into",
"the",
"stanza",
"properties",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L144-L160 | [
"def",
"_decode_attributes",
"(",
"self",
")",
":",
"try",
":",
"from_jid",
"=",
"self",
".",
"_element",
".",
"get",
"(",
"'from'",
")",
"if",
"from_jid",
":",
"self",
".",
"_from_jid",
"=",
"JID",
"(",
"from_jid",
")",
"to_jid",
"=",
"self",
".",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza._decode_error | Decode error element of the stanza. | pyxmpp2/stanza.py | def _decode_error(self):
"""Decode error element of the stanza."""
error_qname = self._ns_prefix + "error"
for child in self._element:
if child.tag == error_qname:
self._error = StanzaErrorElement(child)
return
raise BadRequestProtocolError("Er... | def _decode_error(self):
"""Decode error element of the stanza."""
error_qname = self._ns_prefix + "error"
for child in self._element:
if child.tag == error_qname:
self._error = StanzaErrorElement(child)
return
raise BadRequestProtocolError("Er... | [
"Decode",
"error",
"element",
"of",
"the",
"stanza",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L162-L170 | [
"def",
"_decode_error",
"(",
"self",
")",
":",
"error_qname",
"=",
"self",
".",
"_ns_prefix",
"+",
"\"error\"",
"for",
"child",
"in",
"self",
".",
"_element",
":",
"if",
"child",
".",
"tag",
"==",
"error_qname",
":",
"self",
".",
"_error",
"=",
"StanzaEr... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.copy | Create a deep copy of the stanza.
:returntype: `Stanza` | pyxmpp2/stanza.py | def copy(self):
"""Create a deep copy of the stanza.
:returntype: `Stanza`"""
result = Stanza(self.element_name, self.from_jid, self.to_jid,
self.stanza_type, self.stanza_id, self.error,
self._return_path())
if self._payload is None:
... | def copy(self):
"""Create a deep copy of the stanza.
:returntype: `Stanza`"""
result = Stanza(self.element_name, self.from_jid, self.to_jid,
self.stanza_type, self.stanza_id, self.error,
self._return_path())
if self._payload is None:
... | [
"Create",
"a",
"deep",
"copy",
"of",
"the",
"stanza",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L172-L183 | [
"def",
"copy",
"(",
"self",
")",
":",
"result",
"=",
"Stanza",
"(",
"self",
".",
"element_name",
",",
"self",
".",
"from_jid",
",",
"self",
".",
"to_jid",
",",
"self",
".",
"stanza_type",
",",
"self",
".",
"stanza_id",
",",
"self",
".",
"error",
",",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.as_xml | 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` | pyxmpp2/stanza.py | 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`"""
attrs = {}
if self._from_jid:
... | 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`"""
attrs = {}
if self._from_jid:
... | [
"Return",
"the",
"XML",
"stanza",
"representation",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L192-L218 | [
"def",
"as_xml",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"}",
"if",
"self",
".",
"_from_jid",
":",
"attrs",
"[",
"'from'",
"]",
"=",
"unicode",
"(",
"self",
".",
"_from_jid",
")",
"if",
"self",
".",
"_to_jid",
":",
"attrs",
"[",
"'to'",
"]",
"=... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.get_xml | Return the XML stanza representation.
This returns the original or cached XML representation, which
may be much more efficient than `as_xml`.
Result of this function should never be modified.
:returntype: :etree:`ElementTree.Element` | pyxmpp2/stanza.py | def get_xml(self):
"""Return the XML stanza representation.
This returns the original or cached XML representation, which
may be much more efficient than `as_xml`.
Result of this function should never be modified.
:returntype: :etree:`ElementTree.Element`"""
if not sel... | def get_xml(self):
"""Return the XML stanza representation.
This returns the original or cached XML representation, which
may be much more efficient than `as_xml`.
Result of this function should never be modified.
:returntype: :etree:`ElementTree.Element`"""
if not sel... | [
"Return",
"the",
"XML",
"stanza",
"representation",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L220-L234 | [
"def",
"get_xml",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_dirty",
":",
"return",
"self",
".",
"_element",
"element",
"=",
"self",
".",
"as_xml",
"(",
")",
"self",
".",
"_element",
"=",
"element",
"self",
".",
"_dirty",
"=",
"False",
"retur... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.decode_payload | Decode payload from the element passed to the stanza constructor.
Iterates over stanza children and creates StanzaPayload objects for
them. Called automatically by `get_payload()` and other methods that
access the payload.
For the `Stanza` class stanza namespace child elements will als... | pyxmpp2/stanza.py | def decode_payload(self, specialize = False):
"""Decode payload from the element passed to the stanza constructor.
Iterates over stanza children and creates StanzaPayload objects for
them. Called automatically by `get_payload()` and other methods that
access the payload.
For th... | def decode_payload(self, specialize = False):
"""Decode payload from the element passed to the stanza constructor.
Iterates over stanza children and creates StanzaPayload objects for
them. Called automatically by `get_payload()` and other methods that
access the payload.
For th... | [
"Decode",
"payload",
"from",
"the",
"element",
"passed",
"to",
"the",
"stanza",
"constructor",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L236-L261 | [
"def",
"decode_payload",
"(",
"self",
",",
"specialize",
"=",
"False",
")",
":",
"if",
"self",
".",
"_payload",
"is",
"not",
"None",
":",
"# already decoded",
"return",
"if",
"self",
".",
"_element",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"This s... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.set_payload | Set stanza payload to a single item.
All current stanza content of will be dropped.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to use
:Types:
- `payload`: :etree:`ElementTree.Element` or `StanzaPayload` | pyxmpp2/stanza.py | def set_payload(self, payload):
"""Set stanza payload to a single item.
All current stanza content of will be dropped.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to use
:Types:
- `payload`: :etree:`ElementTree.... | def set_payload(self, payload):
"""Set stanza payload to a single item.
All current stanza content of will be dropped.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to use
:Types:
- `payload`: :etree:`ElementTree.... | [
"Set",
"stanza",
"payload",
"to",
"a",
"single",
"item",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L350-L367 | [
"def",
"set_payload",
"(",
"self",
",",
"payload",
")",
":",
"if",
"isinstance",
"(",
"payload",
",",
"ElementClass",
")",
":",
"self",
".",
"_payload",
"=",
"[",
"XMLPayload",
"(",
"payload",
")",
"]",
"elif",
"isinstance",
"(",
"payload",
",",
"StanzaP... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.add_payload | Add new the stanza payload.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
:Types:
- `payload`: :etree:`ElementTree.Element` or `StanzaPayload` | pyxmpp2/stanza.py | def add_payload(self, payload):
"""Add new the stanza payload.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
:Types:
- `payload`: :etree:`ElementTree.Element` or `StanzaPayload`
"""
if self._payload... | def add_payload(self, payload):
"""Add new the stanza payload.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
:Types:
- `payload`: :etree:`ElementTree.Element` or `StanzaPayload`
"""
if self._payload... | [
"Add",
"new",
"the",
"stanza",
"payload",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L369-L387 | [
"def",
"add_payload",
"(",
"self",
",",
"payload",
")",
":",
"if",
"self",
".",
"_payload",
"is",
"None",
":",
"self",
".",
"decode_payload",
"(",
")",
"if",
"isinstance",
"(",
"payload",
",",
"ElementClass",
")",
":",
"self",
".",
"_payload",
".",
"ap... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.get_all_payload | Return list of stanza payload objects.
:Parameters:
- `specialize`: If `True`, then return objects of specialized
`StanzaPayload` classes whenever possible, otherwise the
representation already available will be used (often
`XMLPayload`)
:Returntyp... | pyxmpp2/stanza.py | def get_all_payload(self, specialize = False):
"""Return list of stanza payload objects.
:Parameters:
- `specialize`: If `True`, then return objects of specialized
`StanzaPayload` classes whenever possible, otherwise the
representation already available will be u... | def get_all_payload(self, specialize = False):
"""Return list of stanza payload objects.
:Parameters:
- `specialize`: If `True`, then return objects of specialized
`StanzaPayload` classes whenever possible, otherwise the
representation already available will be u... | [
"Return",
"list",
"of",
"stanza",
"payload",
"objects",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L389-L410 | [
"def",
"get_all_payload",
"(",
"self",
",",
"specialize",
"=",
"False",
")",
":",
"if",
"self",
".",
"_payload",
"is",
"None",
":",
"self",
".",
"decode_payload",
"(",
"specialize",
")",
"elif",
"specialize",
":",
"for",
"i",
",",
"payload",
"in",
"enume... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | Stanza.get_payload | Get the first payload item matching the given class
and optional key.
Payloads may be addressed using a specific payload class or
via the generic `XMLPayload` element, though the `XMLPayload`
representation is available only as long as the element is not
requested by a more spec... | pyxmpp2/stanza.py | def get_payload(self, payload_class, payload_key = None,
specialize = False):
"""Get the first payload item matching the given class
and optional key.
Payloads may be addressed using a specific payload class or
via the generic `XML... | def get_payload(self, payload_class, payload_key = None,
specialize = False):
"""Get the first payload item matching the given class
and optional key.
Payloads may be addressed using a specific payload class or
via the generic `XML... | [
"Get",
"the",
"first",
"payload",
"item",
"matching",
"the",
"given",
"class",
"and",
"optional",
"key",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/stanza.py#L412-L467 | [
"def",
"get_payload",
"(",
"self",
",",
"payload_class",
",",
"payload_key",
"=",
"None",
",",
"specialize",
"=",
"False",
")",
":",
"if",
"self",
".",
"_payload",
"is",
"None",
":",
"self",
".",
"decode_payload",
"(",
")",
"if",
"payload_class",
"is",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | element_to_unicode | Serialize an XML element into a unicode string.
This should work the same on Python2 and Python3 and with all
:etree:`ElementTree` implementations.
:Parameters:
- `element`: the XML element to serialize
:Types:
- `element`: :etree:`ElementTree.Element` | pyxmpp2/etree.py | def element_to_unicode(element):
"""Serialize an XML element into a unicode string.
This should work the same on Python2 and Python3 and with all
:etree:`ElementTree` implementations.
:Parameters:
- `element`: the XML element to serialize
:Types:
- `element`: :etree:`ElementTree.El... | def element_to_unicode(element):
"""Serialize an XML element into a unicode string.
This should work the same on Python2 and Python3 and with all
:etree:`ElementTree` implementations.
:Parameters:
- `element`: the XML element to serialize
:Types:
- `element`: :etree:`ElementTree.El... | [
"Serialize",
"an",
"XML",
"element",
"into",
"a",
"unicode",
"string",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/etree.py#L71-L88 | [
"def",
"element_to_unicode",
"(",
"element",
")",
":",
"if",
"hasattr",
"(",
"ElementTree",
",",
"'tounicode'",
")",
":",
"# pylint: disable=E1103",
"return",
"ElementTree",
".",
"tounicode",
"(",
"\"element\"",
")",
"elif",
"sys",
".",
"version_info",
".",
"maj... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ResourceBindingHandler.make_stream_features | Add resource binding feature to the <features/> element of the
stream.
[receving entity only]
:returns: update <features/> element. | pyxmpp2/binding.py | def make_stream_features(self, stream, features):
"""Add resource binding feature to the <features/> element of the
stream.
[receving entity only]
:returns: update <features/> element.
"""
self.stream = stream
if stream.peer_authenticated and not stream.peer.res... | def make_stream_features(self, stream, features):
"""Add resource binding feature to the <features/> element of the
stream.
[receving entity only]
:returns: update <features/> element.
"""
self.stream = stream
if stream.peer_authenticated and not stream.peer.res... | [
"Add",
"resource",
"binding",
"feature",
"to",
"the",
"<features",
"/",
">",
"element",
"of",
"the",
"stream",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L107-L117 | [
"def",
"make_stream_features",
"(",
"self",
",",
"stream",
",",
"features",
")",
":",
"self",
".",
"stream",
"=",
"stream",
"if",
"stream",
".",
"peer_authenticated",
"and",
"not",
"stream",
".",
"peer",
".",
"resource",
":",
"ElementTree",
".",
"SubElement"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ResourceBindingHandler.handle_stream_features | Process incoming <stream:features/> element.
[initiating entity only]
The received features element is available in `features`. | pyxmpp2/binding.py | def handle_stream_features(self, stream, features):
"""Process incoming <stream:features/> element.
[initiating entity only]
The received features element is available in `features`.
"""
logger.debug(u"Handling stream features: {0}".format(
... | def handle_stream_features(self, stream, features):
"""Process incoming <stream:features/> element.
[initiating entity only]
The received features element is available in `features`.
"""
logger.debug(u"Handling stream features: {0}".format(
... | [
"Process",
"incoming",
"<stream",
":",
"features",
"/",
">",
"element",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L119-L134 | [
"def",
"handle_stream_features",
"(",
"self",
",",
"stream",
",",
"features",
")",
":",
"logger",
".",
"debug",
"(",
"u\"Handling stream features: {0}\"",
".",
"format",
"(",
"element_to_unicode",
"(",
"features",
")",
")",
")",
"element",
"=",
"features",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ResourceBindingHandler.bind | Bind to a resource.
[initiating entity only]
:Parameters:
- `resource`: the resource name to bind to.
:Types:
- `resource`: `unicode`
XMPP stream is authenticated for bare JID only. To use
the full JID it must be bound to a resource. | pyxmpp2/binding.py | def bind(self, stream, resource):
"""Bind to a resource.
[initiating entity only]
:Parameters:
- `resource`: the resource name to bind to.
:Types:
- `resource`: `unicode`
XMPP stream is authenticated for bare JID only. To use
the full JID it mus... | def bind(self, stream, resource):
"""Bind to a resource.
[initiating entity only]
:Parameters:
- `resource`: the resource name to bind to.
:Types:
- `resource`: `unicode`
XMPP stream is authenticated for bare JID only. To use
the full JID it mus... | [
"Bind",
"to",
"a",
"resource",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L136-L156 | [
"def",
"bind",
"(",
"self",
",",
"stream",
",",
"resource",
")",
":",
"self",
".",
"stream",
"=",
"stream",
"stanza",
"=",
"Iq",
"(",
"stanza_type",
"=",
"\"set\"",
")",
"payload",
"=",
"ResourceBindingPayload",
"(",
"resource",
"=",
"resource",
")",
"st... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ResourceBindingHandler._bind_success | Handle resource binding success.
[initiating entity only]
:Parameters:
- `stanza`: <iq type="result"/> stanza received.
Set `streambase.StreamBase.me` to the full JID negotiated. | pyxmpp2/binding.py | def _bind_success(self, stanza):
"""Handle resource binding success.
[initiating entity only]
:Parameters:
- `stanza`: <iq type="result"/> stanza received.
Set `streambase.StreamBase.me` to the full JID negotiated."""
# pylint: disable-msg=R0201
payload = s... | def _bind_success(self, stanza):
"""Handle resource binding success.
[initiating entity only]
:Parameters:
- `stanza`: <iq type="result"/> stanza received.
Set `streambase.StreamBase.me` to the full JID negotiated."""
# pylint: disable-msg=R0201
payload = s... | [
"Handle",
"resource",
"binding",
"success",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L158-L174 | [
"def",
"_bind_success",
"(",
"self",
",",
"stanza",
")",
":",
"# pylint: disable-msg=R0201",
"payload",
"=",
"stanza",
".",
"get_payload",
"(",
"ResourceBindingPayload",
")",
"jid",
"=",
"payload",
".",
"jid",
"if",
"not",
"jid",
":",
"raise",
"BadRequestProtoco... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | ResourceBindingHandler.handle_bind_iq_set | Handler <iq type="set"/> for resource binding. | pyxmpp2/binding.py | def handle_bind_iq_set(self, stanza):
"""Handler <iq type="set"/> for resource binding."""
# pylint: disable-msg=R0201
if not self.stream:
logger.error("Got bind stanza before stream feature has been set")
return False
if self.stream.initiator:
return ... | def handle_bind_iq_set(self, stanza):
"""Handler <iq type="set"/> for resource binding."""
# pylint: disable-msg=R0201
if not self.stream:
logger.error("Got bind stanza before stream feature has been set")
return False
if self.stream.initiator:
return ... | [
"Handler",
"<iq",
"type",
"=",
"set",
"/",
">",
"for",
"resource",
"binding",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/binding.py#L185-L212 | [
"def",
"handle_bind_iq_set",
"(",
"self",
",",
"stanza",
")",
":",
"# pylint: disable-msg=R0201",
"if",
"not",
"self",
".",
"stream",
":",
"logger",
".",
"error",
"(",
"\"Got bind stanza before stream feature has been set\"",
")",
"return",
"False",
"if",
"self",
".... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | serialize | Serialize an XMPP element.
Utility function for debugging or logging.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode` | pyxmpp2/xmppserializer.py | def serialize(element):
"""Serialize an XMPP element.
Utility function for debugging or logging.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode`
... | def serialize(element):
"""Serialize an XMPP element.
Utility function for debugging or logging.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode`
... | [
"Serialize",
"an",
"XMPP",
"element",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L351-L367 | [
"def",
"serialize",
"(",
"element",
")",
":",
"if",
"getattr",
"(",
"_THREAD",
",",
"\"serializer\"",
",",
"None",
")",
"is",
"None",
":",
"_THREAD",
".",
"serializer",
"=",
"XMPPSerializer",
"(",
"\"jabber:client\"",
")",
"_THREAD",
".",
"serializer",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer.add_prefix | Add a new namespace prefix.
If the root element has not yet been emitted the prefix will
be declared there, otherwise the prefix will be declared on the
top-most element using this namespace in every stanza.
:Parameters:
- `namespace`: the namespace URI
- `prefi... | pyxmpp2/xmppserializer.py | def add_prefix(self, namespace, prefix):
"""Add a new namespace prefix.
If the root element has not yet been emitted the prefix will
be declared there, otherwise the prefix will be declared on the
top-most element using this namespace in every stanza.
:Parameters:
-... | def add_prefix(self, namespace, prefix):
"""Add a new namespace prefix.
If the root element has not yet been emitted the prefix will
be declared there, otherwise the prefix will be declared on the
top-most element using this namespace in every stanza.
:Parameters:
-... | [
"Add",
"a",
"new",
"namespace",
"prefix",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L88-L104 | [
"def",
"add_prefix",
"(",
"self",
",",
"namespace",
",",
"prefix",
")",
":",
"if",
"prefix",
"==",
"\"xml\"",
"and",
"namespace",
"!=",
"XML_NS",
":",
"raise",
"ValueError",
",",
"\"Cannot change 'xml' prefix meaning\"",
"self",
".",
"_prefixes",
"[",
"namespace... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer.emit_head | Return the opening tag of the stream root element.
:Parameters:
- `stream_from`: the 'from' attribute of the stream. May be `None`.
- `stream_to`: the 'to' attribute of the stream. May be `None`.
- `version`: the 'version' of the stream.
- `language`: the 'xml:la... | pyxmpp2/xmppserializer.py | def emit_head(self, stream_from, stream_to, stream_id = None,
version = u'1.0', language = None):
"""Return the opening tag of the stream root element.
:Parameters:
- `stream_from`: the 'from' attribute of the stream. May be `None`.
- ... | def emit_head(self, stream_from, stream_to, stream_id = None,
version = u'1.0', language = None):
"""Return the opening tag of the stream root element.
:Parameters:
- `stream_from`: the 'from' attribute of the stream. May be `None`.
- ... | [
"Return",
"the",
"opening",
"tag",
"of",
"the",
"stream",
"root",
"element",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L106-L149 | [
"def",
"emit_head",
"(",
"self",
",",
"stream_from",
",",
"stream_to",
",",
"stream_id",
"=",
"None",
",",
"version",
"=",
"u'1.0'",
",",
"language",
"=",
"None",
")",
":",
"# pylint: disable-msg=R0913",
"self",
".",
"_root_prefixes",
"=",
"dict",
"(",
"STAN... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer._split_qname | Split an element of attribute qname into namespace and local
name.
:Parameters:
- `name`: element or attribute QName
- `is_element`: `True` for an element, `False` for an attribute
:Types:
- `name`: `unicode`
- `is_element`: `bool`
:Retur... | pyxmpp2/xmppserializer.py | def _split_qname(self, name, is_element):
"""Split an element of attribute qname into namespace and local
name.
:Parameters:
- `name`: element or attribute QName
- `is_element`: `True` for an element, `False` for an attribute
:Types:
- `name`: `unicod... | def _split_qname(self, name, is_element):
"""Split an element of attribute qname into namespace and local
name.
:Parameters:
- `name`: element or attribute QName
- `is_element`: `True` for an element, `False` for an attribute
:Types:
- `name`: `unicod... | [
"Split",
"an",
"element",
"of",
"attribute",
"qname",
"into",
"namespace",
"and",
"local",
"name",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L155-L176 | [
"def",
"_split_qname",
"(",
"self",
",",
"name",
",",
"is_element",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"u\"{\"",
")",
":",
"namespace",
",",
"name",
"=",
"name",
"[",
"1",
":",
"]",
".",
"split",
"(",
"u\"}\"",
",",
"1",
")",
"if",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer._make_prefix | Make up a new namespace prefix, which won't conflict
with `_prefixes` and prefixes declared in the current scope.
:Parameters:
- `declared_prefixes`: namespace to prefix mapping for the current
scope
:Types:
- `declared_prefixes`: `unicode` to `unicode` dic... | pyxmpp2/xmppserializer.py | def _make_prefix(self, declared_prefixes):
"""Make up a new namespace prefix, which won't conflict
with `_prefixes` and prefixes declared in the current scope.
:Parameters:
- `declared_prefixes`: namespace to prefix mapping for the current
scope
:Types:
... | def _make_prefix(self, declared_prefixes):
"""Make up a new namespace prefix, which won't conflict
with `_prefixes` and prefixes declared in the current scope.
:Parameters:
- `declared_prefixes`: namespace to prefix mapping for the current
scope
:Types:
... | [
"Make",
"up",
"a",
"new",
"namespace",
"prefix",
"which",
"won",
"t",
"conflict",
"with",
"_prefixes",
"and",
"prefixes",
"declared",
"in",
"the",
"current",
"scope",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L178-L198 | [
"def",
"_make_prefix",
"(",
"self",
",",
"declared_prefixes",
")",
":",
"used_prefixes",
"=",
"set",
"(",
"self",
".",
"_prefixes",
".",
"values",
"(",
")",
")",
"used_prefixes",
"|=",
"set",
"(",
"declared_prefixes",
".",
"values",
"(",
")",
")",
"while",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer._make_prefixed | Return namespace-prefixed tag or attribute name.
Add appropriate declaration to `declarations` when neccessary.
If no prefix for an element namespace is defined, make the elements
namespace default (no prefix). For attributes, make up a prefix in such
case.
:Parameters:
... | pyxmpp2/xmppserializer.py | def _make_prefixed(self, name, is_element, declared_prefixes, declarations):
"""Return namespace-prefixed tag or attribute name.
Add appropriate declaration to `declarations` when neccessary.
If no prefix for an element namespace is defined, make the elements
namespace default (no pref... | def _make_prefixed(self, name, is_element, declared_prefixes, declarations):
"""Return namespace-prefixed tag or attribute name.
Add appropriate declaration to `declarations` when neccessary.
If no prefix for an element namespace is defined, make the elements
namespace default (no pref... | [
"Return",
"namespace",
"-",
"prefixed",
"tag",
"or",
"attribute",
"name",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L200-L242 | [
"def",
"_make_prefixed",
"(",
"self",
",",
"name",
",",
"is_element",
",",
"declared_prefixes",
",",
"declarations",
")",
":",
"namespace",
",",
"name",
"=",
"self",
".",
"_split_qname",
"(",
"name",
",",
"is_element",
")",
"if",
"namespace",
"is",
"None",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer._make_ns_declarations | Build namespace declarations and remove obsoleted mappings
from `declared_prefixes`.
:Parameters:
- `declarations`: namespace to prefix mapping of the new
declarations
- `declared_prefixes`: namespace to prefix mapping of already
declared prefixes.
... | pyxmpp2/xmppserializer.py | def _make_ns_declarations(declarations, declared_prefixes):
"""Build namespace declarations and remove obsoleted mappings
from `declared_prefixes`.
:Parameters:
- `declarations`: namespace to prefix mapping of the new
declarations
- `declared_prefixes`: nam... | def _make_ns_declarations(declarations, declared_prefixes):
"""Build namespace declarations and remove obsoleted mappings
from `declared_prefixes`.
:Parameters:
- `declarations`: namespace to prefix mapping of the new
declarations
- `declared_prefixes`: nam... | [
"Build",
"namespace",
"declarations",
"and",
"remove",
"obsoleted",
"mappings",
"from",
"declared_prefixes",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L245-L273 | [
"def",
"_make_ns_declarations",
"(",
"declarations",
",",
"declared_prefixes",
")",
":",
"result",
"=",
"[",
"]",
"for",
"namespace",
",",
"prefix",
"in",
"declarations",
".",
"items",
"(",
")",
":",
"if",
"prefix",
":",
"result",
".",
"append",
"(",
"u' x... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer._emit_element | Recursive XML element serializer.
:Parameters:
- `element`: the element to serialize
- `level`: nest level (0 - root element, 1 - stanzas, etc.)
- `declared_prefixes`: namespace to prefix mapping of already
declared prefixes.
:Types:
- `elem... | pyxmpp2/xmppserializer.py | def _emit_element(self, element, level, declared_prefixes):
""""Recursive XML element serializer.
:Parameters:
- `element`: the element to serialize
- `level`: nest level (0 - root element, 1 - stanzas, etc.)
- `declared_prefixes`: namespace to prefix mapping of alre... | def _emit_element(self, element, level, declared_prefixes):
""""Recursive XML element serializer.
:Parameters:
- `element`: the element to serialize
- `level`: nest level (0 - root element, 1 - stanzas, etc.)
- `declared_prefixes`: namespace to prefix mapping of alre... | [
"Recursive",
"XML",
"element",
"serializer",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L275-L325 | [
"def",
"_emit_element",
"(",
"self",
",",
"element",
",",
"level",
",",
"declared_prefixes",
")",
":",
"declarations",
"=",
"{",
"}",
"declared_prefixes",
"=",
"dict",
"(",
"declared_prefixes",
")",
"name",
"=",
"element",
".",
"tag",
"prefixed",
"=",
"self"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSerializer.emit_stanza | Serialize a stanza.
Must be called after `emit_head`.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode` | pyxmpp2/xmppserializer.py | def emit_stanza(self, element):
""""Serialize a stanza.
Must be called after `emit_head`.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode`
... | def emit_stanza(self, element):
""""Serialize a stanza.
Must be called after `emit_head`.
:Parameters:
- `element`: the element to serialize
:Types:
- `element`: :etree:`ElementTree.Element`
:Return: serialized element
:Returntype: `unicode`
... | [
"Serialize",
"a",
"stanza",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L327-L344 | [
"def",
"emit_stanza",
"(",
"self",
",",
"element",
")",
":",
"if",
"not",
"self",
".",
"_head_emitted",
":",
"raise",
"RuntimeError",
"(",
"\".emit_head() must be called first.\"",
")",
"string",
"=",
"self",
".",
"_emit_element",
"(",
"element",
",",
"level",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | filter_mechanism_list | Filter a mechanisms list only to include those mechanisms that cans
succeed with the provided properties and are secure enough.
:Parameters:
- `mechanisms`: list of the mechanisms names
- `properties`: available authentication properties
- `allow_insecure`: allow insecure mechanisms
... | pyxmpp2/sasl/__init__.py | def filter_mechanism_list(mechanisms, properties, allow_insecure = False,
server_side = False):
"""Filter a mechanisms list only to include those mechanisms that cans
succeed with the provided properties and are secure enough.
:Parameters:
- `mechanisms`: list of the mec... | def filter_mechanism_list(mechanisms, properties, allow_insecure = False,
server_side = False):
"""Filter a mechanisms list only to include those mechanisms that cans
succeed with the provided properties and are secure enough.
:Parameters:
- `mechanisms`: list of the mec... | [
"Filter",
"a",
"mechanisms",
"list",
"only",
"to",
"include",
"those",
"mechanisms",
"that",
"cans",
"succeed",
"with",
"the",
"provided",
"properties",
"and",
"are",
"secure",
"enough",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/sasl/__init__.py#L85-L121 | [
"def",
"filter_mechanism_list",
"(",
"mechanisms",
",",
"properties",
",",
"allow_insecure",
"=",
"False",
",",
"server_side",
"=",
"False",
")",
":",
"# pylint: disable=W0212",
"result",
"=",
"[",
"]",
"for",
"mechanism",
"in",
"mechanisms",
":",
"try",
":",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomHandler.error | Called when an error stanza is received.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza` | pyxmpp2/ext/muc/muc.py | def error(self,stanza):
"""
Called when an error stanza is received.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`
"""
err=stanza.get_error()
self.__logger.debug("Error from: %r Condition: %r"
... | def error(self,stanza):
"""
Called when an error stanza is received.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyxmpp.stanza.Stanza`
"""
err=stanza.get_error()
self.__logger.debug("Error from: %r Condition: %r"
... | [
"Called",
"when",
"an",
"error",
"stanza",
"is",
"received",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L251-L262 | [
"def",
"error",
"(",
"self",
",",
"stanza",
")",
":",
"err",
"=",
"stanza",
".",
"get_error",
"(",
")",
"self",
".",
"__logger",
".",
"debug",
"(",
"\"Error from: %r Condition: %r\"",
"%",
"(",
"stanza",
".",
"get_from",
"(",
")",
",",
"err",
".",
"get... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomUser.update_presence | Update user information.
:Parameters:
- `presence`: a presence stanza with user information update.
:Types:
- `presence`: `MucPresence` | pyxmpp2/ext/muc/muc.py | def update_presence(self,presence):
"""
Update user information.
:Parameters:
- `presence`: a presence stanza with user information update.
:Types:
- `presence`: `MucPresence`
"""
self.presence=MucPresence(presence)
t=presence.get_type()
... | def update_presence(self,presence):
"""
Update user information.
:Parameters:
- `presence`: a presence stanza with user information update.
:Types:
- `presence`: `MucPresence`
"""
self.presence=MucPresence(presence)
t=presence.get_type()
... | [
"Update",
"user",
"information",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L324-L354 | [
"def",
"update_presence",
"(",
"self",
",",
"presence",
")",
":",
"self",
".",
"presence",
"=",
"MucPresence",
"(",
"presence",
")",
"t",
"=",
"presence",
".",
"get_type",
"(",
")",
"if",
"t",
"==",
"\"unavailable\"",
":",
"self",
".",
"role",
"=",
"\"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.get_user | Get a room user with given nick or JID.
:Parameters:
- `nick_or_jid`: the nickname or room JID of the user requested.
- `create`: if `True` and `nick_or_jid` is a JID, then a new
user object will be created if there is no such user in the room.
:Types:
... | pyxmpp2/ext/muc/muc.py | def get_user(self,nick_or_jid,create=False):
"""
Get a room user with given nick or JID.
:Parameters:
- `nick_or_jid`: the nickname or room JID of the user requested.
- `create`: if `True` and `nick_or_jid` is a JID, then a new
user object will be created i... | def get_user(self,nick_or_jid,create=False):
"""
Get a room user with given nick or JID.
:Parameters:
- `nick_or_jid`: the nickname or room JID of the user requested.
- `create`: if `True` and `nick_or_jid` is a JID, then a new
user object will be created i... | [
"Get",
"a",
"room",
"user",
"with",
"given",
"nick",
"or",
"JID",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L414-L439 | [
"def",
"get_user",
"(",
"self",
",",
"nick_or_jid",
",",
"create",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"nick_or_jid",
",",
"JID",
")",
":",
"if",
"not",
"nick_or_jid",
".",
"resource",
":",
"return",
"None",
"for",
"u",
"in",
"self",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.set_stream | Called when current stream changes.
Mark the room not joined and inform `self.handler` that it was left.
:Parameters:
- `stream`: the new stream.
:Types:
- `stream`: `pyxmpp.stream.Stream` | pyxmpp2/ext/muc/muc.py | def set_stream(self,stream):
"""
Called when current stream changes.
Mark the room not joined and inform `self.handler` that it was left.
:Parameters:
- `stream`: the new stream.
:Types:
- `stream`: `pyxmpp.stream.Stream`
"""
_unused = st... | def set_stream(self,stream):
"""
Called when current stream changes.
Mark the room not joined and inform `self.handler` that it was left.
:Parameters:
- `stream`: the new stream.
:Types:
- `stream`: `pyxmpp.stream.Stream`
"""
_unused = st... | [
"Called",
"when",
"current",
"stream",
"changes",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L441-L455 | [
"def",
"set_stream",
"(",
"self",
",",
"stream",
")",
":",
"_unused",
"=",
"stream",
"if",
"self",
".",
"joined",
"and",
"self",
".",
"handler",
":",
"self",
".",
"handler",
".",
"user_left",
"(",
"self",
".",
"me",
",",
"None",
")",
"self",
".",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.join | Send a join request for the room.
:Parameters:
- `password`: password to the room.
- `history_maxchars`: limit of the total number of characters in
history.
- `history_maxstanzas`: limit of the total number of messages in
history.
- `h... | pyxmpp2/ext/muc/muc.py | def join(self, password=None, history_maxchars = None,
history_maxstanzas = None, history_seconds = None, history_since = None):
"""
Send a join request for the room.
:Parameters:
- `password`: password to the room.
- `history_maxchars`: limit of the total nu... | def join(self, password=None, history_maxchars = None,
history_maxstanzas = None, history_seconds = None, history_since = None):
"""
Send a join request for the room.
:Parameters:
- `password`: password to the room.
- `history_maxchars`: limit of the total nu... | [
"Send",
"a",
"join",
"request",
"for",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L457-L484 | [
"def",
"join",
"(",
"self",
",",
"password",
"=",
"None",
",",
"history_maxchars",
"=",
"None",
",",
"history_maxstanzas",
"=",
"None",
",",
"history_seconds",
"=",
"None",
",",
"history_since",
"=",
"None",
")",
":",
"if",
"self",
".",
"joined",
":",
"r... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.leave | Send a leave request for the room. | pyxmpp2/ext/muc/muc.py | def leave(self):
"""
Send a leave request for the room.
"""
if self.joined:
p=MucPresence(to_jid=self.room_jid,stanza_type="unavailable")
self.manager.stream.send(p) | def leave(self):
"""
Send a leave request for the room.
"""
if self.joined:
p=MucPresence(to_jid=self.room_jid,stanza_type="unavailable")
self.manager.stream.send(p) | [
"Send",
"a",
"leave",
"request",
"for",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L486-L492 | [
"def",
"leave",
"(",
"self",
")",
":",
"if",
"self",
".",
"joined",
":",
"p",
"=",
"MucPresence",
"(",
"to_jid",
"=",
"self",
".",
"room_jid",
",",
"stanza_type",
"=",
"\"unavailable\"",
")",
"self",
".",
"manager",
".",
"stream",
".",
"send",
"(",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.send_message | Send a message to the room.
:Parameters:
- `body`: the message body.
:Types:
- `body`: `unicode` | pyxmpp2/ext/muc/muc.py | def send_message(self,body):
"""
Send a message to the room.
:Parameters:
- `body`: the message body.
:Types:
- `body`: `unicode`
"""
m=Message(to_jid=self.room_jid.bare(),stanza_type="groupchat",body=body)
self.manager.stream.send(m) | def send_message(self,body):
"""
Send a message to the room.
:Parameters:
- `body`: the message body.
:Types:
- `body`: `unicode`
"""
m=Message(to_jid=self.room_jid.bare(),stanza_type="groupchat",body=body)
self.manager.stream.send(m) | [
"Send",
"a",
"message",
"to",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L494-L504 | [
"def",
"send_message",
"(",
"self",
",",
"body",
")",
":",
"m",
"=",
"Message",
"(",
"to_jid",
"=",
"self",
".",
"room_jid",
".",
"bare",
"(",
")",
",",
"stanza_type",
"=",
"\"groupchat\"",
",",
"body",
"=",
"body",
")",
"self",
".",
"manager",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.set_subject | Send a subject change request to the room.
:Parameters:
- `subject`: the new subject.
:Types:
- `subject`: `unicode` | pyxmpp2/ext/muc/muc.py | def set_subject(self,subject):
"""
Send a subject change request to the room.
:Parameters:
- `subject`: the new subject.
:Types:
- `subject`: `unicode`
"""
m=Message(to_jid=self.room_jid.bare(),stanza_type="groupchat",subject=subject)
self... | def set_subject(self,subject):
"""
Send a subject change request to the room.
:Parameters:
- `subject`: the new subject.
:Types:
- `subject`: `unicode`
"""
m=Message(to_jid=self.room_jid.bare(),stanza_type="groupchat",subject=subject)
self... | [
"Send",
"a",
"subject",
"change",
"request",
"to",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L506-L516 | [
"def",
"set_subject",
"(",
"self",
",",
"subject",
")",
":",
"m",
"=",
"Message",
"(",
"to_jid",
"=",
"self",
".",
"room_jid",
".",
"bare",
"(",
")",
",",
"stanza_type",
"=",
"\"groupchat\"",
",",
"subject",
"=",
"subject",
")",
"self",
".",
"manager",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.change_nick | Send a nick change request to the room.
:Parameters:
- `new_nick`: the new nickname requested.
:Types:
- `new_nick`: `unicode` | pyxmpp2/ext/muc/muc.py | def change_nick(self,new_nick):
"""
Send a nick change request to the room.
:Parameters:
- `new_nick`: the new nickname requested.
:Types:
- `new_nick`: `unicode`
"""
new_room_jid=JID(self.room_jid.node,self.room_jid.domain,new_nick)
p=Pre... | def change_nick(self,new_nick):
"""
Send a nick change request to the room.
:Parameters:
- `new_nick`: the new nickname requested.
:Types:
- `new_nick`: `unicode`
"""
new_room_jid=JID(self.room_jid.node,self.room_jid.domain,new_nick)
p=Pre... | [
"Send",
"a",
"nick",
"change",
"request",
"to",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L518-L529 | [
"def",
"change_nick",
"(",
"self",
",",
"new_nick",
")",
":",
"new_room_jid",
"=",
"JID",
"(",
"self",
".",
"room_jid",
".",
"node",
",",
"self",
".",
"room_jid",
".",
"domain",
",",
"new_nick",
")",
"p",
"=",
"Presence",
"(",
"to_jid",
"=",
"new_room_... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.get_room_jid | Get own room JID or a room JID for given `nick`.
:Parameters:
- `nick`: a nick for which the room JID is requested.
:Types:
- `nick`: `unicode`
:return: the room JID.
:returntype: `JID` | pyxmpp2/ext/muc/muc.py | def get_room_jid(self,nick=None):
"""
Get own room JID or a room JID for given `nick`.
:Parameters:
- `nick`: a nick for which the room JID is requested.
:Types:
- `nick`: `unicode`
:return: the room JID.
:returntype: `JID`
"""
if... | def get_room_jid(self,nick=None):
"""
Get own room JID or a room JID for given `nick`.
:Parameters:
- `nick`: a nick for which the room JID is requested.
:Types:
- `nick`: `unicode`
:return: the room JID.
:returntype: `JID`
"""
if... | [
"Get",
"own",
"room",
"JID",
"or",
"a",
"room",
"JID",
"for",
"given",
"nick",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L531-L545 | [
"def",
"get_room_jid",
"(",
"self",
",",
"nick",
"=",
"None",
")",
":",
"if",
"nick",
"is",
"None",
":",
"return",
"self",
".",
"room_jid",
"return",
"JID",
"(",
"self",
".",
"room_jid",
".",
"node",
",",
"self",
".",
"room_jid",
".",
"domain",
",",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.process_available_presence | Process <presence/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence` | pyxmpp2/ext/muc/muc.py | def process_available_presence(self,stanza):
"""
Process <presence/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence`
"""
fr=stanza.get_from()
if not fr.resource:
return
... | def process_available_presence(self,stanza):
"""
Process <presence/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence`
"""
fr=stanza.get_from()
if not fr.resource:
return
... | [
"Process",
"<presence",
"/",
">",
"received",
"from",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L556-L600 | [
"def",
"process_available_presence",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"if",
"not",
"fr",
".",
"resource",
":",
"return",
"nick",
"=",
"fr",
".",
"resource",
"user",
"=",
"self",
".",
"users",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.process_unavailable_presence | Process <presence type="unavailable"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence` | pyxmpp2/ext/muc/muc.py | def process_unavailable_presence(self,stanza):
"""
Process <presence type="unavailable"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence`
"""
fr=stanza.get_from()
if not fr.resource:
... | def process_unavailable_presence(self,stanza):
"""
Process <presence type="unavailable"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `MucPresence`
"""
fr=stanza.get_from()
if not fr.resource:
... | [
"Process",
"<presence",
"type",
"=",
"unavailable",
"/",
">",
"received",
"from",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L602-L639 | [
"def",
"process_unavailable_presence",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"if",
"not",
"fr",
".",
"resource",
":",
"return",
"nick",
"=",
"fr",
".",
"resource",
"user",
"=",
"self",
".",
"users",
".",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.process_groupchat_message | Process <message type="groupchat"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message` | pyxmpp2/ext/muc/muc.py | def process_groupchat_message(self,stanza):
"""
Process <message type="groupchat"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
"""
fr=stanza.get_from()
user=self.get_user(fr,True)
... | def process_groupchat_message(self,stanza):
"""
Process <message type="groupchat"/> received from the room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
"""
fr=stanza.get_from()
user=self.get_user(fr,True)
... | [
"Process",
"<message",
"type",
"=",
"groupchat",
"/",
">",
"received",
"from",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L642-L658 | [
"def",
"process_groupchat_message",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"user",
"=",
"self",
".",
"get_user",
"(",
"fr",
",",
"True",
")",
"s",
"=",
"stanza",
".",
"get_subject",
"(",
")",
"if",
"s",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.process_configuration_form_success | Process successful result of a room configuration form request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence` | pyxmpp2/ext/muc/muc.py | def process_configuration_form_success(self, stanza):
"""
Process successful result of a room configuration form request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
"""
if stanza.get_query_ns() != MUC_OWNER_NS:
... | def process_configuration_form_success(self, stanza):
"""
Process successful result of a room configuration form request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
"""
if stanza.get_query_ns() != MUC_OWNER_NS:
... | [
"Process",
"successful",
"result",
"of",
"a",
"room",
"configuration",
"form",
"request",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L682-L701 | [
"def",
"process_configuration_form_success",
"(",
"self",
",",
"stanza",
")",
":",
"if",
"stanza",
".",
"get_query_ns",
"(",
")",
"!=",
"MUC_OWNER_NS",
":",
"raise",
"ValueError",
"(",
"\"Bad result namespace\"",
")",
"# TODO: ProtocolError",
"query",
"=",
"stanza",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.request_configuration_form | Request a configuration form for the room.
When the form is received `self.handler.configuration_form_received` will be called.
When an error response is received then `self.handler.error` will be called.
:return: id of the request stanza.
:returntype: `unicode` | pyxmpp2/ext/muc/muc.py | def request_configuration_form(self):
"""
Request a configuration form for the room.
When the form is received `self.handler.configuration_form_received` will be called.
When an error response is received then `self.handler.error` will be called.
:return: id of the request stan... | def request_configuration_form(self):
"""
Request a configuration form for the room.
When the form is received `self.handler.configuration_form_received` will be called.
When an error response is received then `self.handler.error` will be called.
:return: id of the request stan... | [
"Request",
"a",
"configuration",
"form",
"for",
"the",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L714-L729 | [
"def",
"request_configuration_form",
"(",
"self",
")",
":",
"iq",
"=",
"Iq",
"(",
"to_jid",
"=",
"self",
".",
"room_jid",
".",
"bare",
"(",
")",
",",
"stanza_type",
"=",
"\"get\"",
")",
"iq",
".",
"new_query",
"(",
"MUC_OWNER_NS",
",",
"\"query\"",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.process_configuration_success | Process success response for a room configuration request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence` | pyxmpp2/ext/muc/muc.py | def process_configuration_success(self, stanza):
"""
Process success response for a room configuration request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
"""
_unused = stanza
self.configured = True
... | def process_configuration_success(self, stanza):
"""
Process success response for a room configuration request.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
"""
_unused = stanza
self.configured = True
... | [
"Process",
"success",
"response",
"for",
"a",
"room",
"configuration",
"request",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L731-L742 | [
"def",
"process_configuration_success",
"(",
"self",
",",
"stanza",
")",
":",
"_unused",
"=",
"stanza",
"self",
".",
"configured",
"=",
"True",
"self",
".",
"handler",
".",
"room_configured",
"(",
")"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.configure_room | Configure the room using the provided data.
Do nothing if the provided form is of type 'cancel'.
:Parameters:
- `form`: the configuration parameters. Should be a 'submit' form made by filling-in
the configuration form retireved using `self.request_configuration_form` or
... | pyxmpp2/ext/muc/muc.py | def configure_room(self, form):
"""
Configure the room using the provided data.
Do nothing if the provided form is of type 'cancel'.
:Parameters:
- `form`: the configuration parameters. Should be a 'submit' form made by filling-in
the configuration form retirev... | def configure_room(self, form):
"""
Configure the room using the provided data.
Do nothing if the provided form is of type 'cancel'.
:Parameters:
- `form`: the configuration parameters. Should be a 'submit' form made by filling-in
the configuration form retirev... | [
"Configure",
"the",
"room",
"using",
"the",
"provided",
"data",
".",
"Do",
"nothing",
"if",
"the",
"provided",
"form",
"is",
"of",
"type",
"cancel",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L755-L781 | [
"def",
"configure_room",
"(",
"self",
",",
"form",
")",
":",
"if",
"form",
".",
"type",
"==",
"\"cancel\"",
":",
"return",
"None",
"elif",
"form",
".",
"type",
"!=",
"\"submit\"",
":",
"raise",
"ValueError",
"(",
"\"A 'submit' form required to configure a room\"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomState.request_instant_room | Request an "instant room" -- the default configuration for a MUC room.
:return: id of the request stanza.
:returntype: `unicode` | pyxmpp2/ext/muc/muc.py | def request_instant_room(self):
"""
Request an "instant room" -- the default configuration for a MUC room.
:return: id of the request stanza.
:returntype: `unicode`
"""
if self.configured:
raise RuntimeError("Instant room may be requested for unconfigured roo... | def request_instant_room(self):
"""
Request an "instant room" -- the default configuration for a MUC room.
:return: id of the request stanza.
:returntype: `unicode`
"""
if self.configured:
raise RuntimeError("Instant room may be requested for unconfigured roo... | [
"Request",
"an",
"instant",
"room",
"--",
"the",
"default",
"configuration",
"for",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L783-L793 | [
"def",
"request_instant_room",
"(",
"self",
")",
":",
"if",
"self",
".",
"configured",
":",
"raise",
"RuntimeError",
"(",
"\"Instant room may be requested for unconfigured room only\"",
")",
"form",
"=",
"Form",
"(",
"\"submit\"",
")",
"return",
"self",
".",
"config... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.set_stream | Change the stream assigned to `self`.
:Parameters:
- `stream`: the new stream to be assigned to `self`.
:Types:
- `stream`: `pyxmpp.stream.Stream` | pyxmpp2/ext/muc/muc.py | def set_stream(self,stream):
"""
Change the stream assigned to `self`.
:Parameters:
- `stream`: the new stream to be assigned to `self`.
:Types:
- `stream`: `pyxmpp.stream.Stream`
"""
self.jid=stream.me
self.stream=stream
for r in ... | def set_stream(self,stream):
"""
Change the stream assigned to `self`.
:Parameters:
- `stream`: the new stream to be assigned to `self`.
:Types:
- `stream`: `pyxmpp.stream.Stream`
"""
self.jid=stream.me
self.stream=stream
for r in ... | [
"Change",
"the",
"stream",
"assigned",
"to",
"self",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L819-L831 | [
"def",
"set_stream",
"(",
"self",
",",
"stream",
")",
":",
"self",
".",
"jid",
"=",
"stream",
".",
"me",
"self",
".",
"stream",
"=",
"stream",
"for",
"r",
"in",
"self",
".",
"rooms",
".",
"values",
"(",
")",
":",
"r",
".",
"set_stream",
"(",
"str... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.set_handlers | Assign MUC stanza handlers to the `self.stream`.
:Parameters:
- `priority`: priority for the handlers.
:Types:
- `priority`: `int` | pyxmpp2/ext/muc/muc.py | def set_handlers(self,priority=10):
"""
Assign MUC stanza handlers to the `self.stream`.
:Parameters:
- `priority`: priority for the handlers.
:Types:
- `priority`: `int`
"""
self.stream.set_message_handler("groupchat",self.__groupchat_message,Non... | def set_handlers(self,priority=10):
"""
Assign MUC stanza handlers to the `self.stream`.
:Parameters:
- `priority`: priority for the handlers.
:Types:
- `priority`: `int`
"""
self.stream.set_message_handler("groupchat",self.__groupchat_message,Non... | [
"Assign",
"MUC",
"stanza",
"handlers",
"to",
"the",
"self",
".",
"stream",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L833-L846 | [
"def",
"set_handlers",
"(",
"self",
",",
"priority",
"=",
"10",
")",
":",
"self",
".",
"stream",
".",
"set_message_handler",
"(",
"\"groupchat\"",
",",
"self",
".",
"__groupchat_message",
",",
"None",
",",
"priority",
")",
"self",
".",
"stream",
".",
"set_... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.join | Create and return a new room state object and request joining
to a MUC room.
:Parameters:
- `room`: the name of a room to be joined
- `nick`: the nickname to be used in the room
- `handler`: is an object to handle room events.
- `password`: password for t... | pyxmpp2/ext/muc/muc.py | def join(self, room, nick, handler, password = None, history_maxchars = None,
history_maxstanzas = None, history_seconds = None, history_since = None):
"""
Create and return a new room state object and request joining
to a MUC room.
:Parameters:
- `room`: the nam... | def join(self, room, nick, handler, password = None, history_maxchars = None,
history_maxstanzas = None, history_seconds = None, history_since = None):
"""
Create and return a new room state object and request joining
to a MUC room.
:Parameters:
- `room`: the nam... | [
"Create",
"and",
"return",
"a",
"new",
"room",
"state",
"object",
"and",
"request",
"joining",
"to",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L848-L895 | [
"def",
"join",
"(",
"self",
",",
"room",
",",
"nick",
",",
"handler",
",",
"password",
"=",
"None",
",",
"history_maxchars",
"=",
"None",
",",
"history_maxstanzas",
"=",
"None",
",",
"history_seconds",
"=",
"None",
",",
"history_since",
"=",
"None",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.forget | Remove a room from the list of managed rooms.
:Parameters:
- `rs`: the state object of the room.
:Types:
- `rs`: `MucRoomState` | pyxmpp2/ext/muc/muc.py | def forget(self,rs):
"""
Remove a room from the list of managed rooms.
:Parameters:
- `rs`: the state object of the room.
:Types:
- `rs`: `MucRoomState`
"""
try:
del self.rooms[rs.room_jid.bare().as_unicode()]
except KeyError:
... | def forget(self,rs):
"""
Remove a room from the list of managed rooms.
:Parameters:
- `rs`: the state object of the room.
:Types:
- `rs`: `MucRoomState`
"""
try:
del self.rooms[rs.room_jid.bare().as_unicode()]
except KeyError:
... | [
"Remove",
"a",
"room",
"from",
"the",
"list",
"of",
"managed",
"rooms",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L909-L921 | [
"def",
"forget",
"(",
"self",
",",
"rs",
")",
":",
"try",
":",
"del",
"self",
".",
"rooms",
"[",
"rs",
".",
"room_jid",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"]",
"except",
"KeyError",
":",
"pass"
] | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.__groupchat_message | Process a groupchat message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed rooms, `False` otherwise.
:returntype: `... | pyxmpp2/ext/muc/muc.py | def __groupchat_message(self,stanza):
"""Process a groupchat message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed... | def __groupchat_message(self,stanza):
"""Process a groupchat message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed... | [
"Process",
"a",
"groupchat",
"message",
"from",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L923-L941 | [
"def",
"__groupchat_message",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"key",
"=",
"fr",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"rs",
"=",
"self",
".",
"rooms",
".",
"get",
"(",
"key",
")"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.__error_message | Process an error message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed rooms, `False` otherwise.
:returntype: `boo... | pyxmpp2/ext/muc/muc.py | def __error_message(self,stanza):
"""Process an error message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed rooms,... | def __error_message(self,stanza):
"""Process an error message from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Message`
:return: `True` if the message was properly recognized as directed to
one of the managed rooms,... | [
"Process",
"an",
"error",
"message",
"from",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L943-L960 | [
"def",
"__error_message",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"key",
"=",
"fr",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"rs",
"=",
"self",
".",
"rooms",
".",
"get",
"(",
"key",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.__presence_error | Process an presence error from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the managed rooms, `False` otherwise.
:returntype: `b... | pyxmpp2/ext/muc/muc.py | def __presence_error(self,stanza):
"""Process an presence error from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the managed roo... | def __presence_error(self,stanza):
"""Process an presence error from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the managed roo... | [
"Process",
"an",
"presence",
"error",
"from",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L962-L979 | [
"def",
"__presence_error",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"key",
"=",
"fr",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"rs",
"=",
"self",
".",
"rooms",
".",
"get",
"(",
"key",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.__presence_available | Process an available presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the managed rooms, `False` otherwise.
:returntype... | pyxmpp2/ext/muc/muc.py | def __presence_available(self,stanza):
"""Process an available presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the man... | def __presence_available(self,stanza):
"""Process an available presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the man... | [
"Process",
"an",
"available",
"presence",
"from",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L981-L998 | [
"def",
"__presence_available",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"key",
"=",
"fr",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"rs",
"=",
"self",
".",
"rooms",
".",
"get",
"(",
"key",
")... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | MucRoomManager.__presence_unavailable | Process an unavailable presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the managed rooms, `False` otherwise.
:returnty... | pyxmpp2/ext/muc/muc.py | def __presence_unavailable(self,stanza):
"""Process an unavailable presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the... | def __presence_unavailable(self,stanza):
"""Process an unavailable presence from a MUC room.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `Presence`
:return: `True` if the stanza was properly recognized as generated by
one of the... | [
"Process",
"an",
"unavailable",
"presence",
"from",
"a",
"MUC",
"room",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L1000-L1017 | [
"def",
"__presence_unavailable",
"(",
"self",
",",
"stanza",
")",
":",
"fr",
"=",
"stanza",
".",
"get_from",
"(",
")",
"key",
"=",
"fr",
".",
"bare",
"(",
")",
".",
"as_unicode",
"(",
")",
"rs",
"=",
"self",
".",
"rooms",
".",
"get",
"(",
"key",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSettings.get | Get a parameter value.
If parameter is not set, return `local_default` if it is not `None`
or the PyXMPP global default otherwise.
:Raise `KeyError`: if parameter has no value and no global default
:Return: parameter value | pyxmpp2/settings.py | def get(self, key, local_default = None, required = False):
"""Get a parameter value.
If parameter is not set, return `local_default` if it is not `None`
or the PyXMPP global default otherwise.
:Raise `KeyError`: if parameter has no value and no global default
:Return: paramet... | def get(self, key, local_default = None, required = False):
"""Get a parameter value.
If parameter is not set, return `local_default` if it is not `None`
or the PyXMPP global default otherwise.
:Raise `KeyError`: if parameter has no value and no global default
:Return: paramet... | [
"Get",
"a",
"parameter",
"value",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L138-L166 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"local_default",
"=",
"None",
",",
"required",
"=",
"False",
")",
":",
"# pylint: disable-msg=W0221",
"if",
"key",
"in",
"self",
".",
"_settings",
":",
"return",
"self",
".",
"_settings",
"[",
"key",
"]",
"if",... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSettings.load_arguments | Load settings from :std:`ArgumentParser` output.
:Parameters:
- `args`: output of argument parsed based on the one
returned by `get_arg_parser()` | pyxmpp2/settings.py | def load_arguments(self, args):
"""Load settings from :std:`ArgumentParser` output.
:Parameters:
- `args`: output of argument parsed based on the one
returned by `get_arg_parser()`
"""
for name, setting in self._defs.items():
if sys.version_info.maj... | def load_arguments(self, args):
"""Load settings from :std:`ArgumentParser` output.
:Parameters:
- `args`: output of argument parsed based on the one
returned by `get_arg_parser()`
"""
for name, setting in self._defs.items():
if sys.version_info.maj... | [
"Load",
"settings",
"from",
":",
"std",
":",
"ArgumentParser",
"output",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L180-L197 | [
"def",
"load_arguments",
"(",
"self",
",",
"args",
")",
":",
"for",
"name",
",",
"setting",
"in",
"self",
".",
"_defs",
".",
"items",
"(",
")",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"<",
"3",
":",
"# pylint: disable-msg=W0404",
"from",
"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSettings.add_setting | Add a new setting definition.
:Parameters:
- `name`: setting name
- `type`: setting type object or type description
- `default`: default value
- `factory`: default value factory
- `cache`: if `True` the `factory` will be called only once
... | pyxmpp2/settings.py | def add_setting(cls, name, type = unicode, default = None, factory = None,
cache = False, default_d = None, doc = None,
cmdline_help = None, validator = None, basic = False):
"""Add a new setting definition.
:Parameters:
- `name`: setting name... | def add_setting(cls, name, type = unicode, default = None, factory = None,
cache = False, default_d = None, doc = None,
cmdline_help = None, validator = None, basic = False):
"""Add a new setting definition.
:Parameters:
- `name`: setting name... | [
"Add",
"a",
"new",
"setting",
"definition",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L200-L247 | [
"def",
"add_setting",
"(",
"cls",
",",
"name",
",",
"type",
"=",
"unicode",
",",
"default",
"=",
"None",
",",
"factory",
"=",
"None",
",",
"cache",
"=",
"False",
",",
"default_d",
"=",
"None",
",",
"doc",
"=",
"None",
",",
"cmdline_help",
"=",
"None"... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
valid | XMPPSettings.validate_string_list | Validator for string lists to be used with `add_setting`. | pyxmpp2/settings.py | def validate_string_list(value):
"""Validator for string lists to be used with `add_setting`."""
try:
if sys.version_info.major < 3:
# pylint: disable-msg=W0404
from locale import getpreferredencoding
encoding = getpreferredencoding()
... | def validate_string_list(value):
"""Validator for string lists to be used with `add_setting`."""
try:
if sys.version_info.major < 3:
# pylint: disable-msg=W0404
from locale import getpreferredencoding
encoding = getpreferredencoding()
... | [
"Validator",
"for",
"string",
"lists",
"to",
"be",
"used",
"with",
"add_setting",
"."
] | Jajcus/pyxmpp2 | python | https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/settings.py#L250-L260 | [
"def",
"validate_string_list",
"(",
"value",
")",
":",
"try",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"<",
"3",
":",
"# pylint: disable-msg=W0404",
"from",
"locale",
"import",
"getpreferredencoding",
"encoding",
"=",
"getpreferredencoding",
"(",
")",
... | 14a40a3950910a9cd008b55f0d8905aa0186ce18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.