Commit 357d7db0 authored by Éric Araujo's avatar Éric Araujo

fixed some whitespace thanks to 2to3 -f ws_comma

parent c9ad0f5d
......@@ -71,11 +71,11 @@ class CommandWindow:
self.window.connect('delete-event',
self.on_adhoc_commands_window_delete_event)
for name in ('back_button', 'forward_button',
'execute_button','close_button','stages_notebook',
'execute_button', 'close_button', 'stages_notebook',
'retrieving_commands_stage_vbox',
'command_list_stage_vbox','command_list_vbox',
'sending_form_stage_vbox','sending_form_progressbar',
'notes_label','no_commands_stage_vbox','error_stage_vbox',
'command_list_stage_vbox', 'command_list_vbox',
'sending_form_stage_vbox', 'sending_form_progressbar',
'notes_label', 'no_commands_stage_vbox', 'error_stage_vbox',
'error_description_label'):
self.__dict__[name] = self.xml.get_object(name)
......
......@@ -266,7 +266,7 @@ class AdvancedConfigurationWindow(object):
def visible_func(self, model, treeiter):
search_string = self.entry.get_text().decode('utf-8').lower()
for it in tree_model_pre_order(model,treeiter):
for it in tree_model_pre_order(model, treeiter):
if model[it][C_TYPE] != '':
opt_path = self.get_option_path(model, it)
if len(opt_path) == 3:
......
......@@ -1053,7 +1053,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.scroll_to_end_id = None
return False
def size_request(self, msg_textview , requisition):
def size_request(self, msg_textview, requisition):
"""
When message_textview changes its size: if the new height will enlarge
the window, enable the scrollbar automatic policy. Also enable scrollbar
......
......@@ -117,7 +117,7 @@ class OldEntry(xmpp.Node, object):
Get source link
"""
try:
return self.getTag('feed').getTags('link',{'rel':'alternate'})[1].getData()
return self.getTag('feed').getTags('link', {'rel':'alternate'})[1].getData()
except Exception:
return None
......
......@@ -73,7 +73,7 @@ class Config:
'notify_on_new_message': [ opt_bool, True ],
'autopopupaway': [ opt_bool, False ],
'sounddnd': [ opt_bool, False, _('Play sound when user is busy')],
'use_notif_daemon': [ opt_bool, True , _('Use D-Bus and Notification-Daemon to show notifications') ],
'use_notif_daemon': [ opt_bool, True, _('Use D-Bus and Notification-Daemon to show notifications') ],
'showoffline': [ opt_bool, False ],
'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [ opt_bool, True ],
......@@ -115,7 +115,7 @@ class Config:
'emoticons_theme': [opt_str, 'static', '', True ],
'ascii_formatting': [ opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [ opt_bool, True , _('If True, do not '
'show_ascii_formatting_chars': [ opt_bool, True, _('If True, do not '
'remove */_ . So *abc* will be bold but with * * not removed.')],
'rst_formatting_outgoing_messages': [ opt_bool, False,
_('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')],
......@@ -268,7 +268,7 @@ class Config:
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')],
'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')],
'latex_png_dpi': [opt_str, '108',_('Change the value to change the size of latex formulas displayed. The higher is larger.') ],
'latex_png_dpi': [opt_str, '108', _('Change the value to change the size of latex formulas displayed. The higher is larger.') ],
'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True],
'ask_offline_status_on_connection': [ opt_bool, False, _('Ask offline status message to all offline contacts when connection to an accoutn is established. WARNING: This causes a lot of requests to be sent!') ],
'shell_like_completion': [ opt_bool, False, _('If True, completion in groupchats will be like a shell auto-completion')],
......@@ -342,7 +342,7 @@ class Config:
'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-width': [opt_int, 480],
'msgwin-height': [opt_int, 440],
'listen_to_network_manager' : [opt_bool, True],
'listen_to_network_manager': [opt_bool, True],
'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''],
......@@ -350,9 +350,9 @@ class Config:
'zeroconf_last_name': [ opt_str, '', '', True ],
'zeroconf_jabber_id': [ opt_str, '', '', True ],
'zeroconf_email': [ opt_str, '', '', True ],
'use_env_http_proxy' : [opt_bool, False],
'answer_receipts' : [opt_bool, True, _('Answer to receipt requests')],
'request_receipt' : [opt_bool, True, _('Sent receipt requests')],
'use_env_http_proxy': [opt_bool, False],
'answer_receipts': [opt_bool, True, _('Answer to receipt requests')],
'request_receipt': [opt_bool, True, _('Sent receipt requests')],
'publish_tune': [opt_bool, False],
'publish_location': [opt_bool, False],
'subscribe_mood': [opt_bool, True],
......@@ -493,7 +493,7 @@ class Config:
themes_default = {
# sorted alphanum
_('default'): [ '', '', '', 'B', '', '','', 'I', '', '', '', '', '','',
_('default'): [ '', '', '', 'B', '', '', '', 'I', '', '', '', '', '', '',
'', 'B' ],
_('green'): [ '', '#94aa8c', '', 'B', '#0000ff', '#eff3e7',
......
......@@ -1118,7 +1118,7 @@ class Connection(CommonConnection, ConnectionHandlers):
msg = '>>>>>> '
if self._proxy['type']=='bosh':
msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri'])
if self._proxy['type'] in ['http','socks5'] or self._proxy['bosh_useproxy']:
if self._proxy['type'] in ['http', 'socks5'] or self._proxy['bosh_useproxy']:
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
log.info(msg)
......@@ -1338,7 +1338,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if not common.xmpp.isResultNode(resp):
self.dispatch('PING_ERROR', (pingTo))
return
timeDiff = round(timePong - timePing,2)
timeDiff = round(timePong - timePing, 2)
self.dispatch('PING_REPLY', (pingTo, timeDiff))
if pingTo:
timePing = time_time()
......@@ -2054,7 +2054,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def send_gc_subject(self, jid, subject):
if not self.connection:
return
msg_iq = common.xmpp.Message(jid,typ = 'groupchat', subject = subject)
msg_iq = common.xmpp.Message(jid, typ = 'groupchat', subject = subject)
self.connection.send(msg_iq)
def request_gc_config(self, room_jid):
......@@ -2178,8 +2178,8 @@ class Connection(CommonConnection, ConnectionHandlers):
username = gajim.config.get_per('accounts', self.name, 'name')
iq = common.xmpp.Iq(typ = 'set', to = hostname)
q = iq.setTag(common.xmpp.NS_REGISTER + ' query')
q.setTagData('username',username)
q.setTagData('password',password)
q.setTagData('username', username)
q.setTagData('password', password)
self.connection.send(iq)
def get_password(self, callback):
......@@ -2260,7 +2260,7 @@ class Connection(CommonConnection, ConnectionHandlers):
item.addChild(node = form)
else:
for i in form.keys():
item.setTagData(i,form[i])
item.setTagData(i, form[i])
def _on_response(resp):
jid = jid = helpers.get_jid_from_iq(resp)
tag = resp.getTag('query', namespace = common.xmpp.NS_SEARCH)
......
......@@ -180,7 +180,7 @@ class ConnectionDisco:
frm=to)
iq.setAttr('id', id_)
query = iq.setTag('query')
query.setAttr('node','http://gajim.org#' + gajim.version.split('-', 1)[0])
query.setAttr('node', 'http://gajim.org#' + gajim.version.split('-', 1)[0])
for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI,
common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS):
feature = common.xmpp.Node('feature')
......@@ -1634,7 +1634,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
is_continued = False
if invite.getTag('invite').getTag('continue'):
is_continued = True
self.dispatch('GC_INVITATION',(frm, jid_from, reason, password,
self.dispatch('GC_INVITATION', (frm, jid_from, reason, password,
is_continued))
def _presenceCB(self, con, prs):
......
......@@ -40,7 +40,7 @@ class GlobalEventsDispatcher(object):
if event_name in self.handlers:
handlers_list = self.handlers[event_name]
i = 0
for i,h in enumerate(handlers_list):
for i, h in enumerate(handlers_list):
if priority < h[0]:
break
......
......@@ -102,7 +102,7 @@ class FancyFormatter(logging.Formatter):
"""
colors_mapping = {
'DEBUG': colors.BLUE,
'INFO' : colors.GREEN,
'INFO': colors.GREEN,
'WARNING': colors.BROWN,
'ERROR': colors.RED,
'CRITICAL': colors.BRIGHT_RED,
......
......@@ -706,7 +706,7 @@ class OptionsParser:
"""
dirs = ('../data', gajim.gajimpaths.root, gajim.DATA_DIR)
for evt in gajim.config.get_per('soundevents'):
path = gajim.config.get_per('soundevents', evt ,'path')
path = gajim.config.get_per('soundevents', evt, 'path')
# absolute and relative passes are necessary
path = helpers.strip_soundfile_path(path, dirs, abs=False)
path = helpers.strip_soundfile_path(path, dirs, abs=True)
......
......@@ -189,7 +189,7 @@ class NSLookupResolver(CommonResolver):
if not result:
return []
hosts = []
lines = result.replace('\r','').split('\n')
lines = result.replace('\r', '').split('\n')
current_host = None
for line in lines:
line = line.lstrip()
......@@ -305,7 +305,7 @@ class NsLookup(IdleCommand):
return
def _compose_command_args(self):
return ['nslookup', '-type=' + self.type , self.host]
return ['nslookup', '-type=' + self.type, self.host]
def _return_result(self):
if self.result_handler:
......
......@@ -25,7 +25,7 @@ try:
from docutils import io
from docutils.core import Publisher
from docutils.parsers.rst import roles
from docutils import nodes,utils
from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes
except ImportError:
print "Requires docutils 0.4 for set_classes to be available"
......@@ -91,7 +91,7 @@ else:
generate_uri_role('xep-reference', ('jep', 'xep'),
'XEP #', 'http://www.xmpp.org/extensions/', 'xep-%04d.html',
pos_int_validator)
generate_uri_role('gajim-ticket-reference', ('ticket','gtrack'),
generate_uri_role('gajim-ticket-reference', ('ticket', 'gtrack'),
'Gajim Ticket #', 'http://trac.gajim.org/ticket/', '%d',
pos_int_validator)
......
......@@ -387,7 +387,7 @@ class Socks5:
def open_file_for_reading(self):
if self.file is None:
try:
self.file = open(self.file_props['file-name'],'rb')
self.file = open(self.file_props['file-name'], 'rb')
if 'offset' in self.file_props and self.file_props['offset']:
self.size = self.file_props['offset']
self.file.seek(self.size)
......@@ -448,7 +448,7 @@ class Socks5:
self.disconnect()
return add
def send_raw(self,raw_data):
def send_raw(self, raw_data):
"""
Write raw outgoing data
"""
......@@ -651,7 +651,7 @@ class Socks5:
host, = '.'.join(str(s) for s in host_arr)
host_len = len(host)
elif host_type == 0x03:
host_len, = struct.unpack('!B' , buff[4])
host_len, = struct.unpack('!B', buff[4])
host, = struct.unpack('!%ds' % host_len, buff[5:5 + host_len])
portlen = len(buff[host_len + 5:])
if portlen == 1:
......
......@@ -424,7 +424,7 @@ class EncryptedStanzaSession(StanzaSession):
n, e = (crypto.decode_mpi(base64.b64decode(
keyvalue.getTagData(x))) for x in ('Modulus', 'Exponent'))
eir_pubkey = RSA.construct((n,long(e)))
eir_pubkey = RSA.construct((n, long(e)))
pubkey_o = xmpp.c14n.c14n(keyvalue, self._is_buggy_gajim())
else:
......@@ -750,7 +750,7 @@ class EncryptedStanzaSession(StanzaSession):
else:
negotiated['logging'] = self.logging_preference()[0]
for r,a in (('recv_pubkey', 'resp_pubkey'), ('send_pubkey',
for r, a in (('recv_pubkey', 'resp_pubkey'), ('send_pubkey',
'init_pubkey')):
negotiated[r] = None
......
......@@ -202,7 +202,7 @@ class SASL(PlugIn):
def MechanismHandler(self):
if 'ANONYMOUS' in self.mecs and self.username is None:
self.mecs.remove('ANONYMOUS')
node = Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'ANONYMOUS'})
node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'ANONYMOUS'})
self.mechanism = 'ANONYMOUS'
self.startsasl = SASL_IN_PROCESS
self._owner.send(str(node))
......@@ -222,7 +222,7 @@ class SASL(PlugIn):
self._owner.xmpp_hostname)[1]
kerberos.authGSSClientStep(self.gss_vc, '')
response = kerberos.authGSSClientResponse(self.gss_vc)
node=Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'},
node=Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'},
payload=(response or ''))
self.mechanism = 'GSSAPI'
self.gss_step = GSS_STATE_STEP
......@@ -233,7 +233,7 @@ class SASL(PlugIn):
log.info('GSSAPI authentication failed: %s' % str(e))
if 'DIGEST-MD5' in self.mecs:
self.mecs.remove('DIGEST-MD5')
node = Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'DIGEST-MD5'})
node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'DIGEST-MD5'})
self.mechanism = 'DIGEST-MD5'
self.startsasl = SASL_IN_PROCESS
self._owner.send(str(node))
......@@ -369,7 +369,7 @@ class SASL(PlugIn):
sasl_data = u''
for key in ('charset', 'username', 'realm', 'nonce', 'nc', 'cnonce',
'digest-uri', 'response', 'qop'):
if key in ('nc','qop','response','charset'):
if key in ('nc', 'qop', 'response', 'charset'):
sasl_data += u"%s=%s," % (key, self.resp[key])
else:
sasl_data += u'%s="%s",' % (key, self.resp[key])
......@@ -422,10 +422,10 @@ class NonBlockingNonSASL(PlugIn):
log.error('No result node arrived! Aborting...')
return self.on_auth(None)
iq=Iq(typ='set',node=resp)
iq=Iq(typ='set', node=resp)
query = iq.getTag('query')
query.setTagData('username',self.user)
query.setTagData('resource',self.resource)
query.setTagData('username', self.user)
query.setTagData('resource', self.resource)
if query.getTag('digest'):
log.info("Performing digest authentication")
......@@ -454,7 +454,7 @@ class NonBlockingNonSASL(PlugIn):
authentication")
query.setTagData('password', self.password)
self._method = 'plain'
resp = self.owner.Dispatcher.SendAndWaitForResponse(iq,func=self._on_auth)
resp = self.owner.Dispatcher.SendAndWaitForResponse(iq, func=self._on_auth)
def _on_auth(self, resp):
if isResultNode(resp):
......@@ -527,7 +527,7 @@ class NonBlockingBind(PlugIn):
self._owner.onreceive(None)
self._owner.Dispatcher.SendAndWaitForResponse(
Protocol('iq',typ='set', payload=[Node('bind', attrs={'xmlns':NS_BIND},
Protocol('iq', typ='set', payload=[Node('bind', attrs={'xmlns':NS_BIND},
payload=self._resource)]), func=self._on_bound)
def _on_bound(self, resp):
......
......@@ -373,7 +373,7 @@ class NonBlockingBOSH(NonBlockingTransport):
def get_current_state(self):
t = '------ SOCKET_ID\tSOCKET_STATE\tPENDING_REQS\n'
for s in self.http_socks:
t = '%s------ %s\t%s\t%s\n' % (t,id(s), s.get_state(), s.pending_requests)
t = '%s------ %s\t%s\t%s\n' % (t, id(s), s.get_state(), s.pending_requests)
t = '%s------ prio stanzas: %s, queued XMPP stanzas: %s, not_acked stanzas: %s' \
% (t, self.prio_bosh_stanzas, self.stanza_buffer,
self.ack_checker.get_not_acked_rids())
......@@ -417,7 +417,7 @@ class NonBlockingBOSH(NonBlockingTransport):
'xmpp:version': '1.0',
'ver': '1.6',
'xmlns:xmpp': 'urn:xmpp:xbosh'})
self.send_BOSH((t,True))
self.send_BOSH((t, True))
def start_disconnect(self):
NonBlockingTransport.start_disconnect(self)
......
......@@ -431,7 +431,7 @@ class NonBlockingClient:
Raise event to connection instance. DATA_SENT and DATA_RECIVED events
are used in XML console to show XMPP traffic
"""
log.info('raising event from transport: :::::%s::::\n_____________\n%s\n_____________\n' % (event_type,data))
log.info('raising event from transport: :::::%s::::\n_____________\n%s\n_____________\n' % (event_type, data))
if hasattr(self, 'Dispatcher'):
self.Dispatcher.Event('', event_type, data)
......@@ -556,13 +556,13 @@ class NonBlockingClient:
### following methods are moved from blocking client class of xmpppy
###############################################################################
def RegisterDisconnectHandler(self,handler):
def RegisterDisconnectHandler(self, handler):
"""
Register handler that will be called on disconnect
"""
self.disconnect_handlers.append(handler)
def UnregisterDisconnectHandler(self,handler):
def UnregisterDisconnectHandler(self, handler):
"""
Unregister handler that is called on disconnect
"""
......
......@@ -277,13 +277,13 @@ class XMPPDispatcher(PlugIn):
if not typ and not ns:
typ='default'
if xmlns not in self.handlers:
self.RegisterNamespace(xmlns,'warn')
self.RegisterNamespace(xmlns, 'warn')
if name not in self.handlers[xmlns]:
self.RegisterProtocol(name,Protocol,xmlns,'warn')
self.RegisterProtocol(name, Protocol, xmlns, 'warn')
if typ+ns not in self.handlers[xmlns][name]:
self.handlers[xmlns][name][typ+ns]=[]
if makefirst:
self.handlers[xmlns][name][typ+ns].insert(0,{'func':handler,
self.handlers[xmlns][name][typ+ns].insert(0, {'func':handler,
'system':system})
else:
self.handlers[xmlns][name][typ+ns].append({'func':handler,
......@@ -340,7 +340,7 @@ class XMPPDispatcher(PlugIn):
Return stanza back to the sender with <feature-not-implemented/> error
set
"""
if stanza.getType() in ('get','set'):
if stanza.getType() in ('get', 'set'):
conn._owner.send(Error(stanza, ERR_FEATURE_NOT_IMPLEMENTED))
def RegisterCycleHandler(self, handler):
......@@ -572,7 +572,7 @@ class BOSHDispatcher(XMPPDispatcher):
fromstream = self._metastream
fromstream.setAttr('from', fromstream.getAttr('to'))
fromstream.delAttr('to')
data = '%s%s>%s' % (XML_DECLARATION,str(fromstream)[:-2] ,data)
data = '%s%s>%s' % (XML_DECLARATION, str(fromstream)[:-2], data)
self.restart = False
return XMPPDispatcher.ProcessNonBlocking(self, data)
......
......@@ -45,9 +45,9 @@ def getRegInfo(disp, host, info={}, sync=True):
See JEP-0077 for details.
"""
iq=Iq('get',NS_REGISTER,to=host)
iq=Iq('get', NS_REGISTER, to=host)
for i in info.keys():
iq.setTagData(i,info[i])
iq.setTagData(i, info[i])
if sync:
disp.SendAndCallForResponse(iq, lambda resp:
_ReceivedRegInfo(disp.Dispatcher, resp, host))
......@@ -55,26 +55,26 @@ def getRegInfo(disp, host, info={}, sync=True):
disp.SendAndCallForResponse(iq, _ReceivedRegInfo, {'agent': host })
def _ReceivedRegInfo(con, resp, agent):
Iq('get',NS_REGISTER,to=agent)
Iq('get', NS_REGISTER, to=agent)
if not isResultNode(resp):
error_msg = resp.getErrorMsg()
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False,error_msg))
con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, None, False, error_msg))
return
tag=resp.getTag('query',namespace=NS_REGISTER)
tag=resp.getTag('query', namespace=NS_REGISTER)
if not tag:
error_msg = resp.getErrorMsg()
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False,error_msg))
con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, None, False, error_msg))
return
df=tag.getTag('x',namespace=NS_DATA)
df=tag.getTag('x', namespace=NS_DATA)
if df:
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,df,True,''))
con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, df, True, ''))
return
df={}
for i in resp.getQueryPayload():
if not isinstance(i, Node):
continue
df[i.getName()] = i.getData()
con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent,df,False,''))
con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, df, False, ''))
def register(disp, host, info, cb, args=None):
"""
......@@ -87,7 +87,7 @@ def register(disp, host, info, cb, args=None):
if not isinstance(info, dict):
info=info.asDict()
for i in info.keys():
iq.setTag('query').setTagData(i,info[i])
iq.setTag('query').setTagData(i, info[i])
disp.SendAndCallForResponse(iq, cb, args)
def unregister(disp, host, cb):
......@@ -104,8 +104,8 @@ def changePasswordTo(disp, newpassword, host=None, cb = None):
"""
if not host:
host = disp._owner.Server
iq = Iq('set',NS_REGISTER,to=host, payload=[Node('username',
payload=[disp._owner.Server]),Node('password',payload=[newpassword])])
iq = Iq('set', NS_REGISTER, to=host, payload=[Node('username',
payload=[disp._owner.Server]), Node('password', payload=[newpassword])])
_on_default_response(disp, iq, cb)
###############################################################################
......@@ -178,14 +178,14 @@ def setActivePrivacyList(disp, listname=None, typ='active', cb=None):
attrs={'name':listname}
else:
attrs={}
iq = Iq('set',NS_PRIVACY,payload=[Node(typ,attrs)])
iq = Iq('set', NS_PRIVACY, payload=[Node(typ, attrs)])
_on_default_response(disp, iq, cb)
def setDefaultPrivacyList(disp, listname=None):
"""
Set the default privacy list as 'listname'. Returns true on success
"""
return setActivePrivacyList(disp, listname,'default')
return setActivePrivacyList(disp, listname, 'default')
def setPrivacyList(disp, listname, tags):
"""
......@@ -213,5 +213,5 @@ def setPrivacyList(disp, listname, tags):
def delPrivacyList(disp, listname, cb=None):
''' Deletes privacy list 'listname'. Returns true on success. '''
iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})])
iq = Iq('set', NS_PRIVACY, payload=[Node('list', {'name':listname})])
_on_default_response(disp, iq, cb)
......@@ -475,7 +475,7 @@ class SelectIdleQueue(IdleQueue):
waiting_descriptors = select.select(self.read_fds.keys(),
self.write_fds.keys(), self.error_fds.keys(), 0)
except select.error, e:
waiting_descriptors = ((),(),())
waiting_descriptors = ((), (), ())
if e[0] != 4: # interrupt
raise
for fd in waiting_descriptors[0]:
......
......@@ -60,7 +60,7 @@ class PlugIn:
owner.__dict__[self.__class__.__name__]=self
# Execute hook
if hasattr(self,'plugin'):
if hasattr(self, 'plugin'):
return self.plugin(owner)
def PlugOut(self):
......@@ -80,7 +80,7 @@ class PlugIn:
else:
del self._owner.__dict__[self.__class__.__name__]
# Execute hook
if hasattr(self,'plugout'):
if hasattr(self, 'plugout'):
return self.plugout()
del self._owner
......
......@@ -189,8 +189,8 @@ temporary-auth-failure -- -- -- The authentication failed because of a tempora
ERRORS, _errorcodes = {}, {}
for ns, errname, errpool in ((NS_XMPP_STREAMS, 'STREAM', xmpp_stream_error_conditions),
(NS_STANZAS ,'ERR' ,xmpp_stanza_error_conditions),
(NS_SASL ,'SASL' ,sasl_error_conditions)):
(NS_STANZAS, 'ERR', xmpp_stanza_error_conditions),
(NS_SASL, 'SASL', sasl_error_conditions)):
for err in errpool.split('\n')[1:]:
cond, code, typ, text = err.split(' -- ')
name = errname + '_' + cond.upper().replace('-', '_')
......@@ -343,11 +343,11 @@ class JID:
self.node, self.domain, self.resource = node, domain, resource
else:
if jid.find('@') + 1:
self.node,jid = jid.split('@', 1)
self.node, jid = jid.split('@', 1)
else:
self.node = ''
if jid.find('/')+1:
self.domain, self.resource = jid.split('/',1)
self.domain, self.resource = jid.split('/', 1)
else:
self.domain, self.resource = jid, ''
......@@ -593,7 +593,7 @@ class Protocol(Node):
"""
Return the error code. Obsolete.
"""
return self.getTagAttr('error','code')
return self.getTagAttr('error', 'code')
def setError(self,error,code=None):
"""
......@@ -604,7 +604,7 @@ class Protocol(Node):
error = ErrorNode(_errorcodes[str(code)], text=error)
else:
error = ErrorNode(ERR_UNDEFINED_CONDITION, code=code, typ='cancel', text=error)
elif type(error) in [type(''),type(u'')]:
elif type(error) in [type(''), type(u'')]:
error=ErrorNode(error)
self.setType('error')
self.addChild(node=error)
......@@ -633,7 +633,7 @@ class Protocol(Node):
"""
Set the item 'item' to the value 'val'
"""
if item in ['to','from']:
if item in ['to', 'from']:
val = JID(val)
return self.setAttr(item, val)
......@@ -974,7 +974,7 @@ class ErrorNode(Node):
cod = code
if text:
txt = text
Node.__init__(self,'error', {}, [Node(name)])
Node.__init__(self, 'error', {}, [Node(name)])
if type_:
self.setAttr('type', type_)
if not cod:
......@@ -1160,7 +1160,7 @@ class DataField(Node):
"""
Set 'var' attribute value of this field
"""
return self.setAttr('var',val)
return self.setAttr('var', val)
class DataForm(Node):
"""
......
......@@ -34,7 +34,7 @@ class ProxyConnector:
"""
def __init__(self, send_method, onreceive, old_on_receive, on_success,
on_failure, xmpp_server, proxy_creds=(None,None)):
on_failure, xmpp_server, proxy_creds=(None, None)):
"""
Creates proxy connector, starts connecting immediately and gives control
back to transport afterwards
......
......@@ -59,7 +59,7 @@ class NonBlockingRoster(PlugIn):
elif not force:
return
iq = Iq('get',NS_ROSTER)
iq = Iq('get', NS_ROSTER)
iq.setTagAttr('query', 'ver', self.version)
id_ = self._owner.getAnID()
iq.setID(id_)
......@@ -98,7 +98,7 @@ class NonBlockingRoster(PlugIn):
for group in item.getTags('group'):
if group.getData() not in self._data[jid]['groups']:
self._data[jid]['groups'].append(group.getData())
self._data[self._owner.User+'@'+self._owner.Server]={'resources':{},'name':None,'ask':None,'subscription':None,'groups':None,}
self._data[self._owner.User+'@'+self._owner.Server]={'resources': {}, 'name': None, 'ask': None, 'subscription': None, 'groups': None,}
self.set=1
# Looks like we have a workaround
# raise NodeProcessed # a MUST. Otherwise you'll get back an <iq type='error'/>
......@@ -122,7 +122,7 @@ class NonBlockingRoster(PlugIn):
typ=pres.getType()
if not typ:
log.info('Setting roster item %s for resource %s...'%(jid.getStripped(),jid.getResource()))
log.info('Setting roster item %s for resource %s...'%(jid.getStripped(), jid.getResource()))
item['resources'][jid.getResource()]=res={'show':None,'status':None,'priority':'0','timestamp':None}
if pres.getTag('show'): res['show']=pres.getShow()
if pres.getTag('status'): res['status']=pres.getStatus()
......@@ -152,7 +152,7 @@ class NonBlockingRoster(PlugIn):
lastpri = -129
for r in self._data[jid]['resources'].keys():
if int(self._data[jid]['resources'][r]['priority']) > lastpri:
resource,lastpri=r,int(self._data[jid]['resources'][r]['priority'])
resource, lastpri=r, int(self._data[jid]['resources'][r]['priority'])
return self._data[jid]['resources'][resource][dataname]
def delItem(self, jid):
......@@ -227,12 +227,12 @@ class NonBlockingRoster(PlugIn):
"""
Rename contact 'jid' and sets the groups list that it now belongs to
"""
iq = Iq('set',NS_ROSTER)
iq = Iq('set', NS_ROSTER)
query = iq.getTag('query')
attrs = {'jid': jid}
if name:
attrs['name'] = name
item = query.setTag('item' ,attrs)
item = query.setTag('item', attrs)
for group in groups:
item.addChild(node=Node('group', payload=[group]))
self._owner.send(iq)
......@@ -271,7 +271,7 @@ class NonBlockingRoster(PlugIn):
"""
return self._data[item]
def getItem(self,item):
def getItem(self, item):
"""
Get the contact in the internal format (or None if JID 'item' is not in
roster)
......@@ -285,7 +285,7 @@ class NonBlockingRoster(PlugIn):
"""
self._owner.send(Presence(jid, 'subscribe'))
def Unsubscribe(self,jid):
def Unsubscribe(self, jid):