From 3447196756484b6c55f6c13e51022e6b9b60ab74 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:53:15 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.12b0 → 22.1.0](https://github.com/psf/black/compare/21.12b0...22.1.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 735d7788ab..6dfacac85e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: check-yaml - id: check-added-large-files - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black - repo: https://github.com/codespell-project/codespell From 0993fef64930ea8273207cbed250fe5218f2211c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:53:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pydra/engine/tests/utils.py | 4 ++-- pydra/mark/tests/test_functions.py | 10 +++++----- pydra/utils/profiler.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pydra/engine/tests/utils.py b/pydra/engine/tests/utils.py index a3483d8005..ffb118cd0b 100644 --- a/pydra/engine/tests/utils.py +++ b/pydra/engine/tests/utils.py @@ -104,7 +104,7 @@ def fun_addvar4(a, b, c, d): @mark.task def moment(lst, n): - return sum([i ** n for i in lst]) / len(lst) + return sum([i**n for i in lst]) / len(lst) @mark.task @@ -142,7 +142,7 @@ def add2_sub2_res(res): @mark.task def power(a, b): - return a ** b + return a**b @mark.task diff --git a/pydra/mark/tests/test_functions.py b/pydra/mark/tests/test_functions.py index 0d9ad7ce63..4be0343f1f 100644 --- a/pydra/mark/tests/test_functions.py +++ b/pydra/mark/tests/test_functions.py @@ -171,7 +171,7 @@ def addtwo(a): def test_annotated_task(): @task def square(in_val: float): - return in_val ** 2 + return in_val**2 res = square(in_val=2.0)() assert res.output.out == 4.0 @@ -181,7 +181,7 @@ def test_return_annotated_task(): @task @annotate({"in_val": float, "return": {"squared": float}}) def square(in_val): - return in_val ** 2 + return in_val**2 res = square(in_val=2.0)() assert res.output.squared == 4.0 @@ -191,7 +191,7 @@ def test_return_halfannotated_annotated_task(): @task @annotate({"in_val": float, "return": float}) def square(in_val): - return in_val ** 2 + return in_val**2 res = square(in_val=2.0)() assert res.output.out == 4.0 @@ -201,7 +201,7 @@ def test_return_annotated_task_multiple_output(): @task @annotate({"in_val": float, "return": {"squared": float, "cubed": float}}) def square(in_val): - return in_val ** 2, in_val ** 3 + return in_val**2, in_val**3 res = square(in_val=2.0)() assert res.output.squared == 4.0 @@ -212,7 +212,7 @@ def test_return_halfannotated_task_multiple_output(): @task @annotate({"in_val": float, "return": (float, float)}) def square(in_val): - return in_val ** 2, in_val ** 3 + return in_val**2, in_val**3 res = square(in_val=2.0)() assert res.output.out1 == 4.0 diff --git a/pydra/utils/profiler.py b/pydra/utils/profiler.py index 989de0fc9f..9b417ef987 100644 --- a/pydra/utils/profiler.py +++ b/pydra/utils/profiler.py @@ -5,7 +5,7 @@ from time import time # Init variables -_MB = 1024.0 ** 2 +_MB = 1024.0**2 class ResourceMonitor(threading.Thread): @@ -157,10 +157,10 @@ def get_system_total_memory_gb(): meminfo_lines = f_in.readlines() mem_total_line = [line for line in meminfo_lines if "MemTotal" in line][0] mem_total = float(mem_total_line.split()[1]) - memory_gb = mem_total / (1024.0 ** 2) + memory_gb = mem_total / (1024.0**2) elif "darwin" in sys.platform: mem_str = os.popen("sysctl hw.memsize").read().strip().split(" ")[-1] - memory_gb = float(mem_str) / (1024.0 ** 3) + memory_gb = float(mem_str) / (1024.0**3) else: err_msg = "System platform: %s is not supported" raise Exception(err_msg)