Skip to content

Commit f0b00f8

Browse files
TYP: remove type:ignore from pandas/io/common.py (#31700)
1 parent 2bf618f commit f0b00f8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

pandas/io/common.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@
77
import mmap
88
import os
99
import pathlib
10-
from typing import IO, Any, AnyStr, Dict, List, Mapping, Optional, Tuple, Union
10+
from typing import (
11+
IO,
12+
TYPE_CHECKING,
13+
Any,
14+
AnyStr,
15+
Dict,
16+
List,
17+
Mapping,
18+
Optional,
19+
Tuple,
20+
Type,
21+
Union,
22+
)
1123
from urllib.parse import ( # noqa
1224
urlencode,
1325
urljoin,
@@ -37,6 +49,10 @@
3749
_VALID_URLS.discard("")
3850

3951

52+
if TYPE_CHECKING:
53+
from io import IOBase # noqa: F401
54+
55+
4056
def is_url(url) -> bool:
4157
"""
4258
Check to see if a URL has a valid protocol.
@@ -356,12 +372,13 @@ def get_handle(
356372
handles : list of file-like objects
357373
A list of file-like object that were opened in this function.
358374
"""
375+
need_text_wrapping: Tuple[Type["IOBase"], ...]
359376
try:
360377
from s3fs import S3File
361378

362379
need_text_wrapping = (BufferedIOBase, RawIOBase, S3File)
363380
except ImportError:
364-
need_text_wrapping = (BufferedIOBase, RawIOBase) # type: ignore
381+
need_text_wrapping = (BufferedIOBase, RawIOBase)
365382

366383
handles: List[IO] = list()
367384
f = path_or_buf

0 commit comments

Comments
 (0)