Skip to content

Commit 310c245

Browse files
committed
Iterator type for .glob and .iterdir
1 parent 3d9816b commit 310c245

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/pathlib/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from pathlib._os import magic_open, ensure_distinct_paths, ensure_different_files, copyfileobj
1616
from pathlib import PurePath, Path
1717
from typing import (
18-
Any, BinaryIO, Callable, Generator, Optional, Protocol, Sequence, TypeVar, Union,
18+
Any, BinaryIO, Callable, Generator, Iterator, Optional, Protocol, Sequence, TypeVar, Union,
1919
runtime_checkable,
2020
)
2121

@@ -283,15 +283,15 @@ def read_text(
283283
return f.read()
284284

285285
@abstractmethod
286-
def iterdir(self: _RP) -> Generator[_RP, None, None]:
286+
def iterdir(self: _RP) -> Iterator[_RP]:
287287
"""Yield path objects of the directory contents.
288288
289289
The children are yielded in arbitrary order, and the
290290
special entries '.' and '..' are not included.
291291
"""
292292
raise NotImplementedError
293293

294-
def glob(self: _RP, pattern: Union[_RP, str], *, recurse_symlinks: bool = True) -> Generator[_RP, None, None]:
294+
def glob(self: _RP, pattern: Union[_RP, str], *, recurse_symlinks: bool = True) -> Iterator[_RP]:
295295
"""Iterate over this subtree and yield all existing files (of any
296296
kind, including directories) matching the given relative pattern.
297297
"""

0 commit comments

Comments
 (0)