diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e148d4307..8fdcfb433 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,12 +8,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/ambv/black - rev: 20.8b1 + rev: 22.1.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 + rev: 3.9.2 hooks: - id: flake8 diff --git a/semeio/workflows/correlated_observations_scaling/scaled_matrix.py b/semeio/workflows/correlated_observations_scaling/scaled_matrix.py index 9115a5e6b..0c018ea37 100644 --- a/semeio/workflows/correlated_observations_scaling/scaled_matrix.py +++ b/semeio/workflows/correlated_observations_scaling/scaled_matrix.py @@ -92,5 +92,5 @@ def get_nr_primary_components(self, threshold): data_matrix = self.get_data_matrix() data_matrix = data_matrix - data_matrix.mean(axis=0) _, s, _ = np.linalg.svd(data_matrix.astype(np.float), full_matrices=False) - variance_ratio = np.cumsum(s ** 2) / np.sum(s ** 2) + variance_ratio = np.cumsum(s**2) / np.sum(s**2) return len([1 for i in variance_ratio[:-1] if i < threshold]) + 1, s diff --git a/tests/jobs/misfit_preprocessor/test_misfit_preprocessor.py b/tests/jobs/misfit_preprocessor/test_misfit_preprocessor.py index e38914f75..95b44d457 100644 --- a/tests/jobs/misfit_preprocessor/test_misfit_preprocessor.py +++ b/tests/jobs/misfit_preprocessor/test_misfit_preprocessor.py @@ -82,7 +82,7 @@ def generate_simulated_responses( new_parameters = np.random.uniform(0, 10, 3 * ensemble_size) new_parameters.resize(ensemble_size, 3) simulated[f"poly_{poly_idx}"] = { - (state, state): sum((new_parameters * np.array((state ** 2, state, 1))).T) + (state, state): sum((new_parameters * np.array((state**2, state, 1))).T) for state in states } @@ -120,7 +120,7 @@ def generate_measurements(num_polynomials, poly_states=None, ensemble_size=10000 poly_states = [range(3) for _ in range(num_polynomials)] forward_polynomials = [ - lambda a, b, c, x: a * x ** 2 + b * x + c for _ in range(num_polynomials) + lambda a, b, c, x: a * x**2 + b * x + c for _ in range(num_polynomials) ] def parameter_distribution(): diff --git a/tests/jobs/misfit_preprocessor/unit/test_config.py b/tests/jobs/misfit_preprocessor/unit/test_config.py index 1c4b0014c..19af0565d 100644 --- a/tests/jobs/misfit_preprocessor/unit/test_config.py +++ b/tests/jobs/misfit_preprocessor/unit/test_config.py @@ -128,7 +128,7 @@ def test_default_spearman_threshold(criterion, default_threshold): @pytest.mark.parametrize( "depth", - [1, 2, 10 ** 10], + [1, 2, 10**10], ) def test_valid_depth(depth): config_data = {"fcluster": {"depth": depth}} diff --git a/tests/legacy_test_data/poly_normal/poly_eval.py b/tests/legacy_test_data/poly_normal/poly_eval.py index 5ed27038d..251a63a6c 100755 --- a/tests/legacy_test_data/poly_normal/poly_eval.py +++ b/tests/legacy_test_data/poly_normal/poly_eval.py @@ -9,7 +9,7 @@ def _load_coeffs(filename): def _evaluate(coeffs, x): - return coeffs["a"] * x ** 2 + coeffs["b"] * x + coeffs["c"] + return coeffs["a"] * x**2 + coeffs["b"] * x + coeffs["c"] if __name__ == "__main__":