[Sugar-devel] [PATCH sugar 08/21] style cleanup: use """ everywhere

Sascha Silbe sascha-pgp at silbe.org
Sat Oct 16 18:20:10 EDT 2010


Most of the code uses """, so adjust the few deviations.

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

diff --git a/docs/release_howto.txt b/docs/release_howto.txt
index db877e0..841809a 100644
--- a/docs/release_howto.txt
+++ b/docs/release_howto.txt
@@ -1,7 +1,7 @@
-''' This is the release process of the sugar tarballs sugar(shell), 
+""" This is the release process of the sugar tarballs sugar(shell),
 sugar-toolkit and sugar-base described in a pytish way and
 instructions for sugar packagers
-'''
+"""
 
 # Release sugar tarballs
 
@@ -10,9 +10,9 @@ for package in [sugar, sugar-toolkit, sugar-base, sugar-artwork]:
     Pull the latest sources.
     Increase the version number in configure.ac
     # this will create you a tarball and does a check if it builds fine
-    # e.g. it will check if all the files containing translations are 
+    # e.g. it will check if all the files containing translations are
     # in po/POTFILES.in
-    make distcheck 
+    make distcheck
 
     if that succeed:
         # commit the change, log it as "Release [version_number]" (e.g. 0.79.1)
@@ -26,7 +26,7 @@ for package in [sugar, sugar-toolkit, sugar-base, sugar-artwork]:
         break
 
     # Upload the package
-    Upload the tarball to 
+    Upload the tarball to
         shell.sugarlabs.org:/pub/sugarlabs/sources/sucrose/glucose/$name/$name-$version
 
     # Verify the upload of the package
@@ -34,16 +34,16 @@ for package in [sugar, sugar-toolkit, sugar-base, sugar-artwork]:
         http://download.sugarlabs.org/sources/sucrose/glucose/$name/$name-$version
 
 # Package sugar for Fedora
-# - For announcements of the Sucrose release subscribe at the sugar-devel 
+# - For announcements of the Sucrose release subscribe at the sugar-devel
 #   mailing list; you can filter for the [ANNOUNCE] tag
-# - Uploaded tarballs can be found at: 
+# - Uploaded tarballs can be found at:
 #   glucose: http://download.sugarlabs.org/sources/sucrose/glucose/$name/$name-$version
 #   fructose: http://download.sugarlabs.org/sources/sucrose/fructose/$name/$name-$version
 #   more about the taxonomy: http://sugarlabs.org/go/Taxonomy
-	
-# more info on fedora packaging: 
+
+# more info on fedora packaging:
 #     http://fedoraproject.org/wiki/PackageMaintainers/UpdatingPackageHowTo
-# request permissions to contribute to the fedora package: 
+# request permissions to contribute to the fedora package:
 #     https://admin.fedoraproject.org/pkgdb/packages/name/[package]
 
 if not cvs_package:
@@ -70,4 +70,4 @@ cvs commit -F clog
 make tag
 make build
 
-# Do the same for the other branches e.g. devel 
+# Do the same for the other branches e.g. devel
diff --git a/extensions/cpsection/datetime/model.py b/extensions/cpsection/datetime/model.py
index 0a68fd7..dc17168 100644
--- a/extensions/cpsection/datetime/model.py
+++ b/extensions/cpsection/datetime/model.py
@@ -28,7 +28,7 @@ _zone_tab = '/usr/share/zoneinfo/zone.tab'
 
 
 def _initialize():
-    '''Initialize the docstring of the set function'''
+    """Initialize the docstring of the set function"""
     if set_timezone.__doc__ is None:
         # when running under 'python -OO', all __doc__ fields are None,
         # so += would fail -- and this function would be unnecessary anyway.
diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py
index d1d9af2..b020d50 100644
--- a/extensions/cpsection/keyboard/view.py
+++ b/extensions/cpsection/keyboard/view.py
@@ -360,7 +360,7 @@ class Keyboard(SectionView):
             i += 1
 
     def __create_add_remove_box(self):
-        '''Creates gtk.Hbox with add/remove buttons'''
+        """Creates gtk.Hbox with add/remove buttons"""
         add_icon = Icon(icon_name='list-add')
 
         add_button = gtk.Button()
diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py
index c56ffee..1b9ed93 100644
--- a/extensions/cpsection/language/view.py
+++ b/extensions/cpsection/language/view.py
@@ -87,7 +87,7 @@ class Language(SectionView):
         self.setup()
 
     def _add_row(self, locale_code=None):
-        '''Adds a row to the table'''
+        """Adds a row to the table"""
 
         self._selected_lang_count += 1
 
@@ -149,7 +149,7 @@ class Language(SectionView):
                 ypadding=padding)
 
     def _delete_last_row(self):
-        '''Deletes the last row of the table'''
+        """Deletes the last row of the table"""
 
         self._selected_lang_count -= 1
 
@@ -180,7 +180,7 @@ class Language(SectionView):
         self._lang_alert.hide()
 
     def _create_add_remove_box(self):
-        '''Creates gtk.Hbox with add/remove buttons'''
+        """Creates gtk.Hbox with add/remove buttons"""
         add_icon = Icon(icon_name='list-add')
 
         add_button = gtk.Button()
diff --git a/extensions/cpsection/updater/backends/aslo.py b/extensions/cpsection/updater/backends/aslo.py
index cf2994f..016e5e8 100644
--- a/extensions/cpsection/updater/backends/aslo.py
+++ b/extensions/cpsection/updater/backends/aslo.py
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-'''Activity information microformat parser.
+"""Activity information microformat parser.
 
 Activity information is embedded in HTML/XHTML/XML pages using a
 Resource Description Framework (RDF) http://www.w3.org/RDF/ .
@@ -46,7 +46,7 @@ An example::
         </RDF:Description>
     </em:targetApplication>
 </RDF:Description></RDF:RDF>
-'''
+"""
 
 import logging
 from xml.etree.ElementTree import XML
@@ -146,13 +146,13 @@ class _UpdateFetcher(object):
 
 
 def fetch_update_info(bundle, completion_cb):
-    '''Queries the server for a newer version of the ActivityBundle.
+    """Queries the server for a newer version of the ActivityBundle.
 
        completion_cb receives bundle, version, link, size and possibly an error
        message:
 
        def completion_cb(bundle, version, link, size, error_message):
-    '''
+    """
     global _fetcher
 
     if _fetcher is not None:
diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
index 21b0b65..8e30042 100755
--- a/extensions/cpsection/updater/model.py
+++ b/extensions/cpsection/updater/model.py
@@ -14,12 +14,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-'''Sugar bundle updater: model.
+"""Sugar bundle updater: model.
 
 This module implements the non-GUI portions of the bundle updater, including
 list of installed bundls, whether updates are needed, and the URL at which to
 find the bundle updated.
-'''
+"""
 
 import os
 import logging
diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
index 6d5fe7c..b74dc18 100644
--- a/extensions/cpsection/updater/view.py
+++ b/extensions/cpsection/updater/view.py
@@ -182,8 +182,8 @@ class ActivityUpdater(SectionView):
 
 
 class ProgressPane(gtk.VBox):
-    '''Container which replaces the `ActivityPane` during refresh or
-    install.'''
+    """Container which replaces the `ActivityPane` during refresh or
+    install."""
 
     def __init__(self):
         gtk.VBox.__init__(self)
@@ -376,9 +376,7 @@ class UpdateListModel(gtk.ListStore):
 
 
 def _format_size(size):
-    '''
-    Convert a given size in bytes to a nicer better readable unit
-    '''
+    """Convert a given size in bytes to a nicer better readable unit"""
     if size == 0:
         # TRANS: download size is 0
         return _('None')
diff --git a/src/jarabe/controlpanel/cmd.py b/src/jarabe/controlpanel/cmd.py
index 6d5f127..e7ad6d0 100644
--- a/src/jarabe/controlpanel/cmd.py
+++ b/src/jarabe/controlpanel/cmd.py
@@ -33,7 +33,7 @@ _general_error = _("sugar-control-panel: %s")
 
 
 def cmd_help():
-    '''Print the help to the screen'''
+    """Print the help to the screen"""
     # TRANS: Translators, there's a empty line at the end of this string,
     # which must appear in the translated string (msgstr) as well.
     print _('Usage: sugar-control-panel [ option ] key [ args ... ] \n\
@@ -49,14 +49,14 @@ def cmd_help():
 
 
 def note_restart():
-    '''Instructions how to restart sugar'''
+    """Instructions how to restart sugar"""
     print _('To apply your changes you have to restart sugar.\n' +
             'Hit ctrl+alt+erase on the keyboard to trigger a restart.')
 
 
 def load_modules():
-    '''Build a list of pointers to available modules and import them.
-    '''
+    """Build a list of pointers to available modules and import them.
+    """
     modules = []
 
     path = os.path.join(config.ext_path, 'cpsection')
diff --git a/src/jarabe/controlpanel/gui.py b/src/jarabe/controlpanel/gui.py
index 2448bb4..affdcec 100644
--- a/src/jarabe/controlpanel/gui.py
+++ b/src/jarabe/controlpanel/gui.py
@@ -229,13 +229,13 @@ class ControlPanel(gtk.Window):
                                   style.COLOR_WHITE.get_gdk_color())
 
     def set_section_view_auto_close(self):
-        '''Automatically close the control panel if there is "nothing to do"
-        '''
+        """Automatically close the control panel if there is "nothing to do"
+        """
         self._section_view.auto_close = True
 
     def _get_options(self):
-        '''Get the available option information from the extensions
-        '''
+        """Get the available option information from the extensions
+        """
         options = {}
 
         path = os.path.join(config.ext_path, 'cpsection')
diff --git a/src/jarabe/controlpanel/sectionview.py b/src/jarabe/controlpanel/sectionview.py
index edef59f..4b5751f 100644
--- a/src/jarabe/controlpanel/sectionview.py
+++ b/src/jarabe/controlpanel/sectionview.py
@@ -50,5 +50,5 @@ class SectionView(gtk.VBox):
             return self._is_valid
 
     def undo(self):
-        '''Undo here the changes that have been made in this section.'''
+        """Undo here the changes that have been made in this section."""
         pass
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index e680dc9..44db15f 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -333,11 +333,11 @@ class JournalActivity(Window):
         self._list_view.set_is_visible(visible)
 
     def _check_available_space(self):
-        ''' Check available space on device
+        """Check available space on device
 
             If the available space is below 50MB an alert will be
             shown which encourages to delete old journal entries.
-        '''
+        """
 
         if self._critical_space_alert:
             return
diff --git a/src/jarabe/journal/modalalert.py b/src/jarabe/journal/modalalert.py
index c306b9e..877b11a 100644
--- a/src/jarabe/journal/modalalert.py
+++ b/src/jarabe/journal/modalalert.py
@@ -92,6 +92,5 @@ class ModalAlert(gtk.Window):
         self.window.set_accept_focus(True)
 
     def __show_journal_cb(self, button):
-        '''The opener will listen on the destroy signal
-        '''
+        """The opener will listen on the destroy signal"""
         self.destroy()
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 8c12afc..50d74de 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -523,9 +523,9 @@ class NMSettings(dbus.service.Object):
 
 
 class SecretsResponse(object):
-    ''' Intermediate object to report the secrets from the dialog
+    """Intermediate object to report the secrets from the dialog
     back to the connection object and which will inform NM
-    '''
+    """
     def __init__(self, connection, reply_cb, error_cb):
         self._connection = connection
         self._reply_cb = reply_cb
-- 
1.7.1



More information about the Sugar-devel mailing list