From 01d6e3bac75bd2f160492cf5cc7cdf87a31017ca Mon Sep 17 00:00:00 2001 From: Lingchaox Xin Date: Fri, 14 Jun 2013 09:19:05 +0800 Subject: [PATCH] Pylint for common/buildtrigger.py Change-Id: I0ae68ca260ad6397e96baca25d4968ea1224ce46 --- common/buildtrigger.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/common/buildtrigger.py b/common/buildtrigger.py index 49d8ce7..7c60e62 100644 --- a/common/buildtrigger.py +++ b/common/buildtrigger.py @@ -1,3 +1,5 @@ +"""A build trigger""" + import base64 try: import json @@ -7,16 +9,21 @@ except ImportError: from common.utils import unicode_to_str def trigger_next(job_name, data): - print "====LOG:TRIGGER_NEXT:%s ========================================" %job_name.upper() - with open("%s.env" %job_name, 'w') as fh: - fh.write('TRIGGER_INFO=%s\n' % base64.b64encode(json.dumps(data))) + """Trigger next job""" + + print "====LOG:TRIGGER_NEXT:%s =======================" % job_name.upper() + with open("%s.env" % job_name, 'w') as info_file: + info_file.write('TRIGGER_INFO=%s\n' % \ + base64.b64encode(json.dumps(data))) for key in data.keys(): - print "%s='%s'" %(key, data[key]) - print "====LOG:TRIGGER_NEXT:========================================end==" + print "%s='%s'" % (key, data[key]) + print "====LOG:TRIGGER_NEXT:======================end==" + +def trigger_info(_trigger_info): + "Return a trigger info dict""" -def trigger_info(TRIGGER_INFO): - print "====LOG:TRIGGER_INFO:========================================" - content_dict = unicode_to_str(json.loads(base64.b64decode(TRIGGER_INFO))) + print "====LOG:TRIGGER_INFO:===========================" + content_dict = unicode_to_str(json.loads(base64.b64decode(_trigger_info))) print json.dumps(content_dict, indent = 4) - print "====LOG:TRIGGER_INFO:========================================end==" + print "====LOG:TRIGGER_INFO:======================end==" return content_dict -- 2.7.4