convert several not covered by unit-test modules to use print function
authorDiane Trout <diane@ghic.org>
Mon, 6 Apr 2015 21:50:03 +0000 (14:50 -0700)
committerDiane Trout <diane@ghic.org>
Mon, 6 Apr 2015 21:50:03 +0000 (14:50 -0700)
htsworkflow/automation/runner.py
htsworkflow/pipelines/configure_run.py
htsworkflow/pipelines/fastq.py
htsworkflow/pipelines/run_status.py
htsworkflow/submission/geo.py
htsworkflow/submission/trackhub_submission.py
test/tree.py
version.py

index 7b0c4c9d7ca6b47e59254b27e2171876525e6715..073a6e7a6861ec8f4b544a64978eca129628bd40 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+from __future__ import print_function
 from glob import glob
 import logging
 import os
@@ -196,7 +197,7 @@ class Runner(rpc.XmlRpcBot):
                 #startCmdLineStatusMonitor(ci)
 
                 # running step
-                print 'Running pipeline now!'
+                print('Running pipeline now!')
                 run_status = run_pipeline(conf_info)
                 if run_status is True:
                     LOGGER.info('Runner: Pipeline: success')
@@ -223,4 +224,3 @@ def main(args=None):
 
 if __name__ == "__main__":
     sys.exit(main(sys.argv[1:]))
-
index d0d43d25e579e62e7a7ddceb6774d187457a118b..324f53b4cdffa25906275e3865d4b1137f5a7e6f 100644 (file)
@@ -1,4 +1,6 @@
 #!/usr/bin/python
+from __future__ import print_function
+
 __docformat__ = "restructuredtext en"
 
 import subprocess
@@ -243,7 +245,7 @@ def config_stdout_handler(line, conf_info):
 
     #Standard output handling
     else:
-      print 'Sequence line:', line
+      print('Sequence line:', line)
       mo = s_seq_folder.search(line)
       conf_info.bustard_path = line[mo.end():]
       conf_info.run_path, temp = os.path.split(conf_info.bustard_path)
@@ -458,7 +460,7 @@ def configure(conf_info):
                            stdout=fout,
                            stderr=ferr)
 
-  print "Configuring pipeline: %s" % (time.ctime())
+  print("Configuring pipeline: %s" % (time.ctime()))
   error_code = pipe.wait()
 
   # Clean up
@@ -509,8 +511,8 @@ def configure(conf_info):
   # 1) The stdout completed without error
   # 2) The program exited with status 0
   # 3) No errors found in stdout
-  print '#Expect: True, False, True, True'
-  print complete, bool(error_code), abort != RUN_ABORT, stderr_success is True
+  print('#Expect: True, False, True, True')
+  print(complete, bool(error_code), abort != RUN_ABORT, stderr_success is True)
   status = complete is True and \
            bool(error_code) is False and \
            abort != RUN_ABORT and \
@@ -592,9 +594,9 @@ def run_pipeline(conf_info):
   ferr.close()
 
   # Finished file check!
-  print 'RUN SUCCESS CHECK:'
+  print('RUN SUCCESS CHECK:')
   for key, value in event.run_status_dict.items():
-    print '  %s: %s' % (key, value)
+    print('  %s: %s' % (key, value))
 
   dstatus = event.run_status_dict
 
index 47b2f8300d553d6ba944c1309ec5c233ad1f4951..fce8993e10a0946115382c702da22edf98c40bfc 100644 (file)
@@ -1,5 +1,7 @@
 '''summarize fastq file
 '''
+from __future__ import print_function
+
 import os
 import numpy
 
@@ -42,4 +44,4 @@ if __name__ == '__main__':
     import sys
     from autoopen import autoopen
     with autoopen(sys.argv[1], 'r') as instream:
-        print summarize_hiseq_fastq(instream)
+        print(summarize_hiseq_fastq(instream))
index e6a3ed8e6b2f41793f1109dac1334900860e8eaf..46e400726fd3342578c839c8772e65e509cdbc01 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 __docformat__ = "restructuredtext en"
 
 import glob
@@ -104,7 +106,7 @@ class GARunStatus(object):
     during a run and provides methods for retrieving
     (completed, total) for each step or entire run.
     """
-    #print 'self._conf_filepath = %s' % (conf_filepath)
+    #print('self._conf_filepath = %s' % (conf_filepath))
     self._conf_filepath = conf_filepath
     self._base_dir, junk = os.path.split(conf_filepath)
     self._image_dir = os.path.join(self._base_dir, 'Images')
@@ -178,9 +180,9 @@ class GARunStatus(object):
     """
     Figures out the number of cycles that are available
     """
-    #print 'self._image_dir = %s' % (self._image_dir)
+    #print('self._image_dir = %s' % (self._image_dir))
     cycle_dirs = glob.glob(os.path.join(self._image_dir, 'L001', 'C*.1'))
-    #print 'cycle_dirs = %s' % (cycle_dirs)
+    #print('cycle_dirs = %s' % (cycle_dirs))
     cycle_list = []
     for cycle_dir in cycle_dirs:
       junk, c = os.path.split(cycle_dir)
@@ -410,13 +412,13 @@ def _cmdLineStatusMonitorFunc(conf_info):
 
   while 1:
     if conf_info.status is None:
-      print "No status object yet."
+      print("No status object yet.")
       time.sleep(SLEEP_AMOUNT)
       continue
 
     report = conf_info.status.statusReport()
-    print os.linesep.join(report)
-    print
+    print( os.linesep.join(report))
+    print()
 
     time.sleep(SLEEP_AMOUNT)
 
@@ -446,9 +448,8 @@ def main(cmdline=None):
     parser.error("need name of configuration file")
     
   status = GARunStatus(args[0])
-  print os.linesep.join(status.statusReport())
+  print(os.linesep.join(status.statusReport()))
   return 0
 
 if __name__ == "__main__":
   sys.exit(main(sys.argv[1:]))
-                   
index 1d98bd5c9550e36408b3ba4faed02ee8d28cedee..15d5b747bab1d1520757f1277ae3cb4f97ffbe26 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import logging
 import os
 
@@ -52,7 +54,7 @@ class GEOSubmission(Submission):
             'platform_id': platform_id,
             'series_id': series_id,
         })
-        print str(soft_template.render(context))
+        print(str(soft_template.render(context)))
 
     def check_for_name(self, analysis_node):
         name = fromTypedNode(
index 3aa4a96ae26fa96c44e0c0f58c67503890fe38dc..c771b165a52e7b1e57072baa332f2f63ee3dff1a 100644 (file)
@@ -1,3 +1,4 @@
+from __future__ import print_function
 import logging
 import os
 from pprint import pformat
@@ -41,7 +42,7 @@ class TrackHubSubmission(Submission):
         self.baseurl = os.path.join(baseurl, self.name)
         if baseupload:
             sshurl = parse_ssh_url(baseupload)
-            print sshurl
+            print(sshurl)
             self.user = sshurl.user
             self.host = sshurl.host
             self.uploadpath =  sshurl.path
index 4f666cc14a3b4f3326a66ecec138572a5a8bd05a..37d3fd44c0f7673eeb8c975c514dcbd647521fa2 100644 (file)
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
-
 """
 Build a fake directory tree for testing rsync management code.
 """
+from __future__ import print_function
 
 import os
 import random
@@ -77,5 +77,5 @@ def compare_tree(root, paths, verbose=False):
   difference = experimental_set - theoretical_set
   issame = (len(difference) == 0)
   if verbose and not issame:
-    print difference
+    print(difference)
   return issame
index b850b4a713a17a4b289a82d9aae97f6ef79cd883..4856928c7e74680578672a60916a1f11131d65fb 100644 (file)
@@ -30,6 +30,7 @@
 # contains the following line:
 #
 #   include RELEASE-VERSION
+from __future__ import print_function
 
 __all__ = ("get_git_version")
 
@@ -101,4 +102,4 @@ def get_git_version(abbrev=4):
 
 
 if __name__ == "__main__":
-    print get_git_version()
+    print(get_git_version())