fixed some whitespace thanks to 2to3 -f ws_comma

This commit is contained in:
Éric Araujo 2010-02-10 19:24:11 +01:00
parent c9ad0f5d7d
commit 357d7db07d
44 changed files with 167 additions and 167 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -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)

View File

@ -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):

View File

@ -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

View File

@ -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,

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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):

View File

@ -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)

View File

@ -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
"""

View File

@ -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)

View File

@ -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)

View File

@ -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]:

View File

@ -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

View File

@ -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):
"""

View File

@ -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

View File

@ -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):
"""
Ask for removing our subscription for JID 'jid'
"""

View File

@ -90,7 +90,7 @@ class Node(object):
if self.FORCE_NODE_RECREATION and isinstance(node, Node):
node = str(node)
if not isinstance(node, Node):
node = NodeBuilder(node,self)
node = NodeBuilder(node, self)
node_built = True
else:
self.name, self.namespace, self.attrs, self.data, self.kids, self.parent, self.nsd = node.name, node.namespace, {}, [], [], node.parent, {}
@ -100,7 +100,7 @@ class Node(object):
self.data.append(data)
for kid in node.kids:
self.kids.append(kid)
for k,v in node.nsd.items():
for k, v in node.nsd.items():
self.nsd[k] = v
else:
self.name, self.namespace, self.attrs, self.data, self.kids, self.parent, self.nsd = 'tag', '', {}, [], [], None, {}
@ -108,8 +108,8 @@ class Node(object):
self.parent = parent
self.nsp_cache = {}
if nsp:
for k,v in nsp.items(): self.nsp_cache[k] = v
for attr,val in attrs.items():
for k, v in nsp.items(): self.nsp_cache[k] = v
for attr, val in attrs.items():
if attr == 'xmlns':
self.nsd[u''] = val
elif attr.startswith('xmlns:'):
@ -117,11 +117,11 @@ class Node(object):
self.attrs[attr]=attrs[attr]
if tag:
if node_built:
pfx,self.name = (['']+tag.split(':'))[-2:]
pfx, self.name = (['']+tag.split(':'))[-2:]
self.namespace = self.lookup_nsp(pfx)
else:
if ' ' in tag:
self.namespace,self.name = tag.split()
self.namespace, self.name = tag.split()
else:
self.name = tag
if isinstance(payload, basestring): payload=[payload]
@ -132,9 +132,9 @@ class Node(object):
self.data.append(ustr(i))
def lookup_nsp(self, pfx=''):
ns = self.nsd.get(pfx,None)
ns = self.nsd.get(pfx, None)
if ns is None:
ns = self.nsp_cache.get(pfx,None)
ns = self.nsp_cache.get(pfx, None)
if ns is None:
if self.parent:
ns = self.parent.lookup_nsp(pfx)
@ -220,7 +220,7 @@ class Node(object):
attributes
"""
if not isinstance(node, Node):
node = self.getTag(node,attrs)
node = self.getTag(node, attrs)
self.kids.remove(node)
return node
@ -302,7 +302,7 @@ class Node(object):
except:
return None
def getTagData(self,tag):
def getTagData(self, tag):
"""
Return cocatenated CDATA of the child with specified name
"""
@ -418,9 +418,9 @@ class Node(object):
(optionally) attributes "attrs" and sets it's CDATA to string "val"
"""
try:
self.getTag(tag,attrs).setData(ustr(val))
self.getTag(tag, attrs).setData(ustr(val))
except Exception:
self.addChild(tag,attrs,payload = [ustr(val)])
self.addChild(tag, attrs, payload = [ustr(val)])
def has_attr(self, key):
"""
@ -476,7 +476,7 @@ class T:
return self.node.setTag(attr)
def __setattr__(self, attr, val):
if isinstance(val,Node):
if isinstance(val, Node):
Node.__init__(self.node.setTag(attr), node=val)
else:
return self.node.setTagData(attr, val)
@ -493,8 +493,8 @@ class NT(T):
return self.node.addChild(attr)
def __setattr__(self, attr, val):
if isinstance(val,Node):
self.node.addChild(attr,node=val)
if isinstance(val, Node):
self.node.addChild(attr, node=val)
else:
return self.node.addChild(attr, payload=[val])
@ -541,7 +541,7 @@ class NodeBuilder:
self.data_buffer = None
self.streamError = ''
if data:
self._parser.Parse(data,1)
self._parser.Parse(data, 1)
def check_data_buffer(self):
if self.data_buffer:
@ -570,16 +570,16 @@ class NodeBuilder:
if not self._mini_dom :
self._mini_dom = Node(tag=tag, attrs=attrs, nsp = self._document_nsp, node_built=True)
else:
Node.__init__(self._mini_dom,tag=tag, attrs=attrs, nsp = self._document_nsp, node_built=True)
Node.__init__(self._mini_dom, tag=tag, attrs=attrs, nsp = self._document_nsp, node_built=True)
self._ptr = self._mini_dom
elif self.__depth > self._dispatch_depth:
self._ptr.kids.append(Node(tag=tag,parent=self._ptr,attrs=attrs, node_built=True))
self._ptr.kids.append(Node(tag=tag, parent=self._ptr, attrs=attrs, node_built=True))
self._ptr = self._ptr.kids[-1]
if self.__depth == 1:
self._document_attrs = {}
self._document_nsp = {}
nsp, name = (['']+tag.split(':'))[-2:]
for attr,val in attrs.items():
for attr, val in attrs.items():
if attr == 'xmlns':
self._document_nsp[u''] = val
elif attr.startswith('xmlns:'):

View File

@ -560,7 +560,7 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
# get as many bites, as possible, but not more than RECV_BUFSIZE
received = self._recv(RECV_BUFSIZE)
except socket.error, (errnum, errstr):
log.info("_do_receive: got %s:" % received , exc_info=True)
log.info("_do_receive: got %s:" % received, exc_info=True)
except tls_nb.SSLWrapper.Error, e:
log.info("_do_receive, caught SSL error, got %s:" % received,
exc_info=True)
@ -739,7 +739,7 @@ class NonBlockingHTTP(NonBlockingTCP):
httpbody - string with http body)
http_rest - what is left in the message after a full HTTP header + body
"""
message = message.replace('\r','')
message = message.replace('\r', '')
message = message.lstrip('\n')
splitted = message.split('\n\n')
if len(splitted) < 2:

View File

@ -115,7 +115,7 @@ class Zeroconf:
self.remove_service_callback)
self.service_browser.connect_to_signal('Failure', self.error_callback)
def new_domain_callback(self,interface, protocol, domain, flags):
def new_domain_callback(self, interface, protocol, domain, flags):
if domain != 'local':
self.browse_domain(interface, protocol, domain)
@ -246,7 +246,7 @@ class Zeroconf:
txt = {}
# remove empty keys
for key,val in self.txt.iteritems():
for key, val in self.txt.iteritems():
if val:
txt[key] = val

View File

@ -91,7 +91,7 @@ class Zeroconf:
self.remove_serviceCB(key)
return
def new_domain_callback(self,interface, protocol, domain, flags):
def new_domain_callback(self, interface, protocol, domain, flags):
if domain != "local":
self.browse_domain(interface, protocol, domain)
@ -203,7 +203,7 @@ class Zeroconf:
txt = {}
#remove empty keys
for key,val in self.txt:
for key, val in self.txt:
if val:
txt[key] = val

View File

@ -2775,7 +2775,7 @@ class GroupchatConfigWindow:
if not jid:
return
model = self.affiliation_treeview[affiliation].get_model()
model.append((jid,'', '', ''))
model.append((jid, '', '', ''))
dialogs.InputDialog(title, prompt, ok_handler=on_ok)
def on_remove_button_clicked(self, widget, affiliation):
@ -3675,7 +3675,7 @@ class AccountCreationWizardWindow:
img = self.xml.get_object('finish_image')
img.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG)
finish_text = '<big><b>%s</b></big>\n\n%s' % (
_('An error occurred during account creation') , reason)
_('An error occurred during account creation'), reason)
self.finish_label.set_markup(finish_text)
self.notebook.set_current_page(6) # show finish page
@ -3709,7 +3709,7 @@ class AccountCreationWizardWindow:
img = self.xml.get_object('finish_image')
img.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG)
finish_text = '<big><b>%s</b></big>\n\n%s' % (_('An error occurred during '
'account creation') , reason)
'account creation'), reason)
self.finish_label.set_markup(finish_text)
self.notebook.set_current_page(6) # show finish page

View File

@ -268,7 +268,7 @@ class ConversationTextview(gobject.GObject):
colors = gajim.config.get('gc_nicknames_colors')
colors = colors.split(':')
for i,color in enumerate(colors):
for i, color in enumerate(colors):
tagname = 'gc_nickname_color_' + str(i)
tag = buffer_.create_tag(tagname)
tag.set_property('foreground', color)

View File

@ -4639,7 +4639,7 @@ class TransformChatToMUC:
def unique_room_id_error(self, server):
self.unique_room_id_supported(server,
gajim.nicks[self.account].lower().replace(' ','') + str(randrange(
gajim.nicks[self.account].lower().replace(' ', '') + str(randrange(
9999999)))
class DataFormWindow(Dialog):

View File

@ -77,11 +77,11 @@ class FileTransfersWindow:
col = gtk.TreeViewColumn(_('File'))
renderer = gtk.CellRendererText()
col.pack_start(renderer, expand=False)
col.add_attribute(renderer, 'markup' , C_LABELS)
col.add_attribute(renderer, 'markup', C_LABELS)
renderer.set_property('yalign', 0.)
renderer = gtk.CellRendererText()
col.pack_start(renderer, expand=True)
col.add_attribute(renderer, 'markup' , C_FILE)
col.add_attribute(renderer, 'markup', C_FILE)
renderer.set_property('xalign', 0.)
renderer.set_property('yalign', 0.)
renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
@ -92,7 +92,7 @@ class FileTransfersWindow:
col = gtk.TreeViewColumn(_('Time'))
renderer = gtk.CellRendererText()
col.pack_start(renderer, expand=False)
col.add_attribute(renderer, 'markup' , C_TIME)
col.add_attribute(renderer, 'markup', C_TIME)
renderer.set_property('yalign', 0.5)
renderer.set_property('xalign', 0.5)
renderer = gtk.CellRendererText()
@ -106,8 +106,8 @@ class FileTransfersWindow:
renderer.set_property('yalign', 0.5)
renderer.set_property('xalign', 0.5)
col.pack_start(renderer, expand=False)
col.add_attribute(renderer, 'text' , C_PROGRESS)
col.add_attribute(renderer, 'value' , C_PERCENT)
col.add_attribute(renderer, 'text', C_PROGRESS)
col.add_attribute(renderer, 'value', C_PERCENT)
col.set_resizable(True)
col.set_expand(False)
self.tree.append_column(col)
@ -847,7 +847,7 @@ class FileTransfersWindow:
rect = self.tree.get_cell_area(props[0], props[1])
# position of the treeview on the screen
position = widget.window.get_origin()
self.tooltip.show_tooltip(file_props , rect.height,
self.tooltip.show_tooltip(file_props, rect.height,
position[1] + rect.y + self.height_diff)
else:
self.tooltip.hide_tooltip()

View File

@ -73,7 +73,7 @@ class GajimRemote:
# (argument name, help on argument, is mandatory)
#
self.commands = {
'help':[
'help': [
_('Shows a help on specific command'),
[
#User gets help for the command, specified by this parameter
@ -81,7 +81,7 @@ class GajimRemote:
_('show help on command'), False)
]
],
'toggle_roster_appearance' : [
'toggle_roster_appearance': [
_('Shows or hides the roster window'),
[]
],
@ -135,7 +135,7 @@ class GajimRemote:
False)
]
],
'send_chat_message':[
'send_chat_message': [
_('Sends new chat message to a contact in the roster. Both OpenPGP key '
'and account are optional. If you want to set only \'account\', '
'without \'OpenPGP key\', just set \'OpenPGP key\' to \'\'.'),
@ -148,7 +148,7 @@ class GajimRemote:
'using this account'), False),
]
],
'send_single_message':[
'send_single_message': [
_('Sends new single message to a contact in the roster. Both OpenPGP key '
'and account are optional. If you want to set only \'account\', '
'without \'OpenPGP key\', just set \'OpenPGP key\' to \'\'.'),
@ -162,7 +162,7 @@ class GajimRemote:
'using this account'), False),
]
],
'send_groupchat_message':[
'send_groupchat_message': [
_('Sends new message to a groupchat you\'ve joined.'),
[
('room_jid', _('JID of the room that will receive the message'), True),
@ -292,11 +292,11 @@ class GajimRemote:
'room'), False)
]
],
'check_gajim_running':[
'check_gajim_running': [
_('Check if Gajim is running'),
[]
],
'toggle_ipython' : [
'toggle_ipython': [
_('Shows or hides the ipython window'),
[]
],

View File

@ -2015,7 +2015,7 @@ class GroupchatControl(ChatControlBase):
item = xml.get_object('member_checkmenuitem')
item.set_active(target_affiliation != 'none')
if not user_affiliation in ('admin', 'owner') or \
(user_affiliation != 'owner' and target_affiliation in ('admin','owner')):
(user_affiliation != 'owner' and target_affiliation in ('admin', 'owner')):
item.set_sensitive(False)
id_ = item.connect('activate', self.on_member_checkmenuitem_activate, jid)
self.handlers[id_] = item
@ -2226,7 +2226,7 @@ class GroupchatControl(ChatControlBase):
# check if the current pointer is at the same path
# as it was before setting the timeout
if props and self.tooltip.id == props[0]:
rect = self.list_treeview.get_cell_area(props[0],props[1])
rect = self.list_treeview.get_cell_area(props[0], props[1])
position = self.list_treeview.window.get_origin()
self.tooltip.show_tooltip(contact, rect.height,
position[1] + rect.y)

View File

@ -1625,7 +1625,7 @@ class Interface:
gajim.connections[account].username = new_name
gajim.connections[account].change_status(status, '')
def on_cancel():
gajim.connections[account].change_status('offline','')
gajim.connections[account].change_status('offline', '')
dlg = dialogs.InputDialog(_('Username Conflict'),
_('Please type a new username for your local account'),
@ -2877,8 +2877,8 @@ class Interface:
if not auto_message:
auto_message = gajim.connections[account].status
else:
auto_message = auto_message.replace('$S','%(status)s')
auto_message = auto_message.replace('$T','%(time)s')
auto_message = auto_message.replace('$S', '%(status)s')
auto_message = auto_message.replace('$T', '%(time)s')
auto_message = auto_message % {
'status': gajim.status_before_autoaway[account],
'time': gajim.config.get('autoawaytime')
@ -2894,8 +2894,8 @@ class Interface:
if not auto_message:
auto_message = gajim.connections[account].status
else:
auto_message = auto_message.replace('$S','%(status)s')
auto_message = auto_message.replace('$T','%(time)s')
auto_message = auto_message.replace('$S', '%(status)s')
auto_message = auto_message.replace('$T', '%(time)s')
auto_message = auto_message % {
'status': gajim.status_before_autoaway[account],
'time': gajim.config.get('autoxatime')

View File

@ -631,7 +631,7 @@ class HistoryWindow:
self.results_window.set_property('visible', False)
def save_state(self):
x,y = self.window.window.get_root_origin()
x, y = self.window.window.get_root_origin()
width, height = self.window.get_size()
gajim.config.set('history_window_x-position', x)

View File

@ -68,7 +68,7 @@ display_resolution = 0.3514598*(gtk.gdk.screen_height() /
# embryo of CSS classes
classes = {
#'system-message':';display: none',
'problematic':';color: red',
'problematic': ';color: red',
}
# styles for elements
@ -245,9 +245,9 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
"""
if value.endswith('%'):
val = float(value[:-1])
sign = cmp(val,0)
sign = cmp(val, 0)
# limits: 1% to 500%
val = sign*max(1,min(abs(val),500))
val = sign*max(1, min(abs(val), 500))
frac = val/100
if font_relative:
attrs = self._get_current_attributes()
@ -270,9 +270,9 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
def get_val():
val = float(value[:-2])
sign = cmp(val,0)
sign = cmp(val, 0)
# validate length
return sign*max(minl,min(abs(val*display_resolution),maxl))
return sign*max(minl, min(abs(val*display_resolution), maxl))
if value.endswith('pt'): # points
callback(get_val()*display_resolution, *args)
@ -295,9 +295,9 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
try:
# TODO: isn't "no units" interpreted as pixels?
val = int(value)
sign = cmp(val,0)
sign = cmp(val, 0)
# validate length
val = sign*max(minl,min(abs(val),maxl))
val = sign*max(minl, min(abs(val), maxl))
callback(val, *args)
except Exception:
warnings.warn('Unable to parse length value "%s"' % value)
@ -308,7 +308,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
def _parse_style_display(self, tag, value):
if value == 'none':
tag.set_property('invisible','true')
tag.set_property('invisible', 'true')
# FIXME: display: block, inline
def _parse_style_font_size(self, tag, value):
@ -349,7 +349,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
else:
tag.set_property('style', style)
def __frac_length_tag_cb(self,length, tag, propname):
def __frac_length_tag_cb(self, length, tag, propname):
styles = self._get_style_tags()
if styles:
length += styles[-1].get_property(propname)
@ -540,7 +540,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
# images from network... this program is now potentially
# hackable ;)
loader = gtk.gdk.PixbufLoader()
dims = [0,0]
dims = [0, 0]
def height_cb(length):
dims[1] = length
def width_cb(length):
@ -673,7 +673,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
def startElement(self, name, attrs):
self._flush_text()
klass = [i for i in attrs.get('class',' ').split(' ') if i]
klass = [i for i in attrs.get('class', ' ').split(' ') if i]
style = ''
#Add styles defined for classes
for k in klass:
@ -692,7 +692,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
if not href:
href = attrs.get('HREF', None)
# Gaim sends HREF instead of href
title = attrs.get('title', attrs.get('rel',href))
title = attrs.get('title', attrs.get('rel', href))
type_ = attrs.get('type', None)
tag = self._create_url(href, title, type_, id_)
elif name == 'blockquote':
@ -709,7 +709,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
style += element_styles[name]
# so that explicit styles override implicit ones,
# we add the attribute last
style += ";"+attrs.get('style','')
style += ";"+attrs.get('style', '')
if style == '':
style = None
self._begin_span(style, tag, id_)
@ -934,7 +934,7 @@ if __name__ == '__main__':
print "debug:", text
def warn(self, text):
print "warn;", text
def error(self,text):
def error(self, text):
print "error;", text
gajim.log=log()

View File

@ -106,7 +106,7 @@ class IterableIPShell:
os.environ['TERM'] = 'dumb'
excepthook = sys.excepthook
self.IP = IPython.Shell.make_IPython(
argv,user_ns=user_ns,
argv, user_ns=user_ns,
user_global_ns=user_global_ns,
embedded=True,
shell_class=IPython.Shell.InteractiveShell)
@ -397,7 +397,7 @@ class ConsoleView(gtk.TextView):
if text:
self._write('\n')
self._showPrompt(self.prompt)
self.text_buffer.move_mark(self.line_start,self.text_buffer.get_end_iter())
self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter())
self.text_buffer.place_cursor(self.text_buffer.get_end_iter())
def onKeyPress(self, widget, event):
@ -462,7 +462,7 @@ class IPythonView(ConsoleView, IterableIPShell):
"""
ConsoleView.__init__(self)
self.cout = StringIO()
IterableIPShell.__init__(self, cout=self.cout,cerr=self.cout,
IterableIPShell.__init__(self, cout=self.cout, cerr=self.cout,
input_func=self.raw_input)
# self.connect('key_press_event', self.keyPress)
self.execute()

View File

@ -74,7 +74,7 @@ if dbus_support.supported:
if 'org.freedesktop.NetworkManager' in bus.list_names():
nm_object = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
props = dbus.Interface(nm_object,"org.freedesktop.DBus.Properties")
props = dbus.Interface(nm_object, "org.freedesktop.DBus.Properties")
bus.add_signal_receiver(state_changed,
'StateChanged',
'org.freedesktop.NetworkManager',

View File

@ -637,7 +637,7 @@ class DesktopNotification:
notification_response_manager.attach_to_interface()
notification_response_manager.add_pending(self.id, self)
def notify_another_way(self,e):
def notify_another_way(self, e):
gajim.log.debug(str(e))
gajim.log.debug('Need to implement a new way of falling back')

View File

@ -2832,7 +2832,7 @@ class RosterWindow:
def on_ok(checked):
for contact in gajim.contacts.get_contacts_from_group(account, group):
if not checked:
self.remove_contact_from_groups(contact.jid,account, [group])
self.remove_contact_from_groups(contact.jid, account, [group])
else:
gajim.connections[account].unsubscribe(contact.jid)
self.remove_contact(contact.jid, account, backend=True)

View File

@ -598,7 +598,7 @@ class RosterTooltip(NotificationAreaTooltip):
local_time = local_time.decode(
locale.getpreferredencoding())
text = text % local_time
properties.append(('Idle' + text,None))
properties.append(('Idle' + text, None))
while properties:
property_ = properties.pop(0)

View File

@ -70,7 +70,7 @@ class TestNonBlockingTCP(AbstractTransportTest):
def do_connect(self, establish_tls=False, proxy_dict=None):
try:
ips = socket.getaddrinfo('gajim.org', 5222,
socket.AF_UNSPEC,socket.SOCK_STREAM)
socket.AF_UNSPEC, socket.SOCK_STREAM)
ip = ips[0]
except socket.error, e:
self.testcase.fail(msg=str(e))

View File

@ -94,7 +94,7 @@ class Mock(object):
self._setupSubclassMethodInterceptors()
def _setupSubclassMethodInterceptors(self):
methods = inspect.getmembers(self.realClass,inspect.isroutine)
methods = inspect.getmembers(self.realClass, inspect.isroutine)
baseMethods = dict(inspect.getmembers(Mock, inspect.ismethod))
for m in methods:
name = m[0]
@ -109,7 +109,7 @@ class Mock(object):
self.mockReturnValues.update(methodReturnValues)
def mockSetExpectation(self, name, testFn, after=0, until=0):
self.mockExpectations.setdefault(name, []).append((testFn,after,until))
self.mockExpectations.setdefault(name, []).append((testFn, after, until))
def _checkInterfaceCall(self, name, callParams, callKwParams):
"""
@ -231,7 +231,7 @@ class MockCall:
s = s + sep + repr(p)
sep = ', '
items = sorted(self.kwparams.items())
for k,v in items:
for k, v in items:
s = s + sep + k + '=' + repr(v)
sep = ', '
s = s + ')'
@ -252,7 +252,7 @@ class MockCallable:
def __call__(self, *params, **kwparams):
self.mock._checkInterfaceCall(self.name, params, kwparams)
thisCall = self.recordCall(params,kwparams)
thisCall = self.recordCall(params, kwparams)
self.checkExpectations(thisCall, params, kwparams)
return self.makeCall(params, kwparams)