changeset 12bd496db0a6 in /home/hg/repos/gajim
author: Emmanuel Gil Peyrot <linkmauve(a)linkmauve.fr>
branches:
details:http://hg.gajim.org/gajim?cmd=changeset;node=12bd496db0a6
description: Fix NameError in DataForms with a media type.
diffstat:
src/common/dataforms.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r 84e9332822bd -r 12bd496db0a6 src/common/dataforms.py
--- a/src/common/dataforms.py Sat Nov 05 14:53:48 2016 +0000
+++ b/src/common/dataforms.py Sat Nov 05 14:55:48 2016 +0000
@@ -302,7 +302,7 @@
def fset(self, value):
fdel(self)
- for uri in values:
+ for uri in value:
self.addChild(node=uri)
def fdel(self, value):
Yann Leboulanger pushed to branch master at gajim / python-nbxmpp
Commits:
95254655 by Yann Leboulanger at 2016-11-02T22:57:32+01:00
[NooN8] make all parameters immutable. Fixes #38
- - - - -
4 changed files:
- nbxmpp/protocol.py
- nbxmpp/roster_nb.py
- nbxmpp/simplexml.py
- nbxmpp/stringprepare.py
Changes:
=====================================
nbxmpp/protocol.py
=====================================
--- a/nbxmpp/protocol.py
+++ b/nbxmpp/protocol.py
@@ -727,7 +727,7 @@ class BOSHBody(Node):
<body> tag that wraps usual XMPP stanzas in XMPP over BOSH
"""
- def __init__(self, attrs={}, payload=[], node=None):
+ def __init__(self, attrs=None, payload=None, node=None):
Node.__init__(self, tag='body', attrs=attrs, payload=payload, node=node)
self.setNamespace(NS_HTTP_BIND)
@@ -738,8 +738,8 @@ class Protocol(Node):
and messages
"""
- def __init__(self, name=None, to=None, typ=None, frm=None, attrs={},
- payload=[], timestamp=None, xmlns=None, node=None):
+ def __init__(self, name=None, to=None, typ=None, frm=None, attrs=None,
+ payload=None, timestamp=None, xmlns=None, node=None):
"""
Constructor, name is the name of the stanza
i.e. 'message' or 'presence'or 'iq'
@@ -947,7 +947,7 @@ class Message(Protocol):
"""
def __init__(self, to=None, body=None, xhtml=None, typ=None, subject=None,
- attrs={}, frm=None, payload=[], timestamp=None, xmlns=NS_CLIENT,
+ attrs=None, frm=None, payload=None, timestamp=None, xmlns=NS_CLIENT,
node=None):
"""
You can specify recipient, text of message, type of message any
@@ -1062,7 +1062,7 @@ class Message(Protocol):
class Presence(Protocol):
def __init__(self, to=None, typ=None, priority=None, show=None, status=None,
- attrs={}, frm=None, timestamp=None, payload=[], xmlns=NS_CLIENT,
+ attrs=None, frm=None, timestamp=None, payload=None, xmlns=NS_CLIENT,
node=None):
"""
You can specify recipient, type of message, priority, show and status
@@ -1183,8 +1183,8 @@ class Iq(Protocol):
XMPP Iq object - get/set dialog mechanism
"""
- def __init__(self, typ=None, queryNS=None, attrs={}, to=None, frm=None,
- payload=[], xmlns=NS_CLIENT, node=None):
+ def __init__(self, typ=None, queryNS=None, attrs=None, to=None, frm=None,
+ payload=None, xmlns=NS_CLIENT, node=None):
"""
You can specify type, query namespace any additional attributes,
recipient of the iq, sender of the iq, any additional payload (f.e.
@@ -1444,7 +1444,7 @@ class DataField(Node):
"""
def __init__(self, name=None, value=None, typ=None, required=0, desc=None,
- options=[], node=None):
+ options=None, node=None):
"""
Create new data field of specified name,value and type
@@ -1593,7 +1593,7 @@ class DataForm(Node):
Relevant XEPs: 0004, 0068, 0122. Can be used in disco, pub-sub and many
other applications.
"""
- def __init__(self, typ=None, data=[], title=None, node=None):
+ def __init__(self, typ=None, data=None, title=None, node=None):
"""
Create new dataform of type 'typ'. 'data' is the list of DataField
instances that this dataform contains, 'title' - the title string. You
@@ -1621,18 +1621,19 @@ class DataForm(Node):
self.setNamespace(NS_DATA)
if title:
self.setTitle(title)
- if isinstance(data, dict):
- newdata = []
- for name in data.keys():
- newdata.append(DataField(name, data[name]))
- data = newdata
- for child in data:
- if child.__class__.__name__ == 'DataField':
- self.kids.append(child)
- elif isinstance(child, Node):
- self.kids.append(DataField(node=child))
- else: # Must be a string
- self.addInstructions(child)
+ if data is not None:
+ if isinstance(data, dict):
+ newdata = []
+ for name in data.keys():
+ newdata.append(DataField(name, data[name]))
+ data = newdata
+ for child in data:
+ if child.__class__.__name__ == 'DataField':
+ self.kids.append(child)
+ elif isinstance(child, Node):
+ self.kids.append(DataField(node=child))
+ else: # Must be a string
+ self.addInstructions(child)
def getType(self):
"""
=====================================
nbxmpp/roster_nb.py
=====================================
--- a/nbxmpp/roster_nb.py
+++ b/nbxmpp/roster_nb.py
@@ -224,7 +224,7 @@ class NonBlockingRoster(PlugIn):
"""
return list(self._data[jid[:(jid+'/').find('/')]]['resources'].keys())
- def setItem(self, jid, name=None, groups=[]):
+ def setItem(self, jid, name=None, groups=None):
"""
Rename contact 'jid' and sets the groups list that it now belongs to
"""
@@ -234,8 +234,9 @@ class NonBlockingRoster(PlugIn):
if name:
attrs['name'] = name
item = query.setTag('item', attrs)
- for group in groups:
- item.addChild(node=Node('group', payload=[group]))
+ if groups is not None:
+ for group in groups:
+ item.addChild(node=Node('group', payload=[group]))
self._owner.send(iq)
def setItemMulti(self, items):
=====================================
nbxmpp/simplexml.py
=====================================
--- a/nbxmpp/simplexml.py
+++ b/nbxmpp/simplexml.py
@@ -92,7 +92,7 @@ class Node(object):
FORCE_NODE_RECREATION = 0
- def __init__(self, tag=None, attrs={}, payload=[], parent=None, nsp=None,
+ def __init__(self, tag=None, attrs=None, payload=None, parent=None, nsp=None,
node_built=False, node=None):
"""
Takes "tag" argument as the name of node (prepended by namespace, if
@@ -129,12 +129,15 @@ class Node(object):
self.nsp_cache = {}
if nsp:
for k, v in nsp.items(): self.nsp_cache[k] = v
- for attr, val in attrs.items():
- if attr == 'xmlns':
- self.nsd[''] = val
- elif attr.startswith('xmlns:'):
- self.nsd[attr[6:]] = val
- self.attrs[attr]=attrs[attr]
+
+ if attrs is not None:
+ for attr, val in attrs.items():
+ if attr == 'xmlns':
+ self.nsd[''] = val
+ elif attr.startswith('xmlns:'):
+ self.nsd[attr[6:]] = val
+ self.attrs[attr] = attrs[attr]
+
if tag:
if node_built:
pfx, self.name = (['']+tag.split(':'))[-2:]
@@ -144,13 +147,14 @@ class Node(object):
self.namespace, self.name = tag.split()
else:
self.name = tag
- if not isinstance(payload, list):
- payload = [payload]
- for i in payload:
- if isinstance(i, Node):
- self.addChild(node=i)
- else:
- self.data.append(ustr(i))
+ if payload is not None:
+ if not isinstance(payload, list):
+ payload = [payload]
+ for i in payload:
+ if isinstance(i, Node):
+ self.addChild(node=i)
+ else:
+ self.data.append(ustr(i))
def lookup_nsp(self, pfx=''):
ns = self.nsd.get(pfx, None)
@@ -173,39 +177,53 @@ class Node(object):
if self.namespace:
if not self.parent or self.parent.namespace!=self.namespace:
if 'xmlns' not in self.attrs:
- s = s + ' xmlns="%s"'%self.namespace
+ s += ' xmlns="%s"' % self.namespace
for key in self.attrs.keys():
val = ustr(self.attrs[key])
- s = s + ' %s="%s"' % ( key, XMLescape(val) )
- s = s + ">"
+ s += ' %s="%s"' % (key, XMLescape(val))
+
+ s += ">"
cnt = 0
if self.kids:
- if fancy: s = s + "\n"
+ if fancy:
+ s += "\n"
for a in self.kids:
- if not fancy and (len(self.data)-1)>=cnt: s=s+XMLescape(self.data[cnt])
- elif (len(self.data)-1)>=cnt: s=s+XMLescape(self.data[cnt].strip())
+ if not fancy and (len(self.data)-1) >= cnt:
+ s += XMLescape(self.data[cnt])
+ elif (len(self.data)-1) >= cnt:
+ s += XMLescape(self.data[cnt].strip())
if isinstance(a, str):
- s = s + a.__str__()
+ s += a.__str__()
else:
- s = s + a.__str__(fancy and fancy+1)
- cnt=cnt+1
- if not fancy and (len(self.data)-1) >= cnt: s = s + XMLescape(self.data[cnt])
- elif (len(self.data)-1) >= cnt: s = s + XMLescape(self.data[cnt].strip())
+ s += a.__str__(fancy and fancy+1)
+ cnt += 1
+ if not fancy and (len(self.data)-1) >= cnt:
+ s += XMLescape(self.data[cnt])
+ elif (len(self.data)-1) >= cnt:
+ s += XMLescape(self.data[cnt].strip())
if not self.kids and s.endswith('>'):
- s=s[:-1]+' />'
- if fancy: s = s + "\n"
+ s = s[:-1] + ' />'
+ if fancy:
+ s += "\n"
else:
- if fancy and not self.data: s = s + (fancy-1) * 2 * ' '
- s = s + "</" + self.name + ">"
- if fancy: s = s + "\n"
+ if fancy and not self.data:
+ s += (fancy-1) * 2 * ' '
+ s += "</" + self.name + ">"
+ if fancy:
+ s += "\n"
return s
- def addChild(self, name=None, attrs={}, payload=[], namespace=None, node=None):
+ def addChild(self, name=None, attrs=None, payload=None, namespace=None, node=None):
"""
If "node" argument is provided, adds it as child node. Else creates new
node from the other arguments' values and adds it as well
"""
- if 'xmlns' in attrs:
+ if payload is None:
+ payload = []
+
+ if attrs is None:
+ attrs = {}
+ elif 'xmlns' in attrs:
raise AttributeError("Use namespace=x instead of attrs={'xmlns':x}")
if node:
newnode=node
@@ -234,7 +252,7 @@ class Node(object):
"""
del self.attrs[key]
- def delChild(self, node, attrs={}):
+ def delChild(self, node, attrs=None):
"""
Delete the "node" from the node's childs list, if "node" is an instance.
Else delete the first node that have specified name and (optionally)
@@ -306,7 +324,7 @@ class Node(object):
pass
return ret
- def getTag(self, name, attrs={}, namespace=None):
+ def getTag(self, name, attrs=None, namespace=None):
"""
Filter all child nodes using specified arguments as filter. Return the
first found or None if not found
@@ -332,7 +350,7 @@ class Node(object):
except Exception:
return None
- def getTags(self, name, attrs={}, namespace=None, one=0):
+ def getTags(self, name, attrs=None, namespace=None, one=0):
"""
Filter all child nodes using specified arguments as filter. Returns the
list of nodes found
@@ -342,6 +360,8 @@ class Node(object):
if namespace and namespace != node.getNamespace():
continue
if node.getName() == name:
+ if attrs is None:
+ attrs = {}
for key in attrs.keys():
if key not in node.attrs or node.attrs[key]!=attrs[key]:
break
@@ -352,7 +372,7 @@ class Node(object):
if not one:
return nodes
- def iterTags(self, name, attrs={}, namespace=None):
+ def iterTags(self, name, attrs=None, namespace=None):
"""
Iterate over all children using specified arguments as filter
"""
@@ -360,6 +380,8 @@ class Node(object):
if namespace is not None and namespace != node.getNamespace():
continue
if node.getName() == name:
+ if attrs is None:
+ attrs = {}
for key in attrs.keys():
if key not in node.attrs or \
node.attrs[key]!=attrs[key]:
@@ -412,7 +434,7 @@ class Node(object):
else:
self.kids = payload
- def setTag(self, name, attrs={}, namespace=None):
+ def setTag(self, name, attrs=None, namespace=None):
"""
Same as getTag but if the node with specified namespace/attributes not
found, creates such node and returns it
@@ -433,7 +455,7 @@ class Node(object):
except Exception:
self.addChild(tag, attrs={attr: val})
- def setTagData(self, tag, val, attrs={}):
+ def setTagData(self, tag, val, attrs=None):
"""
Creates new node (if not already present) with name "tag" and
(optionally) attributes "attrs" and sets it's CDATA to string "val"
=====================================
nbxmpp/stringprepare.py
=====================================
--- a/nbxmpp/stringprepare.py
+++ b/nbxmpp/stringprepare.py
@@ -86,12 +86,22 @@ class EmptyMappingTable(object):
else:
return c
-class Profile:
- def __init__(self, mappings=[], normalize=True, prohibiteds=[],
- check_unassigneds=True, check_bidi=True):
- self.mappings = mappings
+
+class Profile(object):
+ def __init__(self, mappings=None, normalize=True, prohibiteds=None,
+ check_unassigneds=True, check_bidi=True):
+ if mappings is None:
+ self.mappings = []
+ else:
+ self.mappings = mappings
+
self.normalize = normalize
- self.prohibiteds = prohibiteds
+
+ if prohibiteds is None:
+ self.prohibiteds = []
+ else:
+ self.prohibiteds = prohibiteds
+
self.do_check_unassigneds = check_unassigneds
self.do_check_bidi = check_bidi
View it on GitLab: http://dev.gajim.org/gajim/python-nbxmpp/commit/952546555d5b78402550d12e31d…
Yann Leboulanger pushed to branch master at gajim / python-nbxmpp
Commits:
b3fdc536 by Yann Leboulanger at 2016-11-02T22:33:40+01:00
[NooN8] checks if something is not in a list/dict/.. should be done with 'var not in list'
- - - - -
5b3707eb by Yann Leboulanger at 2016-11-02T22:34:38+01:00
[NooN8] Checks with None should be made with is or is not
- - - - -
b81a3ea7 by Yann Leboulanger at 2016-11-02T22:41:09+01:00
[NooN8] make all classes inherit from object
- - - - -
13 changed files:
- nbxmpp/auth_nb.py
- nbxmpp/bosh.py
- nbxmpp/client_nb.py
- nbxmpp/dispatcher_nb.py
- nbxmpp/idlequeue.py
- nbxmpp/plugin.py
- nbxmpp/protocol.py
- nbxmpp/proxy_connectors.py
- nbxmpp/roster_nb.py
- nbxmpp/simplexml.py
- nbxmpp/smacks.py
- nbxmpp/stringprepare.py
- nbxmpp/tls_nb.py
Changes:
=====================================
nbxmpp/auth_nb.py
=====================================
--- a/nbxmpp/auth_nb.py
+++ b/nbxmpp/auth_nb.py
@@ -193,7 +193,7 @@ class SASL(PlugIn):
# If the server supports a mechanism disable all weaker mechanisms.
password_auth_mechs_strength = ['SCRAM-SHA-1-PLUS', 'SCRAM-SHA-1',
'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2']
- if self.channel_binding == None:
+ if self.channel_binding is None:
password_auth_mechs_strength.remove('SCRAM-SHA-1-PLUS')
for i in range(0, len(password_auth_mechs_strength)):
if password_auth_mechs_strength[i] in self.mecs:
@@ -243,7 +243,7 @@ class SASL(PlugIn):
raise NodeProcessed
except kerberos.GSSError as e:
log.info('GSSAPI authentication failed: %s' % str(e))
- if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding != None:
+ if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding is not None:
self.mecs.remove('SCRAM-SHA-1-PLUS')
self.mechanism = 'SCRAM-SHA-1-PLUS'
self._owner._caller.get_password(self.set_password, self.mechanism)
@@ -501,7 +501,7 @@ class SASL(PlugIn):
self.client_nonce = '%x' % rndg.getrandbits(196)
self.scram_soup = 'n=' + self.username + ',r=' + self.client_nonce
if self.mechanism == 'SCRAM-SHA-1':
- if self.channel_binding == None:
+ if self.channel_binding is None:
# Client doesn't support Channel Binding
self.scram_gs2 = 'n,,' # No CB yet.
else:
=====================================
nbxmpp/bosh.py
=====================================
--- a/nbxmpp/bosh.py
+++ b/nbxmpp/bosh.py
@@ -493,8 +493,7 @@ def get_rand_number():
return rndg.getrandbits(50)
-
-class AckChecker():
+class AckChecker(object):
"""
Class for generating rids and generating and checking acknowledgements in
BOSH messages
@@ -537,10 +536,7 @@ class AckChecker():
return self.rid
-
-
-
-class KeyStack():
+class KeyStack(object):
"""
Class implementing key sequences for BOSH messages
"""
=====================================
nbxmpp/client_nb.py
=====================================
--- a/nbxmpp/client_nb.py
+++ b/nbxmpp/client_nb.py
@@ -29,7 +29,7 @@ import logging
log = logging.getLogger('nbxmpp.client_nb')
-class NonBlockingClient:
+class NonBlockingClient(object):
"""
Client class is XMPP connection mountpoint. Objects for authentication,
network communication, roster, xml parsing ... are plugged to client object.
@@ -499,10 +499,10 @@ class NonBlockingClient:
if self.protocol_type != 'BOSH':
self._channel_binding = self.Connection.NonBlockingTLS.get_channel_binding()
# TLS handshake is finished so channel binding data muss exist
- assert (self._channel_binding != None)
+ assert (self._channel_binding is not None)
except NotImplementedError:
pass
- if auth_mechs == None:
+ if auth_mechs is None:
self._auth_mechs = SASL_AUTHENTICATION_MECHANISMS | set(['XEP-0078'])
else:
self._auth_mechs = auth_mechs
@@ -557,7 +557,7 @@ class NonBlockingClient:
"""
if data:
self.Dispatcher.ProcessNonBlocking(data)
- if not 'SASL' in self.__dict__:
+ if 'SASL' not in self.__dict__:
# SASL is pluged out, possible disconnect
return
if self.SASL.startsasl == 'in-process':
=====================================
nbxmpp/dispatcher_nb.py
=====================================
--- a/nbxmpp/dispatcher_nb.py
+++ b/nbxmpp/dispatcher_nb.py
@@ -43,7 +43,7 @@ DEFAULT_TIMEOUT_SECONDS = 25
XML_DECLARATION = '<?xml version=\'1.0\'?>'
# FIXME: ugly
-class Dispatcher():
+class Dispatcher(object):
"""
Why is this here - I needed to redefine Dispatcher for BOSH and easiest way
was to inherit original Dispatcher (now renamed to XMPPDispatcher). Trouble
=====================================
nbxmpp/idlequeue.py
=====================================
--- a/nbxmpp/idlequeue.py
+++ b/nbxmpp/idlequeue.py
@@ -76,7 +76,7 @@ def get_idlequeue():
return SelectIdleQueue()
-class IdleObject:
+class IdleObject(object):
"""
Idle listener interface. Listed methods are called by IdleQueue.
"""
@@ -216,7 +216,7 @@ class IdleCommand(IdleObject):
self._return_result()
-class IdleQueue:
+class IdleQueue(object):
"""
IdleQueue provide three distinct time based features. Uses select.poll()
@@ -269,7 +269,7 @@ class IdleQueue:
Remove alarm callback alarm_cb scheduled on alarm_time. Returns True if
it was removed sucessfully, otherwise False
"""
- if not alarm_time in self.alarms:
+ if alarm_time not in self.alarms:
return False
i = -1
for i in range(len(self.alarms[alarm_time])):
@@ -278,7 +278,7 @@ class IdleQueue:
break
if i != -1:
del self.alarms[alarm_time][i]
- if self.alarms[alarm_time] == []:
+ if not self.alarms[alarm_time]:
del self.alarms[alarm_time]
return True
else:
=====================================
nbxmpp/plugin.py
=====================================
--- a/nbxmpp/plugin.py
+++ b/nbxmpp/plugin.py
@@ -21,7 +21,8 @@ Provides PlugIn class functionality to develop extentions for xmpppy
import logging
log = logging.getLogger('nbxmpp.plugin')
-class PlugIn:
+
+class PlugIn(object):
"""
Abstract xmpppy plugin infrastructure code, providing plugging in/out and
debugging functionality
=====================================
nbxmpp/protocol.py
=====================================
--- a/nbxmpp/protocol.py
+++ b/nbxmpp/protocol.py
@@ -605,7 +605,8 @@ stream_exceptions = {'bad-format': BadFormat,
'unsupported-version': UnsupportedVersion,
'xml-not-well-formed': XMLNotWellFormed}
-class JID:
+
+class JID(object):
"""
JID can be built from string, modified, compared, serialised into string
"""
=====================================
nbxmpp/proxy_connectors.py
=====================================
--- a/nbxmpp/proxy_connectors.py
+++ b/nbxmpp/proxy_connectors.py
@@ -27,7 +27,8 @@ from base64 import b64encode
import logging
log = logging.getLogger('nbxmpp.proxy_connectors')
-class ProxyConnector:
+
+class ProxyConnector(object):
"""
Interface for proxy-connecting object - when tunnneling XMPP over proxies,
some connecting process usually has to be done before opening stream. Proxy
=====================================
nbxmpp/roster_nb.py
=====================================
--- a/nbxmpp/roster_nb.py
+++ b/nbxmpp/roster_nb.py
@@ -74,7 +74,7 @@ class NonBlockingRoster(PlugIn):
roster representation
"""
sender = stanza.getAttr('from')
- if not sender is None and not sender.bareMatch(
+ if sender is not None and not sender.bareMatch(
self._owner.User + '@' + self._owner.Server):
return
query = stanza.getTag('query')
=====================================
nbxmpp/simplexml.py
=====================================
--- a/nbxmpp/simplexml.py
+++ b/nbxmpp/simplexml.py
@@ -485,7 +485,8 @@ class Node(object):
return self.NT
raise AttributeError
-class T:
+
+class T(object):
"""
Auxiliary class used to quick access to node's child nodes
"""
@@ -519,7 +520,8 @@ class NT(T):
else:
return self.node.addChild(attr, payload=[val])
-class NodeBuilder:
+
+class NodeBuilder(object):
"""
Builds a Node class minidom from data parsed to it. This class used for two
purposes:
=====================================
nbxmpp/smacks.py
=====================================
--- a/nbxmpp/smacks.py
+++ b/nbxmpp/smacks.py
@@ -3,14 +3,15 @@ from .protocol import NS_STREAM_MGMT
import logging
log = logging.getLogger('nbxmpp.smacks')
-class Smacks():
- '''
+
+class Smacks(object):
+ """
This is Smacks is the Stream Management class. It takes care of requesting
and sending acks. Also, it keeps track of the unhandled outgoing stanzas.
The dispatcher has to be able to access this class to increment the
number of handled stanzas
- '''
+ """
def __init__(self, con):
self.con = con # Connection object
=====================================
nbxmpp/stringprepare.py
=====================================
--- a/nbxmpp/stringprepare.py
+++ b/nbxmpp/stringprepare.py
@@ -25,7 +25,8 @@ import stringprep
import unicodedata
from encodings import idna
-class ILookupTable:
+
+class ILookupTable(object):
"""
Interface for character lookup classes
"""
@@ -36,7 +37,8 @@ class ILookupTable:
"""
pass
-class IMappingTable:
+
+class IMappingTable(object):
"""
Interface for character mapping classes
"""
@@ -47,15 +49,15 @@ class IMappingTable:
"""
pass
-class LookupTableFromFunction:
+class LookupTableFromFunction(object):
__implements__ = ILookupTable
def __init__(self, in_table_function):
self.lookup = in_table_function
-class LookupTable:
+class LookupTable(object):
__implements__ = ILookupTable
def __init__(self, table):
@@ -64,15 +66,15 @@ class LookupTable:
def lookup(self, c):
return c in self._table
-class MappingTableFromFunction:
+class MappingTableFromFunction(object):
__implements__ = IMappingTable
def __init__(self, map_table_function):
self.map = map_table_function
-class EmptyMappingTable:
+class EmptyMappingTable(object):
__implements__ = IMappingTable
def __init__(self, in_table_function):
@@ -149,7 +151,7 @@ class Profile:
raise UnicodeError("Violation of BIDI Requirement 3")
-class NamePrep:
+class NamePrep(object):
"""
Implements preparation of internationalized domain names
=====================================
nbxmpp/tls_nb.py
=====================================
--- a/nbxmpp/tls_nb.py
+++ b/nbxmpp/tls_nb.py
@@ -56,7 +56,7 @@ def gattr(obj, attr, default=None):
return default
-class SSLWrapper:
+class SSLWrapper(object):
"""
Abstract SSLWrapper base class
"""
View it on GitLab: http://dev.gajim.org/gajim/python-nbxmpp/compare/eb88300ee0d1767ddc0e6ace4f…
Yann Leboulanger pushed to branch master at gajim / python-nbxmpp
Commits:
eb88300e by Yann Leboulanger at 2016-11-02T22:31:45+01:00
adapt different comment styles to make them equal
- - - - -
6 changed files:
- nbxmpp/auth_nb.py
- nbxmpp/client_nb.py
- nbxmpp/dispatcher_nb.py
- nbxmpp/features_nb.py
- nbxmpp/smacks.py
- nbxmpp/tls_nb.py
Changes:
=====================================
nbxmpp/auth_nb.py
=====================================
--- a/nbxmpp/auth_nb.py
+++ b/nbxmpp/auth_nb.py
@@ -663,7 +663,7 @@ class NonBlockingBind(PlugIn):
self.resuming = False
def plugin(self, owner):
- ''' Start resource binding, if allowed at this time. Used internally. '''
+ """ Start resource binding, if allowed at this time. Used internally. """
if self._owner.Dispatcher.Stream.features:
try:
self.FeaturesHandler(self._owner.Dispatcher,
=====================================
nbxmpp/client_nb.py
=====================================
--- a/nbxmpp/client_nb.py
+++ b/nbxmpp/client_nb.py
@@ -160,6 +160,7 @@ class NonBlockingClient:
:param port: port number of XMPP server
:param on_proxy_failure: called if error occurs during TCP connection
to proxy server or during proxy connecting process
+ :param on_stream_error_cb: called if error occurs
:param proxy: dictionary with proxy data. It should contain at least
values for keys 'host' and 'port' - connection details for proxy
serve and optionally keys 'user' and 'pass' as proxy credentials
=====================================
nbxmpp/dispatcher_nb.py
=====================================
--- a/nbxmpp/dispatcher_nb.py
+++ b/nbxmpp/dispatcher_nb.py
@@ -298,6 +298,7 @@ class XMPPDispatcher(PlugIn):
:param typ: value of stanza's "type" attribute. If not specified any
value will match
:param ns: namespace of child that stanza must contain.
+ :param xmlns: xml namespace
:param makefirst: insert handler in the beginning of handlers list instead
of adding it to the end. Note that more common handlers i.e. w/o "typ"
and " will be called first nevertheless.
=====================================
nbxmpp/features_nb.py
=====================================
--- a/nbxmpp/features_nb.py
+++ b/nbxmpp/features_nb.py
@@ -213,6 +213,6 @@ def setPrivacyList(disp, listname, tags):
_on_default_response(disp, iq, None)
def delPrivacyList(disp, listname, cb=None):
- ''' Deletes privacy list 'listname'. Returns true on success. '''
+ """ Deletes privacy list 'listname'. Returns true on success. """
iq = Iq('set', NS_PRIVACY, payload=[Node('list', {'name':listname})])
_on_default_response(disp, iq, cb)
=====================================
nbxmpp/smacks.py
=====================================
--- a/nbxmpp/smacks.py
+++ b/nbxmpp/smacks.py
@@ -94,11 +94,11 @@ class Smacks():
self._owner.Connection.send(r, False)
def check_ack(self, disp, stanza):
- '''
+ """
Checks if the number of stanzas sent are the same as the
number of stanzas received by the server. Pops stanzas that were
handled by the server from the queue.
- '''
+ """
h = stanza.getAttr('h')
if not h:
log.error('Server did not send h attribute')
@@ -118,11 +118,11 @@ class Smacks():
self.uqueue.pop(0)
def check_resume(self, disp, stanza):
- '''
+ """
Checks if the number of stanzas sent are the same as the
number of stanzas received by the server. Resends stanzas not received
by the server in the last session.
- '''
+ """
h = stanza.getAttr('h')
if not h:
log.error('Server did not send h attribute')
=====================================
nbxmpp/tls_nb.py
=====================================
--- a/nbxmpp/tls_nb.py
+++ b/nbxmpp/tls_nb.py
@@ -158,7 +158,7 @@ class PyOpenSSLWrapper(SSLWrapper):
self.parent.__init__(self, *args)
def is_numtoolarge(self, e):
- ''' Magic methods don't need documentation '''
+ """ Magic methods don't need documentation """
t = ('asn1 encoding routines', 'a2d_ASN1_OBJECT', 'first num too large')
return (isinstance(e.args, (list, tuple)) and len(e.args) == 1 and
isinstance(e.args[0], (list, tuple)) and len(e.args[0]) == 2 and
View it on GitLab: http://dev.gajim.org/gajim/python-nbxmpp/commit/eb88300ee0d1767ddc0e6ace4f1…