[Sugar-devel] [PATCH 02/21 sugar-toolkit] PEP8 cleanup: fix number of blank lines
Sascha Silbe
sascha-pgp at silbe.org
Fri Oct 15 17:01:06 EDT 2010
Caught by pep8.
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
diff --git a/examples/radiopalette.py b/examples/radiopalette.py
index 85b43ce..f8336bd 100644
--- a/examples/radiopalette.py
+++ b/examples/radiopalette.py
@@ -17,6 +17,7 @@ box.pack_start(toolbar, False)
text_view = gtk.TextView()
box.pack_start(text_view)
+
def echo(button, label):
if not button.props.active:
return
diff --git a/examples/toolbar.py b/examples/toolbar.py
index 2faea1f..c0718d3 100644
--- a/examples/toolbar.py
+++ b/examples/toolbar.py
@@ -25,6 +25,7 @@ toolbar.toolbar.insert(tollbarbutton_2, -1)
toolbar.toolbar.insert(gtk.SeparatorToolItem(), -1)
+
def del_cb(widget):
toolbar.toolbar.remove(tollbarbutton_3)
del_b = gtk.Button('delete sub-widget #3')
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 0bda2ea..6774703 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -98,6 +98,7 @@ J_DBUS_INTERFACE = 'org.laptop.Journal'
CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
+
class _ActivitySession(gobject.GObject):
__gsignals__ = {
diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py
index a4dd017..0202a66 100644
--- a/src/sugar/graphics/alert.py
+++ b/src/sugar/graphics/alert.py
@@ -291,6 +291,7 @@ class ConfirmationAlert(Alert):
self.add_button(gtk.RESPONSE_OK, _('Ok'), icon)
icon.show()
+
class ErrorAlert(Alert):
"""
This is a ready-made one button (Ok) alert.
@@ -336,6 +337,7 @@ class ErrorAlert(Alert):
self.add_button(gtk.RESPONSE_OK, _('Ok'), icon)
icon.show()
+
class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem):
"""An icon with a round border"""
__gtype_name__ = 'AlertTimeoutIcon'
diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py
index f51c938..e76e952 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -669,6 +669,7 @@ class Invoker(gobject.GObject):
if not self.props.cache_palette:
self.set_palette(None)
+
class WidgetInvoker(Invoker):
def __init__(self, parent=None, widget=None):
diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py
index aa6b396..a1b7a50 100644
--- a/src/sugar/presence/activity.py
+++ b/src/sugar/presence/activity.py
@@ -463,11 +463,13 @@ class Activity(gobject.GObject):
_logger.debug('%r: leaving', self)
self.telepathy_text_chan.Close()
+
class _BaseCommand(gobject.GObject):
__gsignals__ = {
'finished': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([object])),
}
+
def __init__(self):
gobject.GObject.__init__(self)
@@ -532,6 +534,7 @@ class _ShareCommand(_BaseCommand):
self._finished = True
self.emit('finished', error)
+
class _JoinCommand(_BaseCommand):
def __init__(self, connection, room_handle):
_BaseCommand.__init__(self)
diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py
index 0a72a36..b83bc51 100644
--- a/src/sugar/presence/buddy.py
+++ b/src/sugar/presence/buddy.py
@@ -144,6 +144,7 @@ class BaseBuddy(gobject.GObject):
class Buddy(BaseBuddy):
__gtype_name__ = 'PresenceBuddy'
+
def __init__(self, account_path, contact_id):
_logger.debug('Buddy.__init__')
BaseBuddy.__init__(self)
diff --git a/src/sugar/presence/connectionmanager.py b/src/sugar/presence/connectionmanager.py
index e681eb6..6604d3f 100644
--- a/src/sugar/presence/connectionmanager.py
+++ b/src/sugar/presence/connectionmanager.py
@@ -31,12 +31,14 @@ from telepathy.constants import CONNECTION_STATUS_CONNECTED
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
+
class Connection(object):
def __init__(self, account_path, connection):
self.account_path = account_path
self.connection = connection
self.connected = False
+
class ConnectionManager(object):
"""Track available telepathy connections"""
@@ -108,8 +110,8 @@ class ConnectionManager(object):
return account_path
return None
-_connection_manager = None
+_connection_manager = None
def get_connection_manager():
global _connection_manager
if not _connection_manager:
diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
index 51d8625..fa5edcf 100644
--- a/src/sugar/presence/presenceservice.py
+++ b/src/sugar/presence/presenceservice.py
@@ -37,6 +37,7 @@ from telepathy.interfaces import ACCOUNT, \
CONNECTION
from telepathy.constants import HANDLE_TYPE_CONTACT
+
_logger = logging.getLogger('sugar.presence.presenceservice')
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
@@ -44,6 +45,7 @@ ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
+
class PresenceService(gobject.GObject):
"""Provides simplified access to the Telepathy framework to activities"""
__gsignals__ = {
diff --git a/src/sugar/wm.py b/src/sugar/wm.py
index 3bf1421..eaa196e 100644
--- a/src/sugar/wm.py
+++ b/src/sugar/wm.py
@@ -22,6 +22,7 @@ UNSTABLE. Used only internally by Activity and jarabe.
import gtk
import logging
+
def _property_get_trapped(window, prop, prop_type):
gtk.gdk.error_trap_push()
@@ -35,6 +36,7 @@ def _property_get_trapped(window, prop, prop_type):
return prop_info
+
def _property_change_trapped(window, prop, prop_type, format, mode, data):
gtk.gdk.error_trap_push()
@@ -83,4 +85,3 @@ def set_activity_id(window, activity_id):
def set_bundle_id(window, bundle_id):
_property_change_trapped(window, '_SUGAR_BUNDLE_ID', 'STRING', 8,
gtk.gdk.PROP_MODE_REPLACE, bundle_id)
-
diff --git a/tests/graphics/common.py b/tests/graphics/common.py
index 2f00099..1a7bf47 100644
--- a/tests/graphics/common.py
+++ b/tests/graphics/common.py
@@ -19,10 +19,12 @@ import gtk
from sugar.graphics.toolbutton import ToolButton
+
class Test(gtk.VBox):
def __init__(self):
gtk.VBox.__init__(self)
+
class TestPalette(Test):
def __init__(self):
Test.__init__(self)
@@ -39,6 +41,7 @@ class TestPalette(Test):
def set_palette(self, palette):
self._invoker.set_palette(palette)
+
class TestRunner(object):
def run(self, test):
window = gtk.Window()
@@ -48,6 +51,7 @@ class TestRunner(object):
window.show()
+
def main(test):
runner = TestRunner()
runner.run(test)
diff --git a/tests/graphics/hipposcalability.py b/tests/graphics/hipposcalability.py
index a5cebcc..4101138 100644
--- a/tests/graphics/hipposcalability.py
+++ b/tests/graphics/hipposcalability.py
@@ -19,6 +19,7 @@ canvas.set_root(scrollbars)
box = hippo.CanvasBox(padding=10, spacing=10)
scrollbars.set_root(box)
+
def idle_cb():
global countdown
diff --git a/tests/graphics/iconcache.py b/tests/graphics/iconcache.py
index b03ecb6..90511d4 100644
--- a/tests/graphics/iconcache.py
+++ b/tests/graphics/iconcache.py
@@ -41,6 +41,7 @@ data = [
['battery-090', '#D1A3FF,#00A0FF'],
['battery-100', '#AC32FF,#FF2B34']]
+
def _button_activated_cb(button):
import random
diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py
index 9a9ad61..fd7006b 100644
--- a/tests/lib/test_mime.py
+++ b/tests/lib/test_mime.py
@@ -22,6 +22,7 @@ import unittest
from sugar import mime
+
class TestMime(unittest.TestCase):
def test_from_file_name(self):
self.assertEqual(mime.get_from_file_name('test.pdf'),
@@ -76,6 +77,6 @@ class TestMime(unittest.TestCase):
'text/plain'])
self.assertEqual(mime_type, 'text/plain')
+
if __name__ == "__main__":
unittest.main()
-
--
1.7.1
More information about the Sugar-devel
mailing list