ptrus / suffix-trees

Python implementation of Suffix Trees and Generalized Suffix Trees.
MIT License
122 stars 28 forks source link

Python 3 errors #3

Closed refi64 closed 8 years ago

refi64 commented 8 years ago

I get this under Python 3:

ryan@DevPC-LX:~/stuff/suffix-trees$ ipython3
Python 3.4.4 |Anaconda 2.1.0 (64-bit)| (default, Jan 11 2016, 13:54:01) 
Type "copyright", "credits" or "license" for more information.

IPython 2.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from suffix_trees import STree

In [2]: STree.STree(['abc', 'def'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-3209533ade10> in <module>()
----> 1 STree.STree(['abc', 'def'])

/media/ryan/stuff/suffix-trees/suffix_trees/STree.py in __init__(self, input)
     11 
     12         if not input == '':
---> 13            self.build(input)
     14 
     15     def _check_input(self, input):

/media/ryan/stuff/suffix-trees/suffix_trees/STree.py in build(self, x)
     40             self._build(x)
     41         if type == 'gst':
---> 42             self._build_generalized(x)
     43 
     44     def _build(self, x):

/media/ryan/stuff/suffix-trees/suffix_trees/STree.py in _build_generalized(self, xs)
    131         terminal_gen = self._terminalSymbolsGenerator()
    132 
--> 133         _xs = ''.join([x + next(terminal_gen) for x in xs])
    134         self.word = _xs
    135         self._generalized_word_starts(xs)

/media/ryan/stuff/suffix-trees/suffix_trees/STree.py in <listcomp>(.0)
    131         terminal_gen = self._terminalSymbolsGenerator()
    132 
--> 133         _xs = ''.join([x + next(terminal_gen) for x in xs])
    134         self.word = _xs
    135         self._generalized_word_starts(xs)

/media/ryan/stuff/suffix-trees/suffix_trees/STree.py in _terminalSymbolsGenerator(self)
    244         """
    245         py2 = sys.version[0] < '3'
--> 246         UPPAs = list(range(0xE000,0xF8FF+1) + range(0xF0000,0xFFFFD+1) + range(0x100000, 0x10FFFD))
    247         for i in UPPAs:
    248             if py2:

TypeError: unsupported operand type(s) for +: 'range' and 'range'

In [3]: 
ptrus commented 8 years ago

Thanks, fixed.