Skip to content

Commit

Permalink
linting with black
Browse files Browse the repository at this point in the history
  • Loading branch information
emprzy committed Nov 20, 2024
1 parent 2e62ae3 commit e5772c7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions flepimop/gempyor_pkg/src/gempyor/seir.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def steps_SEIR(
]:
if modinf.stoch_traj_flag == True:
raise ValueError(
f"'{integration_method}' integration method only supports deterministic integration, but `stoch_straj_flag` is '{modinf.stoch_traj_flag}'."
f"'{integration_method}' integration method only supports deterministic integration, but `stoch_straj_flag` is '{modinf.stoch_traj_flag}'."
)
seir_sim = steps_experimental.ode_integration(
**fnct_args, integration_method=integration_method
Expand All @@ -187,9 +187,7 @@ def steps_SEIR(
elif integration_method == "rk4_aot":
seir_sim = steps_experimental.rk4_aot(**fnct_args)
else:
raise ValueError(
f"Unknown integration method given, '{integration_method}'."
)
raise ValueError(f"Unknown integration method given, '{integration_method}'.")

# We return an xarray instead of a ndarray now
compartment_coords = {}
Expand Down
6 changes: 3 additions & 3 deletions flepimop/gempyor_pkg/src/gempyor/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ def compute_logloss(

if not model_data.shape == gt_data.shape:
raise ValueError(
f"`model_data` and `gt_data` do not have "
f"the same shape: `model_data.shape` = '{model_data.shape}' != "
f"`gt_data.shape` = '{gt_data.shape}'."
f"`model_data` and `gt_data` do not have "
f"the same shape: `model_data.shape` = '{model_data.shape}' != "
f"`gt_data.shape` = '{gt_data.shape}'."
)

regularization = 0.0
Expand Down
4 changes: 3 additions & 1 deletion flepimop/gempyor_pkg/tests/seir/test_seir.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ def test_constant_population_legacy_integration():


def test_constant_population_rk4jit_integration_fail():
with pytest.raises(ValueError, match=r".*integration method only supports deterministic integration.*"):
with pytest.raises(
ValueError, match=r".*integration method only supports deterministic integration.*"
):
config.set_file(f"{DATA_DIR}/config.yml")

first_sim_index = 1
Expand Down
8 changes: 2 additions & 6 deletions flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,7 @@ def test_unsupported_regularizations_value_error(
]
if reg_name not in ["forecast", "allsubpop"]
)
with pytest.raises(
ValueError, match=r"^Unsupported regularization \[received:.*$"
):
with pytest.raises(ValueError, match=r"^Unsupported regularization \[received:.*$"):
mock_inputs.create_statistic_instance()

@pytest.mark.parametrize("factory", all_valid_factories)
Expand Down Expand Up @@ -522,9 +520,7 @@ def test_compute_logloss_data_misshape_value_error(

model_rows, model_cols = mock_inputs.model_data[mock_inputs.config["sim_var"]].shape
gt_rows, gt_cols = mock_inputs.gt_data[mock_inputs.config["data_var"]].shape
expected_match = (
rf".*do not have the same shape:.*"
)
expected_match = rf".*do not have the same shape:.*"
with pytest.raises(ValueError, match=expected_match):
statistic.compute_logloss(mock_inputs.model_data, mock_inputs.gt_data)

Expand Down
4 changes: 3 additions & 1 deletion flepimop/gempyor_pkg/tests/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def test_read_df_and_write_success(fname, extension):
("fname", "extension"), [("mobility", "csv"), ("usa-geoid-params-output", "parquet")]
)
def test_read_df_and_write_fail(fname, extension):
with pytest.raises(NotImplementedError, match=r".*Supported extensions are `.csv` or `.parquet`."):
with pytest.raises(
NotImplementedError, match=r".*Supported extensions are `.csv` or `.parquet`."
):
os.chdir(tmp_path)
os.makedirs("data", exist_ok=True)
os.chdir("data")
Expand Down

0 comments on commit e5772c7

Please sign in to comment.