From 2518a6bb9a003482c7b80b0fb2202a4f33c45509 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Mon, 6 Apr 2015 14:50:03 -0700 Subject: [PATCH] convert several not covered by unit-test modules to use print function --- htsworkflow/automation/runner.py | 4 ++-- htsworkflow/pipelines/configure_run.py | 14 ++++++++------ htsworkflow/pipelines/fastq.py | 4 +++- htsworkflow/pipelines/run_status.py | 17 +++++++++-------- htsworkflow/submission/geo.py | 4 +++- htsworkflow/submission/trackhub_submission.py | 3 ++- test/tree.py | 4 ++-- version.py | 3 ++- 8 files changed, 31 insertions(+), 22 deletions(-) diff --git a/htsworkflow/automation/runner.py b/htsworkflow/automation/runner.py index 7b0c4c9..073a6e7 100644 --- a/htsworkflow/automation/runner.py +++ b/htsworkflow/automation/runner.py @@ -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:])) - diff --git a/htsworkflow/pipelines/configure_run.py b/htsworkflow/pipelines/configure_run.py index d0d43d2..324f53b 100644 --- a/htsworkflow/pipelines/configure_run.py +++ b/htsworkflow/pipelines/configure_run.py @@ -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 diff --git a/htsworkflow/pipelines/fastq.py b/htsworkflow/pipelines/fastq.py index 47b2f83..fce8993 100644 --- a/htsworkflow/pipelines/fastq.py +++ b/htsworkflow/pipelines/fastq.py @@ -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)) diff --git a/htsworkflow/pipelines/run_status.py b/htsworkflow/pipelines/run_status.py index e6a3ed8..46e4007 100644 --- a/htsworkflow/pipelines/run_status.py +++ b/htsworkflow/pipelines/run_status.py @@ -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:])) - diff --git a/htsworkflow/submission/geo.py b/htsworkflow/submission/geo.py index 1d98bd5..15d5b74 100644 --- a/htsworkflow/submission/geo.py +++ b/htsworkflow/submission/geo.py @@ -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( diff --git a/htsworkflow/submission/trackhub_submission.py b/htsworkflow/submission/trackhub_submission.py index 3aa4a96..c771b16 100644 --- a/htsworkflow/submission/trackhub_submission.py +++ b/htsworkflow/submission/trackhub_submission.py @@ -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 diff --git a/test/tree.py b/test/tree.py index 4f666cc..37d3fd4 100644 --- a/test/tree.py +++ b/test/tree.py @@ -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 diff --git a/version.py b/version.py index b850b4a..4856928 100644 --- a/version.py +++ b/version.py @@ -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()) -- 2.30.2