From 36c979d1d36b1dda49ce705b1392cd5cafa86902 Mon Sep 17 00:00:00 2001 From: Anne Archibald Date: Thu, 2 Feb 2023 20:00:02 +0000 Subject: [PATCH] Fix to work with flake8 6.0.0 (#335) Co-authored-by: Anne Archibald --- .flake8 | 9 ++++++--- tests/test_gp_coefficients.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.flake8 b/.flake8 index 06e7f1e7..42339f9c 100644 --- a/.flake8 +++ b/.flake8 @@ -3,9 +3,12 @@ max-line-length = 120 max-complexity = 45 ignore = E203 - W503 # line break before binary operator; conflicts with black - E722 # bare except ok - E731 # lambda expressions ok + # line break before binary operator; conflicts with black + W503 + # bare except ok + E722 + # lambda expressions ok + E731 exclude = .git .tox diff --git a/tests/test_gp_coefficients.py b/tests/test_gp_coefficients.py index 06cf2434..ccd1f97d 100644 --- a/tests/test_gp_coefficients.py +++ b/tests/test_gp_coefficients.py @@ -300,8 +300,8 @@ def test_conditional_gp(self): # build index for the global coefficient vector idx, ntot = {}, 0 - for l, v in cmean.items(): - idx[l] = slice(ntot, ntot + len(v)) + for c_name, v in cmean.items(): + idx[c_name] = slice(ntot, ntot + len(v)) ntot = ntot + len(v) # repeat the computation using the common-signal formalism @@ -318,8 +318,8 @@ def test_conditional_gp(self): # check mean values msg = "Conditional GP coefficient value does not match" - for l, v in cmean.items(): - assert np.allclose(mn[idx[l]], v, atol=1e-4, rtol=1e-4), msg + for c_name, v in cmean.items(): + assert np.allclose(mn[idx[c_name]], v, atol=1e-4, rtol=1e-4), msg # check variances par = "B1937+21_linear_timing_model_coefficients" @@ -360,8 +360,8 @@ def test_conditional_gp(self): cmean = c.get_mean_coefficients(p0) idx, ntot = {}, 0 - for l, v in cmean.items(): - idx[l] = slice(ntot, ntot + len(v)) + for c_name, v in cmean.items(): + idx[c_name] = slice(ntot, ntot + len(v)) ntot = ntot + len(v) TNrs = pta.get_TNr(p0) @@ -375,8 +375,8 @@ def test_conditional_gp(self): mn = ch(TNr) msg = "Conditional GP coefficient value does not match for common GP" - for l, v in cmean.items(): - assert np.allclose(mn[idx[l]], v) + for c_name, v in cmean.items(): + assert np.allclose(mn[idx[c_name]], v) class TestGPCoefficientsPint(TestGPCoefficients):