mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 03:51:52 +08:00
Mark stdlib modules with upper version bounds (#5394)
* Mark stdlib modules with upper version bounds * Add minus to all versions and enforce in check_consistent * Fix check_consistent and mypy_test to work with new VERSIONS format
This commit is contained in:
516
stdlib/VERSIONS
516
stdlib/VERSIONS
@@ -1,258 +1,258 @@
|
||||
__future__: 2.7
|
||||
__main__: 2.7
|
||||
_ast: 2.7
|
||||
_bisect: 2.7
|
||||
_bootlocale: 3.6
|
||||
_codecs: 2.7
|
||||
_collections_abc: 3.6
|
||||
_compat_pickle: 3.6
|
||||
_compression: 3.6
|
||||
_csv: 2.7
|
||||
_curses: 2.7
|
||||
_decimal: 3.6
|
||||
_dummy_thread: 3.6
|
||||
_dummy_threading: 2.7
|
||||
_heapq: 2.7
|
||||
_imp: 3.6
|
||||
_json: 2.7
|
||||
_markupbase: 2.7
|
||||
_msi: 2.7
|
||||
_operator: 3.6
|
||||
_osx_support: 2.7
|
||||
_posixsubprocess: 3.6
|
||||
_py_abc: 3.7
|
||||
_pydecimal: 3.6
|
||||
_random: 2.7
|
||||
_sitebuiltins: 3.6
|
||||
_stat: 3.6
|
||||
_thread: 2.7
|
||||
_threading_local: 3.6
|
||||
_tkinter: 2.7
|
||||
_tracemalloc: 3.6
|
||||
_typeshed: 2.7
|
||||
_warnings: 2.7
|
||||
_weakref: 2.7
|
||||
_weakrefset: 2.7
|
||||
_winapi: 3.6
|
||||
abc: 2.7
|
||||
aifc: 2.7
|
||||
antigravity: 2.7
|
||||
argparse: 2.7
|
||||
array: 2.7
|
||||
ast: 2.7
|
||||
asynchat: 2.7
|
||||
asyncio: 3.4
|
||||
asyncore: 2.7
|
||||
atexit: 2.7
|
||||
audioop: 2.7
|
||||
base64: 2.7
|
||||
bdb: 2.7
|
||||
binascii: 2.7
|
||||
binhex: 2.7
|
||||
bisect: 2.7
|
||||
builtins: 3.0
|
||||
bz2: 2.7
|
||||
cProfile: 2.7
|
||||
calendar: 2.7
|
||||
cgi: 2.7
|
||||
cgitb: 2.7
|
||||
chunk: 2.7
|
||||
cmath: 2.7
|
||||
cmd: 2.7
|
||||
code: 2.7
|
||||
codecs: 2.7
|
||||
codeop: 2.7
|
||||
collections: 2.7
|
||||
colorsys: 2.7
|
||||
compileall: 2.7
|
||||
concurrent: 3.2
|
||||
configparser: 2.7
|
||||
contextlib: 2.7
|
||||
contextvars: 3.7
|
||||
copy: 2.7
|
||||
copyreg: 2.7
|
||||
crypt: 2.7
|
||||
csv: 2.7
|
||||
ctypes: 2.7
|
||||
curses: 2.7
|
||||
dataclasses: 3.7
|
||||
datetime: 2.7
|
||||
dbm: 2.7
|
||||
decimal: 2.7
|
||||
difflib: 2.7
|
||||
dis: 2.7
|
||||
distutils: 2.7
|
||||
doctest: 2.7
|
||||
dummy_threading: 2.7
|
||||
email: 2.7
|
||||
encodings: 2.7
|
||||
ensurepip: 2.7
|
||||
enum: 3.4
|
||||
errno: 2.7
|
||||
faulthandler: 3.3
|
||||
fcntl: 2.7
|
||||
filecmp: 2.7
|
||||
fileinput: 2.7
|
||||
fnmatch: 2.7
|
||||
formatter: 2.7
|
||||
fractions: 2.7
|
||||
ftplib: 2.7
|
||||
functools: 2.7
|
||||
gc: 2.7
|
||||
genericpath: 2.7
|
||||
getopt: 2.7
|
||||
getpass: 2.7
|
||||
gettext: 2.7
|
||||
glob: 2.7
|
||||
graphlib: 3.9
|
||||
grp: 2.7
|
||||
gzip: 2.7
|
||||
hashlib: 2.7
|
||||
heapq: 2.7
|
||||
hmac: 2.7
|
||||
html: 2.7
|
||||
http: 3.0
|
||||
imaplib: 2.7
|
||||
imghdr: 2.7
|
||||
imp: 2.7
|
||||
importlib: 2.7
|
||||
inspect: 2.7
|
||||
io: 2.7
|
||||
ipaddress: 2.7
|
||||
itertools: 2.7
|
||||
json: 2.7
|
||||
keyword: 2.7
|
||||
lib2to3: 2.7
|
||||
linecache: 2.7
|
||||
locale: 2.7
|
||||
logging: 2.7
|
||||
lzma: 3.3
|
||||
macpath: 2.7
|
||||
macurl2path: 2.7
|
||||
mailbox: 2.7
|
||||
mailcap: 2.7
|
||||
marshal: 2.7
|
||||
math: 2.7
|
||||
mimetypes: 2.7
|
||||
mmap: 2.7
|
||||
modulefinder: 2.7
|
||||
msilib: 2.7
|
||||
msvcrt: 2.7
|
||||
multiprocessing: 2.7
|
||||
netrc: 2.7
|
||||
nis: 2.7
|
||||
nntplib: 2.7
|
||||
ntpath: 2.7
|
||||
nturl2path: 2.7
|
||||
numbers: 2.7
|
||||
opcode: 2.7
|
||||
operator: 2.7
|
||||
optparse: 2.7
|
||||
os: 2.7
|
||||
ossaudiodev: 2.7
|
||||
parser: 2.7
|
||||
pathlib: 3.4
|
||||
pdb: 2.7
|
||||
pickle: 2.7
|
||||
pickletools: 2.7
|
||||
pipes: 2.7
|
||||
pkgutil: 2.7
|
||||
platform: 2.7
|
||||
plistlib: 2.7
|
||||
poplib: 2.7
|
||||
posix: 2.7
|
||||
posixpath: 2.7
|
||||
pprint: 2.7
|
||||
profile: 2.7
|
||||
pstats: 2.7
|
||||
pty: 2.7
|
||||
pwd: 2.7
|
||||
py_compile: 2.7
|
||||
pyclbr: 2.7
|
||||
pydoc: 2.7
|
||||
pydoc_data: 2.7
|
||||
pyexpat: 2.7
|
||||
queue: 2.7
|
||||
quopri: 2.7
|
||||
random: 2.7
|
||||
re: 2.7
|
||||
readline: 2.7
|
||||
reprlib: 2.7
|
||||
resource: 2.7
|
||||
rlcompleter: 2.7
|
||||
runpy: 2.7
|
||||
sched: 2.7
|
||||
secrets: 3.6
|
||||
select: 2.7
|
||||
selectors: 3.4
|
||||
shelve: 2.7
|
||||
shlex: 2.7
|
||||
shutil: 2.7
|
||||
signal: 2.7
|
||||
site: 2.7
|
||||
smtpd: 2.7
|
||||
smtplib: 2.7
|
||||
sndhdr: 2.7
|
||||
socket: 2.7
|
||||
socketserver: 2.7
|
||||
spwd: 2.7
|
||||
sqlite3: 2.7
|
||||
sre_compile: 2.7
|
||||
sre_constants: 2.7
|
||||
sre_parse: 2.7
|
||||
ssl: 2.7
|
||||
stat: 2.7
|
||||
statistics: 3.4
|
||||
string: 2.7
|
||||
stringprep: 2.7
|
||||
struct: 2.7
|
||||
subprocess: 2.7
|
||||
sunau: 2.7
|
||||
symbol: 2.7
|
||||
symtable: 2.7
|
||||
sys: 2.7
|
||||
sysconfig: 2.7
|
||||
syslog: 2.7
|
||||
tabnanny: 2.7
|
||||
tarfile: 2.7
|
||||
telnetlib: 2.7
|
||||
tempfile: 2.7
|
||||
termios: 2.7
|
||||
textwrap: 2.7
|
||||
this: 2.7
|
||||
threading: 2.7
|
||||
time: 2.7
|
||||
timeit: 2.7
|
||||
tkinter: 3.0
|
||||
token: 2.7
|
||||
tokenize: 2.7
|
||||
trace: 2.7
|
||||
traceback: 2.7
|
||||
tracemalloc: 3.4
|
||||
tty: 2.7
|
||||
turtle: 2.7
|
||||
types: 2.7
|
||||
typing: 3.5
|
||||
typing_extensions: 2.7
|
||||
unicodedata: 2.7
|
||||
unittest: 2.7
|
||||
urllib: 2.7
|
||||
uu: 2.7
|
||||
uuid: 2.7
|
||||
venv: 3.3
|
||||
warnings: 2.7
|
||||
wave: 2.7
|
||||
weakref: 2.7
|
||||
webbrowser: 2.7
|
||||
winreg: 2.7
|
||||
winsound: 2.7
|
||||
wsgiref: 2.7
|
||||
xdrlib: 2.7
|
||||
xml: 2.7
|
||||
xmlrpc: 3.0
|
||||
xxlimited: 3.6
|
||||
zipapp: 3.5
|
||||
zipfile: 2.7
|
||||
zipimport: 2.7
|
||||
zlib: 2.7
|
||||
zoneinfo: 3.9
|
||||
__future__: 2.7-
|
||||
__main__: 2.7-
|
||||
_ast: 2.7-
|
||||
_bisect: 2.7-
|
||||
_bootlocale: 3.6-3.9
|
||||
_codecs: 2.7-
|
||||
_collections_abc: 3.6-
|
||||
_compat_pickle: 3.6-
|
||||
_compression: 3.6-
|
||||
_csv: 2.7-
|
||||
_curses: 2.7-
|
||||
_decimal: 3.6-
|
||||
_dummy_thread: 3.6-
|
||||
_dummy_threading: 2.7-
|
||||
_heapq: 2.7-
|
||||
_imp: 3.6-
|
||||
_json: 2.7-
|
||||
_markupbase: 2.7-
|
||||
_msi: 2.7-
|
||||
_operator: 3.6-
|
||||
_osx_support: 2.7-
|
||||
_posixsubprocess: 3.6-
|
||||
_py_abc: 3.7-
|
||||
_pydecimal: 3.6-
|
||||
_random: 2.7-
|
||||
_sitebuiltins: 3.6-
|
||||
_stat: 3.6-
|
||||
_thread: 2.7-
|
||||
_threading_local: 3.6-
|
||||
_tkinter: 2.7-
|
||||
_tracemalloc: 3.6-
|
||||
_typeshed: 2.7-
|
||||
_warnings: 2.7-
|
||||
_weakref: 2.7-
|
||||
_weakrefset: 2.7-
|
||||
_winapi: 3.6-
|
||||
abc: 2.7-
|
||||
aifc: 2.7-
|
||||
antigravity: 2.7-
|
||||
argparse: 2.7-
|
||||
array: 2.7-
|
||||
ast: 2.7-
|
||||
asynchat: 2.7-
|
||||
asyncio: 3.4-
|
||||
asyncore: 2.7-
|
||||
atexit: 2.7-
|
||||
audioop: 2.7-
|
||||
base64: 2.7-
|
||||
bdb: 2.7-
|
||||
binascii: 2.7-
|
||||
binhex: 2.7-
|
||||
bisect: 2.7-
|
||||
builtins: 3.0-
|
||||
bz2: 2.7-
|
||||
cProfile: 2.7-
|
||||
calendar: 2.7-
|
||||
cgi: 2.7-
|
||||
cgitb: 2.7-
|
||||
chunk: 2.7-
|
||||
cmath: 2.7-
|
||||
cmd: 2.7-
|
||||
code: 2.7-
|
||||
codecs: 2.7-
|
||||
codeop: 2.7-
|
||||
collections: 2.7-
|
||||
colorsys: 2.7-
|
||||
compileall: 2.7-
|
||||
concurrent: 3.2-
|
||||
configparser: 2.7-
|
||||
contextlib: 2.7-
|
||||
contextvars: 3.7-
|
||||
copy: 2.7-
|
||||
copyreg: 2.7-
|
||||
crypt: 2.7-
|
||||
csv: 2.7-
|
||||
ctypes: 2.7-
|
||||
curses: 2.7-
|
||||
dataclasses: 3.7-
|
||||
datetime: 2.7-
|
||||
dbm: 2.7-
|
||||
decimal: 2.7-
|
||||
difflib: 2.7-
|
||||
dis: 2.7-
|
||||
distutils: 2.7-
|
||||
doctest: 2.7-
|
||||
dummy_threading: 2.7-
|
||||
email: 2.7-
|
||||
encodings: 2.7-
|
||||
ensurepip: 2.7-
|
||||
enum: 3.4-
|
||||
errno: 2.7-
|
||||
faulthandler: 3.3-
|
||||
fcntl: 2.7-
|
||||
filecmp: 2.7-
|
||||
fileinput: 2.7-
|
||||
fnmatch: 2.7-
|
||||
formatter: 2.7-3.9
|
||||
fractions: 2.7-
|
||||
ftplib: 2.7-
|
||||
functools: 2.7-
|
||||
gc: 2.7-
|
||||
genericpath: 2.7-
|
||||
getopt: 2.7-
|
||||
getpass: 2.7-
|
||||
gettext: 2.7-
|
||||
glob: 2.7-
|
||||
graphlib: 3.9-
|
||||
grp: 2.7-
|
||||
gzip: 2.7-
|
||||
hashlib: 2.7-
|
||||
heapq: 2.7-
|
||||
hmac: 2.7-
|
||||
html: 2.7-
|
||||
http: 3.0-
|
||||
imaplib: 2.7-
|
||||
imghdr: 2.7-
|
||||
imp: 2.7-
|
||||
importlib: 2.7-
|
||||
inspect: 2.7-
|
||||
io: 2.7-
|
||||
ipaddress: 2.7-
|
||||
itertools: 2.7-
|
||||
json: 2.7-
|
||||
keyword: 2.7-
|
||||
lib2to3: 2.7-
|
||||
linecache: 2.7-
|
||||
locale: 2.7-
|
||||
logging: 2.7-
|
||||
lzma: 3.3-
|
||||
macpath: 2.7-3.7
|
||||
macurl2path: 2.7-3.6
|
||||
mailbox: 2.7-
|
||||
mailcap: 2.7-
|
||||
marshal: 2.7-
|
||||
math: 2.7-
|
||||
mimetypes: 2.7-
|
||||
mmap: 2.7-
|
||||
modulefinder: 2.7-
|
||||
msilib: 2.7-
|
||||
msvcrt: 2.7-
|
||||
multiprocessing: 2.7-
|
||||
netrc: 2.7-
|
||||
nis: 2.7-
|
||||
nntplib: 2.7-
|
||||
ntpath: 2.7-
|
||||
nturl2path: 2.7-
|
||||
numbers: 2.7-
|
||||
opcode: 2.7-
|
||||
operator: 2.7-
|
||||
optparse: 2.7-
|
||||
os: 2.7-
|
||||
ossaudiodev: 2.7-
|
||||
parser: 2.7-3.9
|
||||
pathlib: 3.4-
|
||||
pdb: 2.7-
|
||||
pickle: 2.7-
|
||||
pickletools: 2.7-
|
||||
pipes: 2.7-
|
||||
pkgutil: 2.7-
|
||||
platform: 2.7-
|
||||
plistlib: 2.7-
|
||||
poplib: 2.7-
|
||||
posix: 2.7-
|
||||
posixpath: 2.7-
|
||||
pprint: 2.7-
|
||||
profile: 2.7-
|
||||
pstats: 2.7-
|
||||
pty: 2.7-
|
||||
pwd: 2.7-
|
||||
py_compile: 2.7-
|
||||
pyclbr: 2.7-
|
||||
pydoc: 2.7-
|
||||
pydoc_data: 2.7-
|
||||
pyexpat: 2.7-
|
||||
queue: 2.7-
|
||||
quopri: 2.7-
|
||||
random: 2.7-
|
||||
re: 2.7-
|
||||
readline: 2.7-
|
||||
reprlib: 2.7-
|
||||
resource: 2.7-
|
||||
rlcompleter: 2.7-
|
||||
runpy: 2.7-
|
||||
sched: 2.7-
|
||||
secrets: 3.6-
|
||||
select: 2.7-
|
||||
selectors: 3.4-
|
||||
shelve: 2.7-
|
||||
shlex: 2.7-
|
||||
shutil: 2.7-
|
||||
signal: 2.7-
|
||||
site: 2.7-
|
||||
smtpd: 2.7-
|
||||
smtplib: 2.7-
|
||||
sndhdr: 2.7-
|
||||
socket: 2.7-
|
||||
socketserver: 2.7-
|
||||
spwd: 2.7-
|
||||
sqlite3: 2.7-
|
||||
sre_compile: 2.7-
|
||||
sre_constants: 2.7-
|
||||
sre_parse: 2.7-
|
||||
ssl: 2.7-
|
||||
stat: 2.7-
|
||||
statistics: 3.4-
|
||||
string: 2.7-
|
||||
stringprep: 2.7-
|
||||
struct: 2.7-
|
||||
subprocess: 2.7-
|
||||
sunau: 2.7-
|
||||
symbol: 2.7-3.9
|
||||
symtable: 2.7-
|
||||
sys: 2.7-
|
||||
sysconfig: 2.7-
|
||||
syslog: 2.7-
|
||||
tabnanny: 2.7-
|
||||
tarfile: 2.7-
|
||||
telnetlib: 2.7-
|
||||
tempfile: 2.7-
|
||||
termios: 2.7-
|
||||
textwrap: 2.7-
|
||||
this: 2.7-
|
||||
threading: 2.7-
|
||||
time: 2.7-
|
||||
timeit: 2.7-
|
||||
tkinter: 3.0-
|
||||
token: 2.7-
|
||||
tokenize: 2.7-
|
||||
trace: 2.7-
|
||||
traceback: 2.7-
|
||||
tracemalloc: 3.4-
|
||||
tty: 2.7-
|
||||
turtle: 2.7-
|
||||
types: 2.7-
|
||||
typing: 3.5-
|
||||
typing_extensions: 2.7-
|
||||
unicodedata: 2.7-
|
||||
unittest: 2.7-
|
||||
urllib: 2.7-
|
||||
uu: 2.7-
|
||||
uuid: 2.7-
|
||||
venv: 3.3-
|
||||
warnings: 2.7-
|
||||
wave: 2.7-
|
||||
weakref: 2.7-
|
||||
webbrowser: 2.7-
|
||||
winreg: 2.7-
|
||||
winsound: 2.7-
|
||||
wsgiref: 2.7-
|
||||
xdrlib: 2.7-
|
||||
xml: 2.7-
|
||||
xmlrpc: 3.0-
|
||||
xxlimited: 3.6-
|
||||
zipapp: 3.5-
|
||||
zipfile: 2.7-
|
||||
zipimport: 2.7-
|
||||
zlib: 2.7-
|
||||
zoneinfo: 3.9-
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
def getpreferredencoding(do_setlocale: bool = ...) -> str: ...
|
||||
def getpreferredencoding(do_setlocale: bool = ...) -> str: ...
|
||||
|
||||
@@ -1,99 +1,103 @@
|
||||
import sys
|
||||
from typing import IO, Any, Iterable, List, Optional, Tuple
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
AS_IS: None
|
||||
_FontType = Tuple[str, bool, bool, bool]
|
||||
_StylesType = Tuple[Any, ...]
|
||||
class NullFormatter:
|
||||
writer: Optional[NullWriter]
|
||||
def __init__(self, writer: Optional[NullWriter] = ...) -> None: ...
|
||||
def end_paragraph(self, blankline: int) -> None: ...
|
||||
def add_line_break(self) -> None: ...
|
||||
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
|
||||
def add_flowing_data(self, data: str) -> None: ...
|
||||
def add_literal_data(self, data: str) -> None: ...
|
||||
def flush_softspace(self) -> None: ...
|
||||
def push_alignment(self, align: Optional[str]) -> None: ...
|
||||
def pop_alignment(self) -> None: ...
|
||||
def push_font(self, x: _FontType) -> None: ...
|
||||
def pop_font(self) -> None: ...
|
||||
def push_margin(self, margin: int) -> None: ...
|
||||
def pop_margin(self) -> None: ...
|
||||
def set_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def push_style(self, *styles: _StylesType) -> None: ...
|
||||
def pop_style(self, n: int = ...) -> None: ...
|
||||
def assert_line_data(self, flag: int = ...) -> None: ...
|
||||
class AbstractFormatter:
|
||||
writer: NullWriter
|
||||
align: Optional[str]
|
||||
align_stack: List[Optional[str]]
|
||||
font_stack: List[_FontType]
|
||||
margin_stack: List[int]
|
||||
spacing: Optional[str]
|
||||
style_stack: Any
|
||||
nospace: int
|
||||
softspace: int
|
||||
para_end: int
|
||||
parskip: int
|
||||
hard_break: int
|
||||
have_label: int
|
||||
def __init__(self, writer: NullWriter) -> None: ...
|
||||
def end_paragraph(self, blankline: int) -> None: ...
|
||||
def add_line_break(self) -> None: ...
|
||||
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
|
||||
def format_counter(self, format: Iterable[str], counter: int) -> str: ...
|
||||
def format_letter(self, case: str, counter: int) -> str: ...
|
||||
def format_roman(self, case: str, counter: int) -> str: ...
|
||||
def add_flowing_data(self, data: str) -> None: ...
|
||||
def add_literal_data(self, data: str) -> None: ...
|
||||
def flush_softspace(self) -> None: ...
|
||||
def push_alignment(self, align: Optional[str]) -> None: ...
|
||||
def pop_alignment(self) -> None: ...
|
||||
def push_font(self, font: _FontType) -> None: ...
|
||||
def pop_font(self) -> None: ...
|
||||
def push_margin(self, margin: int) -> None: ...
|
||||
def pop_margin(self) -> None: ...
|
||||
def set_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def push_style(self, *styles: _StylesType) -> None: ...
|
||||
def pop_style(self, n: int = ...) -> None: ...
|
||||
def assert_line_data(self, flag: int = ...) -> None: ...
|
||||
class NullWriter:
|
||||
def __init__(self) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def new_alignment(self, align: Optional[str]) -> None: ...
|
||||
def new_font(self, font: _FontType) -> None: ...
|
||||
def new_margin(self, margin: int, level: int) -> None: ...
|
||||
def new_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_label_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
class AbstractWriter(NullWriter):
|
||||
def new_alignment(self, align: Optional[str]) -> None: ...
|
||||
def new_font(self, font: _FontType) -> None: ...
|
||||
def new_margin(self, margin: int, level: int) -> None: ...
|
||||
def new_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_label_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
class DumbWriter(NullWriter):
|
||||
file: IO[str]
|
||||
maxcol: int
|
||||
def __init__(self, file: Optional[IO[str]] = ..., maxcol: int = ...) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
def test(file: Optional[str] = ...) -> None: ...
|
||||
AS_IS: None
|
||||
_FontType = Tuple[str, bool, bool, bool]
|
||||
_StylesType = Tuple[Any, ...]
|
||||
|
||||
class NullFormatter:
|
||||
writer: Optional[NullWriter]
|
||||
def __init__(self, writer: Optional[NullWriter] = ...) -> None: ...
|
||||
def end_paragraph(self, blankline: int) -> None: ...
|
||||
def add_line_break(self) -> None: ...
|
||||
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
|
||||
def add_flowing_data(self, data: str) -> None: ...
|
||||
def add_literal_data(self, data: str) -> None: ...
|
||||
def flush_softspace(self) -> None: ...
|
||||
def push_alignment(self, align: Optional[str]) -> None: ...
|
||||
def pop_alignment(self) -> None: ...
|
||||
def push_font(self, x: _FontType) -> None: ...
|
||||
def pop_font(self) -> None: ...
|
||||
def push_margin(self, margin: int) -> None: ...
|
||||
def pop_margin(self) -> None: ...
|
||||
def set_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def push_style(self, *styles: _StylesType) -> None: ...
|
||||
def pop_style(self, n: int = ...) -> None: ...
|
||||
def assert_line_data(self, flag: int = ...) -> None: ...
|
||||
|
||||
class AbstractFormatter:
|
||||
writer: NullWriter
|
||||
align: Optional[str]
|
||||
align_stack: List[Optional[str]]
|
||||
font_stack: List[_FontType]
|
||||
margin_stack: List[int]
|
||||
spacing: Optional[str]
|
||||
style_stack: Any
|
||||
nospace: int
|
||||
softspace: int
|
||||
para_end: int
|
||||
parskip: int
|
||||
hard_break: int
|
||||
have_label: int
|
||||
def __init__(self, writer: NullWriter) -> None: ...
|
||||
def end_paragraph(self, blankline: int) -> None: ...
|
||||
def add_line_break(self) -> None: ...
|
||||
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
|
||||
def format_counter(self, format: Iterable[str], counter: int) -> str: ...
|
||||
def format_letter(self, case: str, counter: int) -> str: ...
|
||||
def format_roman(self, case: str, counter: int) -> str: ...
|
||||
def add_flowing_data(self, data: str) -> None: ...
|
||||
def add_literal_data(self, data: str) -> None: ...
|
||||
def flush_softspace(self) -> None: ...
|
||||
def push_alignment(self, align: Optional[str]) -> None: ...
|
||||
def pop_alignment(self) -> None: ...
|
||||
def push_font(self, font: _FontType) -> None: ...
|
||||
def pop_font(self) -> None: ...
|
||||
def push_margin(self, margin: int) -> None: ...
|
||||
def pop_margin(self) -> None: ...
|
||||
def set_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def push_style(self, *styles: _StylesType) -> None: ...
|
||||
def pop_style(self, n: int = ...) -> None: ...
|
||||
def assert_line_data(self, flag: int = ...) -> None: ...
|
||||
|
||||
class NullWriter:
|
||||
def __init__(self) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def new_alignment(self, align: Optional[str]) -> None: ...
|
||||
def new_font(self, font: _FontType) -> None: ...
|
||||
def new_margin(self, margin: int, level: int) -> None: ...
|
||||
def new_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_label_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
|
||||
class AbstractWriter(NullWriter):
|
||||
def new_alignment(self, align: Optional[str]) -> None: ...
|
||||
def new_font(self, font: _FontType) -> None: ...
|
||||
def new_margin(self, margin: int, level: int) -> None: ...
|
||||
def new_spacing(self, spacing: Optional[str]) -> None: ...
|
||||
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_label_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
|
||||
class DumbWriter(NullWriter):
|
||||
file: IO[str]
|
||||
maxcol: int
|
||||
def __init__(self, file: Optional[IO[str]] = ..., maxcol: int = ...) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
def send_flowing_data(self, data: str) -> None: ...
|
||||
|
||||
def test(file: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -3,130 +3,142 @@ import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
_T = TypeVar("_T")
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
curdir: str
|
||||
pardir: str
|
||||
sep: str
|
||||
altsep: Optional[str]
|
||||
extsep: str
|
||||
pathsep: str
|
||||
defpath: str
|
||||
devnull: str
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
# aliases (also in os)
|
||||
curdir: str
|
||||
pardir: str
|
||||
sep: str
|
||||
altsep: Optional[str]
|
||||
extsep: str
|
||||
pathsep: str
|
||||
defpath: str
|
||||
devnull: str
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
if sys.version_info >= (3, 6):
|
||||
# Overloads are necessary to work around python/mypy#3644.
|
||||
@overload
|
||||
def abspath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(s: AnyStr) -> AnyStr: ...
|
||||
def dirname(s: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def exists(path: Union[AnyPath, int]) -> bool: ...
|
||||
else:
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def ismount(s: AnyPath) -> bool: ...
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in
|
||||
# a type error.
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
# Mypy complains that the signatures overlap, but things seem to behave correctly anyway.
|
||||
@overload
|
||||
def join(s: StrPath, *paths: StrPath) -> Text: ...
|
||||
@overload
|
||||
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
else:
|
||||
def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
else:
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
if sys.version_info < (3,):
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
# ----- os.path function stubs -----
|
||||
if sys.version_info >= (3, 6):
|
||||
# Overloads are necessary to work around python/mypy#3644.
|
||||
@overload
|
||||
def abspath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def basename(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def dirname(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(s: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(s: AnyStr) -> AnyStr: ...
|
||||
def dirname(s: AnyStr) -> AnyStr: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def exists(path: Union[AnyPath, int]) -> bool: ...
|
||||
|
||||
else:
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def ismount(s: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in
|
||||
# a type error.
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
|
||||
elif sys.version_info >= (3, 6):
|
||||
# Mypy complains that the signatures overlap, but things seem to behave correctly anyway.
|
||||
@overload
|
||||
def join(s: StrPath, *paths: StrPath) -> Text: ...
|
||||
@overload
|
||||
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
|
||||
else:
|
||||
def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
else:
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import sys
|
||||
from typing import Union
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
def url2pathname(pathname: str) -> str: ...
|
||||
def pathname2url(pathname: str) -> str: ...
|
||||
def _pncomp2url(component: Union[str, bytes]) -> str: ...
|
||||
def url2pathname(pathname: str) -> str: ...
|
||||
def pathname2url(pathname: str) -> str: ...
|
||||
def _pncomp2url(component: Union[str, bytes]) -> str: ...
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import CodeType
|
||||
from typing import Any, List, Sequence, Text, Tuple
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
def expr(source: Text) -> STType: ...
|
||||
def suite(source: Text) -> STType: ...
|
||||
def sequence2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def tuple2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
|
||||
def compilest(st: STType, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(st: STType) -> bool: ...
|
||||
def issuite(st: STType) -> bool: ...
|
||||
class ParserError(Exception): ...
|
||||
class STType:
|
||||
def compile(self, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
|
||||
def expr(source: Text) -> STType: ...
|
||||
def suite(source: Text) -> STType: ...
|
||||
def sequence2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def tuple2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
|
||||
def compilest(st: STType, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(st: STType) -> bool: ...
|
||||
def issuite(st: STType) -> bool: ...
|
||||
|
||||
class ParserError(Exception): ...
|
||||
|
||||
class STType:
|
||||
def compile(self, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
|
||||
|
||||
@@ -1,92 +1,90 @@
|
||||
import sys
|
||||
from typing import Dict
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
single_input: int
|
||||
file_input: int
|
||||
eval_input: int
|
||||
decorator: int
|
||||
decorators: int
|
||||
decorated: int
|
||||
async_funcdef: int
|
||||
funcdef: int
|
||||
parameters: int
|
||||
typedargslist: int
|
||||
tfpdef: int
|
||||
varargslist: int
|
||||
vfpdef: int
|
||||
stmt: int
|
||||
simple_stmt: int
|
||||
small_stmt: int
|
||||
expr_stmt: int
|
||||
annassign: int
|
||||
testlist_star_expr: int
|
||||
augassign: int
|
||||
del_stmt: int
|
||||
pass_stmt: int
|
||||
flow_stmt: int
|
||||
break_stmt: int
|
||||
continue_stmt: int
|
||||
return_stmt: int
|
||||
yield_stmt: int
|
||||
raise_stmt: int
|
||||
import_stmt: int
|
||||
import_name: int
|
||||
import_from: int
|
||||
import_as_name: int
|
||||
dotted_as_name: int
|
||||
import_as_names: int
|
||||
dotted_as_names: int
|
||||
dotted_name: int
|
||||
global_stmt: int
|
||||
nonlocal_stmt: int
|
||||
assert_stmt: int
|
||||
compound_stmt: int
|
||||
async_stmt: int
|
||||
if_stmt: int
|
||||
while_stmt: int
|
||||
for_stmt: int
|
||||
try_stmt: int
|
||||
with_stmt: int
|
||||
with_item: int
|
||||
except_clause: int
|
||||
suite: int
|
||||
test: int
|
||||
test_nocond: int
|
||||
lambdef: int
|
||||
lambdef_nocond: int
|
||||
or_test: int
|
||||
and_test: int
|
||||
not_test: int
|
||||
comparison: int
|
||||
comp_op: int
|
||||
star_expr: int
|
||||
expr: int
|
||||
xor_expr: int
|
||||
and_expr: int
|
||||
shift_expr: int
|
||||
arith_expr: int
|
||||
term: int
|
||||
factor: int
|
||||
power: int
|
||||
atom_expr: int
|
||||
atom: int
|
||||
testlist_comp: int
|
||||
trailer: int
|
||||
subscriptlist: int
|
||||
subscript: int
|
||||
sliceop: int
|
||||
exprlist: int
|
||||
testlist: int
|
||||
dictorsetmaker: int
|
||||
classdef: int
|
||||
arglist: int
|
||||
argument: int
|
||||
comp_iter: int
|
||||
comp_for: int
|
||||
comp_if: int
|
||||
encoding_decl: int
|
||||
yield_expr: int
|
||||
yield_arg: int
|
||||
single_input: int
|
||||
file_input: int
|
||||
eval_input: int
|
||||
decorator: int
|
||||
decorators: int
|
||||
decorated: int
|
||||
async_funcdef: int
|
||||
funcdef: int
|
||||
parameters: int
|
||||
typedargslist: int
|
||||
tfpdef: int
|
||||
varargslist: int
|
||||
vfpdef: int
|
||||
stmt: int
|
||||
simple_stmt: int
|
||||
small_stmt: int
|
||||
expr_stmt: int
|
||||
annassign: int
|
||||
testlist_star_expr: int
|
||||
augassign: int
|
||||
del_stmt: int
|
||||
pass_stmt: int
|
||||
flow_stmt: int
|
||||
break_stmt: int
|
||||
continue_stmt: int
|
||||
return_stmt: int
|
||||
yield_stmt: int
|
||||
raise_stmt: int
|
||||
import_stmt: int
|
||||
import_name: int
|
||||
import_from: int
|
||||
import_as_name: int
|
||||
dotted_as_name: int
|
||||
import_as_names: int
|
||||
dotted_as_names: int
|
||||
dotted_name: int
|
||||
global_stmt: int
|
||||
nonlocal_stmt: int
|
||||
assert_stmt: int
|
||||
compound_stmt: int
|
||||
async_stmt: int
|
||||
if_stmt: int
|
||||
while_stmt: int
|
||||
for_stmt: int
|
||||
try_stmt: int
|
||||
with_stmt: int
|
||||
with_item: int
|
||||
except_clause: int
|
||||
suite: int
|
||||
test: int
|
||||
test_nocond: int
|
||||
lambdef: int
|
||||
lambdef_nocond: int
|
||||
or_test: int
|
||||
and_test: int
|
||||
not_test: int
|
||||
comparison: int
|
||||
comp_op: int
|
||||
star_expr: int
|
||||
expr: int
|
||||
xor_expr: int
|
||||
and_expr: int
|
||||
shift_expr: int
|
||||
arith_expr: int
|
||||
term: int
|
||||
factor: int
|
||||
power: int
|
||||
atom_expr: int
|
||||
atom: int
|
||||
testlist_comp: int
|
||||
trailer: int
|
||||
subscriptlist: int
|
||||
subscript: int
|
||||
sliceop: int
|
||||
exprlist: int
|
||||
testlist: int
|
||||
dictorsetmaker: int
|
||||
classdef: int
|
||||
arglist: int
|
||||
argument: int
|
||||
comp_iter: int
|
||||
comp_for: int
|
||||
comp_if: int
|
||||
encoding_decl: int
|
||||
yield_expr: int
|
||||
yield_arg: int
|
||||
|
||||
sym_name: Dict[int, str]
|
||||
sym_name: Dict[int, str]
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
import filecmp
|
||||
import os
|
||||
import re
|
||||
|
||||
import toml
|
||||
|
||||
@@ -97,22 +98,22 @@ def check_same_files():
|
||||
)
|
||||
|
||||
|
||||
_VERSIONS_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_]*): [23]\.\d{1,2}-(?:[23]\.\d{1,2})?$")
|
||||
|
||||
|
||||
def check_versions():
|
||||
versions = {}
|
||||
versions = set()
|
||||
with open("stdlib/VERSIONS") as f:
|
||||
data = f.read().splitlines()
|
||||
for line in data:
|
||||
if not line or line.lstrip().startswith("#"):
|
||||
continue
|
||||
assert ": " in line, f"Bad line in VERSIONS: {line}"
|
||||
module, version = line.split(": ")
|
||||
msg = f"Unsupported Python version{version}"
|
||||
assert version.count(".") == 1, msg
|
||||
major, minor = version.split(".")
|
||||
assert major in {"2", "3"}, msg
|
||||
assert minor.isdigit(), msg
|
||||
m = _VERSIONS_RE.match(line)
|
||||
if not m:
|
||||
raise AssertionError(f"Bad line in VERSIONS: {line}")
|
||||
module = m.group(1)
|
||||
assert module not in versions, f"Duplicate module {module} in VERSIONS"
|
||||
versions[module] = (int(major), int(minor))
|
||||
versions.add(module)
|
||||
modules = set()
|
||||
for entry in os.listdir("stdlib"):
|
||||
if entry == "@python2" or entry == "VERSIONS":
|
||||
@@ -122,9 +123,9 @@ def check_versions():
|
||||
modules.add(mod)
|
||||
else:
|
||||
modules.add(entry)
|
||||
extra = modules - set(versions)
|
||||
extra = modules - versions
|
||||
assert not extra, f"Modules not in versions: {extra}"
|
||||
extra = set(versions) - modules
|
||||
extra = versions - modules
|
||||
assert not extra, f"Versions not in modules: {extra}"
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ def match(fn, args, exclude_list):
|
||||
return True
|
||||
|
||||
|
||||
_VERSION_LINE_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_]*): ([23]\.\d{1,2})-([23]\.\d{1,2})?$")
|
||||
|
||||
|
||||
def parse_versions(fname):
|
||||
with open(fname) as f:
|
||||
data = f.read().splitlines()
|
||||
@@ -79,13 +82,24 @@ def parse_versions(fname):
|
||||
# Allow having some comments or empty lines.
|
||||
if not line.strip() or line.startswith("#"):
|
||||
continue
|
||||
mod, ver_str = line.split(": ")
|
||||
assert ver_str.count(".") == 1
|
||||
major, minor = ver_str.split(".")
|
||||
result[mod] = (int(major), int(minor))
|
||||
m = _VERSION_LINE_RE.match(line)
|
||||
assert m, "invalid VERSIONS line :" + line
|
||||
mod = m.group(1)
|
||||
min_version = parse_version(m.group(2))
|
||||
max_version = parse_version(m.group(3)) if m.group(3) else (99, 99)
|
||||
result[mod] = min_version, max_version
|
||||
return result
|
||||
|
||||
|
||||
_VERSION_RE = re.compile(r"^([23])\.(\d+)$")
|
||||
|
||||
|
||||
def parse_version(v_str):
|
||||
m = _VERSION_RE.match(v_str)
|
||||
assert m, "invalid version :" + v_str
|
||||
return int(m.group(1)), int(m.group(2))
|
||||
|
||||
|
||||
def is_supported(distribution, major):
|
||||
with open(os.path.join(THIRD_PARTY_NAMESPACE, distribution, "METADATA.toml")) as f:
|
||||
data = dict(toml.loads(f.read()))
|
||||
@@ -202,9 +216,8 @@ def main():
|
||||
if name == PY2_NAMESPACE or name == "VERSIONS":
|
||||
continue
|
||||
mod, _ = os.path.splitext(name)
|
||||
if supported_versions[mod] > (major, minor):
|
||||
continue
|
||||
add_files(files, seen, root, name, args, exclude_list)
|
||||
if supported_versions[mod][0] <= (major, minor) <= supported_versions[mod][1]:
|
||||
add_files(files, seen, root, name, args, exclude_list)
|
||||
|
||||
# Next add files for all third party distributions.
|
||||
for distribution in os.listdir(THIRD_PARTY_NAMESPACE):
|
||||
|
||||
Reference in New Issue
Block a user