From eff438b9306435e5defbd086184ecfa0acdcb12a Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 14 Mar 2018 11:04:13 +0300 Subject: [PATCH] Move MOError to exceptions.py --- mapytex/calculus/core/MO/exceptions.py | 3 +++ mapytex/calculus/core/MO/mo.py | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mapytex/calculus/core/MO/exceptions.py b/mapytex/calculus/core/MO/exceptions.py index a9b7c1e..ec498d4 100644 --- a/mapytex/calculus/core/MO/exceptions.py +++ b/mapytex/calculus/core/MO/exceptions.py @@ -10,6 +10,9 @@ Exceptions for core tools """ +class MOError(Exception): + pass + # ----------------------------- # Reglages pour 'vim' diff --git a/mapytex/calculus/core/MO/mo.py b/mapytex/calculus/core/MO/mo.py index b1a28b8..b3637f3 100644 --- a/mapytex/calculus/core/MO/mo.py +++ b/mapytex/calculus/core/MO/mo.py @@ -7,15 +7,13 @@ # Distributed under terms of the MIT license. from decimal import Decimal +from .exceptions import MOError from ..coroutine import coroutine, STOOOP from ..renders import tree2txt, tree2tex __all__ = ["moify", "MO", "MOstr"] -class MOError(Exception): - pass - @coroutine def moify(target): """ Coroutine which try to convert everything into an MO """ @@ -125,7 +123,7 @@ class MOnumber(MO): >>> MOnumber("a") Traceback (most recent call last): ... - mapytex.calculus.core.MO.mo.MOError: The value of an MOnumber need to be a int, a float or a Decimal + mapytex.calculus.core.MO.exceptions.MOError: The value of an MOnumber need to be a int, a float or a Decimal """ try: @@ -293,15 +291,15 @@ class MOstr(MO): >>> a = MOstr("+") Traceback (most recent call last): ... - mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a alpha string, got + + mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a alpha string, got + >>> MOstr("ui") Traceback (most recent call last): ... - mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a single caracter string, got ui + mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a single caracter string, got ui >>> MOstr(2) Traceback (most recent call last): ... - mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a string - the unknown, got 2 + mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a string - the unknown, got 2 """ try: