Commit 2e8f1110 authored by Vincent Delecroix's avatar Vincent Delecroix

make it work again in Python2/Python3

parent e4120866
Pipeline #53499378 failed with stages
in 14 minutes and 37 seconds
......@@ -17,14 +17,17 @@ The installation is done via pip.
Example
-------
>>> from veerer import
>>> T = ColouredTriangulation([(0,1,2), (-1,-2,-3)], [RED, RED, BLUE])
>>> from veerer import *
>>> T = VeeringTriangulation([(0,1,2), (-1,-2,-3)], [RED, RED, BLUE])
>>> T.is_core()
True
If you are in SageMath you can obtain flat structures and plots
Computing an associated flat structure:
>>> F = T.flat_structure_middle()
And if you are in SageMath you can plot it:
>>> F = T.flat_structure()
>>> F.plot(vertical_train_track=True)
>>> F.plot(horizontal_train_track=True)
......
......@@ -10,11 +10,11 @@ from .constants import RED, BLUE, HORIZONTAL, VERTICAL
from .triangulation import Triangulation
from .cover import TriangulationCover
from .veering_triangulation import VeeringTriangulation, VeeringTriangulations
from .measured_train_track import MeasuredTrainTrack
from .automaton import Automaton
from .env import sage
if sage is not None:
from .layout import FlatVeeringTriangulationLayout
from .measured_train_track import MeasuredTrainTrack
del sage, absolute_import
......@@ -48,4 +48,4 @@ missing_mods = {
# https://docs.python.org/2/library/traceback.html#traceback-examples
def require_package(mod_name, caller):
if missing_mods[mod_name]:
raise ValueError(error_msg.format(caller))
raise ValueError(error_msg[mod_name].format(caller))
......@@ -48,7 +48,8 @@ def ppl_cone_to_hashable(P):
ieqs.sort()
return (P.space_dimension(), tuple(eqns), tuple(ieqs))
def ppl_cone_from_hashable((d, eqns, ieqs)):
def ppl_cone_from_hashable(args):
d, eqns, ieqs = args
P = ppl.C_Polyhedron(d)
for constraint in eqns:
P.add_constraint(sum(coeff * ppl.Variable(i) for i,coeff in enumerate(constraint)) == 0)
......@@ -1184,20 +1185,21 @@ class VeeringTriangulation(Triangulation):
....: T.relabel(p)
....: assert T.iso_sig() == iso_sig
"""
n = self._n
r, (cols, fp, ep) = self.best_relabelling()
if Lx:
raise NotImplementedError("not implemented for linear equations")
if Gx:
raise NotImplementedError("not implemented for generators")
else:
n = self._n
_, (cols, fp, ep) = self.best_relabelling()
cols = ''.join(colour_to_char(col) for col in cols)
cols = ''.join(colour_to_char(col) for col in cols)
fp = perm_base64_str(fp)
ep = perm_base64_str(ep)
fp = perm_base64_str(fp)
ep = perm_base64_str(ep)
return cols + '_' + fp + '_' + ep
return cols + '_' + fp + '_' + ep
def canonical(self):
r"""
......@@ -1257,7 +1259,7 @@ class VeeringTriangulation(Triangulation):
....: T._set_switch_conditions(T._tt_check, Gx.row(1), VERTICAL)
"""
if Lx:
raise ValueError("not implemented for linear equations")
raise NotImplementedError("not implemented for linear equations")
if Gx:
a, b, c, d = self.square_about_edge(e)
e = self._norm(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment