Skip to content

Commit

Permalink
shlex.split: allow TextIO and deprecate None (#11451)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Feb 19, 2024
1 parent 84572bb commit bb6613f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions stdlib/shlex.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import sys
from collections.abc import Iterable
from typing import TextIO
from typing_extensions import Self
from typing import TextIO, overload
from typing_extensions import Self, deprecated

__all__ = ["shlex", "split", "quote", "join"]

def split(s: str, comments: bool = False, posix: bool = True) -> list[str]: ...
if sys.version_info >= (3, 12):
def split(s: str | TextIO, comments: bool = False, posix: bool = True) -> list[str]: ...

else:
@overload
def split(s: str | TextIO, comments: bool = False, posix: bool = True) -> list[str]: ...
@overload
@deprecated("Passing None for 's' to shlex.split() is deprecated and will raise an error in Python 3.12.")
def split(s: None, comments: bool = False, posix: bool = True) -> list[str]: ...

def join(split_command: Iterable[str]) -> str: ...
def quote(s: str) -> str: ...

Expand Down

0 comments on commit bb6613f

Please sign in to comment.