Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

[pre-commit.ci] pre-commit autoupdate #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1000']
Expand All @@ -10,25 +10,25 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
rev: v3.9.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==20.8b1]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
types: [python]
Expand All @@ -38,7 +38,7 @@ repos:
flake8-todo, flake8-unused-arguments, pep8-naming, pydocstyle, Pygments,
]
- repo: https://github.com/PyCQA/doc8
rev: 0.10.1
rev: v1.0.0
hooks:
- id: doc8
#- repo: local
Expand Down
2 changes: 1 addition & 1 deletion labs/approximation/approximation_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def plot_basis_functions(name="monomial"):
if name == "chebychev":
yvals = np.polynomial.Chebyshev.basis(i)(x)
elif name == "monomial":
yvals = x ** i
yvals = x**i

elif name == "linear":
a, b = 0, 1
Expand Down
4 changes: 2 additions & 2 deletions labs/integration/integration_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def quadrature_gauss_legendre_two(f, a=-1, b=1, n=10):
xvals, weight_uni = np.polynomial.legendre.leggauss(n_dim)
xvals_transformed = (b - a) * (xvals + 1.0) / 2.0 + a

weights = np.tile(np.nan, n_dim ** 2)
fvals = np.tile(np.nan, n_dim ** 2)
weights = np.tile(np.nan, n_dim**2)
fvals = np.tile(np.nan, n_dim**2)

counter = 0
for i, x in enumerate(xvals_transformed):
Expand Down
4 changes: 2 additions & 2 deletions labs/linear_equations/linear_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def plot_operation_count():
"""Plot operation count."""
dim = np.arange(10) + 1
fig, ax = plt.subplots()
ax.plot(dim, dim / 3 + dim ** 2, label="LU")
ax.plot(dim, dim ** 3 + dim ** 2, label="Inverse")
ax.plot(dim, dim / 3 + dim**2, label="LU")
ax.plot(dim, dim**3 + dim**2, label="Inverse")
ax.set_xlabel("Dimension")
ax.legend()
2 changes: 1 addition & 1 deletion labs/nonlinear_equations/nonlinear_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ def fischer(u, v, sign):
callable

"""
return u + v + sign * np.sqrt(u ** 2 + v ** 2)
return u + v + sign * np.sqrt(u**2 + v**2)
6 changes: 3 additions & 3 deletions labs/nonlinear_equations/nonlinear_algorithms_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_1():
"""Bisection method is working."""

def example(x):
return x ** 3 - 2
return x**3 - 2

y = bisect(example, 1, 2)[0]

Expand All @@ -33,10 +33,10 @@ def test_3():
"""Newton method is working."""

def _jacobian(x):
return 3 * x ** 2
return 3 * x**2

def _value(x):
return x ** 3 - 2
return x**3 - 2

def f(x):
return _value(x), _jacobian(x)
Expand Down
4 changes: 2 additions & 2 deletions labs/nonlinear_equations/nonlinear_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def plot_newtons_method():
"""
# Define function for illustration.
def f(x):
return x ** 5 - 3, 5 * x ** 4
return x**5 - 3, 5 * x**4

# Set axis limits and get function values.
xmin, xmax = 1.0, 2.55
Expand Down Expand Up @@ -170,7 +170,7 @@ def plot_secant_method():
# Define function for illustration.

def f(x):
return x ** 5 - 3
return x**5 - 3

# Set axis limits and get function values.
xmin, xmax = 1.0, 2.55
Expand Down
4 changes: 2 additions & 2 deletions labs/nonlinear_equations/nonlinear_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def function_iteration_test_function(x):

def bisection_test_function(x):
"""Get test function for bisection."""
return x ** 3 - 2
return x**3 - 2


def newton_pathological_example_fjac(x, f):
Expand All @@ -20,7 +20,7 @@ def newton_pathological_example_fjac(x, f):

def newton_pathological_example_fval(x):
"""Get Newton Pathological example function value."""
return np.cbrt(x) * np.exp(-(x ** 2))
return np.cbrt(x) * np.exp(-(x**2))


def newton_pathological_example(x):
Expand Down
4 changes: 2 additions & 2 deletions labs/nonlinear_equations/nonlinear_solutions_exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_exercise_3():
"""Test for exercise 3."""

def func(x):
return x ** 4 - 2
return x**4 - 2

fig, ax = plt.subplots()
grid = np.linspace(1.1, 1.2)
Expand All @@ -53,7 +53,7 @@ def func(x):
x = 2.3
for it in range(50):
print(it, x)
step = -(x ** 4 - 2) / (4 * x ** 3)
step = -(x**4 - 2) / (4 * x**3)
x += step
if abs(step) < 1e-10:
break
Expand Down
2 changes: 1 addition & 1 deletion labs/optimization/optimization_solutions_exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_exercise_2():
df = pd.read_pickle(f"{dirname}/material/data-consumption-function.pkl")

def construct_predicted_values(income, alpha, beta, gamma):
return alpha + beta * income ** gamma
return alpha + beta * income**gamma

mock_rslt = [-91.1933, 0.5691, 1.0204]
income = df["realgdp"].values
Expand Down