Several pylint fixes.

master
Marco Pesenti Gritti 16 years ago
parent 4c35d77854
commit 80190bf944

@ -291,7 +291,7 @@ class ActivityBundle(Bundle):
# List installed files
manifestfiles = self.get_files(self._raw_manifest())
paths = []
for root, dirs, files in os.walk(install_path):
for root, dirs_, files in os.walk(install_path):
rel_path = root[len(install_path) + 1:]
for f in files:
paths.append(os.path.join(rel_path, f))

@ -49,6 +49,7 @@ class ContentBundle(Bundle):
self._category_icon = None
self._library_version = None
self._bundle_class = None
self._activity_start = None
info_file = self.get_file('library/library.info')
if info_file is None:

@ -281,8 +281,8 @@ class Activity(gobject.GObject):
def tubes_ready():
if self.telepathy_text_chan is None or \
self.telepathy_tubes_chan is None:
return
self.telepathy_tubes_chan is None:
return
_logger.debug('%r: finished setting up tubes', self)
reply_handler()
@ -303,7 +303,7 @@ class Activity(gobject.GObject):
found_text_channel = False
found_tubes_channel = False
for chan_path, chan_iface, handle_type, handle in chans:
for chan_path, chan_iface, handle_type, handle_ in chans:
if handle_type != telepathy.HANDLE_TYPE_ROOM:
return

@ -178,7 +178,7 @@ class PresenceService(gobject.GObject):
self._del_object, object_path)
try:
# Pre-fill the activity's ID
foo = obj.props.id
activity_id = obj.props.id
except dbus.exceptions.DBusException:
logging.debug('Cannot get the activity ID')
else:
@ -239,9 +239,11 @@ class PresenceService(gobject.GObject):
gobject.idle_add(self._emit_activity_invitation_signal, activity_path,
buddy_path, message)
def _emit_private_invitation_signal(self, bus_name, connection, channel, chan_type):
def _emit_private_invitation_signal(self, bus_name, connection,
channel, chan_type):
"""Emit GObject event with bus_name, connection and channel"""
self.emit('private-invitation', bus_name, connection, channel, chan_type)
self.emit('private-invitation', bus_name, connection,
channel, chan_type)
return False
def _private_invitation_cb(self, bus_name, connection, channel, chan_type):
@ -469,7 +471,7 @@ class PresenceService(gobject.GObject):
(activity.get_id(), err))
self.emit("activity-shared", False, None, err)
def share_activity(self, activity, properties={}, private=True):
def share_activity(self, activity, properties=None, private=True):
"""Ask presence service to ask the activity to share itself publicly.
Uses the AdvertiseActivity method on the service to ask for the
@ -484,6 +486,9 @@ class PresenceService(gobject.GObject):
"""
actid = activity.get_id()
if properties is None:
properties = {}
# Ensure the activity is not already shared/joined
for obj in self._objcache.values():
if not isinstance(object, Activity):
@ -584,7 +589,7 @@ class _MockPresenceService(gobject.GObject):
def get_owner(self):
return None
def share_activity(self, activity, properties={}):
def share_activity(self, activity, properties=None):
return None
_ps = None

@ -19,8 +19,8 @@
from telepathy.constants import (
CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES)
from tubeconn import TubeConnection
import presenceservice
from sugar.presence.tubeconn import TubeConnection
from sugar.presence import presenceservice
class SugarTubeConnection(TubeConnection):

@ -215,7 +215,7 @@ class Profile(object):
return None
# hash it
key_hash = util._sha_data(key)
key_hash = util.sha_data(key)
return util.printable_hash(key_hash)
def _get_privkey_hash(self):

@ -31,7 +31,7 @@ def printable_hash(in_hash):
printable = printable + binascii.b2a_hex(char)
return printable
def _sha_data(data):
def sha_data(data):
"""sha1 hash some bytes."""
sha_hash = sha.new()
sha_hash.update(data)
@ -52,7 +52,7 @@ def unique_id(data = ''):
perfectly unique values.
"""
data_string = "%s%s%s" % (time.time(), random.randint(10000, 100000), data)
return printable_hash(_sha_data(data_string))
return printable_hash(sha_data(data_string))
ACTIVITY_ID_LEN = 40

Loading…
Cancel
Save