From 7acfbd070fa207dff309383da6e743ad2b9843c3 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Fri, 15 Oct 2010 19:14:59 +0000 Subject: style cleanup: prefer ' for strings Tomeu prefers ' for strings, so let's use it wherever we don't have a good reason to use ". Reviewed-by: James Cameron Acked-by: Simon Schampijer CC: Aleksey Lim --- (limited to 'src/sugar/bundle') diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index b21f25d..94c44b0 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -87,9 +87,9 @@ class ActivityBundle(Bundle): "activity startup.") def _raw_manifest(self): - f = self.get_file("MANIFEST") + f = self.get_file('MANIFEST') if not f: - logging.warning("Activity directory lacks a MANIFEST file.") + logging.warning('Activity directory lacks a MANIFEST file.') return [] ret = [line.strip() for line in f.readlines()] @@ -108,7 +108,7 @@ class ActivityBundle(Bundle): lines = self._raw_manifest() # Remove trailing newlines, they do not help keep absolute position. - while lines and lines[-1] == "": + while lines and lines[-1] == '': lines = lines[:-1] for num, line in enumerate(lines): @@ -117,20 +117,20 @@ class ActivityBundle(Bundle): # Remove duplicates if line in lines[0:num]: - lines[num] = "" + lines[num] = '' logging.warning('Bundle %s: duplicate entry in MANIFEST: %s', self._name, line) continue # Remove MANIFEST - if line == "MANIFEST": - lines[num] = "" + if line == 'MANIFEST': + lines[num] = '' logging.warning('Bundle %s: MANIFEST includes itself: %s', self._name, line) # Remove invalid files if not self.is_file(line): - lines[num] = "" + lines[num] = '' logging.warning('Bundle %s: invalid entry in MANIFEST: %s', self._name, line) @@ -328,7 +328,7 @@ class ActivityBundle(Bundle): for path in paths: if path in manifestfiles: manifestfiles.remove(path) - elif path != "MANIFEST": + elif path != 'MANIFEST': logging.warning('Bundle %s: %s not in MANIFEST', self._name, path) if strict_manifest: @@ -336,7 +336,7 @@ class ActivityBundle(Bundle): # Is anything in MANIFEST left over after accounting for all files? if manifestfiles: - err = ("Bundle %s: files in MANIFEST not included: %s" % + err = ('Bundle %s: files in MANIFEST not included: %s' % (self._name, str(manifestfiles))) if strict_manifest: raise MalformedBundleException(err) diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py index cb110cc..8200d49 100644 --- a/src/sugar/bundle/bundle.py +++ b/src/sugar/bundle/bundle.py @@ -103,7 +103,7 @@ class Bundle(object): if ext != self._unzipped_extension: raise MalformedBundleException( 'All files in the bundle must be inside a single ' + - 'directory whose name ends with "%s"' % + 'directory whose name ends with %r' % self._unzipped_extension) for file_name in file_names: @@ -118,7 +118,7 @@ class Bundle(object): if self._zip_file is None: path = os.path.join(self._path, filename) try: - f = open(path, "rb") + f = open(path, 'rb') except IOError: return None else: diff --git a/src/sugar/bundle/contentbundle.py b/src/sugar/bundle/contentbundle.py index 48e05a1..5411a0f 100644 --- a/src/sugar/bundle/contentbundle.py +++ b/src/sugar/bundle/contentbundle.py @@ -97,7 +97,7 @@ class ContentBundle(Bundle): self._l10n = False else: raise MalformedBundleException( - 'Content bundle %s has invalid l10n key "%s"' % + 'Content bundle %s has invalid l10n key %r' % (self._path, l10n)) else: raise MalformedBundleException( @@ -196,7 +196,7 @@ class ContentBundle(Bundle): return os.path.join(self.get_root_dir(), self._activity_start) def get_start_uri(self): - return "file://" + urllib.pathname2url(self.get_start_path()) + return 'file://' + urllib.pathname2url(self.get_start_path()) def get_bundle_id(self): # TODO treat ContentBundle in special way -- cgit v0.9.1