From 69e1e439669f4972008ca283d90a811012426745 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 16 Oct 2019 22:45:41 +0200 Subject: [PATCH] Feat: raw methods for tokens --- mapytex/calculus/API/tokens/polynomial.py | 4 ++++ mapytex/calculus/API/tokens/token.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/mapytex/calculus/API/tokens/polynomial.py b/mapytex/calculus/API/tokens/polynomial.py index c58a90a..82de79c 100644 --- a/mapytex/calculus/API/tokens/polynomial.py +++ b/mapytex/calculus/API/tokens/polynomial.py @@ -57,6 +57,10 @@ class Polynomial(Token): def random(cls): raise NotImplementedError + @property + def raw(self): + raise NotImplementedError("Polynomial does not exists in python") + def __setitem__(self, key, item): """ Use Polynomial like if they were a dictionnary to set coefficients """ raise NotImplementedError("Can't set coefficient of a polynomial") diff --git a/mapytex/calculus/API/tokens/token.py b/mapytex/calculus/API/tokens/token.py index b554d98..0d57836 100644 --- a/mapytex/calculus/API/tokens/token.py +++ b/mapytex/calculus/API/tokens/token.py @@ -84,6 +84,11 @@ class Token(object): def __tex__(self): return self._mo.__tex__ + @property + def raw(self): + """ Get python's raw forme of the token """ + return self._mo.value + def _operate(self, other, operation): """ Make a operation between 2 Tokens """ from ..expression import Expression