Skip to content

Commit a724dc2

Browse files
committed
some fixes
1 parent ba1afd3 commit a724dc2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

typeshed_client/finder.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,13 @@ def safe_is_file(path: Union[Path, _DirEntry]) -> bool:
255255
return False
256256

257257

258-
def safe_scandir(path: os.PathLike[str]) -> Iterable[_DirEntry]:
258+
def safe_scandir(path: "os.PathLike[str]") -> Iterable[_DirEntry]:
259259
"""Return an iterator over the entries in a directory, or no entries if we get an error."""
260260
try:
261-
return os.scandir(path)
261+
with os.scandir(path) as sd:
262+
yield from sd
262263
except OSError:
263-
return iter([])
264+
pass
264265

265266

266267
def get_stub_file_name(

0 commit comments

Comments
 (0)