From: Joshua Lock <josh@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] lib/bb/siggen: use open() rather than the file constructor
Date: Fri, 11 May 2012 17:58:57 -0700 [thread overview]
Message-ID: <1336784337-22053-1-git-send-email-josh@linux.intel.com> (raw)
The Python documentation states:
"When opening a file, it’s preferable to use open() instead of invoking
the file constructor directly." [1]
Further in Python 3 direct use of the file constructor is no longer
possible.
1. http://docs.python.org/library/functions.html#open
Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
lib/bb/siggen.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 8c79b17..ca26919 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -201,7 +201,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
for dep in data['runtaskdeps']:
data['runtaskhashes'][dep] = self.taskhash[dep]
- p = pickle.Pickler(file(sigfile, "wb"), -1)
+ p = pickle.Pickler(open(sigfile, "wb"), -1)
p.dump(data)
def dump_sigs(self, dataCache):
@@ -250,9 +250,9 @@ def clean_basepaths(a):
return b
def compare_sigfiles(a, b):
- p1 = pickle.Unpickler(file(a, "rb"))
+ p1 = pickle.Unpickler(open(a, "rb"))
a_data = p1.load()
- p2 = pickle.Unpickler(file(b, "rb"))
+ p2 = pickle.Unpickler(open(b, "rb"))
b_data = p2.load()
def dict_diff(a, b, whitelist=set()):
@@ -331,7 +331,7 @@ def compare_sigfiles(a, b):
print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep])
def dump_sigfile(a):
- p1 = pickle.Unpickler(file(a, "rb"))
+ p1 = pickle.Unpickler(open(a, "rb"))
a_data = p1.load()
print "basewhitelist: %s" % (a_data['basewhitelist'])
--
1.7.7.6
reply other threads:[~2012-05-12 1:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336784337-22053-1-git-send-email-josh@linux.intel.com \
--to=josh@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.