[Sugar-devel] [PATCH sugar v2 06/21] PEP8 cleanup: ensure lines are shorter than 80 characters
Sascha Silbe
sascha-ml-reply-to-2010-3 at silbe.org
Wed Nov 24 14:30:26 EST 2010
Excerpts from Simon Schampijer's message of Wed Nov 24 19:24:40 +0100 2010:
[src/jarabe/journal/model.py]
> > -PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'creation_time', 'filesize',
> > - 'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
> > - 'activity', 'mountpoint', 'activity_id', 'bundle_id']
> > +PROPERTIES = [
> > + 'activity', 'activity_id', 'buddies', 'bundle_id', 'creation_time',
> > + 'filesize', 'icon-color', 'keep', 'mime_type', 'mountpoint', 'mtime',
> > + 'progress', 'timestamp', 'title', 'uid',
> > +]
>
> That one looked better before.
I disagree. And as PEP-8 says nothing about how to format large list and
dictionary literals, I went for the style I found in
/usr/lib/python2.6/pydoc.py:
class Helper:
[...]
_symbols_inverse = {
'STRINGS' : ("'", "'''", "r'", "u'", '"""', '"', 'r"', 'u"'),
'OPERATORS' : ('+', '-', '*', '**', '/', '//', '%', '<<', '>>', '&',
'|', '^', '~', '<', '>', '<=', '>=', '==', '!=', '<>'),
'COMPARISON' : ('<', '>', '<=', '>=', '==', '!=', '<>'),
'UNARY' : ('-', '~'),
'AUGMENTEDASSIGNMENT' : ('+=', '-=', '*=', '/=', '%=', '&=', '|=',
'^=', '<<=', '>>=', '**=', '//='),
'BITWISE' : ('<<', '>>', '&', '|', '^', '~'),
'COMPLEX' : ('j', 'J')
}
But this change is not worth another jiffie, so I now reformatted it to
match the previous style:
@@ -38,9 +38,9 @@ DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
# Properties the journal cares about.
-PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'creation_time', 'filesize',
- 'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
- 'activity', 'mountpoint', 'activity_id', 'bundle_id']
+PROPERTIES = ['activity', 'activity_id', 'buddies', 'bundle_id',
+ 'creation_time', 'filesize', 'icon-color', 'keep', 'mime_type',
+ 'mountpoint', 'mtime', 'progress', 'timestamp', 'title', 'uid']
MIN_PAGES_TO_CACHE = 3
MAX_PAGES_TO_CACHE = 5
[src/jarabe/model/bundleregistry.py]
> > @@ -331,7 +330,8 @@ class BundleRegistry(gobject.GObject):
> > def set_bundle_position(self, bundle_id, version, x, y):
> > key = self._get_favorite_key(bundle_id, version)
> > if key not in self._favorite_bundles:
> > - raise ValueError('Bundle %s %s not favorite' % (bundle_id, version))
> > + raise ValueError('Bundle %s %s not favorite' % (bundle_id,
> > + version))
>
> version)) should be aligned with 'Bundle.
Why? It's still inside the % (...) scope.
PEP-8 breaks at the %, though, so that's what I do now:
@@ -334,7 +333,8 @@ class BundleRegistry(gobject.GObject):
def set_bundle_position(self, bundle_id, version, x, y):
key = self._get_favorite_key(bundle_id, version)
if key not in self._favorite_bundles:
- raise ValueError('Bundle %s %s not favorite' % (bundle_id, version))
+ raise ValueError('Bundle %s %s not favorite' %
+ (bundle_id, version))
if self._favorite_bundles[key] is None:
self._favorite_bundles[key] = {}
Sascha
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101124/3a122fea/attachment.pgp>
More information about the Sugar-devel
mailing list