From 16cb21f32973f26497a3dbc2f76758fc390f6329 Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Tue, 22 Aug 2023 11:06:04 -0400 Subject: [PATCH] fix ruff errors --- pybamm/geometry/battery_geometry.py | 2 +- pybamm/models/full_battery_models/base_battery_model.py | 2 +- pybamm/models/submodels/base_submodel.py | 2 +- pybamm/parameters/base_parameters.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pybamm/geometry/battery_geometry.py b/pybamm/geometry/battery_geometry.py index 92ecaab218..8c06fbcd68 100644 --- a/pybamm/geometry/battery_geometry.py +++ b/pybamm/geometry/battery_geometry.py @@ -28,7 +28,7 @@ def battery_geometry( A geometry class for the battery """ - if options is None or type(options) == dict: + if options is None or isinstance(options, dict): options = pybamm.BatteryModelOptions(options) geo = pybamm.GeometricParameters(options) L_n = geo.n.L diff --git a/pybamm/models/full_battery_models/base_battery_model.py b/pybamm/models/full_battery_models/base_battery_model.py index afd1693f75..d74f886cc6 100644 --- a/pybamm/models/full_battery_models/base_battery_model.py +++ b/pybamm/models/full_battery_models/base_battery_model.py @@ -831,7 +831,7 @@ def options(self, extra_options): # if extra_options is a dict then process it into a BatteryModelOptions # this does not catch cases that subclass the dict type # so other submodels can pass in their own options class if needed - if extra_options is None or type(extra_options) == dict: + if extra_options is None or isinstance(extra_options, dict): options = BatteryModelOptions(extra_options) else: options = extra_options diff --git a/pybamm/models/submodels/base_submodel.py b/pybamm/models/submodels/base_submodel.py index 90a2d2bb97..51b82c8a9d 100644 --- a/pybamm/models/submodels/base_submodel.py +++ b/pybamm/models/submodels/base_submodel.py @@ -73,7 +73,7 @@ def __init__( self.external = external - if options is None or type(options) == dict: + if options is None or isinstance(options, dict): options = pybamm.BatteryModelOptions(options) self.options = options diff --git a/pybamm/parameters/base_parameters.py b/pybamm/parameters/base_parameters.py index 5d1efef9f7..ef3aef367e 100644 --- a/pybamm/parameters/base_parameters.py +++ b/pybamm/parameters/base_parameters.py @@ -62,7 +62,7 @@ def options(self): @options.setter def options(self, extra_options): - if extra_options is None or type(extra_options) == dict: + if extra_options is None or isinstance(extra_options, dict): self._options = pybamm.BatteryModelOptions(extra_options) else: self._options = extra_options