Skip to content

Commit

Permalink
Fix ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed Nov 28, 2023
1 parent ca63509 commit df35b91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions pybamm/expression_tree/operations/serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import numpy as np
import re

from typing import Optional


class Serialise:
"""
Expand Down Expand Up @@ -78,9 +80,9 @@ class _EmptyDict(dict):
def save_model(
self,
model: pybamm.BaseModel,
mesh: pybamm.Mesh = None,
variables: pybamm.FuzzyDict = None,
filename: str = None,
mesh: Optional[pybamm.Mesh] = None,
variables: Optional[pybamm.FuzzyDict] = None,
filename: Optional[str] = None,
):
"""Saves a discretised model to a JSON file.
Expand Down Expand Up @@ -142,7 +144,7 @@ def save_model(
json.dump(model_json, f)

def load_model(
self, filename: str, battery_model: pybamm.BaseModel = None
self, filename: str, battery_model: Optional[pybamm.BaseModel] = None
) -> pybamm.BaseModel:
"""
Loads a discretised, ready to solve model into PyBaMM.
Expand Down
7 changes: 5 additions & 2 deletions pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from functools import lru_cache
from datetime import timedelta
from pybamm.util import have_optional_dependency
from typing import Optional

from pybamm.expression_tree.operations.serialise import Serialise

Expand Down Expand Up @@ -795,7 +796,9 @@ def solve(
# Hacky patch to allow correct processing of end_time and next_starting time
# For efficiency purposes, op_conds treats identical steps as the same object
# regardless of the initial time. Should be refactored as part of #3176
op_conds_unproc = self.experiment.operating_conditions_steps_unprocessed[idx]
op_conds_unproc = (
self.experiment.operating_conditions_steps_unprocessed[idx]
)

start_time = current_solution.t[-1]

Expand Down Expand Up @@ -1192,7 +1195,7 @@ def save(self, filename):

def save_model(
self,
filename: str = None,
filename: Optional[str] = None,
mesh: bool = False,
variables: bool = False,
):
Expand Down

0 comments on commit df35b91

Please sign in to comment.