Debian Codegraph @

jedi/third_party/typeshed/stdlib/shlex.pyi

raw symbols SCIP
1 import sys
2 from collections import deque
3 from collections.abc import Iterable
4 from io import TextIOWrapper
5 from typing import Literal, Protocol, overload, type_check_only
6 from typing_extensions import Self, deprecated
7
8 __all__ = ["shlex", "split", "quote", "join"]
9
10 @type_check_only
11 class _ShlexInstream(Protocol):
12 def read(self, size: Literal[1], /) -> str: ...
13 def readline(self) -> object: ...
14 def close(self) -> object: ...
15
16 if sys.version_info >= (3, 12):
17 def split(s: str | _ShlexInstream, comments: bool = False, posix: bool = True) -> list[str]: ...
18
19 else:
20 @overload
21 def split(s: str | _ShlexInstream, comments: bool = False, posix: bool = True) -> list[str]: ...
22 @overload
23 @deprecated("Passing None for 's' to shlex.split() is deprecated and will raise an error in Python 3.12.")
24 def split(s: None, comments: bool = False, posix: bool = True) -> list[str]: ...
25
26 def join(split_command: Iterable[str]) -> str: ...
27 def quote(s: str) -> str: ...
28
29 # TODO: Make generic over infile once PEP 696 is implemented.
30 class shlex:
31 commenters: str
32 wordchars: str
33 whitespace: str
34 escape: str
35 quotes: str
36 escapedquotes: str
37 whitespace_split: bool
38 infile: str | None
39 instream: _ShlexInstream
40 source: str
41 debug: int
42 lineno: int
43 token: str
44 filestack: deque[tuple[str | None, _ShlexInstream, int]]
45 eof: str | None
46 @property
47 def punctuation_chars(self) -> str: ...
48 def __init__(
49 self,
50 instream: str | _ShlexInstream | None = None,
51 infile: str | None = None,
52 posix: bool = False,
53 punctuation_chars: bool | str = False,
54 ) -> None: ...
55 def get_token(self) -> str | None: ...
56 def push_token(self, tok: str) -> None: ...
57 def read_token(self) -> str | None: ...
58 def sourcehook(self, newfile: str) -> tuple[str, TextIOWrapper] | None: ...
59 def push_source(self, newstream: str | _ShlexInstream, newfile: str | None = None) -> None: ...
60 def pop_source(self) -> None: ...
61 def error_leader(self, infile: str | None = None, lineno: int | None = None) -> str: ...
62 def __iter__(self) -> Self: ...
63 def __next__(self) -> str: ...