Pylint for common/buildtrigger.py
authorLingchaox Xin <lingchaox.xin@intel.com>
Fri, 14 Jun 2013 01:19:05 +0000 (09:19 +0800)
committerLingchaox Xin <lingchaox.xin@intel.com>
Fri, 14 Jun 2013 01:19:05 +0000 (09:19 +0800)
Change-Id: I0ae68ca260ad6397e96baca25d4968ea1224ce46

common/buildtrigger.py

index 49d8ce7..7c60e62 100644 (file)
@@ -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