From 90a84c3a6d754e1531af1493d55ed928d4c37202 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Sat, 16 Oct 2010 17:35:03 +0000 Subject: [PATCH] style cleanup: use """ everywhere Most of the code uses """, so adjust the few deviations. Reviewed-by: James Cameron CC: Aleksey Lim --- docs/release_howto.txt | 4 ++-- extensions/cpsection/datetime/model.py | 2 +- extensions/cpsection/keyboard/view.py | 2 +- extensions/cpsection/language/view.py | 6 +++--- extensions/cpsection/updater/backends/aslo.py | 8 ++++---- extensions/cpsection/updater/model.py | 4 ++-- extensions/cpsection/updater/view.py | 8 +++----- src/jarabe/controlpanel/cmd.py | 8 ++++---- src/jarabe/controlpanel/gui.py | 8 ++++---- src/jarabe/controlpanel/sectionview.py | 2 +- src/jarabe/journal/journalactivity.py | 4 ++-- src/jarabe/journal/modalalert.py | 3 +-- src/jarabe/model/network.py | 4 ++-- 13 files changed, 30 insertions(+), 33 deletions(-) diff --git a/docs/release_howto.txt b/docs/release_howto.txt index cf0957e34c..841809ad0b 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 diff --git a/extensions/cpsection/datetime/model.py b/extensions/cpsection/datetime/model.py index 0a68fd7f45..dc1716806d 100644 --- a/extensions/cpsection/datetime/model.py +++ b/extensions/cpsection/datetime/model.py @@ -28,7 +28,7 @@ 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 6dc76ff5a9..e3492557c2 100644 --- a/extensions/cpsection/keyboard/view.py +++ b/extensions/cpsection/keyboard/view.py @@ -360,7 +360,7 @@ def __determine_add_remove_box_visibility(self): 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 5355890179..c58b3348ab 100644 --- a/extensions/cpsection/language/view.py +++ b/extensions/cpsection/language/view.py @@ -87,7 +87,7 @@ def __init__(self, model, alerts): 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 @@ def _attach_to_table(self, widget, row, column, padding=20, \ 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 @@ def undo(self): 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 f1c4d6d4b2..c8c3d98228 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 @@ -''' +""" import logging from xml.etree.ElementTree import XML @@ -149,13 +149,13 @@ def _process_result(self): 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 86ede0620d..77cc873dee 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 63fb1e5fd7..de50d8d322 100644 --- a/extensions/cpsection/updater/view.py +++ b/extensions/cpsection/updater/view.py @@ -182,8 +182,8 @@ def undo(self): 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 @@ def __init__(self, model): 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 6d5f12734a..e7ad6d0db9 100644 --- a/src/jarabe/controlpanel/cmd.py +++ b/src/jarabe/controlpanel/cmd.py @@ -33,7 +33,7 @@ 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 b7dac739cb..d3cf8db509 100644 --- a/src/jarabe/controlpanel/gui.py +++ b/src/jarabe/controlpanel/gui.py @@ -229,13 +229,13 @@ def show_section_view(self, option): 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 edef59ffc9..4b5751f079 100644 --- a/src/jarabe/controlpanel/sectionview.py +++ b/src/jarabe/controlpanel/sectionview.py @@ -50,5 +50,5 @@ def do_get_property(self, pspec): 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 dc834388ed..6e061cccc1 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -334,11 +334,11 @@ def __visibility_notify_event_cb(self, window, event): 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 c306b9eb77..877b11adfe 100644 --- a/src/jarabe/journal/modalalert.py +++ b/src/jarabe/journal/modalalert.py @@ -92,6 +92,5 @@ def __realize_cb(self, widget): 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 7e2c1415b3..cfb04a6133 100644 --- a/src/jarabe/model/network.py +++ b/src/jarabe/model/network.py @@ -523,9 +523,9 @@ def __secrets_request_cb(self, sender, **kwargs): 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