Skip to content

Commit 1837157

Browse files
László Vaskóvlaci
authored andcommitted
chore(lint): enable flake8-type-checking ruff rules
- TCH003 Move standard library import `io` into a type-checking block https://beta.ruff.rs/docs/rules/#flake8-type-checking-tch
1 parent 3075c40 commit 1837157

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ select = [
8585
"SLF", # flake8-self
8686
"T10", # flake8-debugger
8787
"T20", # flake8-print
88+
"TCH", # flake8-type-checking
8889
"TRY", # tryceratops
8990
"UP", # pyupgrade
9091
"W", # pycodestyle (warnings)

unblob/extractors/command.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import io
21
import shlex
32
import subprocess
43
from pathlib import Path
5-
from typing import List, Optional, Union
4+
from typing import TYPE_CHECKING, List, Optional, Union
65

76
from structlog import get_logger
87

98
from unblob.models import ExtractError, Extractor
109
from unblob.report import ExtractCommandFailedReport, ExtractorDependencyNotFoundReport
1110

11+
if TYPE_CHECKING:
12+
import io
13+
1214
logger = get_logger()
1315

1416

@@ -27,7 +29,7 @@ def extract(self, inpath: Path, outdir: Path):
2729
cmd = self._make_extract_command(inpath, outdir)
2830
command = shlex.join(cmd)
2931
logger.debug("Running extract command", command=command)
30-
stdout_file: Union[int, io.FileIO] = subprocess.PIPE
32+
stdout_file: Union[int, "io.FileIO"] = subprocess.PIPE
3133

3234
def no_op():
3335
pass

0 commit comments

Comments
 (0)