From 056e493691bb1b556f06d0ffb450ad645fd0f592 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sat, 1 May 2021 22:16:41 -0700 Subject: [PATCH] glob: update for py310 (#5292) Co-authored-by: hauntsaninja <> --- stdlib/glob.pyi | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index 3029b2581..42269e95d 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -1,8 +1,21 @@ -from typing import AnyStr, Iterator, List, Union +import sys +from _typeshed import AnyPath +from typing import AnyStr, Iterator, List, Optional, Union def glob0(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... def glob1(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... -def glob(pathname: AnyStr, *, recursive: bool = ...) -> List[AnyStr]: ... -def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... + +if sys.version_info >= (3, 10): + def glob( + pathname: AnyStr, *, root_dir: Optional[AnyPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ... + ) -> List[AnyStr]: ... + def iglob( + pathname: AnyStr, *, root_dir: Optional[AnyPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ... + ) -> Iterator[AnyStr]: ... + +else: + def glob(pathname: AnyStr, *, recursive: bool = ...) -> List[AnyStr]: ... + def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... + def escape(pathname: AnyStr) -> AnyStr: ... def has_magic(s: Union[str, bytes]) -> bool: ... # undocumented