Initial port to python3
[htsworkflow.git] / htsworkflow / submission / submission.py
index 12a5154c33a01bf15d1349040e7bfd2f71f51df8..cd2a8df03629296cc2db17dd582a8f072121db04 100644 (file)
@@ -37,11 +37,11 @@ class Submission(object):
     def scan_submission_dirs(self, result_map):
         """Examine files in our result directory
         """
-        for lib_id, result_dir in result_map.items():
+        for lib_id, result_dir in list(result_map.items()):
             LOGGER.info("Importing %s from %s" % (lib_id, result_dir))
             try:
                 self.import_analysis_dir(result_dir, lib_id)
-            except MetadataLookupException, e:
+            except MetadataLookupException as e:
                 LOGGER.error("Skipping %s: %s" % (lib_id, str(e)))
 
     def import_analysis_dir(self, analysis_dir, library_id):
@@ -60,7 +60,7 @@ class Submission(object):
     def analysis_nodes(self, result_map):
         """Return an iterable of analysis nodes
         """
-        for result_dir in result_map.values():
+        for result_dir in list(result_map.values()):
             an_analysis = self.get_submission_node(result_dir)
             yield an_analysis
 
@@ -224,7 +224,7 @@ class Submission(object):
             LOGGER.debug("Importing %s" % (lane.uri,))
             try:
                 parser.parse_into_model(self.model, lane.uri)
-            except RDF.RedlandError, e:
+            except RDF.RedlandError as e:
                 LOGGER.error("Error accessing %s" % (lane.uri,))
                 raise e
 
@@ -236,7 +236,7 @@ class Submission(object):
             self.__view_map = self._get_filename_view_map()
 
         results = []
-        for pattern, view in self.__view_map.items():
+        for pattern, view in list(self.__view_map.items()):
             if re.match(pattern, filename):
                 results.append(view)
 
@@ -265,7 +265,7 @@ class Submission(object):
             LOGGER.debug("Found: %s" % (literal_re,))
             try:
                 filename_re = re.compile(literal_re)
-            except re.error, e:
+            except re.error as e:
                 LOGGER.error("Unable to compile: %s" % (literal_re,))
             patterns[literal_re] = view_name
         return patterns
@@ -349,7 +349,7 @@ class Submission(object):
         results = []
         for record in rdfstream:
             d = {}
-            for key, value in record.items():
+            for key, value in list(record.items()):
                 d[key] = fromTypedNode(value)
             results.append(d)
         return results