Skip to content

Commit 8be05fc

Browse files
Apply ruff/flake8-type-checking rules (TCH) (#1718)
1 parent 4d1ec47 commit 8be05fc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

fsspec/implementations/tests/test_tar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import tarfile
66
import tempfile
77
from io import BytesIO
8-
from pathlib import Path
8+
from typing import TYPE_CHECKING
99

1010
import pytest
1111

@@ -15,6 +15,9 @@
1515
from fsspec.implementations.tar import TarFileSystem
1616
from fsspec.implementations.tests.test_archive import archive_data, temptar
1717

18+
if TYPE_CHECKING:
19+
from pathlib import Path
20+
1821

1922
def test_info():
2023
with temptar(archive_data) as t:

fsspec/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import logging
55
import math
66
import os
7-
import pathlib
87
import re
98
import sys
109
import tempfile
@@ -24,6 +23,8 @@
2423
from urllib.parse import urlsplit
2524

2625
if TYPE_CHECKING:
26+
import pathlib
27+
2728
from typing_extensions import TypeGuard
2829

2930
from fsspec.spec import AbstractFileSystem

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ select = [
185185
"SIM",
186186
"SLOT",
187187
"SIM101",
188+
"TCH",
188189
"UP",
189190
]
190191
ignore = [

0 commit comments

Comments
 (0)