pep8'd sugar3.bundle

This commit is contained in:
William Orr 2013-05-17 01:21:30 -04:00 committed by Daniel Narvaez
parent 8a6c935dd0
commit 9e4454a2ed
3 changed files with 20 additions and 15 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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