Skip to content

Commit 756fc06

Browse files
committed
chore: add a few more ruff checks
Signed-off-by: Henry Schreiner <[email protected]>
1 parent f094756 commit 756fc06

File tree

8 files changed

+32
-15
lines changed

8 files changed

+32
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
rev: "v0.12.9"
1818
hooks:
1919
- id: ruff-check
20-
args: ["--fix", "--show-fixes"]
20+
args: ["--fix", "--show-fixes", "--unsafe-fixes"]
2121
- id: ruff-format
2222

2323
- repo: https://github.com/pre-commit/mirrors-mypy

pyproject.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,31 +132,40 @@ messages_control.disable = [
132132

133133
[tool.ruff.lint]
134134
extend-select = [
135-
"B", # flake8-bugbear
136-
"I", # isort
137135
"ARG", # flake8-unused-arguments
136+
"B", # flake8-bugbear
138137
"C4", # flake8-comprehensions
138+
"DTZ", # flake8-datetimez
139139
"EM", # flake8-errmsg
140+
"EXE", # flake8-executable
141+
"FA", # flake8-future-annotations
142+
"FURB", # refurb
143+
"G", # flake8-logging-format
144+
"I", # isort
140145
"ICN", # flake8-import-conventions
141146
"ISC", # flake8-implicit-str-concat
147+
"NPY", # NumPy specific rules
148+
"PD", # pandas-vet
149+
"PERF", # perflint
142150
"PGH", # pygrep-hooks
143151
"PIE", # flake8-pie
144152
"PL", # pylint
145153
"PT", # flake8-pytest-style
146154
"PTH", # flake8-use-pathlib
155+
"PYI", # flake8-pyi
147156
"RET", # flake8-return
148157
"RUF", # Ruff-specific
149158
"SIM", # flake8-simplify
159+
"SLOT", # flake8-slots
150160
"T20", # flake8-print
161+
"TC", # flake8-type-checking
151162
"UP", # pyupgrade
152163
"YTT", # flake8-2020
153164
]
154165
ignore = [
155-
"E501",
156166
"E722",
157167
"RUF001", # Unicode chars
158168
"PLR",
159-
"ISC001", # Conflicts with formatter
160169
]
161170
unfixable = [
162171
"SIM118", # Dict .keys() removal (uproot)

src/uproot_browser/_version.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
from __future__ import annotations
2-
31
version: str
42
version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]

src/uproot_browser/tree.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
import dataclasses
88
import functools
9-
from collections.abc import Iterable
109
from pathlib import Path
11-
from typing import Any, Literal, Protocol, TypedDict
10+
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypedDict
1211

1312
import uproot
1413
import uproot.reading
@@ -17,6 +16,9 @@
1716
from rich.text import Text
1817
from rich.tree import Tree
1918

19+
if TYPE_CHECKING:
20+
from collections.abc import Iterable
21+
2022
console = Console()
2123

2224
__all__ = (

src/uproot_browser/tui/browser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__package__ = "uproot_browser.tui" # pylint: disable=redefined-builtin
55

66
import contextlib
7-
from typing import Any, ClassVar
7+
from typing import TYPE_CHECKING, Any, ClassVar
88

99
import plotext as plt
1010
import rich.syntax
@@ -37,11 +37,13 @@
3737
from .header import Header
3838
from .help import HelpScreen
3939
from .left_panel import UprootTree
40-
from .messages import ErrorMessage, RequestPlot, UprootSelected
4140
from .plot import Plotext
4241
from .tools import Info, Tools
4342
from .viewer import ViewWidget
4443

44+
if TYPE_CHECKING:
45+
from .messages import ErrorMessage, RequestPlot, UprootSelected
46+
4547

4648
class Browser(textual.app.App[object]):
4749
"""A basic implementation of the uproot-browser TUI"""

src/uproot_browser/tui/error.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
from __future__ import annotations
22

33
import dataclasses
4-
from types import TracebackType
4+
from typing import TYPE_CHECKING
55

66
import rich.console
77
import rich.traceback
88

9+
if TYPE_CHECKING:
10+
from types import TracebackType
11+
912

1013
@dataclasses.dataclass
1114
class Error:

src/uproot_browser/tui/left_panel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4-
from typing import Any, ClassVar
4+
from typing import TYPE_CHECKING, Any, ClassVar
55

66
import rich.panel
77
import rich.text
@@ -10,11 +10,13 @@
1010
import textual.widgets
1111
import textual.widgets.tree
1212
import uproot
13-
from rich.style import Style
1413

1514
from ..tree import UprootEntry
1615
from .messages import UprootSelected
1716

17+
if TYPE_CHECKING:
18+
from rich.style import Style
19+
1820

1921
class UprootTree(textual.widgets.Tree[UprootEntry]):
2022
"""currently just extending DirectoryTree, showing current path"""

src/uproot_browser/tui/plot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import dataclasses
44
import sys
5-
from collections.abc import Iterable
65
from typing import TYPE_CHECKING, Any
76

87
import plotext as plt # plots in text
@@ -15,6 +14,8 @@
1514
from .messages import EmptyMessage, ErrorMessage, RequestPlot
1615

1716
if TYPE_CHECKING:
17+
from collections.abc import Iterable
18+
1819
from .browser import Browser
1920

2021

0 commit comments

Comments
 (0)