Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 184c096

Browse files
committedJul 30, 2024·
Fix pre-commit complaints
I was not able to make the noqa: U031 (should not use % formatting) to work, so I went for f-string and doubled the existings brackets. It's ugly but I don't know what else to do.
1 parent 00c708a commit 184c096

File tree

8 files changed

+23
-26
lines changed

8 files changed

+23
-26
lines changed
 

‎.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ repos:
5151
args:
5252
[
5353
"--ignore-words-list",
54-
"ags,aray,asend,ba,classs,crate,falsy,feld,inflight,lits,nd,slowy,te,oint,conveniant",
54+
"ags,aray,asend,ba,crate,falsy,feld,inflight,lits,nd,slowy,te,oint,conveniant,atmost",
5555
]
5656
exclude: ^(benchmark/benchmarks/pystone_benchmarks/pystone\.py|src/js/package-lock\.json)$
5757

‎packages/_tests/test_packages_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _get_file_count(expr):
9797

9898
def _import_pkg():
9999
for import_name in import_names:
100-
selenium_standalone.run_async("import %s" % import_name)
100+
selenium_standalone.run_async(f"import {import_name}")
101101

102102
benchmark(_import_pkg)
103103

‎packages/matplotlib/test_matplotlib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_font_manager(selenium):
152152
# get fontlist from build
153153
fontlist_built = json.loads(json.dumps(fm.FontManager(), cls=fm._JSONEncoder))
154154

155-
# reodering list to compare
155+
# reordering list to compare
156156
for list in ("afmlist", "ttflist"):
157157
for fontlist in (fontlist_vendor, fontlist_built):
158158
fontlist[list].sort(key=lambda x: x["fname"])

‎packages/opencv-python/extras/detect_ffmpeg.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ elseif(OPENCL_INCLUDE_DIR)
3030
else()
3131
set(__opencl_dirs "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2")
3232
endif()
33-
# extra dependencies for buildin code (OpenCL dir is required for extensions like cl_d3d11.h)
34-
# buildin HAVE_OPENCL is already defined through cvconfig.h
33+
# extra dependencies for builtin code (OpenCL dir is required for extensions like cl_d3d11.h)
34+
# builtin HAVE_OPENCL is already defined through cvconfig.h
3535
list(APPEND __builtin_include_dirs "${__opencl_dirs}")
3636

3737
# extra dependencies for

‎packages/xgboost/test_xgboost.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_pandas_categorical(selenium):
231231
assert transformed.columns[0].min() == 0
232232

233233
# test missing value
234-
X = pd.DataFrame({"f0": ["a", "b", np.NaN]})
234+
X = pd.DataFrame({"f0": ["a", "b", np.nan]})
235235
X["f0"] = X["f0"].astype("category") # type: ignore[call-overload]
236236
arr, _, _ = xgb.data._transform_pandas_df(X, enable_categorical=True)
237237
assert not np.any(arr == -1.0)

‎src/tests/test_pyodide.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1757,22 +1757,21 @@ def helper(selenium):
17571757
)
17581758
def test_runpython_filename(selenium, run_python):
17591759
msg = selenium.run_js(
1760-
"""
1761-
try {
1762-
%s(`
1760+
f"""
1761+
try {{
1762+
{run_python}(`
17631763
def f1():
17641764
f2()
17651765
17661766
def f2():
17671767
raise Exception("oops")
17681768
17691769
f1()
1770-
`, {filename: "a.py"});
1771-
} catch(e) {
1770+
`, {{filename: "a.py"}});
1771+
}} catch(e) {{
17721772
return e.message
1773-
}
1773+
}}
17741774
"""
1775-
% run_python
17761775
)
17771776
expected = dedent(
17781777
"""

‎src/tests/test_streams.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -523,17 +523,16 @@ def test_custom_stdin_interrupts(selenium, method):
523523
from pyodide.code import run_js
524524

525525
run_js(
526-
"""
526+
f"""
527527
ib = new Int32Array(1);
528528
pyodide.setInterruptBuffer(ib);
529-
pyodide.setStdin({
530-
%s () {
529+
pyodide.setStdin({{
530+
{method} () {{
531531
ib[0] = 2;
532532
pyodide.checkInterrupt();
533-
}
534-
});
533+
}}
534+
}});
535535
"""
536-
% method
537536
)
538537
try:
539538
with pytest.raises(KeyboardInterrupt):
@@ -555,17 +554,16 @@ def test_custom_stdout_interrupts(selenium, method):
555554
from pyodide.code import run_js
556555

557556
run_js(
558-
"""
557+
f"""
559558
ib = new Int32Array(1);
560559
pyodide.setInterruptBuffer(ib);
561-
pyodide.setStdout({
562-
%s () {
560+
pyodide.setStdout({{
561+
{method} () {{
563562
ib[0] = 2;
564563
pyodide.checkInterrupt();
565-
}
566-
});
564+
}}
565+
}});
567566
"""
568-
% method
569567
)
570568
try:
571569
with pytest.raises(KeyboardInterrupt):

‎tools/bump_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def parse_current_version(target: Target) -> str:
125125
match = target.pattern.search(content)
126126

127127
if match is None:
128-
raise ValueError(f"Unabled to detect version string: {target.file}")
128+
raise ValueError(f"Unable to detect version string: {target.file}")
129129

130130
return match.groupdict()["version"]
131131

0 commit comments

Comments
 (0)
Please sign in to comment.