From 9e4454a2edbf33bcd0158a0850a19daefa383fd7 Mon Sep 17 00:00:00 2001 From: William Orr Date: Fri, 17 May 2013 01:21:30 -0400 Subject: [PATCH] pep8'd sugar3.bundle --- src/sugar3/bundle/activitybundle.py | 27 ++++++++++++++++----------- src/sugar3/bundle/bundleversion.py | 4 ++-- src/sugar3/bundle/contentbundle.py | 4 ++-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py index 0c263dbc..ed1c503c 100644 --- a/src/sugar3/bundle/activitybundle.py +++ b/src/sugar3/bundle/activitybundle.py @@ -72,9 +72,12 @@ def _expand_lang(locale): for i in range(mask + 1): if not (i & ~mask): # if all components for this combo exist ... val = language - if i & COMPONENT_TERRITORY: val += territory - if i & COMPONENT_CODESET: val += codeset - if i & COMPONENT_MODIFIER: val += modifier + if i & COMPONENT_TERRITORY: + val += territory + if i & COMPONENT_CODESET: + val += codeset + if i & COMPONENT_MODIFIER: + val += modifier ret.append(val) ret.reverse() return ret @@ -315,8 +318,9 @@ class ActivityBundle(Bundle): mime_types = self.get_mime_types() if mime_types is not None: - installed_icons_dir = os.path.join(xdg_data_home, - 'icons/sugar/scalable/mimetypes') + installed_icons_dir = \ + os.path.join(xdg_data_home, + 'icons/sugar/scalable/mimetypes') if not os.path.isdir(installed_icons_dir): os.makedirs(installed_icons_dir) @@ -326,11 +330,11 @@ class ActivityBundle(Bundle): svg_file = mime_icon_base + '.svg' info_file = mime_icon_base + '.icon' self._symlink(svg_file, - os.path.join(installed_icons_dir, - os.path.basename(svg_file))) + os.path.join(installed_icons_dir, + os.path.basename(svg_file))) self._symlink(info_file, - os.path.join(installed_icons_dir, - os.path.basename(info_file))) + os.path.join(installed_icons_dir, + os.path.basename(info_file))) def _symlink(self, src, dst): if not os.path.isfile(src): @@ -364,8 +368,9 @@ class ActivityBundle(Bundle): mime_types = self.get_mime_types() if mime_types is not None: - installed_icons_dir = os.path.join(xdg_data_home, - 'icons/sugar/scalable/mimetypes') + installed_icons_dir = \ + os.path.join(xdg_data_home, + 'icons/sugar/scalable/mimetypes') if os.path.isdir(installed_icons_dir): for f in os.listdir(installed_icons_dir): path = os.path.join(installed_icons_dir, f) diff --git a/src/sugar3/bundle/bundleversion.py b/src/sugar3/bundle/bundleversion.py index e7632314..10ae42ea 100644 --- a/src/sugar3/bundle/bundleversion.py +++ b/src/sugar3/bundle/bundleversion.py @@ -123,7 +123,7 @@ class NormalizedVersion(object): def __str__(self): version_string = '.'.join(str(v) for v in self.parts) - if self._local != None: + if self._local is not None: version_string += self._local return version_string @@ -132,7 +132,7 @@ class NormalizedVersion(object): def _cannot_compare(self, other): raise TypeError("Can not compare %s and %s" - % (type(self).__name__, type(other).__name__)) + % (type(self).__name__, type(other).__name__)) def __eq__(self, other): if not isinstance(other, NormalizedVersion): diff --git a/src/sugar3/bundle/contentbundle.py b/src/sugar3/bundle/contentbundle.py index 38b4dc56..30cd7e15 100644 --- a/src/sugar3/bundle/contentbundle.py +++ b/src/sugar3/bundle/contentbundle.py @@ -66,7 +66,7 @@ class ContentBundle(Bundle): self._parse_info(info_file) if (self.get_file('index.html') is None and - self.get_file('library/library.xml') is None): + self.get_file('library/library.xml') is None): raise MalformedBundleException( 'Content bundle %s has neither index.html nor library.xml' % self._path) @@ -220,7 +220,7 @@ class ContentBundle(Bundle): return True elif os.path.isdir(self.get_root_dir()): return ContentBundle(self.get_root_dir()).get_library_version() \ - == self.get_library_version() + == self.get_library_version() else: return False