From 1cfc4866687e4033f316d620a66816169cd4dc5e Mon Sep 17 00:00:00 2001 From: Joris Zimmermann Date: Mon, 23 Oct 2023 14:31:30 +0200 Subject: [PATCH] Fix flake8 error E231 missing whitespace --- dhnx/network.py | 8 ++++---- dhnx/simulation.py | 4 ++-- .../precalculation/hydraulic_precalculation.py | 2 +- tests/helpers.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dhnx/network.py b/dhnx/network.py index c60d4662..8f6a95b2 100644 --- a/dhnx/network.py +++ b/dhnx/network.py @@ -150,13 +150,13 @@ def add(self, class_name, id, **kwargs): id kwargs """ - assert class_name in available_components.index,\ + assert class_name in available_components.index, \ f"Component class {class_name} is not within the available components" \ f" {available_components.index}." list_name = available_components.loc[class_name].list_name - assert id not in self.components[list_name].index,\ + assert id not in self.components[list_name].index, \ f"There is already a component with the id {id}." # check if required parameters are in kwargs @@ -187,12 +187,12 @@ def remove(self, class_name, id): id : int id of the component to remove """ - assert class_name in available_components.index,\ + assert class_name in available_components.index, \ "Component class '{}' is not within the available_components." list_name = available_components.loc[class_name].list_name - assert id in self.components[list_name].index,\ + assert id in self.components[list_name].index, \ f"There is no component with the id {id}." self.components[list_name].drop(id, inplace=True) diff --git a/dhnx/simulation.py b/dhnx/simulation.py index 2e0409b5..d413d7f2 100644 --- a/dhnx/simulation.py +++ b/dhnx/simulation.py @@ -40,7 +40,7 @@ def __init__( self.nx_graph = thermal_network.to_nx_graph() - assert nx.algorithms.tree.is_tree(self.nx_graph),\ + assert nx.algorithms.tree.is_tree(self.nx_graph), \ "Currently, only tree networks can be modeled. " \ "Looped networks are not implemented yet." @@ -270,7 +270,7 @@ def _calculate_pipes_mass_flow(self): rcond=None ) - assert residuals < self.tolerance,\ + assert residuals < self.tolerance, \ f"Residuals {residuals} are larger than tolerance {self.tolerance}!" pipes_mass_flow.update({t: x}) diff --git a/examples/optimisation/precalculation/hydraulic_precalculation.py b/examples/optimisation/precalculation/hydraulic_precalculation.py index 660466ce..7ce11c8c 100644 --- a/examples/optimisation/precalculation/hydraulic_precalculation.py +++ b/examples/optimisation/precalculation/hydraulic_precalculation.py @@ -2,7 +2,7 @@ import pandas as pd import matplotlib.pyplot as plt -from dhnx.optimization.precalc_hydraulic import v_max_bisection,\ +from dhnx.optimization.precalc_hydraulic import v_max_bisection, \ calc_mass_flow, calc_power, v_max_secant df = pd.read_csv("Pipe_data.csv", sep=";") diff --git a/tests/helpers.py b/tests/helpers.py index 7ae60de4..991a06e8 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -107,7 +107,7 @@ def check_if_csv_dirs_equal(dir_a, dir_b, **kwargs): diff = list(set(f_names_a).symmetric_difference(set(f_names_b))) - assert not diff,\ + assert not diff, \ f"Lists of filenames are not the same." \ f" The diff is: {diff}"