Commit 2dc8f1f4 authored by cclauss's avatar cclauss Committed by Dylan Trotter

flake8 recommended changes (#164)

pip install --upgrade flake8  # http://flake8.pycqa.org
python2 -m flake8 . --exclude=third_party --ignore=E1,E306 --max-line-length=80
parent efe4d887
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
from __go__.math import (Pi, E, Ceil, Copysign, Abs, Floor, Mod, Frexp, IsInf, from __go__.math import (Pi, E, Ceil, Copysign, Abs, Floor, Mod, Frexp, IsInf,
IsNaN, Exp2, Modf, Trunc, Exp, Expm1, Log, Log1p, Log10, Pow, Sqrt, Acos, IsNaN, Exp2, Modf, Trunc, Exp, Expm1, Log, Log1p, Log10, Pow, Sqrt, Acos,
Asin, Atan, Atan2, Hypot, Sin, Cos, Tan, Acosh, Asinh, Atanh, Sinh, Cosh, Asin, Atan, Atan2, Hypot, Sin, Cos, Tan, Acosh, Asinh, Atanh, Sinh, Cosh,
Tanh, Erf, Erfc, Gamma, Lgamma) # pylint: disable=g-multiple-import Tanh, Erf, Erfc, Gamma, Lgamma) # pylint: disable=g-multiple-import
# Constants # Constants
...@@ -29,12 +29,12 @@ e = E ...@@ -29,12 +29,12 @@ e = E
def ceil(x): def ceil(x):
return Ceil(float(x)) return Ceil(float(x))
def copysign(x, y): def copysign(x, y):
return Copysign(float(x), float(y)) return Copysign(float(x), float(y))
def fabs(x): def fabs(x):
return Abs(float(x)) return Abs(float(x))
...@@ -44,12 +44,12 @@ def factorial(x): ...@@ -44,12 +44,12 @@ def factorial(x):
xi = int(x) xi = int(x)
except TypeError: except TypeError:
xi = None xi = None
try: try:
xf = float(x) xf = float(x)
except TypeError: except TypeError:
xf = None xf = None
if xi is None: if xi is None:
xi = int(xf) xi = int(xf)
if xi != xf: if xi != xf:
...@@ -60,17 +60,17 @@ def factorial(x): ...@@ -60,17 +60,17 @@ def factorial(x):
pass pass
elif xf != xi: elif xf != xi:
raise ValueError("factorial() only accepts integral values") raise ValueError("factorial() only accepts integral values")
x = xi x = xi
if x < 0: if x < 0:
raise ValueError("factorial() not defined for negative values") raise ValueError("factorial() not defined for negative values")
acc = 1 acc = 1
for value in range(2,x+1): for value in range(2, x+1):
acc *= value acc *= value
return acc return acc
...@@ -92,23 +92,23 @@ def frexp(x): ...@@ -92,23 +92,23 @@ def frexp(x):
def isinf(x): def isinf(x):
return IsInf(float(x),0) return IsInf(float(x), 0)
def isnan(x): def isnan(x):
return IsNaN(float(x)) return IsNaN(float(x))
def ldexp(x, i): def ldexp(x, i):
return float(x) * Exp2(float(i)) return float(x) * Exp2(float(i))
def modf(x): def modf(x):
#Modf returns (int, frac), but python should return (frac, int). # Modf returns (int, frac), but python should return (frac, int).
a, b = Modf(float(x)) a, b = Modf(float(x))
return b, a return b, a
def trunc(x): def trunc(x):
return Trunc(float(x)) return Trunc(float(x))
...@@ -134,12 +134,12 @@ def log(x, b=None): ...@@ -134,12 +134,12 @@ def log(x, b=None):
def log1p(x): def log1p(x):
return Log1p(float(x)) return Log1p(float(x))
def log10(x): def log10(x):
return Log10(float(x)) return Log10(float(x))
def pow(x, y): def pow(x, y):
return Pow(float(x), float(y)) return Pow(float(x), float(y))
...@@ -164,8 +164,8 @@ def atan(x): ...@@ -164,8 +164,8 @@ def atan(x):
def atan2(y, x): def atan2(y, x):
return Atan2(float(y), float(x)) return Atan2(float(y), float(x))
def cos(x): def cos(x):
return Cos(float(x)) return Cos(float(x))
...@@ -196,12 +196,12 @@ def radians(x): ...@@ -196,12 +196,12 @@ def radians(x):
def acosh(x): def acosh(x):
return Acosh(float(x)) return Acosh(float(x))
def asinh(x): def asinh(x):
return Asinh(float(x)) return Asinh(float(x))
def atanh(x): def atanh(x):
return Atanh(float(x)) return Atanh(float(x))
...@@ -212,25 +212,25 @@ def cosh(x): ...@@ -212,25 +212,25 @@ def cosh(x):
def sinh(x): def sinh(x):
return Sinh(float(x)) return Sinh(float(x))
def tanh(x): def tanh(x):
return Tanh(float(x)) return Tanh(float(x))
# Special functions # Special functions
def erf(x): def erf(x):
return Erf(float(x)) return Erf(float(x))
def erfc(x): def erfc(x):
return Erfc(float(x)) return Erfc(float(x))
def gamma(x): def gamma(x):
return Gamma(float(x)) return Gamma(float(x))
def lgamma(x): def lgamma(x):
return Lgamma(float(x)) return Lgamma(float(x))
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