Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #511

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pydra/engine/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -142,7 +142,7 @@ def add2_sub2_res(res):

@mark.task
def power(a, b):
return a ** b
return a**b


@mark.task
Expand Down
10 changes: 5 additions & 5 deletions pydra/mark/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pydra/utils/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from time import time

# Init variables
_MB = 1024.0 ** 2
_MB = 1024.0**2


class ResourceMonitor(threading.Thread):
Expand Down Expand Up @@ -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)
Expand Down