convert to unicode_literals
authorDiane Trout <diane@ghic.org>
Tue, 3 Feb 2015 00:24:18 +0000 (16:24 -0800)
committerDiane Trout <diane@ghic.org>
Tue, 3 Feb 2015 00:24:18 +0000 (16:24 -0800)
convert all the string handling to unicode.
to make the RDF stuff work I needed to mark those strings
as byte arrays

47 files changed:
bcmagic/admin.py
bcmagic/forms.py
bcmagic/models.py
bcmagic/plugin.py
bcmagic/urls.py
bcmagic/utils.py
bcmagic/views.py
eland_config/admin.py
eland_config/forms.py
eland_config/models.py
eland_config/urls.py
eland_config/views.py
experiments/admin.py
experiments/experiments.py
experiments/experiments_factory.py
experiments/models.py
experiments/test/test_cluster_station.py
experiments/test/test_filetype.py
experiments/test/test_sequencer.py
experiments/test_experiments.py
experiments/urls.py
experiments/views.py
htsworkflow/pipelines/bustard.py
htsworkflow/pipelines/gerald.py
htsworkflow/pipelines/summary.py
htsworkflow/util/conversion.py
htsworkflow/util/rdfhelp.py
inventory/admin.py
inventory/bcmagic.py
inventory/inventory_factory.py
inventory/models.py
inventory/test_inventory.py
inventory/urls.py
inventory/views.py
labels/admin.py
labels/models.py
labels/test_labels.py
labels/views.py
samples/admin.py
samples/auth_backend.py
samples/changelist.py
samples/models.py
samples/results.py
samples/samples_factory.py
samples/test_samples.py
samples/urls.py
samples/views.py

index bb1d1d0381e80c718d57f9acecb2ec6562c5f057..a70dad82fe862e7bd80e8199259a8486cca613ea 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.contrib import admin
 from .models import KeywordMap, Printer
 
 from django.contrib import admin
 from .models import KeywordMap, Printer
 
index 000acd955651d084c0a22da05d5f1eb092072160..c80a44f49e3e0c59a04422ae380ad44a265b6e1a 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django import forms
 
 class BarcodeMagicForm(forms.Form):
 from django import forms
 
 class BarcodeMagicForm(forms.Form):
index 4db58a3ddd8e5b27bfcc539cae7fd12fa92a4f74..c91905b7259277d2728e61eb6cb010d2fbc070ee 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.db import models
 
 #FIXME: Should be made more generic and probably pre-populated supported list
 from django.db import models
 
 #FIXME: Should be made more generic and probably pre-populated supported list
@@ -27,5 +29,5 @@ class Printer(models.Model):
     label_height = models.FloatField(help_text='height in inches')
     notes = models.TextField()
 
     label_height = models.FloatField(help_text='height in inches')
     notes = models.TextField()
 
-    def __unicode__(self):
-        return u'%s, %s, %s, %s, %sx%s' % (self.name, self.model, self.ip_address, self.label_shape, self.label_width, self.label_width)
\ No newline at end of file
+    def __str__(self):
+        return '%s, %s, %s, %s, %sx%s' % (self.name, self.model, self.ip_address, self.label_shape, self.label_width, self.label_width)
index 12de8d23d575f1d7721b369ba03cc819764bcb75..09a1f8ad022e70c53b734d3f32e305a9d6cd3e66 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 BCM_PLUGINS = {
     #'cmd_move_sample': bcm_cmds.cmd_move_sample
 }
 BCM_PLUGINS = {
     #'cmd_move_sample': bcm_cmds.cmd_move_sample
 }
index 9133391538c3521a44e9ccbdd4ae820d4e3294ee..478e3c848db721014a2fde2b85d9e239abc7066c 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
index 9374e4ae4dfa69940065ed8ac20d37fa3c098a1e..a7982003d44477aba87a3ef961331ef0af5e3d1c 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf import settings
 
 import ftplib
 from django.conf import settings
 
 import ftplib
index 3d9206fec91e52321043f649cfb9937481f0a07e..4efbcaa7503460420b742396fcaa31922f6fed12 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.http import HttpResponse
 from django.template import RequestContext, Template, Context
 from django.shortcuts import render_to_response
 from django.http import HttpResponse
 from django.template import RequestContext, Template, Context
 from django.shortcuts import render_to_response
index 56107ffcca778463f0d86da98acc48d8aa5470a8..895ecb1431a0eae202a0506b49ae5b58247c3284 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.contrib import admin
 from django.utils.translation import ugettext_lazy as _
 
 from django.contrib import admin
 from django.utils.translation import ugettext_lazy as _
 
index a2245f9f35548fe8f231f30cfd7505e18230ea9f..c24bb624d1ca4b335c3781db37051113066ff4d3 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django import forms
 from django.forms.util import ErrorList
 
 from django import forms
 from django.forms.util import ErrorList
 
index 71a836239075aa6e6e4ecb700e9c42c95c022d91..bd4b2abe9e8520ac85fee31e2fd7ed02997b4eaa 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.db import models
 
 # Create your models here.
 from django.db import models
 
 # Create your models here.
index eff1477fa2c1eb308bd4a12ba3ab00c6875653f7..38a2cc39574fb4e4514b826dddf463cdd2572fbd 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf.urls import patterns, url
 
 urlpatterns = patterns('',
 from django.conf.urls import patterns, url
 
 urlpatterns = patterns('',
index f4d765e807fad5166b9822d464313376c0c2d7ef..db307411e7141eadd740894ae437738671e4745e 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.conf import settings
 from django.http import HttpResponse
 
 from django.conf import settings
 from django.http import HttpResponse
index 4ae00607a4d742720682abbb3f24f71cf62ac2e1..b8fff8ac8cd62979d13a1df08d96bc2a589176e9 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from itertools import chain
 
 
 from itertools import chain
 
@@ -185,8 +185,8 @@ class SequencerSelect(Select):
 
 
     def render_option(self, selected_choices, option_value, option_label):
 
 
     def render_option(self, selected_choices, option_value, option_label):
-        disabled_sequencers = [ unicode(s.id) for s in self.queryset.filter(active=False) ]
-        option_value = unicode(option_value)
+        disabled_sequencers = [ str(s.id) for s in self.queryset.filter(active=False) ]
+        option_value = str(option_value)
         selected_html = (option_value in selected_choices) and u' selected="selected"' or ''
         cssclass = "strikeout" if option_value in disabled_sequencers else ''
         return u'<option class="%s" value="%s"%s>%s</option>' % (
         selected_html = (option_value in selected_choices) and u' selected="selected"' or ''
         cssclass = "strikeout" if option_value in disabled_sequencers else ''
         return u'<option class="%s" value="%s"%s>%s</option>' % (
index 8738224d547ea47693902a2f48bf25c7affd526f..e9d12dee03bfc00aff72566b8ba6794ca433f54d 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 # some core functions of the exp tracker module
 from datetime import datetime, timedelta
 
 # some core functions of the exp tracker module
 from datetime import datetime, timedelta
@@ -43,7 +43,7 @@ def flowcell_information(flowcell_id):
             'library_name': lane.library.library_name,
             'library_id': lane.library.id,
             'library_species': lane.library.library_species.scientific_name,
             'library_name': lane.library.library_name,
             'library_id': lane.library.id,
             'library_species': lane.library.library_species.scientific_name,
-            'pM': unicode(lane.pM),
+            'pM': str(lane.pM),
             'read_length': lane.flowcell.read_length,
             'status_code': lane.status,
             'status': LANE_STATUS_MAP[lane.status]
             'read_length': lane.flowcell.read_length,
             'status_code': lane.status,
             'status': LANE_STATUS_MAP[lane.status]
index 1e344b3b86293d52d16fca625fad6f0402e69a31..34e9d5f1d90de80042056c7bd22854cbf3524d13 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import datetime
 
 import factory
 import datetime
 
 import factory
index 3377e28c38c95354d0e7aa972456fbb1070dd135..6e1fe27678ebee218a7bfda5b7f29e54c28c937c 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import datetime
 import glob
 
 import datetime
 import glob
@@ -58,8 +58,8 @@ class ClusterStation(models.Model):
     class Meta:
         ordering = ["-isdefault", "name"]
 
     class Meta:
         ordering = ["-isdefault", "name"]
 
-    def __unicode__(self):
-        return unicode(self.name)
+    def __str__(self):
+        return str(self.name)
 
     @staticmethod
     def update_isdefault(sender, instance, **kwargs):
 
     @staticmethod
     def update_isdefault(sender, instance, **kwargs):
@@ -96,10 +96,10 @@ class Sequencer(models.Model):
     class Meta:
         ordering = ["-isdefault", "-active", "name"]
 
     class Meta:
         ordering = ["-isdefault", "-active", "name"]
 
-    def __unicode__(self):
-        name = [unicode(self.name)]
+    def __str__(self):
+        name = [str(self.name)]
         if self.instrument_name is not None:
         if self.instrument_name is not None:
-            name.append("(%s)" % (unicode(self.instrument_name),))
+            name.append("(%s)" % (str(self.instrument_name),))
         return " ".join(name)
 
     @models.permalink
         return " ".join(name)
 
     @models.permalink
@@ -152,8 +152,8 @@ class FlowCell(models.Model):
 
     notes = models.TextField(blank=True)
 
 
     notes = models.TextField(blank=True)
 
-    def __unicode__(self):
-        return unicode(self.flowcell_id)
+    def __str__(self):
+        return str(self.flowcell_id)
 
     def Lanes(self):
         html = ['<table>']
 
     def Lanes(self):
         html = ['<table>']
@@ -187,9 +187,9 @@ class FlowCell(models.Model):
         """Convert our boolean 'is paired' flag to a name
         """
         if self.paired_end:
         """Convert our boolean 'is paired' flag to a name
         """
         if self.paired_end:
-            return u"Paired"
+            return "Paired"
         else:
         else:
-            return u"Single"
+            return "Single"
 
     @models.permalink
     def get_absolute_url(self):
 
     @models.permalink
     def get_absolute_url(self):
@@ -309,8 +309,8 @@ class Lane(models.Model):
         return ('experiments.views.flowcell_lane_detail',
                 [str(self.id)])
 
         return ('experiments.views.flowcell_lane_detail',
                 [str(self.id)])
 
-    def __unicode__(self):
-        return self.flowcell.flowcell_id + ':' + unicode(self.lane_number)
+    def __str__(self):
+        return self.flowcell.flowcell_id + ':' + str(self.lane_number)
 
 
 class DataRun(models.Model):
 
 
 class DataRun(models.Model):
@@ -423,8 +423,8 @@ class FileType(models.Model):
         return self.name.replace(' ', '_').lower()
     normalized_name = property(_get_normalized_name)
 
         return self.name.replace(' ', '_').lower()
     normalized_name = property(_get_normalized_name)
 
-    def __unicode__(self):
-        #return u"<FileType: %s>" % (self.name,)
+    def __str__(self):
+        #return "<FileType: %s>" % (self.name,)
         return self.name
 
 
         return self.name
 
 
index 965faa92765f04f89c75614b6cf040a206a6347b..9bd53197f74225083de54236dad8d2bd3406ad00 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.test import TestCase
 from ..models import ClusterStation, cluster_station_default
 
 from django.test import TestCase
 from ..models import ClusterStation, cluster_station_default
index fdef8bfffc0cba0d82dc7859a4fe849d6d0290a5..cb89087a797b7ef87fe9ddb8ba71cb471de5ce65 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.test import TestCase
 
 
 from django.test import TestCase
 
@@ -9,8 +9,8 @@ class TestFileType(TestCase):
         file_type_objects = FileType.objects
         name = 'QSEQ tarfile'
         file_type_object = file_type_objects.get(name=name)
         file_type_objects = FileType.objects
         name = 'QSEQ tarfile'
         file_type_object = file_type_objects.get(name=name)
-        self.assertEqual(u"QSEQ tarfile",
-                             unicode(file_type_object))
+        self.assertEqual("QSEQ tarfile",
+                         str(file_type_object))
 
     def test_find_file_type(self):
         file_type_objects = FileType.objects
 
     def test_find_file_type(self):
         file_type_objects = FileType.objects
index 0de4f5a4cdf8858e1bb05b163bff14f35f9cf1b8..c3d4a32fd396c4b65e082d657d28950c8a4f2856 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.test import TestCase
 from ..models import Sequencer, sequencer_default
 
 from django.test import TestCase
 from ..models import Sequencer, sequencer_default
index 7c5d20127243c8aa79e8232a949aa7279cbfa7d7..99079f3cce9edd776d417489a192369a826a34d2 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import re
 from lxml.html import fromstring
 
 import re
 from lxml.html import fromstring
index 8330d91f12c6b5fdf3f8394b1ef6e8be1deac940..0b1722ec1a43df24d2b1626885867b161ab508a6 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
index 294aff27a7ee41e664d4d6a86be047761606a38b..e5f675da42454868a24197a5f9109a6c4e1ede77 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 # Create your views here.
 from datetime import datetime
 
 # Create your views here.
 from datetime import datetime
index 68ecc75c1fcbc9c6c969032cdef3995c1a99a3f0..e56659f6c39975e011695d92813ec468dad5c36a 100644 (file)
@@ -4,7 +4,7 @@ Extract configuration from Illumina Bustard Directory.
 This includes the version number, run date, bustard executable parameters, and
 phasing estimates.
 """
 This includes the version number, run date, bustard executable parameters, and
 phasing estimates.
 """
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
 
 from copy import copy
 from datetime import date
 
 from copy import copy
 from datetime import date
@@ -113,7 +113,7 @@ class CrosstalkMatrix(object):
         for b in base_order:
             for value in self.base[b]:
                 crosstalk_value = ElementTree.SubElement(root, CrosstalkMatrix.ELEMENT)
         for b in base_order:
             for value in self.base[b]:
                 crosstalk_value = ElementTree.SubElement(root, CrosstalkMatrix.ELEMENT)
-                crosstalk_value.text = unicode(value)
+                crosstalk_value.text = str(value)
                 crosstalk_value.tail = os.linesep
 
         return root
                 crosstalk_value.tail = os.linesep
 
         return root
@@ -458,7 +458,7 @@ def main(cmdline):
     opts, args = parser.parse_args(cmdline)
 
     for bustard_dir in args:
     opts, args = parser.parse_args(cmdline)
 
     for bustard_dir in args:
-        print(u'analyzing bustard directory: ' + unicode(bustard_dir))
+        print(u'analyzing bustard directory: ' + str(bustard_dir))
         bustard_object = bustard(bustard_dir)
         bustard_object.dump()
 
         bustard_object = bustard(bustard_dir)
         bustard_object.dump()
 
index b795b141ca736fa40ee815f4eb9cff1744f70d4f..e69a330248ab16b445140c7c920ff1e5f9b7821e 100644 (file)
@@ -1,6 +1,6 @@
 """Provide access to information stored in the GERALD directory.
 """
 """Provide access to information stored in the GERALD directory.
 """
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
 
 import collections
 from datetime import datetime, date
 
 import collections
 from datetime import datetime, date
@@ -72,7 +72,7 @@ class Alignment(object):
             return None
 
         gerald = ElementTree.Element(root_tag,
             return None
 
         gerald = ElementTree.Element(root_tag,
-                                     {'version': unicode(Gerald.XML_VERSION)})
+                                     {'version': str(Gerald.XML_VERSION)})
         gerald.append(self.tree)
         gerald.append(self.summary.get_elements())
         if self.eland_results:
         gerald.append(self.tree)
         gerald.append(self.summary.get_elements())
         if self.eland_results:
index 8f454e6dbee1c8a804d7950c4c337a437dca3deb..d7081ecce3d1d039ef62459fc773b6bff0823f61 100644 (file)
@@ -1,7 +1,7 @@
 """
 Analyze the Summary.htm file produced by GERALD
 """
 """
 Analyze the Summary.htm file produced by GERALD
 """
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
 
 import os
 import logging
 
 import os
 import logging
@@ -42,7 +42,7 @@ class Summary(object):
 
     def get_elements(self):
         summary = etree.Element(Summary.SUMMARY,
 
     def get_elements(self):
         summary = etree.Element(Summary.SUMMARY,
-                                      {'version': unicode(Summary.XML_VERSION)})
+                                      {'version': str(Summary.XML_VERSION)})
         for end in self.lane_results:
             for lane in end.values():
                 summary.append(lane.get_elements())
         for end in self.lane_results:
             for lane in end.values():
                 summary.append(lane.get_elements())
@@ -282,7 +282,7 @@ class LaneResultSummary(object):
     def get_elements(self):
         lane_result = etree.Element(
                         LaneResultSummary.LANE_RESULT_SUMMARY,
     def get_elements(self):
         lane_result = etree.Element(
                         LaneResultSummary.LANE_RESULT_SUMMARY,
-                        {'lane': unicode(self.lane), 'end': unicode(self.end)})
+                        {'lane': str(self.lane), 'end': str(self.end)})
         for tag, variable_name in LaneResultSummary.TAGS.items():
             value = getattr(self, variable_name)
             if value is None:
         for tag, variable_name in LaneResultSummary.TAGS.items():
             value = getattr(self, variable_name)
             if value is None:
@@ -296,7 +296,7 @@ class LaneResultSummary(object):
                 )
             else:
                 element = etree.SubElement(lane_result, tag)
                 )
             else:
                 element = etree.SubElement(lane_result, tag)
-                element.text = unicode(value)
+                element.text = str(value)
         return lane_result
 
     def set_elements(self, tree):
         return lane_result
 
     def set_elements(self, tree):
index d3eb4f6cc5dad43f619ca8db662ed6abbcc402a2..f294e6ff2533c404887de3d66644bd024c64e8b2 100644 (file)
@@ -1,15 +1,16 @@
 """
 Miscellaneous, more refined type casting functions
 """
 """
 Miscellaneous, more refined type casting functions
 """
+from __future__ import unicode_literals
 
 
-def unicode_or_none(value):
+def str_or_none(value):
     """
     """
-    Convert value to unicode if its not none.
+    Convert value to unicode string if its not none.
     """
     if value is None:
         return None
     else:
     """
     if value is None:
         return None
     else:
-        return unicode(value)
+        return str(value)
 
 def parse_flowcell_id(flowcell_id):
     """
 
 def parse_flowcell_id(flowcell_id):
     """
index 89db4832dd4d4a516d13e2fa2dc012fded964b32..33197ddb9631f4f07cfb6114bea4a3516a034ed0 100644 (file)
@@ -295,7 +295,7 @@ def load_string_into_model(model, parser_name, data, ns=None):
     ns = fixup_namespace(ns)
     logger.debug("load_string_into_model parser={0}, len={1}".format(
         parser_name, len(data)))
     ns = fixup_namespace(ns)
     logger.debug("load_string_into_model parser={0}, len={1}".format(
         parser_name, len(data)))
-    rdf_parser = RDF.Parser(name=parser_name)
+    rdf_parser = RDF.Parser(name=str(parser_name))
 
     for s in rdf_parser.parse_string_as_stream(data, ns):
         conditionally_add_statement(model, s, ns)
 
     for s in rdf_parser.parse_string_as_stream(data, ns):
         conditionally_add_statement(model, s, ns)
index b418f997ed2f00855bd2376ec2ed221c635d6e04..5c17d3d35a3d5e6d8dc92916beb72566f6022ec6 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.contrib import admin
 
 
 from django.contrib import admin
 
index a3cb409ca429ff6166a04affe0bc3b775401bc5b..703c0973b39729233e93aa6f52623f10f7319347 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from .models import Item
 
 
 from .models import Item
 
index 1698f279825554dc31ff62d3661c3c9660590bf5..e75ea415ddd25a63a360381705a5ccfb91fc5712 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import datetime
 
 
 import datetime
 
index 1e8509600336bb38a8797fbf097e431b48f13ffc..7e5c2390777565d83a9c288f3259893de7fadbb0 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import logging
 
 
 import logging
 
@@ -48,8 +48,8 @@ class Vendor(models.Model):
     name = models.CharField(max_length=256)
     url = models.URLField(blank=True, null=True)
 
     name = models.CharField(max_length=256)
     url = models.URLField(blank=True, null=True)
 
-    def __unicode__(self):
-        return u"%s" % (self.name)
+    def __str__(self):
+        return "%s" % (self.name)
 
 
 class Location(models.Model):
 
 
 class Location(models.Model):
@@ -64,11 +64,11 @@ class Location(models.Model):
 
     notes = models.TextField(blank=True, null=True)
 
 
     notes = models.TextField(blank=True, null=True)
 
-    def __unicode__(self):
+    def __str__(self):
         if len(self.location_description) > 16:
         if len(self.location_description) > 16:
-            return u"%s: %s" % (self.name, self.location_description[0:16]+u"...")
+            return "%s: %s" % (self.name, self.location_description[0:16]+"...")
         else:
         else:
-            return u"%s: %s" % (self.name, self.location_description)
+            return "%s: %s" % (self.name, self.location_description)
 
 post_init.connect(_assign_uuid, sender=Location)
 
 
 post_init.connect(_assign_uuid, sender=Location)
 
@@ -88,16 +88,16 @@ class ItemInfo(models.Model):
 
     notes = models.TextField(blank=True, null=True)
 
 
     notes = models.TextField(blank=True, null=True)
 
-    def __unicode__(self):
+    def __str__(self):
         name = u''
         if self.model_id:
         name = u''
         if self.model_id:
-            name += u"model:%s " % (self.model_id)
+            name += "model:%s " % (self.model_id)
         if self.part_number:
         if self.part_number:
-            name += u"part:%s " % (self.part_number)
+            name += "part:%s " % (self.part_number)
         if self.lot_number:
         if self.lot_number:
-            name += u"lot:%s " % (self.lot_number)
+            name += "lot:%s " % (self.lot_number)
 
 
-        return u"%s: %s" % (name, self.purchase_date)
+        return "%s: %s" % (name, self.purchase_date)
 
     class Meta:
         verbose_name_plural = "Item Info"
 
     class Meta:
         verbose_name_plural = "Item Info"
@@ -108,15 +108,15 @@ class ItemType(models.Model):
     name = models.CharField(max_length=64, unique=True)
     description = models.TextField(blank=True, null=True)
 
     name = models.CharField(max_length=64, unique=True)
     description = models.TextField(blank=True, null=True)
 
-    def __unicode__(self):
-        return u"%s" % (self.name)
+    def __str__(self):
+        return "%s" % (self.name)
 
 
 class ItemStatus(models.Model):
     name = models.CharField(max_length=64, unique=True)
     notes = models.TextField(blank=True, null=True)
 
 
 
 class ItemStatus(models.Model):
     name = models.CharField(max_length=64, unique=True)
     notes = models.TextField(blank=True, null=True)
 
-    def __unicode__(self):
+    def __str__(self):
         return self.name
 
     class Meta:
         return self.name
 
     class Meta:
@@ -149,11 +149,11 @@ class Item(models.Model):
 
     notes = models.TextField(blank=True, null=True)
 
 
     notes = models.TextField(blank=True, null=True)
 
-    def __unicode__(self):
+    def __str__(self):
         if self.barcode_id is None or len(self.barcode_id) == 0:
         if self.barcode_id is None or len(self.barcode_id) == 0:
-            return u"invu|%s" % (self.uuid)
+            return "invu|%s" % (self.uuid)
         else:
         else:
-            return u"invb|%s" % (self.barcode_id)
+            return "invb|%s" % (self.barcode_id)
 
     def get_absolute_url(self):
         return '/inventory/%s/' % (self.uuid)
 
     def get_absolute_url(self):
         return '/inventory/%s/' % (self.uuid)
@@ -172,7 +172,7 @@ class PrinterTemplate(models.Model):
 
     template = models.TextField()
 
 
     template = models.TextField()
 
-    def __unicode__(self):
+    def __str__(self):
         if self.default:
             return u'%s %s' % (self.item_type.name, self.printer.name)
         else:
         if self.default:
             return u'%s %s' % (self.item_type.name, self.printer.name)
         else:
@@ -190,8 +190,8 @@ class LongTermStorage(models.Model):
     creation_date = models.DateTimeField(auto_now_add=True)
     modified_date = models.DateTimeField(auto_now=True)
 
     creation_date = models.DateTimeField(auto_now_add=True)
     modified_date = models.DateTimeField(auto_now=True)
 
-    def __unicode__(self):
-        return u"%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.storage_devices.iterator()]))
+    def __str__(self):
+        return "%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.storage_devices.iterator()]))
 
     class Meta:
         verbose_name_plural = "Long Term Storage"
 
     class Meta:
         verbose_name_plural = "Long Term Storage"
@@ -213,8 +213,8 @@ class ReagentFlowcell(ReagentBase):
     """
     flowcell = models.ForeignKey(FlowCell)
 
     """
     flowcell = models.ForeignKey(FlowCell)
 
-    def __unicode__(self):
-        return u"%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.reagent.iterator()]))
+    def __str__(self):
+        return "%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.reagent.iterator()]))
 
 
 class ReagentLibrary(ReagentBase):
 
 
 class ReagentLibrary(ReagentBase):
@@ -223,5 +223,5 @@ class ReagentLibrary(ReagentBase):
     """
     library = models.ForeignKey(Library)
 
     """
     library = models.ForeignKey(Library)
 
-    def __unicode__(self):
-        return u"%s: %s" % (str(self.library), ', '.join([str(s) for s in self.reagent.iterator()]))
+    def __str__(self):
+        return "%s: %s" % (str(self.library), ', '.join([str(s) for s in self.reagent.iterator()]))
index b30da8c757ebfb5603cf442ad0ec6c0270afc4e4..6a5c59552e1c92ebcf3f833ed21e30379064d512 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import RDF
 
 
 import RDF
 
@@ -41,7 +41,7 @@ class InventoryTestCase(TestCase):
 
         itemNode = RDF.Node(RDF.Uri(url))
         item_type = fromTypedNode(
 
         itemNode = RDF.Node(RDF.Uri(url))
         item_type = fromTypedNode(
-            model.get_target(itemNode, inventoryOntology['item_type']))
+            model.get_target(itemNode, inventoryOntology[b'item_type']))
         self.failUnlessEqual(item_type, item.item_type.name)
 
     def test_itemindex(self):
         self.failUnlessEqual(item_type, item.item_type.name)
 
     def test_itemindex(self):
index ff71a6bc9534183edaf16ee052237e6077658031..98ece191231dd9b48d48ae0ea770c9aa34b7e614 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
 from django.conf.urls import patterns
 
 urlpatterns = patterns('',
index 149710ff22466df20da3905a2ccb12180113f434..23b720017cf4b73b5cb60ccbc004f2ca3e784312 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.conf import settings
 from django.contrib.auth.decorators import login_required
 
 from django.conf import settings
 from django.contrib.auth.decorators import login_required
index 3ae391ec64e43a3a4be76810e3875064f39cd0aa..d2c7fcf07e024d18cc858669e693b62701c050c5 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.template import Context, Template
 from django.contrib import admin
 
 from django.template import Context, Template
 from django.contrib import admin
 
index 8794492d0e5dab2b85f92ea58d656d65474f32e7..fa5920bb5a10ebe26c12966b6c453524aff09704 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.db import models
 
 class LabelPrinter(models.Model):
 from django.db import models
 
 class LabelPrinter(models.Model):
@@ -10,8 +12,8 @@ class LabelPrinter(models.Model):
     labels = models.CharField(max_length=200)
     notes = models.TextField(null=True, blank=True)
 
     labels = models.CharField(max_length=200)
     notes = models.TextField(null=True, blank=True)
 
-    def __unicode__(self):
-        return u'%s: %s' % (self.name, self.labels)
+    def __str__(self):
+        return '%s: %s' % (self.name, self.labels)
 
 class LabelTemplate(models.Model):
     """
 
 class LabelTemplate(models.Model):
     """
@@ -23,7 +25,7 @@ class LabelTemplate(models.Model):
     
     ZPL_code = models.TextField('template')
     
     
     ZPL_code = models.TextField('template')
     
-    def __unicode__(self):
+    def __str__(self):
             return '%s %s' % (self.name, self.printer.name)
 
 class LabelContent(models.Model):
             return '%s %s' % (self.name, self.printer.name)
 
 class LabelContent(models.Model):
index ca3633bb6d2c73635640d8dca26ef16f3fc9999b..b09de7a301caeacc8b66aee9b01d45c4ff1b5bf0 100644 (file)
@@ -4,6 +4,7 @@ unittest). These will both pass when you run "manage.py test".
 
 Replace these with more appropriate tests for your application.
 """
 
 Replace these with more appropriate tests for your application.
 """
+from __future__ import unicode_literals
 
 from django.test import TestCase
 
 
 from django.test import TestCase
 
index 60f00ef0ef347811e7b0c0921b7fda097acd9fcc..6f984966c521f47889eb0e3c9143b3d3899906a0 100644 (file)
@@ -1 +1,2 @@
+from __future__ import unicode_literals
 # Create your views here.
 # Create your views here.
index 5b9b858b1cb52297a9c70cdb5b6243f031516175..69fe059db1931231b7e34cf06e47385fe3caf8f4 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.contrib import admin
 from django.contrib.admin import widgets
 
 from django.contrib import admin
 from django.contrib.admin import widgets
index aacf43b3d3a7b52b5af36983117a0995554ac6e1..18fbe5c61fd19c7850db91bb4f0feb1ce1c3236a 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 from django.conf import settings
 from django.contrib.auth.backends import ModelBackend
 
 from django.conf import settings
 from django.contrib.auth.backends import ModelBackend
index 716713aa0d4042961b4dc22f585000c153c35213..842eb0adc04c8cfc51ccdc020de7ded052888895 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import django
 from django.contrib.admin.views.main import ChangeList
 
 import django
 from django.contrib.admin.views.main import ChangeList
index 5cf2e9097ee1693ddcb15b0306b0ed33ed654bb8..94cd075bd641b2ad949b080a253289e31549236d 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import types
 import logging
 from django.db import models
 import types
 import logging
 from django.db import models
@@ -24,8 +26,8 @@ class Antibody(models.Model):
     source = models.CharField(max_length=500, blank=True, null=True, db_index=True)
     biology = models.TextField(blank=True, null=True)
     notes = models.TextField(blank=True, null=True)
     source = models.CharField(max_length=500, blank=True, null=True, db_index=True)
     biology = models.TextField(blank=True, null=True)
     notes = models.TextField(blank=True, null=True)
-    def __unicode__(self):
-        return u'%s - %s' % (self.antigene, self.antibodies)
+    def __str__(self):
+        return '%s - %s' % (self.antigene, self.antibodies)
     class Meta:
         verbose_name_plural = "antibodies"
         ordering = ["antigene"]
     class Meta:
         verbose_name_plural = "antibodies"
         ordering = ["antigene"]
@@ -38,8 +40,8 @@ class Cellline(models.Model):
         db_index=True)
 
     notes = models.TextField(blank=True)
         db_index=True)
 
     notes = models.TextField(blank=True)
-    def __unicode__(self):
-        return unicode(self.cellline_name)
+    def __str__(self):
+        return str(self.cellline_name)
 
     class Meta:
         ordering = ["cellline_name"]
 
     class Meta:
         ordering = ["cellline_name"]
@@ -54,8 +56,8 @@ class Condition(models.Model):
         verbose_name = 'Short Name')
     notes = models.TextField(blank=True)
 
         verbose_name = 'Short Name')
     notes = models.TextField(blank=True)
 
-    def __unicode__(self):
-        return unicode(self.condition_name)
+    def __str__(self):
+        return str(self.condition_name)
 
     class Meta:
         ordering = ["condition_name"]
 
     class Meta:
         ordering = ["condition_name"]
@@ -64,8 +66,8 @@ class Condition(models.Model):
 class ExperimentType(models.Model):
   name = models.CharField(max_length=50, unique=True)
 
 class ExperimentType(models.Model):
   name = models.CharField(max_length=50, unique=True)
 
-  def __unicode__(self):
-    return unicode(self.name)
+  def __str__(self):
+    return str(self.name)
 
 class Tag(models.Model):
   tag_name = models.CharField(max_length=100, db_index=True,blank=False,null=False)
 
 class Tag(models.Model):
   tag_name = models.CharField(max_length=100, db_index=True,blank=False,null=False)
@@ -79,8 +81,8 @@ class Tag(models.Model):
   context = models.CharField(max_length=50,
       choices=TAG_CONTEXT, default='Library')
 
   context = models.CharField(max_length=50,
       choices=TAG_CONTEXT, default='Library')
 
-  def __unicode__(self):
-    return u'%s' % (self.tag_name)
+  def __str__(self):
+    return '%s' % (self.tag_name)
 
   class Meta:
     ordering = ["context","tag_name"]
 
   class Meta:
     ordering = ["context","tag_name"]
@@ -93,8 +95,8 @@ class Species(models.Model):
   common_name = models.CharField(max_length=256, blank=True)
   #use_genome_build = models.CharField(max_length=100, blank=False, null=False)
 
   common_name = models.CharField(max_length=256, blank=True)
   #use_genome_build = models.CharField(max_length=100, blank=False, null=False)
 
-  def __unicode__(self):
-    return u'%s (%s)' % (self.scientific_name, self.common_name)
+  def __str__(self):
+    return '%s (%s)' % (self.scientific_name, self.common_name)
 
   class Meta:
     verbose_name_plural = "species"
 
   class Meta:
     verbose_name_plural = "species"
@@ -111,15 +113,15 @@ class Affiliation(models.Model):
   users = models.ManyToManyField('HTSUser', null=True, blank=True)
   users.admin_order_field = "username"
 
   users = models.ManyToManyField('HTSUser', null=True, blank=True)
   users.admin_order_field = "username"
 
-  def __unicode__(self):
-    str = unicode(self.name)
+  def __str__(self):
+    name = str(self.name)
     if self.contact is not None and len(self.contact) > 0:
     if self.contact is not None and len(self.contact) > 0:
-      str += u' ('+self.contact+u')'
-    return str
+      name += ' ('+self.contact+')'
+    return name
 
   def Users(self):
       users = self.users.all().order_by('username')
 
   def Users(self):
       users = self.users.all().order_by('username')
-      return ", ".join([unicode(a) for a in users ])
+      return ", ".join([str(a) for a in users ])
 
   class Meta:
     ordering = ["name","contact"]
 
   class Meta:
     ordering = ["name","contact"]
@@ -133,8 +135,8 @@ class LibraryType(models.Model):
   can_multiplex = models.BooleanField(default=True,
                     help_text="Does this adapter provide multiplexing?")
 
   can_multiplex = models.BooleanField(default=True,
                     help_text="Does this adapter provide multiplexing?")
 
-  def __unicode__(self):
-      return unicode(self.name)
+  def __str__(self):
+      return str(self.name)
 
   class Meta:
       ordering = ["-id"]
 
   class Meta:
       ordering = ["-id"]
@@ -201,7 +203,7 @@ class Library(models.Model):
 
   undiluted_concentration = models.DecimalField("Concentration",
       max_digits=5, decimal_places=2, blank=True, null=True,
 
   undiluted_concentration = models.DecimalField("Concentration",
       max_digits=5, decimal_places=2, blank=True, null=True,
-      help_text=u"Undiluted concentration (ng/\u00b5l)")
+      help_text = "Undiluted concentration (ng/\u00b5l)")
       # note \u00b5 is the micro symbol in unicode
   successful_pM = models.DecimalField(max_digits=9,
                                       decimal_places=1, blank=True, null=True)
       # note \u00b5 is the micro symbol in unicode
   successful_pM = models.DecimalField(max_digits=9,
                                       decimal_places=1, blank=True, null=True)
@@ -213,11 +215,11 @@ class Library(models.Model):
   bioanalyzer_summary = models.TextField(blank=True,default="")
   bioanalyzer_concentration = models.DecimalField(max_digits=5,
                                 decimal_places=2, blank=True, null=True,
   bioanalyzer_summary = models.TextField(blank=True,default="")
   bioanalyzer_concentration = models.DecimalField(max_digits=5,
                                 decimal_places=2, blank=True, null=True,
-                                help_text=u"(ng/\u00b5l)")
+                                help_text="(ng/\u00b5l)")
   bioanalyzer_image_url = models.URLField(blank=True,default="")
 
   bioanalyzer_image_url = models.URLField(blank=True,default="")
 
-  def __unicode__(self):
-    return u'#%s: %s' % (self.id, self.library_name)
+  def __str__(self):
+    return '#%s: %s' % (self.id, self.library_name)
 
   class Meta:
       verbose_name_plural = "libraries"
 
   class Meta:
       verbose_name_plural = "libraries"
@@ -292,7 +294,7 @@ class Library(models.Model):
     tstr = ''
     ar = []
     for t in affs:
     tstr = ''
     ar = []
     for t in affs:
-        ar.append(t.__unicode__())
+        ar.append(t.__str__())
     return '%s' % (", ".join(ar))
 
   def is_archived(self):
     return '%s' % (", ".join(ar))
 
   def is_archived(self):
@@ -317,8 +319,8 @@ class Library(models.Model):
     affs = self.tags.all().order_by('tag_name')
     ar = []
     for t in affs:
     affs = self.tags.all().order_by('tag_name')
     ar = []
     for t in affs:
-      ar.append(t.__unicode__())
-    return u'%s' % ( ", ".join(ar))
+      ar.append(t.__str__())
+    return '%s' % ( ", ".join(ar))
 
   def DataRun(self):
     str ='<a target=_self href="/admin/experiments/datarun/?q='+self.id+'" title="Check All Data Runs for This Specific Library ..." ">Data Run</a>'
 
   def DataRun(self):
     str ='<a target=_self href="/admin/experiments/datarun/?q='+self.id+'" title="Check All Data Runs for This Specific Library ..." ">Data Run</a>'
@@ -333,7 +335,7 @@ class Library(models.Model):
 
     # Check data sanity
     if res[2] != "OK":
 
     # Check data sanity
     if res[2] != "OK":
-      return u'<div style="border:solid red 2px">'+res[2]+'</div>'
+      return '<div style="border:solid red 2px">'+res[2]+'</div>'
 
     rc = "%1.2f" % (res[1]/1000000.0)
     # Color Scheme: green is more than 10M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds should be doubled
 
     rc = "%1.2f" % (res[1]/1000000.0)
     # Color Scheme: green is more than 10M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds should be doubled
@@ -352,7 +354,7 @@ class Library(models.Model):
            if res[1] > rc_thr[2]:
              bgcolor ='#ffcc33'  # Orange
       tstr = '<div style="background-color:'+bgcolor+';color:black">'
            if res[1] > rc_thr[2]:
              bgcolor ='#ffcc33'  # Orange
       tstr = '<div style="background-color:'+bgcolor+';color:black">'
-      tstr += res[0].__unicode__()+' Lanes, '+rc+' M Reads'
+      tstr += res[0].__str__()+' Lanes, '+rc+' M Reads'
       tstr += '</div>'
     else: tstr = 'not processed yet'
     return tstr
       tstr += '</div>'
     else: tstr = 'not processed yet'
     return tstr
@@ -384,9 +386,9 @@ class HTSUser(User):
     def admin_url(self):
         return '/admin/%s/%s/%d' % (self._meta.app_label, self._meta.module_name, self.id)
 
     def admin_url(self):
         return '/admin/%s/%s/%d' % (self._meta.app_label, self._meta.module_name, self.id)
 
-    def __unicode__(self):
-        #return unicode(self.username) + u" (" + unicode(self.get_full_name()) + u")"
-        return unicode(self.get_full_name()) + u' (' + unicode(self.username) + ')'
+    def __str__(self):
+        #return str(self.username) + " (" + str(self.get_full_name()) + u")"
+        return str(self.get_full_name()) + ' (' + str(self.username) + ')'
 
 def HTSUserInsertID(sender, instance, **kwargs):
     """
 
 def HTSUserInsertID(sender, instance, **kwargs):
     """
index 2724a378a3f6b50610a13325a92812df5252bc41..6949d4d269118c965785e87e4ee21155c9da9863 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf import settings
 
 import glob
 from django.conf import settings
 
 import glob
index 3dd35f5b13f6b9ac8b3467b9fe7b3bd9b57faad0..09b7988d90c936bf0953d2dba3a415891cd87683 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import datetime
 
 import factory
 import datetime
 
 import factory
index 61fc9305cb938382b3fa2205eead9e701cc1d817..4d14538c3d1c17780d67161ab0b55aba13a2e7ad 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 import datetime
 import unittest
 
 import datetime
 import unittest
@@ -12,7 +12,7 @@ from .views import library_dict, library_json, library
 from .samples_factory import *
 
 from htsworkflow.auth import apidata
 from .samples_factory import *
 
 from htsworkflow.auth import apidata
-from htsworkflow.util.conversion import unicode_or_none
+from htsworkflow.util.conversion import str_or_none
 from htsworkflow.util.ethelp import validate_xhtml
 
 class LibraryTestCase(TestCase):
 from htsworkflow.util.ethelp import validate_xhtml
 
 class LibraryTestCase(TestCase):
@@ -52,7 +52,7 @@ class SampleWebTestCase(TestCase):
         lib_dict = library_dict(library.id)
         url = '/samples/library/%s/json' % (library.id,)
         lib_response = self.client.get(url, apidata)
         lib_dict = library_dict(library.id)
         url = '/samples/library/%s/json' % (library.id,)
         lib_response = self.client.get(url, apidata)
-        lib_json = json.loads(lib_response.content)['result']
+        lib_json = json.loads(str(lib_response.content))['result']
 
         for d in [lib_dict, lib_json]:
             # amplified_from_sample is a link to the library table,
 
         for d in [lib_dict, lib_json]:
             # amplified_from_sample is a link to the library table,
@@ -63,7 +63,7 @@ class SampleWebTestCase(TestCase):
             #self.failUnlessEqual(d['amplified_from_sample'], lib.amplified_from_sample)
             self.failUnlessEqual(d['antibody_id'], library.antibody_id)
             self.failUnlessEqual(d['cell_line_id'], library.cell_line_id)
             #self.failUnlessEqual(d['amplified_from_sample'], lib.amplified_from_sample)
             self.failUnlessEqual(d['antibody_id'], library.antibody_id)
             self.failUnlessEqual(d['cell_line_id'], library.cell_line_id)
-            self.failUnlessEqual(d['cell_line'], unicode_or_none(library.cell_line))
+            self.failUnlessEqual(d['cell_line'], str_or_none(library.cell_line))
             self.failUnlessEqual(d['experiment_type'], library.experiment_type.name)
             self.failUnlessEqual(d['experiment_type_id'], library.experiment_type_id)
             self.failUnlessEqual(d['gel_cut_size'], library.gel_cut_size)
             self.failUnlessEqual(d['experiment_type'], library.experiment_type.name)
             self.failUnlessEqual(d['experiment_type_id'], library.experiment_type_id)
             self.failUnlessEqual(d['gel_cut_size'], library.gel_cut_size)
@@ -82,7 +82,7 @@ class SampleWebTestCase(TestCase):
             self.failUnlessEqual(d['stopping_point'], library.stopping_point)
             self.failUnlessEqual(d['successful_pM'], library.successful_pM)
             self.failUnlessEqual(d['undiluted_concentration'],
             self.failUnlessEqual(d['stopping_point'], library.stopping_point)
             self.failUnlessEqual(d['successful_pM'], library.successful_pM)
             self.failUnlessEqual(d['undiluted_concentration'],
-                                 unicode(library.undiluted_concentration))
+                                 str(library.undiluted_concentration))
 
 
         def junk(self):
 
 
         def junk(self):
@@ -271,9 +271,9 @@ try:
     import RDF
     HAVE_RDF = True
 
     import RDF
     HAVE_RDF = True
 
-    rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
-    xsdNS = RDF.NS("http://www.w3.org/2001/XMLSchema#")
-    libNS = RDF.NS("http://jumpgate.caltech.edu/wiki/LibraryOntology#")
+    rdfNS = RDF.NS(b"http://www.w3.org/1999/02/22-rdf-syntax-ns#")
+    xsdNS = RDF.NS(b"http://www.w3.org/2001/XMLSchema#")
+    libNS = RDF.NS(b"http://jumpgate.caltech.edu/wiki/LibraryOntology#")
 
     from htsworkflow.util.rdfhelp import dump_model
 except ImportError as e:
 
     from htsworkflow.util.rdfhelp import dump_model
 except ImportError as e:
@@ -288,7 +288,7 @@ class TestRDFaLibrary(TestCase):
     def test_parse_rdfa(self):
 
         model = get_rdf_memory_model()
     def test_parse_rdfa(self):
 
         model = get_rdf_memory_model()
-        parser = RDF.Parser(name='rdfa')
+        parser = RDF.Parser(name=b'rdfa')
 
         bob = AffiliationFactory.create(name='Bob')
 
 
         bob = AffiliationFactory.create(name='Bob')
 
@@ -309,20 +309,20 @@ class TestRDFaLibrary(TestCase):
         #with open('/tmp/test.ttl', 'w') as outstream:
         #    dump_model(model, outstream)
         # http://jumpgate.caltech.edu/wiki/LibraryOntology#affiliation>
         #with open('/tmp/test.ttl', 'w') as outstream:
         #    dump_model(model, outstream)
         # http://jumpgate.caltech.edu/wiki/LibraryOntology#affiliation>
-        self.check_literal_object(model, ['Bob'], p=libNS['affiliation'])
+        self.check_literal_object(model, ['Bob'], p=libNS[b'affiliation'])
         self.check_literal_object(model,
                                   ['experiment type name'],
         self.check_literal_object(model,
                                   ['experiment type name'],
-                                  p=libNS['experiment_type'])
-        self.check_literal_object(model, ['400'], p=libNS['gel_cut'])
+                                  p=libNS[b'experiment_type'])
+        self.check_literal_object(model, ['400'], p=libNS[b'gel_cut'])
         self.check_literal_object(model,
                                   ['microfluidics bot 7321'],
         self.check_literal_object(model,
                                   ['microfluidics bot 7321'],
-                                  p=libNS['made_by'])
+                                  p=libNS[b'made_by'])
         self.check_literal_object(model,
                                   [lib_object.library_name],
         self.check_literal_object(model,
                                   [lib_object.library_name],
-                                  p=libNS['name'])
+                                  p=libNS[b'name'])
         self.check_literal_object(model,
                                   [lib_object.library_species.scientific_name],
         self.check_literal_object(model,
                                   [lib_object.library_species.scientific_name],
-                                  p=libNS['species_name'])
+                                  p=libNS[b'species_name'])
 
 
     def check_literal_object(self, model, values, s=None, p=None, o=None):
 
 
     def check_literal_object(self, model, values, s=None, p=None, o=None):
@@ -340,7 +340,7 @@ class TestRDFaLibrary(TestCase):
         self.failUnlessEqual(len(statements), len(values),
                         "Couln't find %s %s %s" % (s,p,o))
         for s in statements:
         self.failUnlessEqual(len(statements), len(values),
                         "Couln't find %s %s %s" % (s,p,o))
         for s in statements:
-            self.failUnless(unicode(s.object.uri) in values)
+            self.failUnless(str(s.object.uri) in values)
 
 
 
 
 
 
index 3d09dd4182718d97da0bbf5605639d9f8667ad3b..1bda463ed3c6a965d61ee287e464e13e984a3277 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from django.conf.urls import patterns, url
 
 urlpatterns = patterns('samples.views',
 from django.conf.urls import patterns, url
 
 urlpatterns = patterns('samples.views',
index 0684ee7f5589cf8436a5a1e6c1fff1cb8e023150..cc94c620474ce1e8267b0e969921157141e63a3a 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 # Create your views here.
 import logging
 
 # Create your views here.
 import logging
@@ -30,7 +30,7 @@ from bcmagic.forms import BarcodeMagicForm
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.eland import ResultLane
 from htsworkflow.pipelines.samplekey import SampleKey
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.eland import ResultLane
 from htsworkflow.pipelines.samplekey import SampleKey
-from htsworkflow.util.conversion import unicode_or_none, parse_flowcell_id
+from htsworkflow.util.conversion import str_or_none, parse_flowcell_id
 from htsworkflow.util import makebed
 from htsworkflow.util import opener
 
 from htsworkflow.util import makebed
 from htsworkflow.util import opener
 
@@ -93,7 +93,7 @@ def create_library_context(cl):
         summary['lanes_run'] = lanes_run
         summary['is_archived'] = lib.is_archived()
         records.append(summary)
         summary['lanes_run'] = lanes_run
         summary['is_archived'] = lib.is_archived()
         records.append(summary)
-    cl.result_count = unicode(cl.paginator._count)
+    cl.result_count = str(cl.paginator._count)
     return {'library_list': records}
 
 
     return {'library_list': records}
 
 
@@ -492,7 +492,7 @@ def library_dict(library_id):
         #'antibody_name': lib.antibody_name(), # we have no antibodies.
         'antibody_id': lib.antibody_id,
         'cell_line_id': lib.cell_line_id,
         #'antibody_name': lib.antibody_name(), # we have no antibodies.
         'antibody_id': lib.antibody_id,
         'cell_line_id': lib.cell_line_id,
-        'cell_line': unicode_or_none(lib.cell_line),
+        'cell_line': str_or_none(lib.cell_line),
         'experiment_type': lib.experiment_type.name,
         'experiment_type_id': lib.experiment_type_id,
         'gel_cut_size': lib.gel_cut_size,
         'experiment_type': lib.experiment_type.name,
         'experiment_type_id': lib.experiment_type_id,
         'gel_cut_size': lib.gel_cut_size,
@@ -511,8 +511,8 @@ def library_dict(library_id):
         'notes': lib.notes,
         'replicate': lib.replicate,
         'stopping_point': lib.stopping_point,
         'notes': lib.notes,
         'replicate': lib.replicate,
         'stopping_point': lib.stopping_point,
-        'successful_pM': unicode_or_none(lib.successful_pM),
-        'undiluted_concentration': unicode_or_none(lib.undiluted_concentration)
+        'successful_pM': str_or_none(lib.successful_pM),
+        'undiluted_concentration': str_or_none(lib.undiluted_concentration)
         }
     if lib.library_type_id is None:
         info['library_type'] = None
         }
     if lib.library_type_id is None:
         info['library_type'] = None