From 932dcf5858d1c447acf0feb9ae1b8278264aa3ad Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 14:48:23 +0000 Subject: [PATCH] Format code with black This commit fixes the style issues introduced in 1b8ec96 according to the output from black. Details: https://deepsource.io/gh/MilesCranmer/PySR/transform/1238fdcd-08b5-4b2e-ab9b-9efdb9123dab/ --- benchmarks/hyperparamopt.py | 2 +- pysr/sr.py | 4 ++-- test/test.py | 6 +++--- test/test_torch.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmarks/hyperparamopt.py b/benchmarks/hyperparamopt.py index be71c6362..57491ce6a 100644 --- a/benchmarks/hyperparamopt.py +++ b/benchmarks/hyperparamopt.py @@ -178,7 +178,7 @@ def merge_trials(trials1, trials2_slice): max_evals=n + len(trials.trials), trials=trials, verbose=1, - rstate=np.random.RandomState(np.random.randint(1, 10 ** 6)), + rstate=np.random.RandomState(np.random.randint(1, 10**6)), ) except hyperopt.exceptions.AllTrialsFailed: continue diff --git a/pysr/sr.py b/pysr/sr.py index 62f684644..851fcf046 100644 --- a/pysr/sr.py +++ b/pysr/sr.py @@ -78,8 +78,8 @@ def import_error_string(julia_project=None): "div": lambda x, y: x / y, "mult": lambda x, y: x * y, "sqrt_abs": lambda x: sympy.sqrt(abs(x)), - "square": lambda x: x ** 2, - "cube": lambda x: x ** 3, + "square": lambda x: x**2, + "cube": lambda x: x**3, "plus": lambda x, y: x + y, "sub": lambda x, y: x - y, "neg": lambda x: -x, diff --git a/test/test.py b/test/test.py index 743ead8c2..6edf988ce 100644 --- a/test/test.py +++ b/test/test.py @@ -40,7 +40,7 @@ def test_multioutput_custom_operator_quiet(self): y = self.X[:, [0, 1]] ** 2 model = PySRRegressor( unary_operators=["sq(x) = x^2"], - extra_sympy_mappings={"sq": lambda x: x ** 2}, + extra_sympy_mappings={"sq": lambda x: x**2}, binary_operators=["plus"], verbosity=0, **self.default_test_kwargs, @@ -65,7 +65,7 @@ def test_multioutput_weighted_with_callable_temp_equation(self): model = PySRRegressor( unary_operators=["sq(x) = x^2"], binary_operators=["plus"], - extra_sympy_mappings={"sq": lambda x: x ** 2}, + extra_sympy_mappings={"sq": lambda x: x**2}, **self.default_test_kwargs, procs=0, temp_equation_file=True, @@ -121,7 +121,7 @@ def test_noisy(self): # Test that passing a single operator works: unary_operators="sq(x) = x^2", binary_operators="plus", - extra_sympy_mappings={"sq": lambda x: x ** 2}, + extra_sympy_mappings={"sq": lambda x: x**2}, **self.default_test_kwargs, procs=0, denoise=True, diff --git a/test/test_torch.py b/test/test_torch.py index 9ed0497b1..0bd435bb8 100644 --- a/test/test_torch.py +++ b/test/test_torch.py @@ -58,7 +58,7 @@ def test_pipeline(self): def test_mod_mapping(self): x, y, z = sympy.symbols("x y z") - expression = x ** 2 + sympy.atanh(sympy.Mod(y + 1, 2) - 1) * 3.2 * z + expression = x**2 + sympy.atanh(sympy.Mod(y + 1, 2) - 1) * 3.2 * z module = sympy2torch(expression, [x, y, z])