Skip to content

Commit b710ef4

Browse files
Merge pull request #2664 from pybamm-team/pre-commit-ci-update-config
chore: update pre-commit hooks
2 parents df7d404 + df5c745 commit b710ef4

File tree

76 files changed

+5
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+5
-147
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ repos:
1010
exclude: assets/js/webapp\.js
1111

1212
- repo: https://github.com/psf/black
13-
rev: 22.12.0
13+
rev: 23.1.0
1414
hooks:
1515
- id: black
1616

1717
- repo: https://github.com/charliermarsh/ruff-pre-commit
18-
rev: "v0.0.237"
18+
rev: "v0.0.242"
1919
hooks:
2020
- id: ruff
2121
args: [--ignore=E741, --exclude=__init__.py]

benchmarks/different_model_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class TimeBuildModelLossActiveMaterial:
8383
)
8484

8585
def time_setup_model(self, model, params):
86-
8786
build_model("Ai2020", model, "loss of active material", params)
8887

8988

benchmarks/work_precision_sets/time_vs_abstols.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
itertools.product(solvers.values(), models.values()),
3636
itertools.product(solvers, models),
3737
):
38-
3938
for params in parameters:
40-
4139
time_points = []
4240
solver = i[0]
4341

@@ -70,13 +68,11 @@
7068
disc.process_model(model)
7169

7270
for tol in abstols:
73-
7471
solver.atol = tol
7572
solver.solve(model, t_eval=t_eval)
7673
time = 0
7774
runs = 20
7875
for k in range(0, runs):
79-
8076
solution = solver.solve(model, t_eval=t_eval)
8177
time += solution.solve_time.value
8278
time = time / runs

benchmarks/work_precision_sets/time_vs_dt_max.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
models.values(),
4040
models,
4141
):
42-
4342
for params in parameters:
44-
4543
time_points = []
4644
# solver = pybamm.CasadiSolver()
4745

@@ -74,14 +72,12 @@
7472
disc.process_model(model)
7573

7674
for t in dt_max:
77-
7875
solver = pybamm.CasadiSolver(dt_max=t)
7976

8077
solver.solve(model, t_eval=t_eval)
8178
time = 0
8279
runs = 20
8380
for k in range(0, runs):
84-
8581
solution = solver.solve(model, t_eval=t_eval)
8682
time += solution.solve_time.value
8783
time = time / runs

benchmarks/work_precision_sets/time_vs_mesh_size.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
itertools.product(solvers.values(), models.values()),
3030
itertools.product(solvers, models),
3131
):
32-
3332
for params in parameters:
3433
time_points = []
3534
solver = i[0]
@@ -42,7 +41,6 @@
4241
i = list(i)
4342

4443
for N in npts:
45-
4644
var_pts = {
4745
"x_n": N, # negative electrode
4846
"x_s": N, # separator
@@ -57,7 +55,6 @@
5755
time = 0
5856
runs = 20
5957
for k in range(0, runs):
60-
6158
solution = sim.solve([0, 3500])
6259
time += solution.solve_time.value
6360
time = time / runs

benchmarks/work_precision_sets/time_vs_no_of_states.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
itertools.product(solvers.values(), models.values()),
2929
itertools.product(solvers, models),
3030
):
31-
3231
for params in parameters:
3332
time_points = []
3433
ns = []
@@ -42,7 +41,6 @@
4241
i = list(i)
4342

4443
for N in npts:
45-
4644
var_pts = {
4745
"x_n": N, # negative electrode
4846
"x_s": N, # separator
@@ -57,7 +55,6 @@
5755
time = 0
5856
runs = 20
5957
for k in range(0, runs):
60-
6158
solution = sim.solve([0, 3500])
6259
time += solution.solve_time.value
6360
time = time / runs

benchmarks/work_precision_sets/time_vs_reltols.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
itertools.product(solvers.values(), models.values()),
4242
itertools.product(solvers, models),
4343
):
44-
4544
for params in parameters:
46-
4745
time_points = []
4846
solver = i[0]
4947

@@ -76,13 +74,11 @@
7674
disc.process_model(model)
7775

7876
for tol in reltols:
79-
8077
solver.rtol = tol
8178
solver.solve(model, t_eval=t_eval)
8279
time = 0
8380
runs = 20
8481
for k in range(0, runs):
85-
8682
solution = solver.solve(model, t_eval=t_eval)
8783
time += solution.solve_time.value
8884
time = time / runs

examples/scripts/compare_interface_utilisation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
t_eval = np.linspace(0, 3600, 100)
3737

3838
for model in models:
39-
4039
sim = pybamm.Simulation(model, parameter_values=param)
4140
solution = sim.solve(t_eval)
4241
solutions.append(solution)

pybamm/discretisations/discretisation.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010

1111
def has_bc_of_form(symbol, side, bcs, form):
12-
1312
if symbol in bcs:
1413
if bcs[symbol][side][1] == form:
1514
return True
@@ -346,7 +345,6 @@ def set_internal_boundary_conditions(self, model):
346345
"""
347346

348347
def boundary_gradient(left_symbol, right_symbol):
349-
350348
pybamm.logger.debug(
351349
"Calculate boundary gradient ({} and {})".format(
352350
left_symbol, right_symbol
@@ -1001,7 +999,6 @@ def check_model(self, model):
1001999
self.check_variables(model)
10021000

10031001
def check_initial_conditions(self, model):
1004-
10051002
# Check initial conditions are a numpy array
10061003
# Individual
10071004
for var, eqn in model.initial_conditions.items():

pybamm/expression_tree/interpolant.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ def _function_evaluate(self, evaluated_children):
251251
if self.dimension == 1:
252252
return self.function(*children_eval_flat).flatten()[:, np.newaxis]
253253
elif self.dimension in [2, 3]:
254-
255254
# If the children are scalars, we need to add a dimension
256255
shapes = []
257256
for child in evaluated_children:
@@ -273,7 +272,6 @@ def _function_evaluate(self, evaluated_children):
273272
shape = shapes.pop()
274273
new_evaluated_children = []
275274
for child in evaluated_children:
276-
277275
if hasattr(child, "shape") and child.shape == shape:
278276
new_evaluated_children.append(child.flatten())
279277
else:

0 commit comments

Comments
 (0)