Skip to content

Commit 8a240f1

Browse files
Apply pre-commit fixes
1 parent d90ef67 commit 8a240f1

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

doc/getting_started/tutorials/05.persistent-reductions.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@
153153
"t1 = time.time()\n",
154154
"print(lazy_expression.shape)\n",
155155
"t2 = time.time()\n",
156-
"print(f\"Time to get shape:{t2-t1:.5f}\")\n",
156+
"print(f\"Time to get shape:{t2 - t1:.5f}\")\n",
157157
"t1 = time.time()\n",
158158
"result1 = lazy_expression.compute()\n",
159159
"t2 = time.time()\n",
160-
"print(f\"Time to compute:{t2-t1:.5f}\")\n",
160+
"print(f\"Time to compute:{t2 - t1:.5f}\")\n",
161161
"print(\"Result of the operation (slice):\")\n",
162162
"print(result1[:2, :4]) # Print a small slice of the result for demonstration"
163163
]
@@ -219,11 +219,11 @@
219219
"t1 = time.time()\n",
220220
"print(lazy_expression.shape)\n",
221221
"t2 = time.time()\n",
222-
"print(f\"Time to get shape:{t2-t1:.5f}\")\n",
222+
"print(f\"Time to get shape:{t2 - t1:.5f}\")\n",
223223
"t1 = time.time()\n",
224224
"result2 = lazy_expression.compute()\n",
225225
"t2 = time.time()\n",
226-
"print(f\"Time to compute:{t2-t1:.5f}\")\n",
226+
"print(f\"Time to compute:{t2 - t1:.5f}\")\n",
227227
"print(\"Result of the operation (slice):\")\n",
228228
"print(result2[:2, :4])"
229229
]

examples/ndarray/filter_sort_fields.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
print(f"type of farr: {farr.dtype}, type of arr: {arr.dtype}")
4848

4949
if isinstance(farr, np.ndarray):
50-
print(f"nbytes of farr: {farr.nbytes / 2 ** 20:.2f}MB")
50+
print(f"nbytes of farr: {farr.nbytes / 2**20:.2f}MB")
5151
# We cannot proceed anymore
5252
sys.exit(1)
5353

src/blosc2/helpers.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def wrapper(child_func):
1919
for line in parent_func.__doc__.splitlines():
2020
if parameter in line:
2121
match = re.search(rf"(\s*){parameter}", line)
22-
assert (
23-
match is not None
24-
), f"Parameter {parameter} not found in the docstring of {parent_func.__name__}"
22+
assert match is not None, (
23+
f"Parameter {parameter} not found in the docstring of {parent_func.__name__}"
24+
)
2525
indent_parent = match.group(1)
2626

2727
# The first line should be without the indentation because it will be placed at the correct location
@@ -32,15 +32,15 @@ def wrapper(child_func):
3232
# Next parameter starts, stop copying lines
3333
break
3434
matching_lines.append(line)
35-
assert (
36-
len(matching_lines) > 0
37-
), f"Could not extract the parameter {parameter} from the docstring of {parent_func.__name__}"
35+
assert len(matching_lines) > 0, (
36+
f"Could not extract the parameter {parameter} from the docstring of {parent_func.__name__}"
37+
)
3838

3939
# Replace the indentation of the parent with the indentation used in the child function
4040
match = re.search(rf"([ \t]+){parameter}", child_func.__doc__)
41-
assert (
42-
match is not None
43-
), f"Parameter {parameter} not found in the docstring of {child_func.__name__}"
41+
assert match is not None, (
42+
f"Parameter {parameter} not found in the docstring of {child_func.__name__}"
43+
)
4444
indent_child = match.group(1)
4545

4646
# First line contains the parameter name itself which should not be indented
@@ -53,9 +53,9 @@ def wrapper(child_func):
5353
if replacements is not None:
5454
for regex, repl in replacements.items():
5555
new_doc = re.sub(regex, repl, child_func.__doc__)
56-
assert (
57-
new_doc != child_func.__doc__
58-
), f"The replacement rule {regex}: {repl} did not change the docstring of {child_func.__name__}"
56+
assert new_doc != child_func.__doc__, (
57+
f"The replacement rule {regex}: {repl} did not change the docstring of {child_func.__name__}"
58+
)
5959
child_func.__doc__ = new_doc
6060

6161
return child_func

src/blosc2/info.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ def info_html_report(items: list) -> str:
4646
report = '<table class="NDArray-info">'
4747
report += "<tbody>"
4848
for k, v in items:
49-
report += (
50-
f"<tr>"
51-
f'<th style="text-align: left">{k}</th>'
52-
f'<td style="text-align: left">{v}</td>'
53-
f"</tr>"
54-
)
49+
report += f'<tr><th style="text-align: left">{k}</th><td style="text-align: left">{v}</td></tr>'
5550
report += "</tbody>"
5651
report += "</table>"
5752
return report

0 commit comments

Comments
 (0)