changeset 60f54ff36c17 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=60f54ff36c17
description: coding standards
diffstat:
src/adhoc_commands.py | 2 +-
src/common/connection_handlers_events.py | 4 +-
src/common/dataforms.py | 8 +-
src/common/jingle_ft.py | 8 +-
src/common/jingle_ftstates.py | 4 +-
src/common/jingle_transport.py | 2 +-
src/common/pep.py | 26 +++---
src/common/resolver.py | 10 +-
src/common/socks5.py | 123 +++++++++++-------------------
src/common/stanza_session.py | 2 +-
src/config.py | 2 +-
src/dataforms_widget.py | 26 +++---
src/groupchat_control.py | 2 +-
src/search_window.py | 2 +-
src/statusicon.py | 2 +-
test/lib/gajim_mocks.py | 2 +-
16 files changed, 96 insertions(+), 129 deletions(-)
diffs (truncated from 845 to 300 lines):
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/adhoc_commands.py
--- a/src/adhoc_commands.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/adhoc_commands.py Wed Aug 22 12:55:57 2012 +0200
@@ -371,7 +371,7 @@
_('The form is not filled correctly.'))
self.data_form_widget.set_sensitive(True)
return
- self.data_form_widget.data_form.type = 'submit'
+ self.data_form_widget.data_form.type_ = 'submit'
else:
self.data_form_widget.hide()
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/connection_handlers_events.py Wed Aug 22 12:55:57 2012 +0200
@@ -1683,7 +1683,7 @@
pep = pep_class.get_tag_as_PEP(self.fjid, self.conn.name,
self.event_tag)
if pep:
- self.pep_type = pep.type
+ self.pep_type = pep.type_
return True
items = self.event_tag.getTag('items')
@@ -2007,7 +2007,7 @@
return
self.dataform = dataforms.ExtendForm(node=form_tag)
for f in self.dataform.iter_fields():
- if f.var == 'stream-method' and f.type == 'list-single':
+ if f.var == 'stream-method' and f.type_ == 'list-single':
values = [o[1] for o in f.options]
self.file_props.stream_methods = ' '.join(values)
if xmpp.NS_BYTESTREAM in values or xmpp.NS_IBB in values:
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/dataforms.py
--- a/src/common/dataforms.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/dataforms.py Wed Aug 22 12:55:57 2012 +0200
@@ -120,7 +120,7 @@
if extend is None:
ExtendedNode.__init__(self, 'field')
- self.type = typ
+ self.type_ = typ
self.var = var
if value is not None:
self.value = value
@@ -248,7 +248,7 @@
self.delChild(t)
return locals()
-
+
def is_valid(self):
return True
@@ -463,7 +463,7 @@
def iter_values(self):
for element in self.getTags('value'):
yield element.getData()
-
+
def is_valid(self):
if not self.required:
return True
@@ -577,7 +577,7 @@
def __getitem__(self, item):
return self.vars[item]
-
+
def is_valid(self):
for f in self.iter_fields():
if not f.is_valid():
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/jingle_ft.py
--- a/src/common/jingle_ft.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/jingle_ft.py Wed Aug 22 12:55:57 2012 +0200
@@ -186,7 +186,7 @@
fingerprint = None
if self.use_security:
fingerprint = 'client'
- if self.transport.type == TransportType.SOCKS5:
+ if self.transport.type_ == TransportType.SOCKS5:
gajim.socks5queue.connect_to_hosts(self.session.connection.name,
self.file_props.sid, self.on_connect,
self._on_connect_error, fingerprint=fingerprint,
@@ -272,7 +272,7 @@
action=None):
# Sets up a few transport specific things for the file transfer
- if self.transport.type == TransportType.IBB:
+ if self.transport.type_ == TransportType.IBB:
# No action required, just set the state to transfering
self.state = STATE_TRANSFERING
@@ -323,11 +323,11 @@
if self.weinitiate:
listener = gajim.socks5queue.start_listener(port, sha_str,
self._store_socks5_sid, self.file_props,
- fingerprint=fingerprint, type='sender')
+ fingerprint=fingerprint, typ='sender')
else:
listener = gajim.socks5queue.start_listener(port, sha_str,
self._store_socks5_sid, self.file_props,
- fingerprint=fingerprint, type='receiver')
+ fingerprint=fingerprint, typ='receiver')
if not listener:
# send error message, notify the user
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/jingle_ftstates.py
--- a/src/common/jingle_ftstates.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/jingle_ftstates.py Wed Aug 22 12:55:57 2012 +0200
@@ -219,8 +219,8 @@
self.jft.session.connection.name, mode)
def action(self, args=None):
- if self.jft.transport.type == TransportType.IBB:
+ if self.jft.transport.type_ == TransportType.IBB:
self.__start_IBB_transfer(self.jft.session.connection)
- elif self.jft.transport.type == TransportType.SOCKS5:
+ elif self.jft.transport.type_ == TransportType.SOCKS5:
self.__start_SOCK5_transfer()
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/jingle_transport.py
--- a/src/common/jingle_transport.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/jingle_transport.py Wed Aug 22 12:55:57 2012 +0200
@@ -47,7 +47,7 @@
"""
def __init__(self, type_):
- self.type = type_
+ self.type_ = type_
self.candidates = []
self.remote_candidates = []
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/pep.py
--- a/src/common/pep.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/pep.py Wed Aug 22 12:55:57 2012 +0200
@@ -211,14 +211,14 @@
class AbstractPEP(object):
- type = ''
+ type_ = ''
namespace = ''
@classmethod
def get_tag_as_PEP(cls, jid, account, event_tag):
items = event_tag.getTag('items', {'node': cls.namespace})
if items:
- log.debug("Received PEP 'user %s' from %s" % (cls.type, jid))
+ log.debug("Received PEP 'user %s' from %s" % (cls.type_, jid))
return cls(jid, account, items)
else:
return None
@@ -237,18 +237,18 @@
def _update_contacts(self, jid, account):
for contact in gajim.contacts.get_contacts(account, jid):
if self._retracted:
- if self.type in contact.pep:
- del contact.pep[self.type]
+ if self.type_ in contact.pep:
+ del contact.pep[self.type_]
else:
- contact.pep[self.type] = self
+ contact.pep[self.type_] = self
def _update_account(self, account):
acc = gajim.connections[account]
if self._retracted:
- if self.type in acc.pep:
- del acc.pep[self.type]
+ if self.type_ in acc.pep:
+ del acc.pep[self.type_]
else:
- acc.pep[self.type] = self
+ acc.pep[self.type_] = self
def asPixbufIcon(self):
'''SHOULD be implemented by subclasses'''
@@ -262,7 +262,7 @@
class UserMoodPEP(AbstractPEP):
'''XEP-0107: User Mood'''
- type = 'mood'
+ type_ = 'mood'
namespace = xmpp.NS_MOOD
def _extract_info(self, items):
@@ -308,7 +308,7 @@
class UserTunePEP(AbstractPEP):
'''XEP-0118: User Tune'''
- type = 'tune'
+ type_ = 'tune'
namespace = xmpp.NS_TUNE
def _extract_info(self, items):
@@ -354,7 +354,7 @@
class UserActivityPEP(AbstractPEP):
'''XEP-0108: User Activity'''
- type = 'activity'
+ type_ = 'activity'
namespace = xmpp.NS_ACTIVITY
def _extract_info(self, items):
@@ -420,7 +420,7 @@
class UserNicknamePEP(AbstractPEP):
'''XEP-0172: User Nickname'''
- type = 'nickname'
+ type_ = 'nickname'
namespace = xmpp.NS_NICK
def _extract_info(self, items):
@@ -449,7 +449,7 @@
class UserLocationPEP(AbstractPEP):
'''XEP-0080: User Location'''
- type = 'location'
+ type_ = 'location'
namespace = xmpp.NS_LOCATION
def _extract_info(self, items):
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/resolver.py
--- a/src/common/resolver.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/resolver.py Wed Aug 22 12:55:57 2012 +0200
@@ -295,23 +295,23 @@
IdleCommand.__init__(self, on_result)
self.commandtimeout = 10
self.host = host.lower()
- self.type = type.lower()
+ self.type_ = type.lower()
if not host_pattern.match(self.host):
# invalid host name
log.error('Invalid host: %s' % self.host)
self.canexecute = False
return
- if not ns_type_pattern.match(self.type):
- log.error('Invalid querytype: %s' % self.type)
+ if not ns_type_pattern.match(self.type_):
+ log.error('Invalid querytype: %s' % self.type_)
self.canexecute = False
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:
- self.result_handler(self.host, self.type, self.result)
+ self.result_handler(self.host, self.type_, self.result)
self.result_handler = None
# below lines is on how to use API and assist in testing
diff -r b1c321d3f8c9 -r 60f54ff36c17 src/common/socks5.py
--- a/src/common/socks5.py Wed Aug 22 12:21:45 2012 +0200
+++ b/src/common/socks5.py Wed Aug 22 12:55:57 2012 +0200
@@ -82,18 +82,18 @@
self.on_success = {} # {id: cb}
self.on_failure = {} # {id: cb}
- def start_listener(self, port, sha_str, sha_handler, file_props,
fingerprint=None,
- type='sender'):
+ def start_listener(self, port, sha_str, sha_handler, file_props,
+ fingerprint=None, typ='sender'):
"""
Start waiting for incomming connections on (host, port) and do a socks5
authentication using sid for generated SHA
"""
sid = file_props.sid
- self.type = type # It says whether we are sending or receiving
+ self.type_ = typ # It says whether we are sending or receiving
self.sha_handlers[sha_str] = (sha_handler, sid)
if self.listener is None or self.listener.connections == []:
self.listener = Socks5Listener(self.idlequeue, port, file_props,
- fingerprint=fingerprint)
+ fingerprint=fingerprint)
self.listener.queue = self
self.listener.bind()
else:
@@ -135,9 +135,9 @@
else:
fp = fingerprint
if receiving:
- self.type = 'receiver'
- socks5obj = Socks5ReceiverClient(self.idlequeue, streamhost,
sid,
- file_props, fingerprint=fp)
+ self.type_ = 'receiver'
+ socks5obj = Socks5ReceiverClient(self.idlequeue, streamhost,
+ sid, file_props, fingerprint=fp)
self.add_sockobj(account, socks5obj)
else:
if file_props.sha_str:
@@ -145,7 +145,7 @@
else:
idx = self.idx
self.idx = self.idx + 1
- self.type = 'sender'
+ self.type_ = 'sender'
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits