Some PEP8 rectifications

This commit is contained in:
2018-03-13 14:43:48 +03:00
parent e9046c49ff
commit e4efa1028e
14 changed files with 100 additions and 109 deletions

View File

@@ -7,7 +7,7 @@
# Distributed under terms of the MIT license.
from mapytex.calculus.core.tree import Tree
from .mo import MO, MOError
from .mo import MO
__all__ = ["MOFraction"]
@@ -33,9 +33,9 @@ class MOFraction(MO):
<MOFraction - 2 / 3>
"""
base_value = Tree("/",
MO.factory(numerator),
MO.factory(denominator),
)
MO.factory(numerator),
MO.factory(denominator),
)
if negative:
value = Tree("-", None, base_value)
else:

View File

@@ -6,9 +6,9 @@
#
# Distributed under terms of the MIT license.
from decimal import Decimal
from ..coroutine import coroutine, STOOOP
from ..renders import tree2txt, tree2tex
from decimal import Decimal
__all__ = ["moify", "MO", "MOstr"]
@@ -43,23 +43,22 @@ class MO(object):
"""MO for math object
This base class is representing int and Decimal. It stocks its value in
self.value and it
This base class is representing int and Decimal. It stocks its value in
self.value and it
"""
def __init__(self, value):
""" Initiate the MO
It should be idempotent.
>>> a = MO(3)
>>> a
<MO 3>
>>> a = MO(a)
>>> a
<MO 3>
"""
try:
self.value = value.value
@@ -107,7 +106,7 @@ class MOnumber(MO):
""" Base number math object (int or Decimal) """
def __init__(self, value, negative=False):
def __init__(self, value):
""" Initiate a number MO
>>> MOnumber(23)
@@ -134,7 +133,7 @@ class MOnumber(MO):
except AttributeError:
val = value
if isinstance(val, int) or isinstance(val, Decimal):
if isinstance(val, (int, Decimal)):
MO.__init__(self, value)
elif isinstance(val, float):
MO.__init__(self, Decimal(val))
@@ -154,7 +153,7 @@ class MOnumber(MO):
return str(self.value)
return f"- {abs(self.value)}"
class MOstr(MO):
""" Unknown math object like x or n"""
@@ -197,7 +196,7 @@ class MOstr(MO):
MO.__init__(self, value)
self.is_scalar = False
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4: