|
19 | 19 | # the License, or (at youroption) any later version. |
20 | 20 | # http://www.gnu.org/licenses/ |
21 | 21 | #***************************************************************************** |
22 | | -from __future__ import absolute_import, print_function |
23 | 22 |
|
24 | 23 | from gmpy2 cimport GMPy_MPZ_From_mpz, import_gmpy2 |
25 | 24 | from cython.operator cimport dereference as deref |
26 | 25 | from .linear_algebra cimport PPL_Coefficient_from_pyobject |
27 | 26 |
|
28 | | -import sys |
29 | | -cdef int PY_MAJOR_VERSION = sys.version_info.major |
30 | 27 |
|
31 | 28 | # PPL can use floating-point arithmetic to compute integers |
32 | 29 | cdef extern from "ppl.hh" namespace "Parma_Polyhedra_Library": |
@@ -667,24 +664,14 @@ cdef class Generator(object): |
667 | 664 | """ |
668 | 665 | le = Linear_Expression(self.coefficients(), 0) |
669 | 666 | 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())) |
688 | 675 | else: |
689 | 676 | raise RuntimeError |
690 | 677 |
|
@@ -1224,18 +1211,3 @@ cdef _wrap_Poly_Gen_Relation(PPL_Poly_Gen_Relation relation): |
1224 | 1211 | cdef Poly_Gen_Relation rel = Poly_Gen_Relation(True) |
1225 | 1212 | rel.thisptr = new PPL_Poly_Gen_Relation(relation) |
1226 | 1213 | 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 |
0 commit comments