Skip to content

Commit b782faa

Browse files
authored
Merge pull request #28 from videlec/clean-python2-specifics
Clean python2 specifics
2 parents fcd3a15 + a890062 commit b782faa

File tree

8 files changed

+8
-45
lines changed

8 files changed

+8
-45
lines changed

ppl/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
Split the main code into several files.
127127
Remove the _mutable_immutable class.
128128
"""
129-
from __future__ import absolute_import
130129

131130
from .linear_algebra import (
132131
Variable, Variables_Set, Linear_Expression,

ppl/bit_arrays.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# http://www.gnu.org/licenses/
1010
#*****************************************************************************
1111

12-
from __future__ import absolute_import, print_function
13-
1412
from libc.limits cimport ULONG_MAX
1513

1614
from .ppl_decl cimport PPL_Bit_Row

ppl/congruence.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# the License, or (at youroption) any later version.
99
# http://www.gnu.org/licenses/
1010
#*****************************************************************************
11-
from __future__ import absolute_import, print_function
1211

1312
from cython.operator cimport dereference as deref
1413

ppl/constraint.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# the License, or (at youroption) any later version.
2020
# http://www.gnu.org/licenses/
2121
#*****************************************************************************
22-
from __future__ import absolute_import, print_function
2322

2423
from gmpy2 cimport GMPy_MPZ_From_mpz, import_gmpy2
2524
from cython.operator cimport dereference as deref

ppl/generator.pyx

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
# the License, or (at youroption) any later version.
2020
# http://www.gnu.org/licenses/
2121
#*****************************************************************************
22-
from __future__ import absolute_import, print_function
2322

2423
from gmpy2 cimport GMPy_MPZ_From_mpz, import_gmpy2
2524
from cython.operator cimport dereference as deref
2625
from .linear_algebra cimport PPL_Coefficient_from_pyobject
2726

28-
import sys
29-
cdef int PY_MAJOR_VERSION = sys.version_info.major
3027

3128
# PPL can use floating-point arithmetic to compute integers
3229
cdef extern from "ppl.hh" namespace "Parma_Polyhedra_Library":
@@ -667,24 +664,14 @@ cdef class Generator(object):
667664
"""
668665
le = Linear_Expression(self.coefficients(), 0)
669666
t = self.thisptr.type()
670-
if PY_MAJOR_VERSION == 2:
671-
if t == LINE or t == RAY:
672-
return (_unpickle_generator, (self.type(), le))
673-
elif t == POINT or t == CLOSURE_POINT:
674-
return (_unpickle_generator, (self.type(), le, self.divisor()))
675-
else:
676-
raise RuntimeError
677-
elif PY_MAJOR_VERSION == 3:
678-
if t == LINE:
679-
return (Generator.line, (le,))
680-
elif t == RAY:
681-
return (Generator.ray, (le,))
682-
elif t == POINT:
683-
return (Generator.point, (le, self.divisor()))
684-
elif t == CLOSURE_POINT:
685-
return (Generator.closure_point, (le, self.divisor()))
686-
else:
687-
raise RuntimeError
667+
if t == LINE:
668+
return (Generator.line, (le,))
669+
elif t == RAY:
670+
return (Generator.ray, (le,))
671+
elif t == POINT:
672+
return (Generator.point, (le, self.divisor()))
673+
elif t == CLOSURE_POINT:
674+
return (Generator.closure_point, (le, self.divisor()))
688675
else:
689676
raise RuntimeError
690677

@@ -1224,18 +1211,3 @@ cdef _wrap_Poly_Gen_Relation(PPL_Poly_Gen_Relation relation):
12241211
cdef Poly_Gen_Relation rel = Poly_Gen_Relation(True)
12251212
rel.thisptr = new PPL_Poly_Gen_Relation(relation)
12261213
return rel
1227-
1228-
if PY_MAJOR_VERSION == 2:
1229-
def _unpickle_generator(*args):
1230-
t = args[0]
1231-
args = args[1:]
1232-
if t == 'line':
1233-
return Generator.line(*args)
1234-
elif t == 'ray':
1235-
return Generator.ray(*args)
1236-
elif t == 'point':
1237-
return Generator.point(*args)
1238-
elif t == 'closure_point':
1239-
return Generator.closure_point(*args)
1240-
else:
1241-
raise RuntimeError

ppl/linear_algebra.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
# http://www.gnu.org/licenses/
2121
#*****************************************************************************
2222

23-
from __future__ import absolute_import, print_function
24-
2523
cimport cython
2624

2725
from gmpy2 cimport import_gmpy2, mpz, GMPy_MPZ_From_mpz, MPZ_Check

ppl/mip_problem.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# the License, or (at youroption) any later version.
2020
# http://www.gnu.org/licenses/
2121
#*****************************************************************************
22-
from __future__ import absolute_import, print_function
2322

2423
from cysignals.signals cimport sig_on, sig_off
2524
from gmpy2 cimport import_gmpy2, GMPy_MPQ_From_mpz

ppl/polyhedron.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# the License, or (at youroption) any later version.
2020
# http://www.gnu.org/licenses/
2121
#*****************************************************************************
22-
from __future__ import absolute_import, print_function
2322

2423
from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
2524
from cysignals.signals cimport sig_on, sig_off

0 commit comments

Comments
 (0)