Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3ff0f3

Browse files
authored
Merge pull request#264 from dstansby/repo-review
Some more repo-review suggestions
2 parents9a1147c +33a71d3 commitd3ff0f3

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

‎.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
-id:end-of-file-fixer
77
-id:trailing-whitespace
88

9-
-repo:https://github.com/psf/black
9+
-repo:https://github.com/psf/black-pre-commit-mirror
1010
rev:24.4.2
1111
hooks:
1212
-id:black

‎docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def napari_scraper(block, block_vars, gallery_conf): # type: ignore[no-untyped-
6969
forwin,img_pathinzip(
7070
reversed(napari._qt.qt_main_window._QtMainWindow._instances),
7171
imgpath_iter,
72+
strict=False,
7273
):
7374
img_paths.append(img_path)
7475
win._window.screenshot(img_path,canvas_only=False)

‎pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ line_length = 79
3131

3232
[tool.ruff]
3333
target-version ="py310"
34-
select = ["I","UP","F","E","W","D"]
34+
fix =true
35+
36+
[tool.ruff.lint]
37+
select = ["B","I","UP","F","E","W","D"]
3538
ignore = [
3639
"D100",# Missing docstring in public module
3740
"D104",# Missing docstring in public package
@@ -41,14 +44,13 @@ ignore = [
4144
"D401",# First line of docstring should be in imperative mood
4245

4346
]
44-
fix =true
4547

46-
[tool.ruff.per-file-ignores]
48+
[tool.ruff.lint.per-file-ignores]
4749
"docs/*" = ["D"]
4850
"examples/*" = ["D"]
4951
"src/napari_matplotlib/tests/*" = ["D"]
5052

51-
[tool.ruff.pydocstyle]
53+
[tool.ruff.lint.pydocstyle]
5254
convention ="numpy"
5355

5456
[tool.mypy]
@@ -59,6 +61,8 @@ disallow_subclassing_any = false # TODO: fix
5961
warn_return_any =false# TODO: fix
6062
ignore_missing_imports =true
6163

64+
enable_error_code = ["ignore-without-code","redundant-expr","truthy-bool"]
65+
6266
[[tool.mypy.overrides]]
6367
module = [
6468
"napari_matplotlib/tests/*",

‎src/napari_matplotlib/histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def on_update_layers(self) -> None:
6060

6161
def_update_contrast_lims(self)->None:
6262
forlim,lineinzip(
63-
self.layers[0].contrast_limits,self._contrast_lines
63+
self.layers[0].contrast_limits,self._contrast_lines,strict=False
6464
):
6565
line.set_xdata(lim)
6666

‎src/napari_matplotlib/tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_interval():
2626
assert10notininterval
2727

2828
withpytest.raises(ValueError,match="must be an integer"):
29-
"string"ininterval# type: ignore
29+
assert"string"ininterval# type: ignore[operator]
3030

3131
withpytest.raises(ValueError,match="must be <= upper_bound"):
3232
Interval(5,3)

‎src/napari_matplotlib/util.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,18 @@ def _get_dimension(nodes: list[tinycss2.ast.Node], id_name: str) -> int | None:
9494
None if no IdentToken is found.
9595
"""
9696
cleaned_nodes= [nodefornodeinnodesifnode.type!="whitespace"]
97-
forname,_,value,_inzip(*(iter(cleaned_nodes),)*4):
97+
forname,_,value,_inzip(*(iter(cleaned_nodes),)*4,strict=False):
9898
if (
9999
name.type=="ident"
100100
andvalue.type=="dimension"
101101
andname.value==id_name
102102
):
103103
returnvalue.int_value
104-
warn(f"Unable to find DimensionToken for{id_name}",RuntimeWarning)
104+
warn(
105+
f"Unable to find DimensionToken for{id_name}",
106+
RuntimeWarning,
107+
stacklevel=1,
108+
)
105109
returnNone
106110

107111

@@ -134,6 +138,7 @@ def from_napari_css_get_size_of(
134138
f"Unable to find{qt_element_name} or unable to find its size in "
135139
f"the current Napari stylesheet, falling back to{fallback}",
136140
RuntimeWarning,
141+
stacklevel=1,
137142
)
138143
returnQSize(*fallback)
139144

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp