From 1a66d4cb3e1f6510137bbb5b3356855b23adc89f Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Sat, 30 Nov 2024 04:59:44 -0800 Subject: [PATCH] Updated typeshed stubs to the latest version. --- .../typeshed-fallback/commit.txt | 2 +- .../typeshed-fallback/stdlib/VERSIONS | 9 + .../typeshed-fallback/stdlib/_codecs.pyi | 5 +- .../stdlib/_collections_abc.pyi | 3 + .../typeshed-fallback/stdlib/_csv.pyi | 56 +- .../typeshed-fallback/stdlib/_ctypes.pyi | 221 ++++-- .../typeshed-fallback/stdlib/_curses.pyi | 8 +- .../stdlib/_curses_panel.pyi | 27 + .../typeshed-fallback/stdlib/_dbm.pyi | 13 +- .../typeshed-fallback/stdlib/_decimal.pyi | 9 +- .../typeshed-fallback/stdlib/_hashlib.pyi | 80 ++ .../typeshed-fallback/stdlib/_json.pyi | 1 + .../stdlib/_multibytecodec.pyi | 44 ++ .../stdlib/_posixsubprocess.pyi | 1 - .../typeshed-fallback/stdlib/_socket.pyi | 134 ++-- .../typeshed-fallback/stdlib/_thread.pyi | 8 + .../stdlib/_threading_local.pyi | 4 + .../typeshed-fallback/stdlib/builtins.pyi | 23 +- .../typeshed-fallback/stdlib/bz2.pyi | 1 + .../typeshed-fallback/stdlib/codecs.pyi | 6 +- .../typeshed-fallback/stdlib/configparser.pyi | 26 +- .../typeshed-fallback/stdlib/contextlib.pyi | 12 +- .../typeshed-fallback/stdlib/crypt.pyi | 11 +- .../typeshed-fallback/stdlib/csv.pyi | 10 +- .../stdlib/ctypes/__init__.pyi | 44 +- .../stdlib/ctypes/macholib/__init__.pyi | 1 + .../stdlib/ctypes/macholib/dyld.pyi | 8 + .../stdlib/ctypes/macholib/dylib.pyi | 14 + .../stdlib/ctypes/macholib/framework.pyi | 14 + .../typeshed-fallback/stdlib/ctypes/util.pyi | 2 + .../stdlib/ctypes/wintypes.pyi | 16 +- .../stdlib/curses/__init__.pyi | 20 +- .../typeshed-fallback/stdlib/curses/panel.pyi | 23 +- .../typeshed-fallback/stdlib/datetime.pyi | 21 +- .../typeshed-fallback/stdlib/dbm/__init__.pyi | 4 +- .../typeshed-fallback/stdlib/decimal.pyi | 11 +- .../stdlib/distutils/ccompiler.pyi | 2 +- .../stdlib/distutils/spawn.pyi | 6 +- .../typeshed-fallback/stdlib/doctest.pyi | 16 +- .../stdlib/email/__init__.pyi | 38 +- .../stdlib/email/_policybase.pyi | 2 + .../stdlib/encodings/aliases.pyi | 1 + .../stdlib/encodings/ascii.pyi | 30 + .../stdlib/encodings/base64_codec.pyi | 26 + .../stdlib/encodings/big5.pyi | 23 + .../stdlib/encodings/big5hkscs.pyi | 23 + .../stdlib/encodings/bz2_codec.pyi | 26 + .../stdlib/encodings/charmap.pyi | 33 + .../stdlib/encodings/cp037.pyi | 21 + .../stdlib/encodings/cp1006.pyi | 21 + .../stdlib/encodings/cp1026.pyi | 21 + .../stdlib/encodings/cp1125.pyi | 21 + .../stdlib/encodings/cp1140.pyi | 21 + .../stdlib/encodings/cp1250.pyi | 21 + .../stdlib/encodings/cp1251.pyi | 21 + .../stdlib/encodings/cp1252.pyi | 21 + .../stdlib/encodings/cp1253.pyi | 21 + .../stdlib/encodings/cp1254.pyi | 21 + .../stdlib/encodings/cp1255.pyi | 21 + .../stdlib/encodings/cp1256.pyi | 21 + .../stdlib/encodings/cp1257.pyi | 21 + .../stdlib/encodings/cp1258.pyi | 21 + .../stdlib/encodings/cp273.pyi | 21 + .../stdlib/encodings/cp424.pyi | 21 + .../stdlib/encodings/cp437.pyi | 21 + .../stdlib/encodings/cp500.pyi | 21 + .../stdlib/encodings/cp720.pyi | 21 + .../stdlib/encodings/cp737.pyi | 21 + .../stdlib/encodings/cp775.pyi | 21 + .../stdlib/encodings/cp850.pyi | 21 + .../stdlib/encodings/cp852.pyi | 21 + .../stdlib/encodings/cp855.pyi | 21 + .../stdlib/encodings/cp856.pyi | 21 + .../stdlib/encodings/cp857.pyi | 21 + .../stdlib/encodings/cp858.pyi | 21 + .../stdlib/encodings/cp860.pyi | 21 + .../stdlib/encodings/cp861.pyi | 21 + .../stdlib/encodings/cp862.pyi | 21 + .../stdlib/encodings/cp863.pyi | 21 + .../stdlib/encodings/cp864.pyi | 21 + .../stdlib/encodings/cp865.pyi | 21 + .../stdlib/encodings/cp866.pyi | 21 + .../stdlib/encodings/cp869.pyi | 21 + .../stdlib/encodings/cp874.pyi | 21 + .../stdlib/encodings/cp875.pyi | 21 + .../stdlib/encodings/cp932.pyi | 23 + .../stdlib/encodings/cp949.pyi | 23 + .../stdlib/encodings/cp950.pyi | 23 + .../stdlib/encodings/euc_jis_2004.pyi | 23 + .../stdlib/encodings/euc_jisx0213.pyi | 23 + .../stdlib/encodings/euc_jp.pyi | 23 + .../stdlib/encodings/euc_kr.pyi | 23 + .../stdlib/encodings/gb18030.pyi | 23 + .../stdlib/encodings/gb2312.pyi | 23 + .../stdlib/encodings/gbk.pyi | 23 + .../stdlib/encodings/hex_codec.pyi | 26 + .../stdlib/encodings/hp_roman8.pyi | 21 + .../typeshed-fallback/stdlib/encodings/hz.pyi | 23 + .../stdlib/encodings/idna.pyi | 26 + .../stdlib/encodings/iso2022_jp.pyi | 23 + .../stdlib/encodings/iso2022_jp_1.pyi | 23 + .../stdlib/encodings/iso2022_jp_2.pyi | 23 + .../stdlib/encodings/iso2022_jp_2004.pyi | 23 + .../stdlib/encodings/iso2022_jp_3.pyi | 23 + .../stdlib/encodings/iso2022_jp_ext.pyi | 23 + .../stdlib/encodings/iso2022_kr.pyi | 23 + .../stdlib/encodings/iso8859_1.pyi | 21 + .../stdlib/encodings/iso8859_10.pyi | 21 + .../stdlib/encodings/iso8859_11.pyi | 21 + .../stdlib/encodings/iso8859_13.pyi | 21 + .../stdlib/encodings/iso8859_14.pyi | 21 + .../stdlib/encodings/iso8859_15.pyi | 21 + .../stdlib/encodings/iso8859_16.pyi | 21 + .../stdlib/encodings/iso8859_2.pyi | 21 + .../stdlib/encodings/iso8859_3.pyi | 21 + .../stdlib/encodings/iso8859_4.pyi | 21 + .../stdlib/encodings/iso8859_5.pyi | 21 + .../stdlib/encodings/iso8859_6.pyi | 21 + .../stdlib/encodings/iso8859_7.pyi | 21 + .../stdlib/encodings/iso8859_8.pyi | 21 + .../stdlib/encodings/iso8859_9.pyi | 21 + .../stdlib/encodings/johab.pyi | 23 + .../stdlib/encodings/koi8_r.pyi | 21 + .../stdlib/encodings/koi8_t.pyi | 21 + .../stdlib/encodings/koi8_u.pyi | 21 + .../stdlib/encodings/kz1048.pyi | 21 + .../stdlib/encodings/latin_1.pyi | 30 + .../stdlib/encodings/mac_arabic.pyi | 21 + .../stdlib/encodings/mac_centeuro.pyi | 21 + .../stdlib/encodings/mac_croatian.pyi | 21 + .../stdlib/encodings/mac_cyrillic.pyi | 21 + .../stdlib/encodings/mac_farsi.pyi | 21 + .../stdlib/encodings/mac_greek.pyi | 21 + .../stdlib/encodings/mac_iceland.pyi | 21 + .../stdlib/encodings/mac_latin2.pyi | 21 + .../stdlib/encodings/mac_roman.pyi | 21 + .../stdlib/encodings/mac_romanian.pyi | 21 + .../stdlib/encodings/mac_turkish.pyi | 21 + .../stdlib/encodings/mbcs.pyi | 28 + .../stdlib/encodings/oem.pyi | 28 + .../stdlib/encodings/palmos.pyi | 21 + .../stdlib/encodings/ptcp154.pyi | 21 + .../stdlib/encodings/punycode.pyi | 33 + .../stdlib/encodings/quopri_codec.pyi | 26 + .../stdlib/encodings/raw_unicode_escape.pyi | 34 + .../stdlib/encodings/rot_13.pyi | 23 + .../stdlib/encodings/shift_jis.pyi | 23 + .../stdlib/encodings/shift_jis_2004.pyi | 23 + .../stdlib/encodings/shift_jisx0213.pyi | 23 + .../stdlib/encodings/tis_620.pyi | 21 + .../stdlib/encodings/undefined.pyi | 20 + .../stdlib/encodings/unicode_escape.pyi | 34 + .../stdlib/encodings/utf_16.pyi | 20 + .../stdlib/encodings/utf_16_be.pyi | 26 + .../stdlib/encodings/utf_16_le.pyi | 26 + .../stdlib/encodings/utf_32.pyi | 20 + .../stdlib/encodings/utf_32_be.pyi | 26 + .../stdlib/encodings/utf_32_le.pyi | 26 + .../stdlib/encodings/utf_7.pyi | 26 + .../stdlib/encodings/utf_8.pyi | 9 +- .../stdlib/encodings/uu_codec.pyi | 28 + .../stdlib/encodings/zlib_codec.pyi | 26 + .../typeshed-fallback/stdlib/fcntl.pyi | 4 +- .../typeshed-fallback/stdlib/gettext.pyi | 2 + .../typeshed-fallback/stdlib/hashlib.pyi | 93 +-- .../typeshed-fallback/stdlib/hmac.pyi | 15 +- .../stdlib/importlib/resources/abc.pyi | 2 + .../typeshed-fallback/stdlib/ipaddress.pyi | 53 +- .../typeshed-fallback/stdlib/json/scanner.pyi | 3 + .../typeshed-fallback/stdlib/modulefinder.pyi | 2 + .../stdlib/multiprocessing/context.pyi | 3 +- .../stdlib/multiprocessing/sharedctypes.pyi | 3 +- .../stdlib/multiprocessing/synchronize.pyi | 14 +- .../typeshed-fallback/stdlib/os/__init__.pyi | 550 ++++++++++++-- .../typeshed-fallback/stdlib/platform.pyi | 44 +- .../typeshed-fallback/stdlib/posix.pyi | 40 +- .../typeshed-fallback/stdlib/pstats.pyi | 40 +- .../stdlib/pyexpat/__init__.pyi | 4 +- .../typeshed-fallback/stdlib/sched.pyi | 7 +- .../typeshed-fallback/stdlib/socket.pyi | 683 ++++++++++++++++-- .../stdlib/sqlite3/__init__.pyi | 4 +- .../typeshed-fallback/stdlib/sqlite3/dump.pyi | 2 + .../typeshed-fallback/stdlib/ssl.pyi | 4 +- .../typeshed-fallback/stdlib/sys/__init__.pyi | 120 ++- .../typeshed-fallback/stdlib/termios.pyi | 180 +++-- .../stdlib/tkinter/__init__.pyi | 153 ++-- .../typeshed-fallback/stdlib/tkinter/font.pyi | 4 +- .../typeshed-fallback/stdlib/tokenize.pyi | 4 +- .../typeshed-fallback/stdlib/turtle.pyi | 19 +- .../typeshed-fallback/stdlib/typing.pyi | 18 +- .../stdlib/typing_extensions.pyi | 13 +- .../typeshed-fallback/stdlib/webbrowser.pyi | 1 + .../stdlib/wsgiref/types.pyi | 4 +- .../typeshed-fallback/stdlib/xml/__init__.pyi | 4 +- .../stdlib/zipfile/_path.pyi | 2 + .../typeshed-fallback/stdlib/zlib.pyi | 30 +- .../stubs/Deprecated/METADATA.toml | 2 +- .../stubs/Deprecated/deprecated/classic.pyi | 7 +- .../stubs/Deprecated/deprecated/sphinx.pyi | 1 + .../stubs/bleach/METADATA.toml | 2 +- .../stubs/docutils/docutils/core.pyi | 217 +++++- .../docutils/docutils/writers/__init__.pyi | 62 +- .../stubs/gevent/METADATA.toml | 2 +- .../stubs/gevent/gevent/events.pyi | 4 +- .../stubs/icalendar/METADATA.toml | 8 +- .../stubs/icalendar/icalendar/__init__.pyi | 14 + .../stubs/icalendar/icalendar/alarms.pyi | 54 ++ .../stubs/icalendar/icalendar/cal.pyi | 148 +++- .../stubs/icalendar/icalendar/prop.pyi | 15 +- .../icalendar/icalendar/timezone/__init__.pyi | 5 +- .../timezone/equivalent_timezone_ids.pyi | 15 + .../equivalent_timezone_ids_result.pyi | 6 + .../icalendar/icalendar/timezone/tzid.pyi | 8 + .../icalendar/icalendar/timezone/tzp.pyi | 4 +- .../stubs/icalendar/icalendar/tools.pyi | 13 +- .../stubs/networkx/METADATA.toml | 2 +- .../components/strongly_connected.pyi | 2 - .../networkx/algorithms/tree/branchings.pyi | 31 - .../networkx/algorithms/tree/operations.pyi | 2 +- .../networkx/networkx/classes/reportviews.pyi | 4 +- .../networkx/networkx/drawing/layout.pyi | 4 + .../networkx/networkx/generators/trees.pyi | 4 - .../readwrite/json_graph/node_link.pyi | 14 +- .../networkx/networkx/readwrite/text.pyi | 5 +- .../stubs/networkx/networkx/utils/configs.pyi | 22 +- .../stubs/openpyxl/openpyxl/__init__.pyi | 3 +- .../stubs/openpyxl/openpyxl/cell/__init__.pyi | 2 + .../stubs/openpyxl/openpyxl/cell/_writer.pyi | 6 +- .../stubs/openpyxl/openpyxl/cell/cell.pyi | 4 +- .../openpyxl/comments/comment_sheet.pyi | 3 +- .../openpyxl/openpyxl/workbook/workbook.pyi | 4 +- .../openpyxl/worksheet/_read_only.pyi | 19 +- .../openpyxl/openpyxl/worksheet/_reader.pyi | 5 +- .../openpyxl/openpyxl/worksheet/_writer.pyi | 7 +- .../openpyxl/openpyxl/worksheet/merge.pyi | 3 +- .../openpyxl/openpyxl/worksheet/worksheet.pyi | 49 +- .../stubs/peewee/METADATA.toml | 2 +- .../typeshed-fallback/stubs/peewee/peewee.pyi | 4 +- .../stubs/pynput/pynput/_util.pyi | 4 +- .../stubs/pysftp/pysftp/__init__.pyi | 4 +- .../stubs/pywin32/isapi/install.pyi | 98 +++ .../stubs/pywin32/win32/win32clipboard.pyi | 50 +- .../stubs/setuptools/METADATA.toml | 2 +- .../stubs/setuptools/distutils/spawn.pyi | 1 + .../stubs/setuptools/setuptools/__init__.pyi | 13 +- .../setuptools/_distutils/ccompiler.pyi | 4 +- .../setuptools/setuptools/_distutils/cmd.pyi | 4 +- .../setuptools/_distutils/spawn.pyi | 7 + .../setuptools/setuptools/build_meta.pyi | 6 +- .../setuptools/command/bdist_egg.pyi | 17 +- .../setuptools/command/bdist_wheel.pyi | 8 +- .../setuptools/command/build_ext.pyi | 3 +- .../setuptools/command/build_py.pyi | 13 +- .../setuptools/command/easy_install.pyi | 29 +- .../setuptools/command/editable_wheel.pyi | 2 +- .../setuptools/command/egg_info.pyi | 2 +- .../setuptools/command/install_egg_info.pyi | 2 +- .../setuptools/setuptools/command/sdist.pyi | 3 +- .../setuptools/setuptools/command/test.pyi | 4 +- .../setuptools/setuptools/config/__init__.pyi | 15 +- .../setuptools/setuptools/config/expand.pyi | 2 +- .../setuptools/setuptools/config/setupcfg.pyi | 12 +- .../stubs/setuptools/setuptools/depends.pyi | 12 +- .../stubs/setuptools/setuptools/dist.pyi | 2 +- .../stubs/setuptools/setuptools/msvc.pyi | 15 +- .../setuptools/setuptools/package_index.pyi | 10 +- .../stubs/setuptools/setuptools/sandbox.pyi | 6 +- .../stubs/tqdm/METADATA.toml | 3 +- .../stubs/tqdm/tqdm/contrib/discord.pyi | 17 +- .../stubs/waitress/waitress/runner.pyi | 6 +- 270 files changed, 6061 insertions(+), 883 deletions(-) create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/_curses_panel.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/_hashlib.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/_multibytecodec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/__init__.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dyld.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dylib.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/framework.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/aliases.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/ascii.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/base64_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5hkscs.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/bz2_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/charmap.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp037.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1006.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1026.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1125.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1140.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1250.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1251.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1252.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1253.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1254.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1255.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1256.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1257.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1258.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp273.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp424.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp437.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp500.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp720.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp737.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp775.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp850.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp852.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp855.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp856.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp857.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp858.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp860.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp861.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp862.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp863.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp864.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp865.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp866.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp869.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp874.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp875.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp932.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp949.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp950.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jis_2004.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jisx0213.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jp.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_kr.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb18030.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb2312.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/gbk.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/hex_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/hp_roman8.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/hz.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/idna.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_1.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2004.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_3.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_ext.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_kr.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_1.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_10.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_11.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_13.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_14.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_15.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_16.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_2.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_3.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_4.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_5.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_6.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_7.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_8.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_9.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/johab.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_r.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_t.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_u.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/kz1048.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/latin_1.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_arabic.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_croatian.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_cyrillic.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_farsi.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_greek.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_iceland.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_latin2.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_roman.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_romanian.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_turkish.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/mbcs.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/oem.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/palmos.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/ptcp154.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/punycode.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/quopri_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/raw_unicode_escape.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/rot_13.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis_2004.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jisx0213.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/tis_620.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/undefined.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/unicode_escape.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_be.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_le.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_be.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_le.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_7.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/uu_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/encodings/zlib_codec.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/dump.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/alarms.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids_result.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzid.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/pywin32/isapi/install.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/setuptools/distutils/spawn.pyi create mode 100644 packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/spawn.pyi diff --git a/packages/pyright-internal/typeshed-fallback/commit.txt b/packages/pyright-internal/typeshed-fallback/commit.txt index 598e609ae1d3..ee0e813f0467 100644 --- a/packages/pyright-internal/typeshed-fallback/commit.txt +++ b/packages/pyright-internal/typeshed-fallback/commit.txt @@ -1 +1 @@ -af4df4eb24f1cda42033f74440ba1117ce4c8f7e +2ccc53bb6716463680fcf1d204642c46299b7f88 diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS index 702fdbab75c0..7ff14c55d3a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS +++ b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS @@ -33,6 +33,7 @@ _contextvars: 3.7- _csv: 3.0- _ctypes: 3.0- _curses: 3.0- +_curses_panel: 3.0- _dbm: 3.0- _decimal: 3.3- _dummy_thread: 3.0-3.8 @@ -40,6 +41,7 @@ _dummy_threading: 3.0-3.8 _frozen_importlib: 3.0- _frozen_importlib_external: 3.5- _gdbm: 3.0- +_hashlib: 3.0- _heapq: 3.0- _imp: 3.0- _interpchannels: 3.13- @@ -52,6 +54,7 @@ _lsprof: 3.0- _lzma: 3.3- _markupbase: 3.0- _msi: 3.0-3.12 +_multibytecodec: 3.0- _operator: 3.4- _osx_support: 3.0- _posixsubprocess: 3.2- @@ -139,6 +142,12 @@ doctest: 3.0- dummy_threading: 3.0-3.8 email: 3.0- encodings: 3.0- +encodings.cp1125: 3.4- +encodings.cp273: 3.4- +encodings.cp858: 3.2- +encodings.koi8_t: 3.5- +encodings.kz1048: 3.5- +encodings.mac_centeuro: 3.0-3.8 ensurepip: 3.0- enum: 3.4- errno: 3.0- diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_codecs.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_codecs.pyi index ecf874d33ddd..11c5d58a855b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_codecs.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_codecs.pyi @@ -2,10 +2,13 @@ import codecs import sys from _typeshed import ReadableBuffer from collections.abc import Callable -from typing import Literal, overload +from typing import Literal, final, overload, type_check_only from typing_extensions import TypeAlias # This type is not exposed; it is defined in unicodeobject.c +# At runtime it calls itself builtins.EncodingMap +@final +@type_check_only class _EncodingMap: def size(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi index 8b1ac9c7eb8b..bf7f2991f9a4 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi @@ -73,6 +73,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. @final class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... + def __reversed__(self) -> Iterator[_KT_co]: ... if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ... if sys.version_info >= (3, 10): @@ -81,6 +82,7 @@ class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented @final class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented + def __reversed__(self) -> Iterator[_VT_co]: ... if sys.version_info >= (3, 10): @property def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... @@ -88,6 +90,7 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented @final class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... + def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ... if sys.version_info >= (3, 10): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi index 0e206a63b260..afa2870be158 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi @@ -1,9 +1,9 @@ import csv import sys from _typeshed import SupportsWrite -from collections.abc import Iterable, Iterator -from typing import Any, Final -from typing_extensions import TypeAlias +from collections.abc import Iterable +from typing import Any, Final, type_check_only +from typing_extensions import Self, TypeAlias __version__: Final[str] @@ -45,17 +45,47 @@ class Dialect: strict: bool = False, ) -> None: ... -class _reader(Iterator[list[str]]): - @property - def dialect(self) -> Dialect: ... - line_num: int - def __next__(self) -> list[str]: ... +if sys.version_info >= (3, 10): + # This class calls itself _csv.reader. + class Reader: + @property + def dialect(self) -> Dialect: ... + line_num: int + def __iter__(self) -> Self: ... + def __next__(self) -> list[str]: ... -class _writer: - @property - def dialect(self) -> Dialect: ... - def writerow(self, row: Iterable[Any]) -> Any: ... - def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ... + # This class calls itself _csv.writer. + class Writer: + @property + def dialect(self) -> Dialect: ... + if sys.version_info >= (3, 13): + def writerow(self, row: Iterable[Any], /) -> Any: ... + def writerows(self, rows: Iterable[Iterable[Any]], /) -> None: ... + else: + def writerow(self, row: Iterable[Any]) -> Any: ... + def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ... + + # For the return types below. + # These aliases can be removed when typeshed drops support for 3.9. + _reader = Reader + _writer = Writer +else: + # This class is not exposed. It calls itself _csv.reader. + @type_check_only + class _reader: + @property + def dialect(self) -> Dialect: ... + line_num: int + def __iter__(self) -> Self: ... + def __next__(self) -> list[str]: ... + + # This class is not exposed. It calls itself _csv.writer. + @type_check_only + class _writer: + @property + def dialect(self) -> Dialect: ... + def writerow(self, row: Iterable[Any]) -> Any: ... + def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ... def writer( csvfile: SupportsWrite[str], diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi index f4d26d05323a..1f3f8f38802b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi @@ -1,9 +1,10 @@ +import _typeshed import sys -from _typeshed import ReadableBuffer, WriteableBuffer +from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer from abc import abstractmethod from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p -from typing import Any, ClassVar, Generic, TypeVar, overload +from typing import Any, ClassVar, Generic, TypeVar, final, overload, type_check_only from typing_extensions import Self, TypeAlias if sys.version_info >= (3, 9): @@ -47,46 +48,79 @@ if sys.platform == "win32": def LoadLibrary(name: str, load_flags: int = 0, /) -> int: ... def FreeLibrary(handle: int, /) -> None: ... -class _CDataMeta(type): - # By default mypy complains about the following two methods, because strictly speaking cls - # might not be a Type[_CT]. However this can never actually happen, because the only class that - # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. - def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] - def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] +else: + def dlclose(handle: int, /) -> None: ... + # The default for flag is RTLD_GLOBAL|RTLD_LOCAL, which is platform dependent. + def dlopen(name: StrOrBytesPath, flag: int = ..., /) -> int: ... + def dlsym(handle: int, name: str, /) -> int: ... -class _CData(metaclass=_CDataMeta): +if sys.version_info >= (3, 13): + # This class is not exposed. It calls itself _ctypes.CType_Type. + @type_check_only + class _CType_Type(type): + # By default mypy complains about the following two methods, because strictly speaking cls + # might not be a Type[_CT]. However this doesn't happen because this is only a + # metaclass for subclasses of _CData. + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + + _CTypeBaseType = _CType_Type + +else: + _CTypeBaseType = type + +# This class is not exposed. +@type_check_only +class _CData: _b_base_: int _b_needsfree_: bool _objects: Mapping[Any, int] | None - # At runtime the following classmethods are available only on classes, not - # on instances. This can't be reflected properly in the type system: - # - # Structure.from_buffer(...) # valid at runtime - # Structure(...).from_buffer(...) # invalid at runtime - # - @classmethod - def from_buffer(cls, source: WriteableBuffer, offset: int = ...) -> Self: ... - @classmethod - def from_buffer_copy(cls, source: ReadableBuffer, offset: int = ...) -> Self: ... - @classmethod - def from_address(cls, address: int) -> Self: ... - @classmethod - def from_param(cls, value: Any, /) -> Self | _CArgObject: ... - @classmethod - def in_dll(cls, library: CDLL, name: str) -> Self: ... def __buffer__(self, flags: int, /) -> memoryview: ... - def __release_buffer__(self, buffer: memoryview, /) -> None: ... + def __ctypes_from_outparam__(self, /) -> Self: ... -class _SimpleCData(_CData, Generic[_T]): +# this is a union of all the subclasses of _CData, which is useful because of +# the methods that are present on each of those subclasses which are not present +# on _CData itself. +_CDataType: TypeAlias = _SimpleCData[Any] | _Pointer[Any] | CFuncPtr | Union | Structure | Array[Any] + +# This class is not exposed. It calls itself _ctypes.PyCSimpleType. +@type_check_only +class _PyCSimpleType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(self: type[_CT], value: int, /) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(self: type[_CT], value: int, /) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class _SimpleCData(_CData, Generic[_T], metaclass=_PyCSimpleType): value: _T # The TypeVar can be unsolved here, # but we can't use overloads without creating many, many mypy false-positive errors def __init__(self, value: _T = ...) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] + def __ctypes_from_outparam__(self, /) -> _T: ... # type: ignore[override] class _CanCastTo(_CData): ... class _PointerLike(_CanCastTo): ... -class _Pointer(_PointerLike, _CData, Generic[_CT]): +# This type is not exposed. It calls itself _ctypes.PyCPointerType. +@type_check_only +class _PyCPointerType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + def set_type(self, type: Any, /) -> None: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType): _type_: type[_CT] contents: _CT @overload @@ -105,16 +139,32 @@ def POINTER(type: None, /) -> type[c_void_p]: ... def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ... def pointer(obj: _CT, /) -> _Pointer[_CT]: ... +# This class is not exposed. It calls itself _ctypes.CArgObject. +@final +@type_check_only class _CArgObject: ... -def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... +def byref(obj: _CData | _CDataType, offset: int = ...) -> _CArgObject: ... -_ECT: TypeAlias = Callable[[_CData | None, CFuncPtr, tuple[_CData, ...]], _CData] +_ECT: TypeAlias = Callable[[_CData | _CDataType | None, CFuncPtr, tuple[_CData | _CDataType, ...]], _CDataType] _PF: TypeAlias = tuple[int] | tuple[int, str | None] | tuple[int, str | None, Any] -class CFuncPtr(_PointerLike, _CData): - restype: type[_CData] | Callable[[int], Any] | None - argtypes: Sequence[type[_CData]] +# This class is not exposed. It calls itself _ctypes.PyCFuncPtrType. +@type_check_only +class _PyCFuncPtrType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType): + restype: type[_CDataType] | Callable[[int], Any] | None + argtypes: Sequence[type[_CDataType]] errcheck: _ECT # Abstract attribute that must be defined on subclasses _flags_: ClassVar[int] @@ -129,7 +179,7 @@ class CFuncPtr(_PointerLike, _CData): if sys.platform == "win32": @overload def __init__( - self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | None = ..., / + self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., / ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @@ -137,30 +187,95 @@ class CFuncPtr(_PointerLike, _CData): _GetT = TypeVar("_GetT") _SetT = TypeVar("_SetT") +# This class is not exposed. It calls itself _ctypes.CField. +@final +@type_check_only class _CField(Generic[_CT, _GetT, _SetT]): offset: int size: int - @overload - def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ... - @overload - def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ... + if sys.version_info >= (3, 10): + @overload + def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ... + @overload + def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ... + else: + @overload + def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ... + @overload + def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ... + def __set__(self, instance: Any, value: _SetT, /) -> None: ... -class _StructUnionMeta(_CDataMeta): - _fields_: Sequence[tuple[str, type[_CData]] | tuple[str, type[_CData], int]] - _pack_: int - _anonymous_: Sequence[str] +# This class is not exposed. It calls itself _ctypes.UnionType. +@type_check_only +class _UnionType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + # At runtime, various attributes are created on a Union subclass based + # on its _fields_. This method doesn't exist, but represents those + # dynamically created attributes. def __getattr__(self, name: str) -> _CField[Any, Any, Any]: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class Union(_CData, metaclass=_UnionType): + _fields_: ClassVar[Sequence[tuple[str, type[_CDataType]] | tuple[str, type[_CDataType], int]]] + _pack_: ClassVar[int] + _anonymous_: ClassVar[Sequence[str]] + if sys.version_info >= (3, 13): + _align_: ClassVar[int] + + def __init__(self, *args: Any, **kw: Any) -> None: ... + def __getattr__(self, name: str) -> Any: ... + def __setattr__(self, name: str, value: Any) -> None: ... + +# This class is not exposed. It calls itself _ctypes.PyCStructType. +@type_check_only +class _PyCStructType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + # At runtime, various attributes are created on a Structure subclass based + # on its _fields_. This method doesn't exist, but represents those + # dynamically created attributes. + def __getattr__(self, name: str) -> _CField[Any, Any, Any]: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class Structure(_CData, metaclass=_PyCStructType): + _fields_: ClassVar[Sequence[tuple[str, type[_CDataType]] | tuple[str, type[_CDataType], int]]] + _pack_: ClassVar[int] + _anonymous_: ClassVar[Sequence[str]] + if sys.version_info >= (3, 13): + _align_: ClassVar[int] -class _StructUnionBase(_CData, metaclass=_StructUnionMeta): def __init__(self, *args: Any, **kw: Any) -> None: ... def __getattr__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... -class Union(_StructUnionBase): ... -class Structure(_StructUnionBase): ... +# This class is not exposed. It calls itself _ctypes.PyCArrayType. +@type_check_only +class _PyCArrayType(_CTypeBaseType): + def from_address(self: type[_typeshed.Self], value: int, /) -> _typeshed.Self: ... + def from_buffer(self: type[_typeshed.Self], obj: WriteableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... + def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... + def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... + if sys.version_info < (3, 13): + # Inherited from CType_Type starting on 3.13 + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] -class Array(_CData, Generic[_CT]): +class Array(_CData, Generic[_CT], metaclass=_PyCArrayType): @property @abstractmethod def _length_(self) -> int: ... @@ -205,9 +320,15 @@ class Array(_CData, Generic[_CT]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... -def addressof(obj: _CData, /) -> int: ... -def alignment(obj_or_type: _CData | type[_CData], /) -> int: ... +def addressof(obj: _CData | _CDataType, /) -> int: ... +def alignment(obj_or_type: _CData | _CDataType | type[_CData | _CDataType], /) -> int: ... def get_errno() -> int: ... -def resize(obj: _CData, size: int, /) -> None: ... +def resize(obj: _CData | _CDataType, size: int, /) -> None: ... def set_errno(value: int, /) -> int: ... -def sizeof(obj_or_type: _CData | type[_CData], /) -> int: ... +def sizeof(obj_or_type: _CData | _CDataType | type[_CData | _CDataType], /) -> int: ... +def PyObj_FromPtr(address: int, /) -> Any: ... +def Py_DECREF(o: _T, /) -> _T: ... +def Py_INCREF(o: _T, /) -> _T: ... +def buffer_info(o: _CData | _CDataType | type[_CData | _CDataType], /) -> tuple[str, int, tuple[int, ...]]: ... +def call_cdeclfunction(address: int, arguments: tuple[Any, ...], /) -> Any: ... +def call_function(address: int, arguments: tuple[Any, ...], /) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi index 80075d77e8e6..9e06a1414da5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import ReadOnlyBuffer, SupportsRead -from typing import IO, Any, NamedTuple, final, overload +from curses import _ncurses_version +from typing import IO, Any, final, overload from typing_extensions import TypeAlias # NOTE: This module is ordinarily only available on Unix, but the windows-curses @@ -549,9 +550,4 @@ class window: # undocumented @overload def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ... -class _ncurses_version(NamedTuple): - major: int - minor: int - patch: int - ncurses_version: _ncurses_version diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_curses_panel.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_curses_panel.pyi new file mode 100644 index 000000000000..ddec22236b96 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_curses_panel.pyi @@ -0,0 +1,27 @@ +from _curses import window +from typing import final + +__version__: str +version: str + +class error(Exception): ... + +@final +class panel: + def above(self) -> panel: ... + def below(self) -> panel: ... + def bottom(self) -> None: ... + def hidden(self) -> bool: ... + def hide(self) -> None: ... + def move(self, y: int, x: int, /) -> None: ... + def replace(self, win: window, /) -> None: ... + def set_userptr(self, obj: object, /) -> None: ... + def show(self) -> None: ... + def top(self) -> None: ... + def userptr(self) -> object: ... + def window(self) -> window: ... + +def bottom_panel() -> panel: ... +def new_panel(win: window, /) -> panel: ... +def top_panel() -> panel: ... +def update_panels() -> panel: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_dbm.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_dbm.pyi index 4113a7e3ffb9..7e53cca3c704 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_dbm.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_dbm.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import ReadOnlyBuffer, StrOrBytesPath from types import TracebackType -from typing import TypeVar, overload +from typing import TypeVar, final, overload, type_check_only from typing_extensions import Self, TypeAlias if sys.platform != "win32": @@ -13,6 +13,8 @@ if sys.platform != "win32": library: str # Actual typename dbm, not exposed by the implementation + @final + @type_check_only class _dbm: def close(self) -> None: ... if sys.version_info >= (3, 13): @@ -22,18 +24,17 @@ if sys.platform != "win32": def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... def __delitem__(self, key: _KeyType) -> None: ... def __len__(self) -> int: ... - def __del__(self) -> None: ... def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @overload - def get(self, k: _KeyType) -> bytes | None: ... + def get(self, k: _KeyType, /) -> bytes | None: ... @overload - def get(self, k: _KeyType, default: _T) -> bytes | _T: ... + def get(self, k: _KeyType, default: _T, /) -> bytes | _T: ... def keys(self) -> list[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime + def setdefault(self, k: _KeyType, default: _ValueType = ..., /) -> bytes: ... + # This isn't true, but the class can't be instantiated. See #13024 __new__: None # type: ignore[assignment] __init__: None # type: ignore[assignment] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_decimal.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_decimal.pyi index 9fcc08dbb95d..cdd0268a1bdf 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_decimal.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_decimal.pyi @@ -17,20 +17,13 @@ from decimal import ( Rounded as Rounded, Subnormal as Subnormal, Underflow as Underflow, + _ContextManager, ) -from types import TracebackType from typing import Final from typing_extensions import TypeAlias _TrapType: TypeAlias = type[DecimalException] -class _ContextManager: - new_context: Context - saved_context: Context - def __init__(self, new_context: Context) -> None: ... - def __enter__(self) -> Context: ... - def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... - __version__: Final[str] __libmpdec_version__: Final[str] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_hashlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_hashlib.pyi new file mode 100644 index 000000000000..5cf85e4cacaa --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_hashlib.pyi @@ -0,0 +1,80 @@ +import sys +from _typeshed import ReadableBuffer +from collections.abc import Callable +from types import ModuleType +from typing import AnyStr, final, overload +from typing_extensions import Self, TypeAlias + +_DigestMod: TypeAlias = str | Callable[[], HASH] | ModuleType | None + +openssl_md_meth_names: frozenset[str] + +class HASH: + @property + def digest_size(self) -> int: ... + @property + def block_size(self) -> int: ... + @property + def name(self) -> str: ... + def copy(self) -> Self: ... + def digest(self) -> bytes: ... + def hexdigest(self) -> str: ... + def update(self, obj: ReadableBuffer, /) -> None: ... + +if sys.version_info >= (3, 10): + class UnsupportedDigestmodError(ValueError): ... + +if sys.version_info >= (3, 9): + class HASHXOF(HASH): + def digest(self, length: int) -> bytes: ... # type: ignore[override] + def hexdigest(self, length: int) -> str: ... # type: ignore[override] + + @final + class HMAC: + @property + def digest_size(self) -> int: ... + @property + def block_size(self) -> int: ... + @property + def name(self) -> str: ... + def copy(self) -> Self: ... + def digest(self) -> bytes: ... + def hexdigest(self) -> str: ... + def update(self, msg: ReadableBuffer) -> None: ... + + @overload + def compare_digest(a: ReadableBuffer, b: ReadableBuffer, /) -> bool: ... + @overload + def compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ... + def get_fips_mode() -> int: ... + def hmac_new(key: bytes | bytearray, msg: ReadableBuffer = b"", digestmod: _DigestMod = None) -> HMAC: ... + def new(name: str, string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_md5(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha1(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha3_224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha3_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha3_384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_sha3_512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ... + def openssl_shake_128(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASHXOF: ... + def openssl_shake_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASHXOF: ... + +else: + def new(name: str, string: ReadableBuffer = b"") -> HASH: ... + def openssl_md5(string: ReadableBuffer = b"") -> HASH: ... + def openssl_sha1(string: ReadableBuffer = b"") -> HASH: ... + def openssl_sha224(string: ReadableBuffer = b"") -> HASH: ... + def openssl_sha256(string: ReadableBuffer = b"") -> HASH: ... + def openssl_sha384(string: ReadableBuffer = b"") -> HASH: ... + def openssl_sha512(string: ReadableBuffer = b"") -> HASH: ... + +def hmac_digest(key: bytes | bytearray, msg: ReadableBuffer, digest: str) -> bytes: ... +def pbkdf2_hmac( + hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = None +) -> bytes: ... +def scrypt( + password: ReadableBuffer, *, salt: ReadableBuffer, n: int, r: int, p: int, maxmem: int = 0, dklen: int = 64 +) -> bytes: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi index 069fb6eac4bf..e1c7c52ca3b1 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi @@ -45,5 +45,6 @@ class make_scanner: def __init__(self, context: make_scanner) -> None: ... def __call__(self, string: str, index: int) -> tuple[Any, int]: ... +def encode_basestring(s: str, /) -> str: ... def encode_basestring_ascii(s: str, /) -> str: ... def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_multibytecodec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_multibytecodec.pyi new file mode 100644 index 000000000000..7e408f2aa30e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_multibytecodec.pyi @@ -0,0 +1,44 @@ +from _typeshed import ReadableBuffer +from codecs import _ReadableStream, _WritableStream +from collections.abc import Iterable +from typing import final, type_check_only + +# This class is not exposed. It calls itself _multibytecodec.MultibyteCodec. +@final +@type_check_only +class _MultibyteCodec: + def decode(self, input: ReadableBuffer, errors: str | None = None) -> str: ... + def encode(self, input: str, errors: str | None = None) -> bytes: ... + +class MultibyteIncrementalDecoder: + errors: str + def __init__(self, errors: str = "strict") -> None: ... + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + def getstate(self) -> tuple[bytes, int]: ... + def reset(self) -> None: ... + def setstate(self, state: tuple[bytes, int], /) -> None: ... + +class MultibyteIncrementalEncoder: + errors: str + def __init__(self, errors: str = "strict") -> None: ... + def encode(self, input: str, final: bool = False) -> bytes: ... + def getstate(self) -> int: ... + def reset(self) -> None: ... + def setstate(self, state: int, /) -> None: ... + +class MultibyteStreamReader: + errors: str + stream: _ReadableStream + def __init__(self, stream: _ReadableStream, errors: str = "strict") -> None: ... + def read(self, sizeobj: int | None = None, /) -> str: ... + def readline(self, sizeobj: int | None = None, /) -> str: ... + def readlines(self, sizehintobj: int | None = None, /) -> list[str]: ... + def reset(self) -> None: ... + +class MultibyteStreamWriter: + errors: str + stream: _WritableStream + def __init__(self, stream: _WritableStream, errors: str = "strict") -> None: ... + def reset(self) -> None: ... + def write(self, strobj: str, /) -> None: ... + def writelines(self, lines: Iterable[str], /) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_posixsubprocess.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_posixsubprocess.pyi index 3df56d9a3d03..df05dcd80be8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_posixsubprocess.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_posixsubprocess.pyi @@ -4,7 +4,6 @@ from collections.abc import Callable, Sequence from typing import SupportsIndex if sys.platform != "win32": - def cloexec_pipe() -> tuple[int, int]: ... def fork_exec( args: Sequence[StrOrBytesPath] | None, executable_list: Sequence[bytes], diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi index 7e4cf4e0364a..36bc5c31c646 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer, WriteableBuffer from collections.abc import Iterable from socket import error as error, gaierror as gaierror, herror as herror, timeout as timeout from typing import Any, SupportsIndex, overload -from typing_extensions import TypeAlias +from typing_extensions import CapsuleType, TypeAlias _CMSG: TypeAlias = tuple[int, int, bytes] _CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer] @@ -72,7 +72,8 @@ SO_SNDBUF: int SO_SNDLOWAT: int SO_SNDTIMEO: int SO_TYPE: int -SO_USELOOPBACK: int +if sys.platform != "linux": + SO_USELOOPBACK: int if sys.platform == "win32": SO_EXCLUSIVEADDRUSE: int if sys.platform != "win32": @@ -87,7 +88,10 @@ if sys.platform != "win32" and sys.platform != "darwin": SO_PEERSEC: int SO_PRIORITY: int SO_PROTOCOL: int +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": SO_SETFIB: int +if sys.platform == "linux" and sys.version_info >= (3, 13): + SO_BINDTOIFINDEX: int SOMAXCONN: int @@ -99,27 +103,32 @@ MSG_TRUNC: int MSG_WAITALL: int if sys.platform != "win32": MSG_DONTWAIT: int - MSG_EOF: int MSG_EOR: int MSG_NOSIGNAL: int # Sometimes this exists on darwin, sometimes not if sys.platform != "darwin": - MSG_BCAST: int MSG_ERRQUEUE: int +if sys.platform == "win32": + MSG_BCAST: int MSG_MCAST: int if sys.platform != "win32" and sys.platform != "darwin": - MSG_BTAG: int MSG_CMSG_CLOEXEC: int MSG_CONFIRM: int - MSG_ETAG: int MSG_FASTOPEN: int MSG_MORE: int +if sys.platform != "win32" and sys.platform != "linux": + MSG_EOF: int +if sys.platform != "win32" and sys.platform != "linux" and sys.platform != "darwin": MSG_NOTIFICATION: int + MSG_BTAG: int # Not FreeBSD either + MSG_ETAG: int # Not FreeBSD either SOL_IP: int SOL_SOCKET: int SOL_TCP: int SOL_UDP: int if sys.platform != "win32" and sys.platform != "darwin": + # Defined in socket.h for Linux, but these aren't always present for + # some reason. SOL_ATALK: int SOL_AX25: int SOL_HCI: int @@ -128,10 +137,11 @@ if sys.platform != "win32" and sys.platform != "darwin": SOL_ROSE: int if sys.platform != "win32": - SCM_CREDS: int SCM_RIGHTS: int if sys.platform != "win32" and sys.platform != "darwin": SCM_CREDENTIALS: int +if sys.platform != "win32" and sys.platform != "linux": + SCM_CREDS: int IPPROTO_ICMP: int IPPROTO_IP: int @@ -143,21 +153,22 @@ IPPROTO_DSTOPTS: int IPPROTO_EGP: int IPPROTO_ESP: int IPPROTO_FRAGMENT: int -IPPROTO_GGP: int IPPROTO_HOPOPTS: int IPPROTO_ICMPV6: int IPPROTO_IDP: int IPPROTO_IGMP: int -IPPROTO_IPV4: int IPPROTO_IPV6: int -IPPROTO_MAX: int -IPPROTO_ND: int IPPROTO_NONE: int IPPROTO_PIM: int IPPROTO_PUP: int IPPROTO_ROUTING: int IPPROTO_SCTP: int -if sys.platform != "darwin": +if sys.platform != "linux": + IPPROTO_GGP: int + IPPROTO_IPV4: int + IPPROTO_MAX: int + IPPROTO_ND: int +if sys.platform == "win32": IPPROTO_CBT: int IPPROTO_ICLFXBM: int IPPROTO_IGP: int @@ -166,18 +177,19 @@ if sys.platform != "darwin": IPPROTO_RDP: int IPPROTO_ST: int if sys.platform != "win32": - IPPROTO_EON: int IPPROTO_GRE: int - IPPROTO_HELLO: int - IPPROTO_IPCOMP: int IPPROTO_IPIP: int IPPROTO_RSVP: int IPPROTO_TP: int +if sys.platform != "win32" and sys.platform != "linux": + IPPROTO_EON: int + IPPROTO_HELLO: int + IPPROTO_IPCOMP: int IPPROTO_XTP: int -if sys.platform != "win32" and sys.platform != "darwin": - IPPROTO_BIP: int - IPPROTO_MOBILE: int - IPPROTO_VRRP: int +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": + IPPROTO_BIP: int # Not FreeBSD either + IPPROTO_MOBILE: int # Not FreeBSD either + IPPROTO_VRRP: int # Not FreeBSD either if sys.version_info >= (3, 9) and sys.platform == "linux": # Availability: Linux >= 2.6.20, FreeBSD >= 10.1 IPPROTO_UDPLITE: int @@ -202,11 +214,10 @@ IP_MULTICAST_IF: int IP_MULTICAST_LOOP: int IP_MULTICAST_TTL: int IP_OPTIONS: int -IP_RECVDSTADDR: int +if sys.platform != "linux": + IP_RECVDSTADDR: int if sys.version_info >= (3, 10): IP_RECVTOS: int -elif sys.platform != "win32" and sys.platform != "darwin": - IP_RECVTOS: int IP_TOS: int IP_TTL: int if sys.platform != "win32": @@ -218,6 +229,7 @@ if sys.platform != "win32": IP_RETOPTS: int if sys.platform != "win32" and sys.platform != "darwin": IP_TRANSPARENT: int +if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11): IP_BIND_ADDRESS_NO_PORT: int if sys.version_info >= (3, 12): IP_ADD_SOURCE_MEMBERSHIP: int @@ -255,6 +267,9 @@ if sys.platform != "win32": IPV6_RECVPATHMTU: int IPV6_RECVPKTINFO: int IPV6_RTHDRDSTOPTS: int + +if sys.platform != "win32" and sys.platform != "linux": + if sys.version_info >= (3, 9) or sys.platform != "darwin": IPV6_USE_MIN_MTU: int EAI_AGAIN: int @@ -268,11 +283,12 @@ EAI_SERVICE: int EAI_SOCKTYPE: int if sys.platform != "win32": EAI_ADDRFAMILY: int + EAI_OVERFLOW: int + EAI_SYSTEM: int +if sys.platform != "win32" and sys.platform != "linux": EAI_BADHINTS: int EAI_MAX: int - EAI_OVERFLOW: int EAI_PROTOCOL: int - EAI_SYSTEM: int AI_ADDRCONFIG: int AI_ALL: int @@ -281,7 +297,7 @@ AI_NUMERICHOST: int AI_NUMERICSERV: int AI_PASSIVE: int AI_V4MAPPED: int -if sys.platform != "win32": +if sys.platform != "win32" and sys.platform != "linux": AI_DEFAULT: int AI_MASK: int AI_V4MAPPED_CFG: int @@ -293,6 +309,8 @@ NI_NAMEREQD: int NI_NOFQDN: int NI_NUMERICHOST: int NI_NUMERICSERV: int +if sys.platform == "linux" and sys.version_info >= (3, 13): + NI_IDN: int TCP_FASTOPEN: int TCP_KEEPCNT: int @@ -318,6 +336,27 @@ if sys.platform != "win32" and sys.platform != "darwin": TCP_SYNCNT: int TCP_USER_TIMEOUT: int TCP_WINDOW_CLAMP: int +if sys.platform == "linux" and sys.version_info >= (3, 12): + TCP_CC_INFO: int + TCP_FASTOPEN_CONNECT: int + TCP_FASTOPEN_KEY: int + TCP_FASTOPEN_NO_COOKIE: int + TCP_INQ: int + TCP_MD5SIG: int + TCP_MD5SIG_EXT: int + TCP_QUEUE_SEQ: int + TCP_REPAIR: int + TCP_REPAIR_OPTIONS: int + TCP_REPAIR_QUEUE: int + TCP_REPAIR_WINDOW: int + TCP_SAVED_SYN: int + TCP_SAVE_SYN: int + TCP_THIN_DUPACK: int + TCP_THIN_LINEAR_TIMEOUTS: int + TCP_TIMESTAMP: int + TCP_TX_DELAY: int + TCP_ULP: int + TCP_ZEROCOPY_RECEIVE: int # -------------------- # Specifically documented constants @@ -334,12 +373,13 @@ if sys.platform == "linux": CAN_ERR_FLAG: int CAN_ERR_MASK: int CAN_RAW: int - CAN_RAW_ERR_FILTER: int CAN_RAW_FILTER: int CAN_RAW_LOOPBACK: int CAN_RAW_RECV_OWN_MSGS: int CAN_RTR_FLAG: int CAN_SFF_MASK: int + if sys.version_info < (3, 11): + CAN_RAW_ERR_FILTER: int if sys.platform == "linux": # Availability: Linux >= 2.6.25 @@ -437,12 +477,13 @@ if sys.platform == "linux": AF_RDS: int PF_RDS: int SOL_RDS: int + # These are present in include/linux/rds.h but don't always show up + # here. RDS_CANCEL_SENT_TO: int RDS_CMSG_RDMA_ARGS: int RDS_CMSG_RDMA_DEST: int RDS_CMSG_RDMA_MAP: int RDS_CMSG_RDMA_STATUS: int - RDS_CMSG_RDMA_UPDATE: int RDS_CONG_MONITOR: int RDS_FREE_MR: int RDS_GET_MR: int @@ -456,6 +497,10 @@ if sys.platform == "linux": RDS_RDMA_USE_ONCE: int RDS_RECVERR: int + # This is supported by CPython but doesn't seem to be a real thing. + # The closest existing constant in rds.h is RDS_CMSG_CONG_UPDATE + # RDS_CMSG_RDMA_UPDATE: int + if sys.platform == "win32": SIO_RCVALL: int SIO_KEEPALIVE_VALS: int @@ -522,16 +567,17 @@ if sys.platform == "linux": if sys.platform != "win32" or sys.version_info >= (3, 9): # Documented as only available on BSD, macOS, but empirically sometimes # available on Windows - AF_LINK: int + if sys.platform != "linux": + AF_LINK: int has_ipv6: bool -if sys.platform != "darwin": +if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "win32" or sys.version_info >= (3, 9): BDADDR_ANY: str BDADDR_LOCAL: str -if sys.platform != "win32" and sys.platform != "darwin": +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": HCI_FILTER: int # not in NetBSD or DragonFlyBSD HCI_TIME_STAMP: int # not in FreeBSD, NetBSD, or DragonFlyBSD HCI_DATA_DIR: int # not in FreeBSD, NetBSD, or DragonFlyBSD @@ -580,36 +626,37 @@ if sys.version_info >= (3, 12): if sys.platform == "linux": # Netlink is defined by Linux AF_NETLINK: int - NETLINK_ARPD: int NETLINK_CRYPTO: int NETLINK_DNRTMSG: int NETLINK_FIREWALL: int NETLINK_IP6_FW: int NETLINK_NFLOG: int - NETLINK_ROUTE6: int NETLINK_ROUTE: int - NETLINK_SKIP: int - NETLINK_TAPBASE: int - NETLINK_TCPDIAG: int NETLINK_USERSOCK: int - NETLINK_W1: int NETLINK_XFRM: int + # Technically still supported by CPython + # NETLINK_ARPD: int # linux 2.0 to 2.6.12 (EOL August 2005) + # NETLINK_ROUTE6: int # linux 2.2 to 2.6.12 (EOL August 2005) + # NETLINK_SKIP: int # linux 2.0 to 2.6.12 (EOL August 2005) + # NETLINK_TAPBASE: int # linux 2.2 to 2.6.12 (EOL August 2005) + # NETLINK_TCPDIAG: int # linux 2.6.0 to 2.6.13 (EOL December 2005) + # NETLINK_W1: int # linux 2.6.13 to 2.6.17 (EOL October 2006) if sys.platform == "darwin": PF_SYSTEM: int SYSPROTO_CONTROL: int -if sys.platform != "darwin": +if sys.platform != "darwin" and sys.platform != "linux": if sys.version_info >= (3, 9) or sys.platform != "win32": AF_BLUETOOTH: int -if sys.platform != "win32" and sys.platform != "darwin": +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": # Linux and some BSD support is explicit in the docs # Windows and macOS do not support in practice BTPROTO_HCI: int BTPROTO_L2CAP: int BTPROTO_SCO: int # not in FreeBSD -if sys.platform != "darwin": +if sys.platform != "darwin" and sys.platform != "linux": if sys.version_info >= (3, 9) or sys.platform != "win32": BTPROTO_RFCOMM: int @@ -636,13 +683,14 @@ AF_SNA: int if sys.platform != "win32": AF_ROUTE: int + +if sys.platform == "darwin": AF_SYSTEM: int if sys.platform != "darwin": AF_IRDA: int if sys.platform != "win32" and sys.platform != "darwin": - AF_AAL5: int AF_ASH: int AF_ATMPVC: int AF_ATMSVC: int @@ -661,10 +709,12 @@ if sys.platform != "win32" and sys.platform != "darwin": # Miscellaneous undocumented -if sys.platform != "win32": +if sys.platform != "win32" and sys.platform != "linux": LOCAL_PEERCRED: int if sys.platform != "win32" and sys.platform != "darwin": + # Defined in linux socket.h, but this isn't always present for + # some reason. IPX_TYPE: int # ===== Classes ===== @@ -792,4 +842,4 @@ def if_nameindex() -> list[tuple[int, str]]: ... def if_nametoindex(oname: str, /) -> int: ... def if_indextoname(index: int, /) -> str: ... -CAPI: object +CAPI: CapsuleType diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi index b75e7608fa77..f0b70ed2a0b0 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi @@ -44,6 +44,12 @@ def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpa @overload def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... +# Obsolete synonym for start_new_thread() +@overload +def start_new(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ... +@overload +def start_new(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... + if sys.version_info >= (3, 10): def interrupt_main(signum: signal.Signals = ..., /) -> None: ... @@ -51,7 +57,9 @@ else: def interrupt_main() -> None: ... def exit() -> NoReturn: ... +def exit_thread() -> NoReturn: ... # Obsolete synonym for exit() def allocate_lock() -> LockType: ... +def allocate() -> LockType: ... # Obsolete synonym for allocate_lock() def get_ident() -> int: ... def stack_size(size: int = 0, /) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_threading_local.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_threading_local.pyi index f9ac942278b9..07a825f0d816 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_threading_local.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_threading_local.pyi @@ -1,3 +1,4 @@ +from threading import RLock from typing import Any from typing_extensions import Self, TypeAlias from weakref import ReferenceType @@ -8,6 +9,9 @@ _LocalDict: TypeAlias = dict[Any, Any] class _localimpl: key: str dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]] + # Keep localargs in sync with the *args, **kwargs annotation on local.__new__ + localargs: tuple[list[Any], dict[str, Any]] + locallock: RLock def get_dict(self) -> _LocalDict: ... def create_dict(self) -> _LocalDict: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi index 14ad7ebaf601..4c7467fc84c8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi @@ -107,7 +107,7 @@ class object: @property def __class__(self) -> type[Self]: ... @__class__.setter - def __class__(self, type: type[object], /) -> None: ... + def __class__(self, type: type[Self], /) -> None: ... def __init__(self) -> None: ... def __new__(cls) -> Self: ... # N.B. `object.__setattr__` and `object.__delattr__` are heavily special-cased by type checkers. @@ -1963,14 +1963,33 @@ class StopAsyncIteration(Exception): class SyntaxError(Exception): msg: str + filename: str | None lineno: int | None offset: int | None text: str | None - filename: str | None + # Errors are displayed differently if this attribute exists on the exception. + # The value is always None. + print_file_and_line: None if sys.version_info >= (3, 10): end_lineno: int | None end_offset: int | None + @overload + def __init__(self) -> None: ... + @overload + def __init__(self, msg: object, /) -> None: ... + # Second argument is the tuple (filename, lineno, offset, text) + @overload + def __init__(self, msg: str, info: tuple[str | None, int | None, int | None, str | None], /) -> None: ... + if sys.version_info >= (3, 10): + # end_lineno and end_offset must both be provided if one is. + @overload + def __init__( + self, msg: str, info: tuple[str | None, int | None, int | None, str | None, int | None, int | None], / + ) -> None: ... + # If you provide more than two arguments, it still creates the SyntaxError, but + # the arguments from the info tuple are not parsed. This form is omitted. + class SystemError(Exception): ... class TypeError(Exception): ... class ValueError(Exception): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/bz2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/bz2.pyi index ee5587031f2a..2f869f9697f4 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/bz2.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/bz2.pyi @@ -126,6 +126,7 @@ class BZ2File(BaseStream, IO[bytes]): def readline(self, size: SupportsIndex = -1) -> bytes: ... # type: ignore[override] def readinto(self, b: WriteableBuffer) -> int: ... def readlines(self, size: SupportsIndex = -1) -> list[bytes]: ... + def peek(self, n: int = 0) -> bytes: ... def seek(self, offset: int, whence: int = 0) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi index a41df9752d33..b3c721f1e283 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi @@ -3,7 +3,7 @@ from _codecs import * from _typeshed import ReadableBuffer from abc import abstractmethod from collections.abc import Callable, Generator, Iterable -from typing import Any, BinaryIO, Final, Literal, Protocol, TextIO +from typing import Any, BinaryIO, ClassVar, Final, Literal, Protocol, TextIO from typing_extensions import Self __all__ = [ @@ -202,6 +202,7 @@ class StreamWriter(Codec): def write(self, object: str) -> None: ... def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... + def seek(self, offset: int, whence: int = 0) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str, getattr: Callable[[Any, str], Any] = ...) -> Any: ... @@ -209,11 +210,14 @@ class StreamWriter(Codec): class StreamReader(Codec): stream: _ReadableStream errors: str + # This is set to str, but some subclasses set to bytes instead. + charbuffertype: ClassVar[type] = ... def __init__(self, stream: _ReadableStream, errors: str = "strict") -> None: ... def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> str: ... def readline(self, size: int | None = None, keepends: bool = True) -> str: ... def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ... def reset(self) -> None: ... + def seek(self, offset: int, whence: int = 0) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __iter__(self) -> Self: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/configparser.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/configparser.pyi index ee5000196e0e..a44dc2e1c035 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/configparser.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/configparser.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import StrOrBytesPath, SupportsWrite +from _typeshed import MaybeNone, StrOrBytesPath, SupportsWrite from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence from re import Pattern from typing import Any, ClassVar, Final, Literal, TypeVar, overload @@ -263,11 +263,11 @@ class RawConfigParser(_Parser): ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] - def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | Any: ... + def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | MaybeNone: ... @overload def get( self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T - ) -> str | _T | Any: ... + ) -> str | _T | MaybeNone: ... @overload def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ... @overload @@ -277,6 +277,8 @@ class RawConfigParser(_Parser): def remove_option(self, section: str, option: str) -> bool: ... def remove_section(self, section: str) -> bool: ... def optionxform(self, optionstr: str) -> str: ... + @property + def converters(self) -> ConverterMapping: ... class ConfigParser(RawConfigParser): # This is incompatible with MutableMapping so we ignore the type @@ -300,28 +302,34 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... - def get( # type: ignore[override] + # This is incompatible with MutableMapping so we ignore the type + @overload # type: ignore[override] + def get( + self, option: str, *, raw: bool = False, vars: _Section | None = None, _impl: Any | None = None, **kwargs: Any + ) -> str | None: ... + @overload + def get( self, option: str, - fallback: str | None = None, + fallback: _T, *, raw: bool = False, vars: _Section | None = None, _impl: Any | None = None, **kwargs: Any, - ) -> str | Any: ... # can be None in RawConfigParser's sections + ) -> str | _T: ... # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together @overload - def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... + def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int | None: ... @overload def getint(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> int | _T: ... @overload - def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... + def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float | None: ... @overload def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> float | _T: ... @overload - def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... + def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool | None: ... @overload def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> bool | _T: ... # SectionProxy can have arbitrary attributes when custom converters are used diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi index 8a5b7dd6101c..dc5d926775f3 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi @@ -1,7 +1,7 @@ import abc import sys from _typeshed import FileDescriptorOrPath, Unused -from abc import abstractmethod +from abc import ABC, abstractmethod from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator from types import TracebackType from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable @@ -38,16 +38,22 @@ _P = ParamSpec("_P") _ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None] _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc) +# mypy and pyright object to this being both ABC and Protocol. +# At runtime it inherits from ABC and is not a Protocol, but it is on the +# allowlist for use as a Protocol. @runtime_checkable -class AbstractContextManager(Protocol[_T_co, _ExitT_co]): +class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] def __enter__(self) -> _T_co: ... @abstractmethod def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, / ) -> _ExitT_co: ... +# mypy and pyright object to this being both ABC and Protocol. +# At runtime it inherits from ABC and is not a Protocol, but it is on the +# allowlist for use as a Protocol. @runtime_checkable -class AbstractAsyncContextManager(Protocol[_T_co, _ExitT_co]): +class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] async def __aenter__(self) -> _T_co: ... @abstractmethod async def __aexit__( diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/crypt.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/crypt.pyi index 294003859286..bd22b5f8daba 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/crypt.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/crypt.pyi @@ -1,8 +1,15 @@ import sys -from typing import Final +from typing import Final, NamedTuple, type_check_only if sys.platform != "win32": - class _Method: ... + @type_check_only + class _MethodBase(NamedTuple): + name: str + ident: str | None + salt_chars: int + total_size: int + + class _Method(_MethodBase): ... METHOD_CRYPT: Final[_Method] METHOD_MD5: Final[_Method] METHOD_SHA256: Final[_Method] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/csv.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/csv.pyi index c5c7fea8fa25..4a82de638136 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/csv.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/csv.pyi @@ -8,8 +8,6 @@ from _csv import ( __version__ as __version__, _DialectLike, _QuotingType, - _reader, - _writer, field_size_limit as field_size_limit, get_dialect as get_dialect, list_dialects as list_dialects, @@ -21,6 +19,10 @@ from _csv import ( if sys.version_info >= (3, 12): from _csv import QUOTE_NOTNULL as QUOTE_NOTNULL, QUOTE_STRINGS as QUOTE_STRINGS +if sys.version_info >= (3, 10): + from _csv import Reader, Writer +else: + from _csv import _reader as Reader, _writer as Writer from _typeshed import SupportsWrite from collections.abc import Collection, Iterable, Mapping, Sequence @@ -77,7 +79,7 @@ class DictReader(Generic[_T]): fieldnames: Sequence[_T] | None restkey: _T | None restval: str | Any | None - reader: _reader + reader: Reader dialect: _DialectLike line_num: int @overload @@ -125,7 +127,7 @@ class DictWriter(Generic[_T]): fieldnames: Collection[_T] restval: Any | None extrasaction: Literal["raise", "ignore"] - writer: _writer + writer: Writer def __init__( self, f: SupportsWrite[str], diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi index 40a073d107c7..3e0e7c45bf15 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi @@ -10,13 +10,11 @@ from _ctypes import ( _CanCastTo as _CanCastTo, _CArgObject as _CArgObject, _CData as _CData, - _CDataMeta as _CDataMeta, + _CDataType as _CDataType, _CField as _CField, _Pointer as _Pointer, _PointerLike as _PointerLike, _SimpleCData as _SimpleCData, - _StructUnionBase as _StructUnionBase, - _StructUnionMeta as _StructUnionMeta, addressof as addressof, alignment as alignment, byref as byref, @@ -28,7 +26,7 @@ from _ctypes import ( ) from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure from typing import Any, ClassVar, Generic, TypeVar -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias, deprecated if sys.platform == "win32": from _ctypes import FormatError as FormatError, get_last_error as get_last_error, set_last_error as set_last_error @@ -41,6 +39,7 @@ if sys.version_info >= (3, 9): _T = TypeVar("_T") _DLLT = TypeVar("_DLLT", bound=CDLL) +_CT = TypeVar("_CT", bound=_CData) DEFAULT_MODE: int @@ -48,7 +47,7 @@ class ArgumentError(Exception): ... class CDLL: _func_flags_: ClassVar[int] - _func_restype_: ClassVar[_CData] + _func_restype_: ClassVar[_CDataType] _name: str _handle: int _FuncPtr: type[_FuncPointer] @@ -91,15 +90,21 @@ class _NamedFuncPointer(_FuncPointer): __name__: str def CFUNCTYPE( - restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... + restype: type[_CData | _CDataType] | None, + *argtypes: type[_CData | _CDataType], + use_errno: bool = ..., + use_last_error: bool = ..., ) -> type[_FuncPointer]: ... if sys.platform == "win32": def WINFUNCTYPE( - restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... + restype: type[_CData | _CDataType] | None, + *argtypes: type[_CData | _CDataType], + use_errno: bool = ..., + use_last_error: bool = ..., ) -> type[_FuncPointer]: ... -def PYFUNCTYPE(restype: type[_CData] | None, *argtypes: type[_CData]) -> type[_FuncPointer]: ... +def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_FuncPointer]: ... # Any type that can be implicitly converted to c_void_p when passed as a C function argument. # (bytes is not included here, see below.) @@ -112,12 +117,17 @@ _CVoidConstPLike: TypeAlias = _CVoidPLike | bytes _CastT = TypeVar("_CastT", bound=_CanCastTo) -def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ... +def cast(obj: _CData | _CDataType | _CArgObject | int, typ: type[_CastT]) -> _CastT: ... def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_char]: ... c_buffer = create_string_buffer def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ... +@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15") +def SetPointerType( + pointer: type[_Pointer[Any]], cls: Any # noqa: F811 # Redefinition of unused `pointer` from line 22 +) -> None: ... +def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove if sys.platform == "win32": def DllCanUnloadNow() -> int: ... @@ -126,12 +136,12 @@ if sys.platform == "win32": def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ... def memset(dst: _CVoidPLike, c: int, count: int) -> int: ... -def string_at(address: _CVoidConstPLike, size: int = -1) -> bytes: ... +def string_at(ptr: _CVoidConstPLike, size: int = -1) -> bytes: ... if sys.platform == "win32": def WinError(code: int | None = None, descr: str | None = None) -> OSError: ... -def wstring_at(address: _CVoidConstPLike, size: int = -1) -> str: ... +def wstring_at(ptr: _CVoidConstPLike, size: int = -1) -> str: ... class c_byte(_SimpleCData[int]): ... @@ -140,6 +150,8 @@ class c_char(_SimpleCData[bytes]): class c_char_p(_PointerLike, _SimpleCData[bytes | None]): def __init__(self, value: int | bytes | None = ...) -> None: ... + @classmethod + def from_param(cls, value: Any, /) -> Self | _CArgObject: ... class c_double(_SimpleCData[float]): ... class c_longdouble(_SimpleCData[float]): ... # can be an alias for c_double @@ -155,7 +167,13 @@ class c_uint(_SimpleCData[int]): ... # can be an alias for c_ulong class c_ulong(_SimpleCData[int]): ... class c_ulonglong(_SimpleCData[int]): ... # can be an alias for c_ulong class c_ushort(_SimpleCData[int]): ... -class c_void_p(_PointerLike, _SimpleCData[int | None]): ... + +class c_void_p(_PointerLike, _SimpleCData[int | None]): + @classmethod + def from_param(cls, value: Any, /) -> Self | _CArgObject: ... + +c_voidp = c_void_p # backwards compatibility (to a bug) + class c_wchar(_SimpleCData[str]): ... c_int8 = c_byte @@ -174,6 +192,8 @@ class c_uint64(_SimpleCData[int]): ... class c_wchar_p(_PointerLike, _SimpleCData[str | None]): def __init__(self, value: int | str | None = ...) -> None: ... + @classmethod + def from_param(cls, value: Any, /) -> Self | _CArgObject: ... class c_bool(_SimpleCData[bool]): def __init__(self, value: bool = ...) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/__init__.pyi new file mode 100644 index 000000000000..bda5b5a7f4cc --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/__init__.pyi @@ -0,0 +1 @@ +__version__: str diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dyld.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dyld.pyi new file mode 100644 index 000000000000..c7e94daa2149 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dyld.pyi @@ -0,0 +1,8 @@ +from collections.abc import Mapping +from ctypes.macholib.dylib import dylib_info as dylib_info +from ctypes.macholib.framework import framework_info as framework_info + +__all__ = ["dyld_find", "framework_find", "framework_info", "dylib_info"] + +def dyld_find(name: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: ... +def framework_find(fn: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dylib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dylib.pyi new file mode 100644 index 000000000000..95945edfd155 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/dylib.pyi @@ -0,0 +1,14 @@ +from typing import TypedDict, type_check_only + +__all__ = ["dylib_info"] + +# Actual result is produced by re.match.groupdict() +@type_check_only +class _DylibInfo(TypedDict): + location: str + name: str + shortname: str + version: str | None + suffix: str | None + +def dylib_info(filename: str) -> _DylibInfo | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/framework.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/framework.pyi new file mode 100644 index 000000000000..e92bf3700e84 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/macholib/framework.pyi @@ -0,0 +1,14 @@ +from typing import TypedDict, type_check_only + +__all__ = ["framework_info"] + +# Actual result is produced by re.match.groupdict() +@type_check_only +class _FrameworkInfo(TypedDict): + location: str + name: str + shortname: str + version: str | None + suffix: str | None + +def framework_info(filename: str) -> _FrameworkInfo | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/util.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/util.pyi index c0274f5e539b..316f7a2b3e2f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/util.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/util.pyi @@ -4,3 +4,5 @@ def find_library(name: str) -> str | None: ... if sys.platform == "win32": def find_msvcrt() -> str | None: ... + +def test() -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/wintypes.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/wintypes.pyi index 8847860f2002..e938d8f22957 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/wintypes.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/wintypes.pyi @@ -1,7 +1,7 @@ +from _ctypes import _CArgObject, _CField from ctypes import ( Array, Structure, - _CField, _Pointer, _SimpleCData, c_byte, @@ -21,8 +21,8 @@ from ctypes import ( c_wchar, c_wchar_p, ) -from typing import TypeVar -from typing_extensions import TypeAlias +from typing import Any, TypeVar +from typing_extensions import Self, TypeAlias BYTE = c_byte WORD = c_ushort @@ -241,10 +241,16 @@ LPBYTE = PBYTE PBOOLEAN = PBYTE # LP_c_char -class PCHAR(_Pointer[CHAR]): ... +class PCHAR(_Pointer[CHAR]): + # this is inherited from ctypes.c_char_p, kind of. + @classmethod + def from_param(cls, value: Any, /) -> Self | _CArgObject: ... # LP_c_wchar -class PWCHAR(_Pointer[WCHAR]): ... +class PWCHAR(_Pointer[WCHAR]): + # inherited from ctypes.c_wchar_p, kind of + @classmethod + def from_param(cls, value: Any, /) -> Self | _CArgObject: ... # LP_c_void_p class PHANDLE(_Pointer[HANDLE]): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/curses/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/curses/__init__.pyi index 939cec0cede9..edc64a00cd39 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/curses/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/curses/__init__.pyi @@ -1,7 +1,9 @@ +import sys from _curses import * from _curses import window as window +from _typeshed import structseq from collections.abc import Callable -from typing import TypeVar +from typing import Final, TypeVar, final, type_check_only from typing_extensions import Concatenate, ParamSpec # NOTE: The _curses module is ordinarily only available on Unix, but the @@ -25,3 +27,19 @@ def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwd # it was mapped to the name 'window' in 3.8. # Kept here as a legacy alias in case any third-party code is relying on it. _CursesWindow = window + +# At runtime this class is unexposed and calls itself curses.ncurses_version. +# That name would conflict with the actual curses.ncurses_version, which is +# an instance of this class. +@final +@type_check_only +class _ncurses_version(structseq[int], tuple[int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("major", "minor", "patch") + + @property + def major(self) -> int: ... + @property + def minor(self) -> int: ... + @property + def patch(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/curses/panel.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/curses/panel.pyi index d94f76635d8f..861559d38bc5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/curses/panel.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/curses/panel.pyi @@ -1,22 +1 @@ -from _curses import window - -version: str - -class _Curses_Panel: # type is (note the space in the class name) - def above(self) -> _Curses_Panel: ... - def below(self) -> _Curses_Panel: ... - def bottom(self) -> None: ... - def hidden(self) -> bool: ... - def hide(self) -> None: ... - def move(self, y: int, x: int) -> None: ... - def replace(self, win: window) -> None: ... - def set_userptr(self, obj: object) -> None: ... - def show(self) -> None: ... - def top(self) -> None: ... - def userptr(self) -> object: ... - def window(self) -> window: ... - -def bottom_panel() -> _Curses_Panel: ... -def new_panel(win: window, /) -> _Curses_Panel: ... -def top_panel() -> _Curses_Panel: ... -def update_panels() -> _Curses_Panel: ... +from _curses_panel import * diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi index e8a4efdc61f3..87037ef39be7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi @@ -1,8 +1,8 @@ import sys from abc import abstractmethod from time import struct_time -from typing import ClassVar, Final, NamedTuple, NoReturn, SupportsIndex, final, overload -from typing_extensions import Self, TypeAlias, deprecated +from typing import ClassVar, Final, NoReturn, SupportsIndex, final, overload, type_check_only +from typing_extensions import CapsuleType, Self, TypeAlias, deprecated if sys.version_info >= (3, 11): __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC") @@ -40,10 +40,17 @@ if sys.version_info >= (3, 11): UTC: timezone if sys.version_info >= (3, 9): - class _IsoCalendarDate(NamedTuple): - year: int - week: int - weekday: int + # This class calls itself datetime.IsoCalendarDate. It's neither + # NamedTuple nor structseq. + @final + @type_check_only + class _IsoCalendarDate(tuple[int, int, int]): + @property + def year(self) -> int: ... + @property + def week(self) -> int: ... + @property + def weekday(self) -> int: ... class date: min: ClassVar[date] @@ -325,3 +332,5 @@ class datetime(date): def __sub__(self, value: Self, /) -> timedelta: ... @overload def __sub__(self, value: timedelta, /) -> Self: ... + +datetime_CAPI: CapsuleType diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/dbm/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/dbm/__init__.pyi index f414763e02a6..7f344060f9ab 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/dbm/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/dbm/__init__.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import StrOrBytesPath from collections.abc import Iterator, MutableMapping from types import TracebackType -from typing import Literal +from typing import Literal, type_check_only from typing_extensions import Self, TypeAlias __all__ = ["open", "whichdb", "error"] @@ -89,6 +89,8 @@ class _Database(MutableMapping[_KeyType, bytes]): self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... +# This class is not exposed. It calls itself dbm.error. +@type_check_only class _error(Exception): ... error: tuple[type[_error], type[OSError]] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi index 3da75ec192ac..7f8708a020fd 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi @@ -24,7 +24,8 @@ from _decimal import ( setcontext as setcontext, ) from collections.abc import Container, Sequence -from typing import Any, ClassVar, Literal, NamedTuple, overload +from types import TracebackType +from typing import Any, ClassVar, Literal, NamedTuple, final, overload, type_check_only from typing_extensions import Self, TypeAlias _Decimal: TypeAlias = Decimal | int @@ -35,6 +36,14 @@ _TrapType: TypeAlias = type[DecimalException] # At runtime, these classes are implemented in C as part of "_decimal". # However, they consider themselves to live in "decimal", so we'll put them here. +# This type isn't exposed at runtime. It calls itself decimal.ContextManager +@final +@type_check_only +class _ContextManager: + def __init__(self, new_context: Context) -> None: ... + def __enter__(self) -> Context: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + class DecimalTuple(NamedTuple): sign: int digits: tuple[int, ...] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/distutils/ccompiler.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/distutils/ccompiler.pyi index 56617d8a7b8d..5bff209807ee 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/distutils/ccompiler.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/distutils/ccompiler.pyi @@ -165,7 +165,7 @@ class CCompiler: def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... - def spawn(self, cmd: list[str]) -> None: ... + def spawn(self, cmd: Iterable[str]) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... @overload def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/distutils/spawn.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/distutils/spawn.pyi index 50d89aeb9e5f..ae07a49504fe 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/distutils/spawn.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/distutils/spawn.pyi @@ -1,6 +1,10 @@ +from collections.abc import Iterable from typing import Literal def spawn( - cmd: list[str], search_path: bool | Literal[0, 1] = 1, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0 + cmd: Iterable[str], + search_path: bool | Literal[0, 1] = 1, + verbose: bool | Literal[0, 1] = 0, + dry_run: bool | Literal[0, 1] = 0, ) -> None: ... def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/doctest.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/doctest.pyi index 4380083027a6..562b5a5bdac9 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/doctest.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/doctest.pyi @@ -3,7 +3,7 @@ import types import unittest from _typeshed import ExcInfo from collections.abc import Callable -from typing import Any, ClassVar, NamedTuple +from typing import Any, NamedTuple, type_check_only from typing_extensions import Self, TypeAlias __all__ = [ @@ -42,17 +42,15 @@ __all__ = [ "debug", ] -# MyPy errors on conditionals within named tuples. - if sys.version_info >= (3, 13): - class TestResults(NamedTuple): - def __new__(cls, failed: int, attempted: int, *, skipped: int = 0) -> Self: ... # type: ignore[misc] - skipped: int + @type_check_only + class _TestResultsBase(NamedTuple): failed: int attempted: int - _fields: ClassVar = ("failed", "attempted") # type: ignore[misc] - __match_args__ = ("failed", "attempted") # type: ignore[misc] - __doc__: None # type: ignore[misc] + + class TestResults(_TestResultsBase): + def __new__(cls, failed: int, attempted: int, *, skipped: int = 0) -> Self: ... + skipped: int else: class TestResults(NamedTuple): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/email/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/email/__init__.pyi index fca302f5f1a7..f564ced105bd 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/email/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/email/__init__.pyi @@ -4,6 +4,29 @@ from email.policy import Policy from typing import IO from typing_extensions import TypeAlias +# At runtime, listing submodules in __all__ without them being imported is +# valid, and causes them to be included in a star import. See #6523 + +__all__ = [ # noqa: F822 # Undefined names in __all__ + "base64mime", # pyright: ignore[reportUnsupportedDunderAll] + "charset", # pyright: ignore[reportUnsupportedDunderAll] + "encoders", # pyright: ignore[reportUnsupportedDunderAll] + "errors", # pyright: ignore[reportUnsupportedDunderAll] + "feedparser", # pyright: ignore[reportUnsupportedDunderAll] + "generator", # pyright: ignore[reportUnsupportedDunderAll] + "header", # pyright: ignore[reportUnsupportedDunderAll] + "iterators", # pyright: ignore[reportUnsupportedDunderAll] + "message", # pyright: ignore[reportUnsupportedDunderAll] + "message_from_file", + "message_from_binary_file", + "message_from_string", + "message_from_bytes", + "mime", # pyright: ignore[reportUnsupportedDunderAll] + "parser", # pyright: ignore[reportUnsupportedDunderAll] + "quoprimime", # pyright: ignore[reportUnsupportedDunderAll] + "utils", # pyright: ignore[reportUnsupportedDunderAll] +] + # Definitions imported by multiple submodules in typeshed _ParamType: TypeAlias = str | tuple[str | None, str | None, str] # noqa: Y047 _ParamsType: TypeAlias = str | None | tuple[str, str | None, str] # noqa: Y047 @@ -12,18 +35,3 @@ def message_from_string(s: str, _class: Callable[[], Message] = ..., *, policy: def message_from_bytes(s: bytes | bytearray, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... def message_from_file(fp: IO[str], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... def message_from_binary_file(fp: IO[bytes], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... - -# Names in __all__ with no definition: -# base64mime -# charset -# encoders -# errors -# feedparser -# generator -# header -# iterators -# message -# mime -# parser -# quoprimime -# utils diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/email/_policybase.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/email/_policybase.pyi index 900224eabb3d..f5dbbd96da14 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/email/_policybase.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/email/_policybase.pyi @@ -5,6 +5,8 @@ from email.message import Message from typing import Generic, Protocol, TypeVar, type_check_only from typing_extensions import Self +__all__ = ["Policy", "Compat32", "compat32"] + _MessageT = TypeVar("_MessageT", bound=Message, default=Message) @type_check_only diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/aliases.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/aliases.pyi new file mode 100644 index 000000000000..079af85d51ee --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/aliases.pyi @@ -0,0 +1 @@ +aliases: dict[str, str] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ascii.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ascii.pyi new file mode 100644 index 000000000000..a85585af32ed --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ascii.pyi @@ -0,0 +1,30 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + # At runtime, this is codecs.ascii_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + # At runtime, this is codecs.ascii_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +# Note: encode being a decode function and decode being an encode function is accurate to runtime. +class StreamConverter(StreamWriter, StreamReader): # type: ignore[misc] # incompatible methods in base classes + # At runtime, this is codecs.ascii_decode + @staticmethod + def encode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... # type: ignore[override] + # At runtime, this is codecs.ascii_encode + @staticmethod + def decode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... # type: ignore[override] + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/base64_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/base64_codec.pyi new file mode 100644 index 000000000000..0c4f1cb1fe59 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/base64_codec.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def base64_encode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... +def base64_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5hkscs.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5hkscs.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/big5hkscs.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/bz2_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/bz2_codec.pyi new file mode 100644 index 000000000000..468346a93da9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/bz2_codec.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def bz2_encode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... +def bz2_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/charmap.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/charmap.pyi new file mode 100644 index 000000000000..a971a15860b5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/charmap.pyi @@ -0,0 +1,33 @@ +import codecs +from _codecs import _CharMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + # At runtime, this is codecs.charmap_encode + @staticmethod + def encode(str: str, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[bytes, int]: ... + # At runtime, this is codecs.charmap_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + mapping: _CharMap | None + def __init__(self, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + mapping: _CharMap | None + def __init__(self, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): + mapping: _CharMap | None + def __init__(self, stream: codecs._WritableStream, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class StreamReader(Codec, codecs.StreamReader): + mapping: _CharMap | None + def __init__(self, stream: codecs._ReadableStream, errors: str = "strict", mapping: _CharMap | None = None) -> None: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp037.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp037.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp037.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1006.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1006.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1006.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1026.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1026.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1026.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1125.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1125.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1125.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1140.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1140.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1140.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1250.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1250.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1250.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1251.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1251.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1251.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1252.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1252.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1252.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1253.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1253.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1253.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1254.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1254.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1254.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1255.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1255.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1255.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1256.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1256.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1256.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1257.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1257.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1257.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1258.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1258.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp1258.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp273.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp273.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp273.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp424.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp424.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp424.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp437.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp437.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp437.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp500.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp500.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp500.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp720.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp720.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp720.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp737.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp737.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp737.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp775.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp775.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp775.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp850.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp850.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp850.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp852.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp852.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp852.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp855.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp855.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp855.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp856.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp856.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp856.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp857.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp857.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp857.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp858.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp858.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp858.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp860.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp860.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp860.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp861.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp861.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp861.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp862.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp862.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp862.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp863.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp863.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp863.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp864.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp864.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp864.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp865.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp865.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp865.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp866.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp866.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp866.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp869.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp869.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp869.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp874.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp874.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp874.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp875.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp875.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp875.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp932.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp932.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp932.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp949.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp949.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp949.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp950.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp950.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/cp950.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jis_2004.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jis_2004.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jis_2004.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jisx0213.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jisx0213.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jisx0213.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jp.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jp.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_jp.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_kr.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_kr.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/euc_kr.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb18030.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb18030.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb18030.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb2312.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb2312.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gb2312.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gbk.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gbk.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/gbk.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hex_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hex_codec.pyi new file mode 100644 index 000000000000..3fd4fe38898a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hex_codec.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def hex_encode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... +def hex_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hp_roman8.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hp_roman8.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hp_roman8.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hz.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hz.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/hz.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/idna.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/idna.pyi new file mode 100644 index 000000000000..3e2c8baf1cb2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/idna.pyi @@ -0,0 +1,26 @@ +import codecs +import re +from _typeshed import ReadableBuffer + +dots: re.Pattern[str] +ace_prefix: bytes +sace_prefix: str + +def nameprep(label: str) -> str: ... +def ToASCII(label: str) -> bytes: ... +def ToUnicode(label: bytes | str) -> str: ... + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: ReadableBuffer | str, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.BufferedIncrementalEncoder): + def _buffer_encode(self, input: str, errors: str, final: bool) -> tuple[bytes, int]: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, input: ReadableBuffer | str, errors: str, final: bool) -> tuple[str, int]: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_1.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_1.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_1.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2004.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2004.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_2004.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_3.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_3.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_3.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_ext.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_ext.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_jp_ext.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_kr.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_kr.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso2022_kr.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_1.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_1.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_1.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_10.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_10.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_10.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_11.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_11.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_11.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_13.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_13.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_13.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_14.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_14.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_14.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_15.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_15.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_15.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_16.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_16.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_16.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_2.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_2.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_3.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_3.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_3.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_4.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_4.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_4.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_5.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_5.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_5.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_6.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_6.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_6.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_7.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_7.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_7.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_8.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_8.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_8.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_9.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_9.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/iso8859_9.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/johab.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/johab.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/johab.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_r.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_r.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_r.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_t.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_t.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_t.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_u.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_u.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/koi8_u.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/kz1048.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/kz1048.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/kz1048.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/latin_1.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/latin_1.pyi new file mode 100644 index 000000000000..3b06773eac03 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/latin_1.pyi @@ -0,0 +1,30 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + # At runtime, this is codecs.latin_1_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + # At runtime, this is codecs.latin_1_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +# Note: encode being a decode function and decode being an encode function is accurate to runtime. +class StreamConverter(StreamWriter, StreamReader): # type: ignore[misc] # incompatible methods in base classes + # At runtime, this is codecs.latin_1_decode + @staticmethod + def encode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... # type: ignore[override] + # At runtime, this is codecs.latin_1_encode + @staticmethod + def decode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... # type: ignore[override] + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_arabic.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_arabic.pyi new file mode 100644 index 000000000000..42781b489298 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_arabic.pyi @@ -0,0 +1,21 @@ +import codecs +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_map: dict[int, int | None] +decoding_table: str +encoding_map: dict[int, int] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_centeuro.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_croatian.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_croatian.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_croatian.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_cyrillic.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_cyrillic.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_cyrillic.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_farsi.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_farsi.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_farsi.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_greek.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_greek.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_greek.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_iceland.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_iceland.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_iceland.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_latin2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_latin2.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_latin2.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_roman.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_roman.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_roman.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_romanian.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_romanian.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_romanian.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_turkish.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_turkish.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mac_turkish.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mbcs.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mbcs.pyi new file mode 100644 index 000000000000..2c2917d63f6d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/mbcs.pyi @@ -0,0 +1,28 @@ +import codecs +import sys +from _typeshed import ReadableBuffer + +if sys.platform == "win32": + encode = codecs.mbcs_encode + + def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + + class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + + class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.mbcs_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + + class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.mbcs_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + + class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.mbcs_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + + def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/oem.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/oem.pyi new file mode 100644 index 000000000000..376c12c445f4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/oem.pyi @@ -0,0 +1,28 @@ +import codecs +import sys +from _typeshed import ReadableBuffer + +if sys.platform == "win32": + encode = codecs.oem_encode + + def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + + class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + + class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.oem_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + + class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.oem_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + + class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.oem_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + + def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/palmos.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/palmos.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/palmos.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ptcp154.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ptcp154.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/ptcp154.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/punycode.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/punycode.pyi new file mode 100644 index 000000000000..eb99e667b416 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/punycode.pyi @@ -0,0 +1,33 @@ +import codecs +from typing import Literal + +def segregate(str: str) -> tuple[bytes, list[int]]: ... +def selective_len(str: str, max: int) -> int: ... +def selective_find(str: str, char: str, index: int, pos: int) -> tuple[int, int]: ... +def insertion_unsort(str: str, extended: list[int]) -> list[int]: ... +def T(j: int, bias: int) -> int: ... + +digits: Literal[b"abcdefghijklmnopqrstuvwxyz0123456789"] + +def generate_generalized_integer(N: int, bias: int) -> bytes: ... +def adapt(delta: int, first: bool, numchars: int) -> int: ... +def generate_integers(baselen: int, deltas: list[int]) -> bytes: ... +def punycode_encode(text: str) -> bytes: ... +def decode_generalized_number(extended: bytes, extpos: int, bias: int, errors: str) -> tuple[int, int | None]: ... +def insertion_sort(base: str, extended: bytes, errors: str) -> str: ... +def punycode_decode(text: memoryview | bytes | bytearray | str, errors: str) -> str: ... + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: memoryview | bytes | bytearray | str, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: memoryview | bytes | bytearray | str, final: bool = False) -> str: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/quopri_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/quopri_codec.pyi new file mode 100644 index 000000000000..e9deadd8d463 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/quopri_codec.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def quopri_encode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... +def quopri_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/raw_unicode_escape.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/raw_unicode_escape.pyi new file mode 100644 index 000000000000..74abb4623fab --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/raw_unicode_escape.pyi @@ -0,0 +1,34 @@ +import codecs +import sys +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + # At runtime, this is codecs.raw_unicode_escape_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + # At runtime, this is codecs.raw_unicode_escape_decode + if sys.version_info >= (3, 9): + @staticmethod + def decode(data: str | ReadableBuffer, errors: str | None = None, final: bool = True, /) -> tuple[str, int]: ... + else: + @staticmethod + def decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +if sys.version_info >= (3, 9): + class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, input: str | ReadableBuffer, errors: str | None, final: bool) -> tuple[str, int]: ... + +else: + class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: str | ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... + +class StreamReader(Codec, codecs.StreamReader): + if sys.version_info >= (3, 9): + def decode(self, input: str | ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/rot_13.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/rot_13.pyi new file mode 100644 index 000000000000..8d71bc957594 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/rot_13.pyi @@ -0,0 +1,23 @@ +import codecs +from _typeshed import SupportsRead, SupportsWrite + +# This codec is string to string. + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] + def decode(self, input: str, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> str: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: str, final: bool = False) -> str: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +rot13_map: dict[int, int] + +def rot13(infile: SupportsRead[str], outfile: SupportsWrite[str]) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis_2004.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis_2004.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jis_2004.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jisx0213.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jisx0213.pyi new file mode 100644 index 000000000000..d613026a5a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/shift_jisx0213.pyi @@ -0,0 +1,23 @@ +import _multibytecodec as mbc +import codecs +from typing import ClassVar + +codec: mbc._MultibyteCodec + +class Codec(codecs.Codec): + encode = codec.encode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + decode = codec.decode # type: ignore[assignment] # pyright: ignore[reportAssignmentType] + +class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] + codec: ClassVar[mbc._MultibyteCodec] = ... + +class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): + codec: ClassVar[mbc._MultibyteCodec] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/tis_620.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/tis_620.pyi new file mode 100644 index 000000000000..f62195662ce9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/tis_620.pyi @@ -0,0 +1,21 @@ +import codecs +from _codecs import _EncodingMap +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... + +decoding_table: str +encoding_table: _EncodingMap diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/undefined.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/undefined.pyi new file mode 100644 index 000000000000..4775dac752f2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/undefined.pyi @@ -0,0 +1,20 @@ +import codecs +from _typeshed import ReadableBuffer + +# These return types are just to match the base types. In reality, these always +# raise an error. + +class Codec(codecs.Codec): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... +class StreamReader(Codec, codecs.StreamReader): ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/unicode_escape.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/unicode_escape.pyi new file mode 100644 index 000000000000..1e942f57916e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/unicode_escape.pyi @@ -0,0 +1,34 @@ +import codecs +import sys +from _typeshed import ReadableBuffer + +class Codec(codecs.Codec): + # At runtime, this is codecs.unicode_escape_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + # At runtime, this is codecs.unicode_escape_decode + if sys.version_info >= (3, 9): + @staticmethod + def decode(data: str | ReadableBuffer, errors: str | None = None, final: bool = True, /) -> tuple[str, int]: ... + else: + @staticmethod + def decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +if sys.version_info >= (3, 9): + class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, input: str | ReadableBuffer, errors: str | None, final: bool) -> tuple[str, int]: ... + +else: + class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: str | ReadableBuffer, final: bool = False) -> str: ... + +class StreamWriter(Codec, codecs.StreamWriter): ... + +class StreamReader(Codec, codecs.StreamReader): + if sys.version_info >= (3, 9): + def decode(self, input: str | ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... # type: ignore[override] + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16.pyi new file mode 100644 index 000000000000..3b712cde420a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16.pyi @@ -0,0 +1,20 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_16_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_be.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_be.pyi new file mode 100644 index 000000000000..cc7d1534fc69 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_be.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_16_be_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_16_be_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_16_be_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_16_be_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_le.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_le.pyi new file mode 100644 index 000000000000..ba103eb088e3 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_16_le.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_16_le_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_16_le_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_16_le_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_16_le_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32.pyi new file mode 100644 index 000000000000..c925be712c72 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32.pyi @@ -0,0 +1,20 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_32_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_be.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_be.pyi new file mode 100644 index 000000000000..9d28f5199c50 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_be.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_32_be_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_32_be_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_32_be_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_32_be_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_le.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_le.pyi new file mode 100644 index 000000000000..5be14a91a3e6 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_32_le.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_32_le_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_32_le_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_32_le_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_32_le_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_7.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_7.pyi new file mode 100644 index 000000000000..dc1162f34c28 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_7.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer + +encode = codecs.utf_7_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: str, final: bool = False) -> bytes: ... + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_7_decode + @staticmethod + def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_7_encode + @staticmethod + def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_7_decode + @staticmethod + def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_8.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_8.pyi index bb745399eb8c..918712d80473 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_8.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/utf_8.pyi @@ -1,21 +1,26 @@ import codecs from _typeshed import ReadableBuffer +encode = codecs.utf_8_encode + +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... + class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + # At runtime, this is codecs.utf_8_decode @staticmethod def _buffer_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... class StreamWriter(codecs.StreamWriter): + # At runtime, this is codecs.utf_8_encode @staticmethod def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... class StreamReader(codecs.StreamReader): + # At runtime, this is codecs.utf_8_decode @staticmethod def decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/uu_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/uu_codec.pyi new file mode 100644 index 000000000000..e32ba8ac0a1a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/uu_codec.pyi @@ -0,0 +1,28 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def uu_encode( + input: ReadableBuffer, errors: str = "strict", filename: str = "", mode: int = 0o666 +) -> tuple[bytes, int]: ... +def uu_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/encodings/zlib_codec.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/zlib_codec.pyi new file mode 100644 index 000000000000..0f13d0e810e9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/encodings/zlib_codec.pyi @@ -0,0 +1,26 @@ +import codecs +from _typeshed import ReadableBuffer +from typing import ClassVar + +# This codec is bytes to bytes. + +def zlib_encode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... +def zlib_decode(input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... + +class Codec(codecs.Codec): + def encode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[bytes, int]: ... # type: ignore[override] + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input: ReadableBuffer, final: bool = False) -> bytes: ... # type: ignore[override] + +class StreamWriter(Codec, codecs.StreamWriter): + charbuffertype: ClassVar[type] = ... + +class StreamReader(Codec, codecs.StreamReader): + charbuffertype: ClassVar[type] = ... + +def getregentry() -> codecs.CodecInfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/fcntl.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/fcntl.pyi index 376611f166b8..71078b3b4579 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/fcntl.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/fcntl.pyi @@ -70,8 +70,10 @@ if sys.platform != "win32": LOCK_RW: int LOCK_WRITE: int - # These are highly problematic, they might be present or not, depends on the specific OS. if sys.platform == "linux": + # Constants for the POSIX STREAMS interface. Present in glibc until 2.29 (released February 2019). + # Never implemented on BSD, and considered "obsolescent" starting in POSIX 2008. + # Probably still used on Solaris. I_ATMARK: int I_CANPUT: int I_CKBAND: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/gettext.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/gettext.pyi index 4c17c0dc5de4..d8fd92a00e13 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/gettext.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/gettext.pyi @@ -167,3 +167,5 @@ if sys.version_info < (3, 11): def bind_textdomain_codeset(domain: str, codeset: str | None = None) -> str: ... Catalog = translation + +def c2py(plural: str) -> Callable[[int], int]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/hashlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/hashlib.pyi index 74687d9abe3d..db6f8635054d 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/hashlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/hashlib.pyi @@ -1,9 +1,19 @@ import sys from _blake2 import blake2b as blake2b, blake2s as blake2s +from _hashlib import ( + HASH, + openssl_md5 as md5, + openssl_sha1 as sha1, + openssl_sha224 as sha224, + openssl_sha256 as sha256, + openssl_sha384 as sha384, + openssl_sha512 as sha512, + pbkdf2_hmac as pbkdf2_hmac, + scrypt as scrypt, +) from _typeshed import ReadableBuffer from collections.abc import Callable, Set as AbstractSet -from typing import Protocol -from typing_extensions import Self +from typing import Protocol, type_check_only if sys.version_info >= (3, 11): __all__ = ( @@ -49,67 +59,35 @@ else: "pbkdf2_hmac", ) -class _Hash: - @property - def digest_size(self) -> int: ... - @property - def block_size(self) -> int: ... - @property - def name(self) -> str: ... - def copy(self) -> Self: ... - def digest(self) -> bytes: ... - def hexdigest(self) -> str: ... - def update(self, data: ReadableBuffer, /) -> None: ... - -class _VarLenHash: - digest_size: int - block_size: int - name: str - def copy(self) -> _VarLenHash: ... - def digest(self, length: int, /) -> bytes: ... - def hexdigest(self, length: int, /) -> str: ... - def update(self, data: ReadableBuffer, /) -> None: ... - if sys.version_info >= (3, 9): - def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = ...) -> _Hash: ... - def md5(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha1(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha3_224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha3_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha3_384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def sha3_512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ... - def shake_128(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _VarLenHash: ... - def shake_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _VarLenHash: ... + def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = ...) -> HASH: ... + from _hashlib import ( + openssl_sha3_224 as sha3_224, + openssl_sha3_256 as sha3_256, + openssl_sha3_384 as sha3_384, + openssl_sha3_512 as sha3_512, + openssl_shake_128 as shake_128, + openssl_shake_256 as shake_256, + ) else: - def new(name: str, data: ReadableBuffer = b"") -> _Hash: ... - def md5(string: ReadableBuffer = b"") -> _Hash: ... - def sha1(string: ReadableBuffer = b"") -> _Hash: ... - def sha224(string: ReadableBuffer = b"") -> _Hash: ... - def sha256(string: ReadableBuffer = b"") -> _Hash: ... - def sha384(string: ReadableBuffer = b"") -> _Hash: ... - def sha512(string: ReadableBuffer = b"") -> _Hash: ... - def sha3_224(string: ReadableBuffer = b"") -> _Hash: ... - def sha3_256(string: ReadableBuffer = b"") -> _Hash: ... - def sha3_384(string: ReadableBuffer = b"") -> _Hash: ... - def sha3_512(string: ReadableBuffer = b"") -> _Hash: ... + @type_check_only + class _VarLenHash(HASH): + def digest(self, length: int) -> bytes: ... # type: ignore[override] + def hexdigest(self, length: int) -> str: ... # type: ignore[override] + + def new(name: str, data: ReadableBuffer = b"") -> HASH: ... + # At runtime these aren't functions but classes imported from _sha3 + def sha3_224(string: ReadableBuffer = b"") -> HASH: ... + def sha3_256(string: ReadableBuffer = b"") -> HASH: ... + def sha3_384(string: ReadableBuffer = b"") -> HASH: ... + def sha3_512(string: ReadableBuffer = b"") -> HASH: ... def shake_128(string: ReadableBuffer = b"") -> _VarLenHash: ... def shake_256(string: ReadableBuffer = b"") -> _VarLenHash: ... algorithms_guaranteed: AbstractSet[str] algorithms_available: AbstractSet[str] -def pbkdf2_hmac( - hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = None -) -> bytes: ... -def scrypt( - password: ReadableBuffer, *, salt: ReadableBuffer, n: int, r: int, p: int, maxmem: int = 0, dklen: int = 64 -) -> bytes: ... - if sys.version_info >= (3, 11): class _BytesIOLike(Protocol): def getbuffer(self) -> ReadableBuffer: ... @@ -119,5 +97,8 @@ if sys.version_info >= (3, 11): def readable(self) -> bool: ... def file_digest( - fileobj: _BytesIOLike | _FileDigestFileObj, digest: str | Callable[[], _Hash], /, *, _bufsize: int = 262144 - ) -> _Hash: ... + fileobj: _BytesIOLike | _FileDigestFileObj, digest: str | Callable[[], HASH], /, *, _bufsize: int = 262144 + ) -> HASH: ... + +# Legacy typing-only alias +_Hash = HASH diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/hmac.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/hmac.pyi index eccfbdc235f4..efd649ec39a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/hmac.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/hmac.pyi @@ -1,6 +1,7 @@ +import sys +from _hashlib import HASH as _HashlibHash from _typeshed import ReadableBuffer, SizedBuffer from collections.abc import Callable -from hashlib import _Hash as _HashlibHash from types import ModuleType from typing import AnyStr, overload from typing_extensions import TypeAlias @@ -30,8 +31,12 @@ class HMAC: def hexdigest(self) -> str: ... def copy(self) -> HMAC: ... -@overload -def compare_digest(a: ReadableBuffer, b: ReadableBuffer, /) -> bool: ... -@overload -def compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ... def digest(key: SizedBuffer, msg: ReadableBuffer, digest: _DigestMod) -> bytes: ... + +if sys.version_info >= (3, 9): + from _hashlib import compare_digest as compare_digest +else: + @overload + def compare_digest(a: ReadableBuffer, b: ReadableBuffer, /) -> bool: ... + @overload + def compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/importlib/resources/abc.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/importlib/resources/abc.pyi index a36c952d01ac..ad80605f7c71 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/importlib/resources/abc.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/importlib/resources/abc.pyi @@ -10,3 +10,5 @@ if sys.version_info >= (3, 11): Traversable as Traversable, TraversableResources as TraversableResources, ) + + __all__ = ["ResourceReader", "Traversable", "TraversableResources"] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi index fce233e84555..f5cee43d6b32 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi @@ -51,25 +51,6 @@ class _BaseAddress(_IPAddressBase): def __gt__(self, other: Self, NotImplemented: Any = ...) -> bool: ... def __le__(self, other: Self, NotImplemented: Any = ...) -> bool: ... - @property - def is_global(self) -> bool: ... - @property - def is_link_local(self) -> bool: ... - @property - def is_loopback(self) -> bool: ... - @property - def is_multicast(self) -> bool: ... - @property - def is_private(self) -> bool: ... - @property - def is_reserved(self) -> bool: ... - @property - def is_unspecified(self) -> bool: ... - @property - def max_prefixlen(self) -> int: ... - @property - def packed(self) -> bytes: ... - class _BaseNetwork(_IPAddressBase, Generic[_A]): network_address: _A netmask: _A @@ -109,8 +90,6 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): @property def is_unspecified(self) -> bool: ... @property - def max_prefixlen(self) -> int: ... - @property def num_addresses(self) -> int: ... def overlaps(self, other: _BaseNetwork[IPv4Address] | _BaseNetwork[IPv6Address]) -> bool: ... @property @@ -135,6 +114,22 @@ class _BaseV4: def max_prefixlen(self) -> Literal[32]: ... class IPv4Address(_BaseV4, _BaseAddress): + @property + def is_global(self) -> bool: ... + @property + def is_link_local(self) -> bool: ... + @property + def is_loopback(self) -> bool: ... + @property + def is_multicast(self) -> bool: ... + @property + def is_private(self) -> bool: ... + @property + def is_reserved(self) -> bool: ... + @property + def is_unspecified(self) -> bool: ... + @property + def packed(self) -> bytes: ... if sys.version_info >= (3, 13): @property def ipv6_mapped(self) -> IPv6Address: ... @@ -164,6 +159,22 @@ class _BaseV6: def max_prefixlen(self) -> Literal[128]: ... class IPv6Address(_BaseV6, _BaseAddress): + @property + def is_global(self) -> bool: ... + @property + def is_link_local(self) -> bool: ... + @property + def is_loopback(self) -> bool: ... + @property + def is_multicast(self) -> bool: ... + @property + def is_private(self) -> bool: ... + @property + def is_reserved(self) -> bool: ... + @property + def is_unspecified(self) -> bool: ... + @property + def packed(self) -> bytes: ... @property def ipv4_mapped(self) -> IPv4Address | None: ... @property diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi new file mode 100644 index 000000000000..f3b98996b752 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi @@ -0,0 +1,3 @@ +from _json import make_scanner as make_scanner + +__all__ = ["make_scanner"] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/modulefinder.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/modulefinder.pyi index 2cf948ba898a..6db665a18e69 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/modulefinder.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/modulefinder.pyi @@ -64,3 +64,5 @@ class ModuleFinder: def any_missing(self) -> list[str]: ... # undocumented def any_missing_maybe(self) -> tuple[list[str], list[str]]: ... # undocumented def replace_paths_in_code(self, co: CodeType) -> CodeType: ... # undocumented + +def test() -> ModuleFinder | None: ... # undocumented diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi index 9900f009a398..03d1d2e5c220 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi @@ -1,7 +1,8 @@ import ctypes import sys +from _ctypes import _CData from collections.abc import Callable, Iterable, Sequence -from ctypes import _CData, _SimpleCData, c_char +from ctypes import _SimpleCData, c_char from logging import Logger, _Level as _LoggingLevel from multiprocessing import popen_fork, popen_forkserver, popen_spawn_posix, popen_spawn_win32, queues, synchronize from multiprocessing.managers import SyncManager diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi index 2b0498abc2c6..5283445d8545 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi @@ -1,6 +1,7 @@ import ctypes +from _ctypes import _CData from collections.abc import Callable, Iterable, Sequence -from ctypes import _CData, _SimpleCData, c_char +from ctypes import _SimpleCData, c_char from multiprocessing.context import BaseContext from multiprocessing.synchronize import _LockLike from types import TracebackType diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi index d6f46b527905..e3cbfbc0ec82 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi @@ -10,7 +10,7 @@ _LockLike: TypeAlias = Lock | RLock class Barrier(threading.Barrier): def __init__( - self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *ctx: BaseContext + self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *, ctx: BaseContext ) -> None: ... class Condition: @@ -19,12 +19,14 @@ class Condition: def notify_all(self) -> None: ... def wait(self, timeout: float | None = None) -> bool: ... def wait_for(self, predicate: Callable[[], bool], timeout: float | None = None) -> bool: ... - def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ... - def release(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, / ) -> None: ... + # These methods are copied from the lock passed to the constructor, or an + # instance of ctx.RLock() if lock was None. + def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ... + def release(self) -> None: ... class Event: def __init__(self, *, ctx: BaseContext) -> None: ... @@ -35,12 +37,14 @@ class Event: # Not part of public API class SemLock: - def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ... - def release(self) -> None: ... + def __init__(self, kind: int, value: int, maxvalue: int, *, ctx: BaseContext | None) -> None: ... def __enter__(self) -> bool: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, / ) -> None: ... + # These methods are copied from the wrapped _multiprocessing.SemLock object + def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ... + def release(self) -> None: ... class Lock(SemLock): def __init__(self, *, ctx: BaseContext) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi index 203956786a9b..98260b14e7ed 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi @@ -19,10 +19,9 @@ from _typeshed import ( WriteableBuffer, structseq, ) -from abc import abstractmethod +from abc import ABC, abstractmethod from builtins import OSError from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence -from contextlib import AbstractContextManager from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from subprocess import Popen from types import TracebackType @@ -48,6 +47,446 @@ from . import path as _path if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "F_OK", + "O_APPEND", + "O_CREAT", + "O_EXCL", + "O_RDONLY", + "O_RDWR", + "O_TRUNC", + "O_WRONLY", + "P_NOWAIT", + "P_NOWAITO", + "P_WAIT", + "R_OK", + "SEEK_CUR", + "SEEK_END", + "SEEK_SET", + "TMP_MAX", + "W_OK", + "X_OK", + "DirEntry", + "_exit", + "abort", + "access", + "altsep", + "chdir", + "chmod", + "close", + "closerange", + "cpu_count", + "curdir", + "defpath", + "device_encoding", + "devnull", + "dup", + "dup2", + "environ", + "error", + "execl", + "execle", + "execlp", + "execlpe", + "execv", + "execve", + "execvp", + "execvpe", + "extsep", + "fdopen", + "fsdecode", + "fsencode", + "fspath", + "fstat", + "fsync", + "ftruncate", + "get_exec_path", + "get_inheritable", + "get_terminal_size", + "getcwd", + "getcwdb", + "getenv", + "getlogin", + "getpid", + "getppid", + "isatty", + "kill", + "linesep", + "link", + "listdir", + "lseek", + "lstat", + "makedirs", + "mkdir", + "name", + "open", + "pardir", + "path", + "pathsep", + "pipe", + "popen", + "putenv", + "read", + "readlink", + "remove", + "removedirs", + "rename", + "renames", + "replace", + "rmdir", + "scandir", + "sep", + "set_inheritable", + "spawnl", + "spawnle", + "spawnv", + "spawnve", + "stat", + "stat_result", + "statvfs_result", + "strerror", + "supports_bytes_environ", + "symlink", + "system", + "terminal_size", + "times", + "times_result", + "truncate", + "umask", + "uname_result", + "unlink", + "urandom", + "utime", + "waitpid", + "walk", + "write", +] +if sys.version_info >= (3, 9): + __all__ += ["waitstatus_to_exitcode"] +if sys.platform == "darwin" and sys.version_info >= (3, 12): + __all__ += ["PRIO_DARWIN_BG", "PRIO_DARWIN_NONUI", "PRIO_DARWIN_PROCESS", "PRIO_DARWIN_THREAD"] +if sys.platform == "darwin" and sys.version_info >= (3, 10): + __all__ += ["O_EVTONLY", "O_NOFOLLOW_ANY", "O_SYMLINK"] +if sys.platform == "linux": + __all__ += [ + "GRND_NONBLOCK", + "GRND_RANDOM", + "MFD_ALLOW_SEALING", + "MFD_CLOEXEC", + "MFD_HUGETLB", + "MFD_HUGE_16GB", + "MFD_HUGE_16MB", + "MFD_HUGE_1GB", + "MFD_HUGE_1MB", + "MFD_HUGE_256MB", + "MFD_HUGE_2GB", + "MFD_HUGE_2MB", + "MFD_HUGE_32MB", + "MFD_HUGE_512KB", + "MFD_HUGE_512MB", + "MFD_HUGE_64KB", + "MFD_HUGE_8MB", + "MFD_HUGE_MASK", + "MFD_HUGE_SHIFT", + "O_DIRECT", + "O_LARGEFILE", + "O_NOATIME", + "O_PATH", + "O_RSYNC", + "O_TMPFILE", + "RTLD_DEEPBIND", + "SCHED_BATCH", + "SCHED_IDLE", + "SCHED_RESET_ON_FORK", + "XATTR_CREATE", + "XATTR_REPLACE", + "XATTR_SIZE_MAX", + "copy_file_range", + "getrandom", + "getxattr", + "listxattr", + "memfd_create", + "removexattr", + "setxattr", + ] +if sys.platform == "linux" and sys.version_info >= (3, 13): + __all__ += [ + "POSIX_SPAWN_CLOSEFROM", + "TFD_CLOEXEC", + "TFD_NONBLOCK", + "TFD_TIMER_ABSTIME", + "TFD_TIMER_CANCEL_ON_SET", + "timerfd_create", + "timerfd_gettime", + "timerfd_gettime_ns", + "timerfd_settime", + "timerfd_settime_ns", + ] +if sys.platform == "linux" and sys.version_info >= (3, 12): + __all__ += [ + "CLONE_FILES", + "CLONE_FS", + "CLONE_NEWCGROUP", + "CLONE_NEWIPC", + "CLONE_NEWNET", + "CLONE_NEWNS", + "CLONE_NEWPID", + "CLONE_NEWUSER", + "CLONE_NEWUTS", + "CLONE_SIGHAND", + "CLONE_SYSVSEM", + "CLONE_THREAD", + "CLONE_VM", + "setns", + "unshare", + ] +if sys.platform == "linux" and sys.version_info >= (3, 10): + __all__ += [ + "EFD_CLOEXEC", + "EFD_NONBLOCK", + "EFD_SEMAPHORE", + "RWF_APPEND", + "SPLICE_F_MORE", + "SPLICE_F_MOVE", + "SPLICE_F_NONBLOCK", + "eventfd", + "eventfd_read", + "eventfd_write", + "splice", + ] +if sys.platform == "linux" and sys.version_info >= (3, 9): + __all__ += ["P_PIDFD", "pidfd_open"] +if sys.platform == "win32": + __all__ += [ + "O_BINARY", + "O_NOINHERIT", + "O_RANDOM", + "O_SEQUENTIAL", + "O_SHORT_LIVED", + "O_TEMPORARY", + "O_TEXT", + "P_DETACH", + "P_OVERLAY", + "get_handle_inheritable", + "set_handle_inheritable", + "startfile", + ] +if sys.platform == "win32" and sys.version_info >= (3, 12): + __all__ += ["listdrives", "listmounts", "listvolumes"] +if sys.platform != "win32": + __all__ += [ + "CLD_CONTINUED", + "CLD_DUMPED", + "CLD_EXITED", + "CLD_TRAPPED", + "EX_CANTCREAT", + "EX_CONFIG", + "EX_DATAERR", + "EX_IOERR", + "EX_NOHOST", + "EX_NOINPUT", + "EX_NOPERM", + "EX_NOUSER", + "EX_OSERR", + "EX_OSFILE", + "EX_PROTOCOL", + "EX_SOFTWARE", + "EX_TEMPFAIL", + "EX_UNAVAILABLE", + "EX_USAGE", + "F_LOCK", + "F_TEST", + "F_TLOCK", + "F_ULOCK", + "NGROUPS_MAX", + "O_ACCMODE", + "O_ASYNC", + "O_CLOEXEC", + "O_DIRECTORY", + "O_DSYNC", + "O_NDELAY", + "O_NOCTTY", + "O_NOFOLLOW", + "O_NONBLOCK", + "O_SYNC", + "POSIX_SPAWN_CLOSE", + "POSIX_SPAWN_DUP2", + "POSIX_SPAWN_OPEN", + "PRIO_PGRP", + "PRIO_PROCESS", + "PRIO_USER", + "P_ALL", + "P_PGID", + "P_PID", + "RTLD_GLOBAL", + "RTLD_LAZY", + "RTLD_LOCAL", + "RTLD_NODELETE", + "RTLD_NOLOAD", + "RTLD_NOW", + "SCHED_FIFO", + "SCHED_OTHER", + "SCHED_RR", + "SEEK_DATA", + "SEEK_HOLE", + "ST_NOSUID", + "ST_RDONLY", + "WCONTINUED", + "WCOREDUMP", + "WEXITED", + "WEXITSTATUS", + "WIFCONTINUED", + "WIFEXITED", + "WIFSIGNALED", + "WIFSTOPPED", + "WNOHANG", + "WNOWAIT", + "WSTOPPED", + "WSTOPSIG", + "WTERMSIG", + "WUNTRACED", + "chown", + "chroot", + "confstr", + "confstr_names", + "ctermid", + "environb", + "fchdir", + "fchown", + "fork", + "forkpty", + "fpathconf", + "fstatvfs", + "fwalk", + "getegid", + "getenvb", + "geteuid", + "getgid", + "getgrouplist", + "getgroups", + "getloadavg", + "getpgid", + "getpgrp", + "getpriority", + "getsid", + "getuid", + "initgroups", + "killpg", + "lchown", + "lockf", + "major", + "makedev", + "minor", + "mkfifo", + "mknod", + "nice", + "openpty", + "pathconf", + "pathconf_names", + "posix_spawn", + "posix_spawnp", + "pread", + "preadv", + "pwrite", + "pwritev", + "readv", + "register_at_fork", + "sched_get_priority_max", + "sched_get_priority_min", + "sched_yield", + "sendfile", + "setegid", + "seteuid", + "setgid", + "setgroups", + "setpgid", + "setpgrp", + "setpriority", + "setregid", + "setreuid", + "setsid", + "setuid", + "spawnlp", + "spawnlpe", + "spawnvp", + "spawnvpe", + "statvfs", + "sync", + "sysconf", + "sysconf_names", + "tcgetpgrp", + "tcsetpgrp", + "ttyname", + "uname", + "wait", + "wait3", + "wait4", + "writev", + ] +if sys.platform != "win32" and sys.version_info >= (3, 13): + __all__ += ["grantpt", "posix_openpt", "ptsname", "unlockpt"] +if sys.platform != "win32" and sys.version_info >= (3, 11): + __all__ += ["login_tty"] +if sys.platform != "win32" and sys.version_info >= (3, 10): + __all__ += ["O_FSYNC"] +if sys.platform != "win32" and sys.version_info >= (3, 9): + __all__ += ["CLD_KILLED", "CLD_STOPPED"] +if sys.platform != "darwin" and sys.platform != "win32": + __all__ += [ + "POSIX_FADV_DONTNEED", + "POSIX_FADV_NOREUSE", + "POSIX_FADV_NORMAL", + "POSIX_FADV_RANDOM", + "POSIX_FADV_SEQUENTIAL", + "POSIX_FADV_WILLNEED", + "RWF_DSYNC", + "RWF_HIPRI", + "RWF_NOWAIT", + "RWF_SYNC", + "ST_APPEND", + "ST_MANDLOCK", + "ST_NOATIME", + "ST_NODEV", + "ST_NODIRATIME", + "ST_NOEXEC", + "ST_RELATIME", + "ST_SYNCHRONOUS", + "ST_WRITE", + "fdatasync", + "getresgid", + "getresuid", + "pipe2", + "posix_fadvise", + "posix_fallocate", + "sched_getaffinity", + "sched_getparam", + "sched_getscheduler", + "sched_param", + "sched_rr_get_interval", + "sched_setaffinity", + "sched_setparam", + "sched_setscheduler", + "setresgid", + "setresuid", + ] +if sys.platform != "linux" and sys.platform != "win32": + __all__ += ["O_EXLOCK", "O_SHLOCK", "chflags", "lchflags"] +if sys.platform != "linux" and sys.platform != "win32" and sys.version_info >= (3, 13): + __all__ += ["O_EXEC", "O_SEARCH"] +if sys.platform != "darwin" or sys.version_info >= (3, 13): + if sys.platform != "win32": + __all__ += ["waitid", "waitid_result"] +if sys.platform != "win32" or sys.version_info >= (3, 13): + __all__ += ["fchmod"] + if sys.platform != "linux": + __all__ += ["lchmod"] +if sys.platform != "win32" or sys.version_info >= (3, 12): + __all__ += ["get_blocking", "set_blocking"] +if sys.platform != "win32" or sys.version_info >= (3, 11): + __all__ += ["EX_OK"] +if sys.platform != "win32" or sys.version_info >= (3, 9): + __all__ += ["unsetenv"] + # This unnecessary alias is to work around various errors path = _path @@ -125,15 +564,16 @@ if sys.platform != "win32": CLD_KILLED: int CLD_STOPPED: int - # TODO: SCHED_RESET_ON_FORK not available on darwin? - # TODO: SCHED_BATCH and SCHED_IDLE are linux only? - SCHED_OTHER: int # some flavors of Unix - SCHED_BATCH: int # some flavors of Unix - SCHED_IDLE: int # some flavors of Unix - SCHED_SPORADIC: int # some flavors of Unix - SCHED_FIFO: int # some flavors of Unix - SCHED_RR: int # some flavors of Unix - SCHED_RESET_ON_FORK: int # some flavors of Unix + SCHED_OTHER: int + SCHED_FIFO: int + SCHED_RR: int + if sys.platform != "darwin" and sys.platform != "linux": + SCHED_SPORADIC: int + +if sys.platform == "linux": + SCHED_BATCH: int + SCHED_IDLE: int + SCHED_RESET_ON_FORK: int if sys.platform != "win32": RTLD_LAZY: int @@ -158,8 +598,8 @@ SEEK_SET: int SEEK_CUR: int SEEK_END: int if sys.platform != "win32": - SEEK_DATA: int # some flavors of Unix - SEEK_HOLE: int # some flavors of Unix + SEEK_DATA: int + SEEK_HOLE: int O_RDONLY: int O_WRONLY: int @@ -168,34 +608,50 @@ O_APPEND: int O_CREAT: int O_EXCL: int O_TRUNC: int -# We don't use sys.platform for O_* flags to denote platform-dependent APIs because some codes, -# including tests for mypy, use a more finer way than sys.platform before using these APIs -# See https://github.com/python/typeshed/pull/2286 for discussions -O_DSYNC: int # Unix only -O_RSYNC: int # Unix only -O_SYNC: int # Unix only -O_NDELAY: int # Unix only -O_NONBLOCK: int # Unix only -O_NOCTTY: int # Unix only -O_CLOEXEC: int # Unix only -O_SHLOCK: int # Unix only -O_EXLOCK: int # Unix only -O_BINARY: int # Windows only -O_NOINHERIT: int # Windows only -O_SHORT_LIVED: int # Windows only -O_TEMPORARY: int # Windows only -O_RANDOM: int # Windows only -O_SEQUENTIAL: int # Windows only -O_TEXT: int # Windows only -O_ASYNC: int # Gnu extension if in C library -O_DIRECT: int # Gnu extension if in C library -O_DIRECTORY: int # Gnu extension if in C library -O_NOFOLLOW: int # Gnu extension if in C library -O_NOATIME: int # Gnu extension if in C library -O_PATH: int # Gnu extension if in C library -O_TMPFILE: int # Gnu extension if in C library -O_LARGEFILE: int # Gnu extension if in C library -O_ACCMODE: int # TODO: when does this exist? +if sys.platform == "win32": + O_BINARY: int + O_NOINHERIT: int + O_SHORT_LIVED: int + O_TEMPORARY: int + O_RANDOM: int + O_SEQUENTIAL: int + O_TEXT: int + +if sys.platform != "win32": + O_DSYNC: int + O_SYNC: int + O_NDELAY: int + O_NONBLOCK: int + O_NOCTTY: int + O_CLOEXEC: int + O_ASYNC: int # Gnu extension if in C library + O_DIRECTORY: int # Gnu extension if in C library + O_NOFOLLOW: int # Gnu extension if in C library + O_ACCMODE: int # TODO: when does this exist? + +if sys.platform == "linux": + O_RSYNC: int + O_DIRECT: int # Gnu extension if in C library + O_NOATIME: int # Gnu extension if in C library + O_PATH: int # Gnu extension if in C library + O_TMPFILE: int # Gnu extension if in C library + O_LARGEFILE: int # Gnu extension if in C library + +if sys.platform != "linux" and sys.platform != "win32": + O_SHLOCK: int + O_EXLOCK: int + +if sys.platform == "darwin" and sys.version_info >= (3, 10): + O_EVTONLY: int + O_NOFOLLOW_ANY: int + O_SYMLINK: int + +if sys.platform != "win32" and sys.version_info >= (3, 10): + O_FSYNC: int + +if sys.platform != "linux" and sys.platform != "win32" and sys.version_info >= (3, 13): + O_EXEC: int + O_SEARCH: int if sys.platform != "win32" and sys.platform != "darwin": # posix, but apparently missing on macos @@ -413,8 +869,11 @@ In the future, this property will contain the last metadata change time.""" # Attributes documented as sometimes appearing, but deliberately omitted from the stub: `st_creator`, `st_rsize`, `st_type`. # See https://github.com/python/typeshed/pull/6560#issuecomment-991253327 +# mypy and pyright object to this being both ABC and Protocol. +# At runtime it inherits from ABC and is not a Protocol, but it will be +# on the allowlist for use as a Protocol starting in 3.14. @runtime_checkable -class PathLike(Protocol[AnyStr_co]): +class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] @abstractmethod def __fspath__(self) -> AnyStr_co: ... @@ -794,9 +1253,12 @@ def replace( src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None ) -> None: ... def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... - -class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr], None]): +@final +class _ScandirIterator(Generic[AnyStr]): + def __del__(self) -> None: ... + def __iter__(self) -> Self: ... def __next__(self) -> DirEntry[AnyStr]: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: Unused) -> None: ... def close(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/platform.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/platform.pyi index c47ecdc51df4..73393eada02c 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/platform.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/platform.pyi @@ -1,5 +1,6 @@ import sys -from typing import NamedTuple +from typing import NamedTuple, type_check_only +from typing_extensions import Self def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ... @@ -14,13 +15,40 @@ def java_ver( def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... def architecture(executable: str = sys.executable, bits: str = "", linkage: str = "") -> tuple[str, str]: ... -class uname_result(NamedTuple): - system: str - node: str - release: str - version: str - machine: str - processor: str +if sys.version_info >= (3, 9): + # This class is not exposed. It calls itself platform.uname_result_base. + # At runtime it only has 5 fields. + @type_check_only + class _uname_result_base(NamedTuple): + system: str + node: str + release: str + version: str + machine: str + # This base class doesn't have this field at runtime, but claiming it + # does is the least bad way to handle the situation. Nobody really + # sees this class anyway. See #13068 + processor: str + + # uname_result emulates a 6-field named tuple, but the processor field + # is lazily evaluated rather than being passed in to the constructor. + class uname_result(_uname_result_base): + if sys.version_info >= (3, 10): + __match_args__ = ("system", "node", "release", "version", "machine") # pyright: ignore[reportAssignmentType] + + def __new__(_cls, system: str, node: str, release: str, version: str, machine: str) -> Self: ... + @property + def processor(self) -> str: ... + +else: + # On 3.8, uname_result is actually just a regular NamedTuple. + class uname_result(NamedTuple): + system: str + node: str + release: str + version: str + machine: str + processor: str def uname() -> uname_result: ... def system() -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/posix.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/posix.pyi index 1a4f22af82cf..7a4d6cb4bdbe 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/posix.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/posix.pyi @@ -29,22 +29,20 @@ if sys.platform != "win32": F_TLOCK as F_TLOCK, F_ULOCK as F_ULOCK, NGROUPS_MAX as NGROUPS_MAX, + O_ACCMODE as O_ACCMODE, O_APPEND as O_APPEND, O_ASYNC as O_ASYNC, + O_CLOEXEC as O_CLOEXEC, O_CREAT as O_CREAT, - O_DIRECT as O_DIRECT, O_DIRECTORY as O_DIRECTORY, O_DSYNC as O_DSYNC, O_EXCL as O_EXCL, - O_LARGEFILE as O_LARGEFILE, O_NDELAY as O_NDELAY, - O_NOATIME as O_NOATIME, O_NOCTTY as O_NOCTTY, O_NOFOLLOW as O_NOFOLLOW, O_NONBLOCK as O_NONBLOCK, O_RDONLY as O_RDONLY, O_RDWR as O_RDWR, - O_RSYNC as O_RSYNC, O_SYNC as O_SYNC, O_TRUNC as O_TRUNC, O_WRONLY as O_WRONLY, @@ -64,13 +62,9 @@ if sys.platform != "win32": RTLD_NODELETE as RTLD_NODELETE, RTLD_NOLOAD as RTLD_NOLOAD, RTLD_NOW as RTLD_NOW, - SCHED_BATCH as SCHED_BATCH, SCHED_FIFO as SCHED_FIFO, - SCHED_IDLE as SCHED_IDLE, SCHED_OTHER as SCHED_OTHER, - SCHED_RESET_ON_FORK as SCHED_RESET_ON_FORK, SCHED_RR as SCHED_RR, - SCHED_SPORADIC as SCHED_SPORADIC, SEEK_DATA as SEEK_DATA, SEEK_HOLE as SEEK_HOLE, ST_NOSUID as ST_NOSUID, @@ -233,6 +227,9 @@ if sys.platform != "win32": if sys.version_info >= (3, 9): from os import CLD_KILLED as CLD_KILLED, CLD_STOPPED as CLD_STOPPED, waitstatus_to_exitcode as waitstatus_to_exitcode + if sys.version_info >= (3, 10): + from os import O_FSYNC as O_FSYNC + if sys.version_info >= (3, 11): from os import login_tty as login_tty @@ -254,10 +251,13 @@ if sys.platform != "win32": ) if sys.platform != "linux": - from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod + from os import O_EXLOCK as O_EXLOCK, O_SHLOCK as O_SHLOCK, chflags as chflags, lchflags as lchflags, lchmod as lchmod if sys.platform != "linux" and sys.platform != "darwin": - from os import EX_NOTFOUND as EX_NOTFOUND + from os import EX_NOTFOUND as EX_NOTFOUND, SCHED_SPORADIC as SCHED_SPORADIC + + if sys.platform != "linux" and sys.version_info >= (3, 13): + from os import O_EXEC as O_EXEC, O_SEARCH as O_SEARCH if sys.platform != "darwin": from os import ( @@ -271,6 +271,15 @@ if sys.platform != "win32": RWF_HIPRI as RWF_HIPRI, RWF_NOWAIT as RWF_NOWAIT, RWF_SYNC as RWF_SYNC, + ST_APPEND as ST_APPEND, + ST_MANDLOCK as ST_MANDLOCK, + ST_NOATIME as ST_NOATIME, + ST_NODEV as ST_NODEV, + ST_NODIRATIME as ST_NODIRATIME, + ST_NOEXEC as ST_NOEXEC, + ST_RELATIME as ST_RELATIME, + ST_SYNCHRONOUS as ST_SYNCHRONOUS, + ST_WRITE as ST_WRITE, fdatasync as fdatasync, getresgid as getresgid, getresuid as getresuid, @@ -315,7 +324,16 @@ if sys.platform != "win32": MFD_HUGE_MASK as MFD_HUGE_MASK, MFD_HUGE_SHIFT as MFD_HUGE_SHIFT, MFD_HUGETLB as MFD_HUGETLB, + O_DIRECT as O_DIRECT, + O_LARGEFILE as O_LARGEFILE, + O_NOATIME as O_NOATIME, + O_PATH as O_PATH, + O_RSYNC as O_RSYNC, + O_TMPFILE as O_TMPFILE, RTLD_DEEPBIND as RTLD_DEEPBIND, + SCHED_BATCH as SCHED_BATCH, + SCHED_IDLE as SCHED_IDLE, + SCHED_RESET_ON_FORK as SCHED_RESET_ON_FORK, XATTR_CREATE as XATTR_CREATE, XATTR_REPLACE as XATTR_REPLACE, XATTR_SIZE_MAX as XATTR_SIZE_MAX, @@ -373,6 +391,8 @@ if sys.platform != "win32": PRIO_DARWIN_PROCESS as PRIO_DARWIN_PROCESS, PRIO_DARWIN_THREAD as PRIO_DARWIN_THREAD, ) + if sys.platform == "darwin" and sys.version_info >= (3, 10): + from os import O_EVTONLY as O_EVTONLY, O_NOFOLLOW_ANY as O_NOFOLLOW_ANY, O_SYMLINK as O_SYMLINK # Not same as os.environ or os.environb # Because of this variable, we can't do "from posix import *" in os/__init__.pyi diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/pstats.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/pstats.pyi index 83256b433035..d41fa202cf77 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/pstats.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/pstats.pyi @@ -1,11 +1,16 @@ import sys -from _typeshed import StrEnum, StrOrBytesPath +from _typeshed import StrOrBytesPath from collections.abc import Iterable from cProfile import Profile as _cProfile from profile import Profile from typing import IO, Any, Literal, overload from typing_extensions import Self, TypeAlias +if sys.version_info >= (3, 11): + from enum import StrEnum +else: + from enum import Enum + if sys.version_info >= (3, 9): __all__ = ["Stats", "SortKey", "FunctionProfile", "StatsProfile"] else: @@ -13,16 +18,29 @@ else: _Selector: TypeAlias = str | float | int -class SortKey(StrEnum): - CALLS = "calls" - CUMULATIVE = "cumulative" - FILENAME = "filename" - LINE = "line" - NAME = "name" - NFL = "nfl" - PCALLS = "pcalls" - STDNAME = "stdname" - TIME = "time" +if sys.version_info >= (3, 11): + class SortKey(StrEnum): + CALLS = "calls" + CUMULATIVE = "cumulative" + FILENAME = "filename" + LINE = "line" + NAME = "name" + NFL = "nfl" + PCALLS = "pcalls" + STDNAME = "stdname" + TIME = "time" + +else: + class SortKey(str, Enum): + CALLS = "calls" + CUMULATIVE = "cumulative" + FILENAME = "filename" + LINE = "line" + NAME = "name" + NFL = "nfl" + PCALLS = "pcalls" + STDNAME = "stdname" + TIME = "time" if sys.version_info >= (3, 9): from dataclasses import dataclass diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/pyexpat/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/pyexpat/__init__.pyi index d38259a20d72..21e676052098 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/pyexpat/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/pyexpat/__init__.pyi @@ -2,7 +2,7 @@ from _typeshed import ReadableBuffer, SupportsRead from collections.abc import Callable from pyexpat import errors as errors, model as model from typing import Any, Final, final -from typing_extensions import TypeAlias +from typing_extensions import CapsuleType, TypeAlias from xml.parsers.expat import ExpatError as ExpatError EXPAT_VERSION: Final[str] # undocumented @@ -78,3 +78,5 @@ def ErrorString(code: int, /) -> str: ... def ParserCreate( encoding: str | None = None, namespace_separator: str | None = None, intern: dict[str, Any] | None = None ) -> XMLParserType: ... + +expat_CAPI: CapsuleType diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi index 75dd63d0414a..ace501430847 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi @@ -1,6 +1,6 @@ import sys from collections.abc import Callable -from typing import Any, NamedTuple +from typing import Any, NamedTuple, type_check_only from typing_extensions import TypeAlias __all__ = ["scheduler"] @@ -17,13 +17,16 @@ if sys.version_info >= (3, 10): kwargs: dict[str, Any] else: - class Event(NamedTuple): + @type_check_only + class _EventBase(NamedTuple): time: float priority: Any action: _ActionCallback argument: tuple[Any, ...] kwargs: dict[str, Any] + class Event(_EventBase): ... + class scheduler: timefunc: Callable[[], float] delayfunc: Callable[[float], object] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi index 39a93ce4d0f3..e42bba757fc3 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi @@ -28,7 +28,6 @@ from _socket import ( IP_MULTICAST_LOOP as IP_MULTICAST_LOOP, IP_MULTICAST_TTL as IP_MULTICAST_TTL, IP_OPTIONS as IP_OPTIONS, - IP_RECVDSTADDR as IP_RECVDSTADDR, IP_TOS as IP_TOS, IP_TTL as IP_TTL, IPPORT_RESERVED as IPPORT_RESERVED, @@ -38,17 +37,13 @@ from _socket import ( IPPROTO_EGP as IPPROTO_EGP, IPPROTO_ESP as IPPROTO_ESP, IPPROTO_FRAGMENT as IPPROTO_FRAGMENT, - IPPROTO_GGP as IPPROTO_GGP, IPPROTO_HOPOPTS as IPPROTO_HOPOPTS, IPPROTO_ICMP as IPPROTO_ICMP, IPPROTO_ICMPV6 as IPPROTO_ICMPV6, IPPROTO_IDP as IPPROTO_IDP, IPPROTO_IGMP as IPPROTO_IGMP, IPPROTO_IP as IPPROTO_IP, - IPPROTO_IPV4 as IPPROTO_IPV4, IPPROTO_IPV6 as IPPROTO_IPV6, - IPPROTO_MAX as IPPROTO_MAX, - IPPROTO_ND as IPPROTO_ND, IPPROTO_NONE as IPPROTO_NONE, IPPROTO_PIM as IPPROTO_PIM, IPPROTO_PUP as IPPROTO_PUP, @@ -93,7 +88,6 @@ from _socket import ( SO_SNDLOWAT as SO_SNDLOWAT, SO_SNDTIMEO as SO_SNDTIMEO, SO_TYPE as SO_TYPE, - SO_USELOOPBACK as SO_USELOOPBACK, SOL_IP as SOL_IP, SOL_SOCKET as SOL_SOCKET, SOL_TCP as SOL_TCP, @@ -139,8 +133,176 @@ from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase from typing import Any, Literal, Protocol, SupportsIndex, overload from typing_extensions import Self +__all__ = [ + "fromfd", + "getfqdn", + "create_connection", + "create_server", + "has_dualstack_ipv6", + "AddressFamily", + "SocketKind", + "AF_APPLETALK", + "AF_DECnet", + "AF_INET", + "AF_INET6", + "AF_IPX", + "AF_SNA", + "AF_UNSPEC", + "AI_ADDRCONFIG", + "AI_ALL", + "AI_CANONNAME", + "AI_NUMERICHOST", + "AI_NUMERICSERV", + "AI_PASSIVE", + "AI_V4MAPPED", + "CAPI", + "EAI_AGAIN", + "EAI_BADFLAGS", + "EAI_FAIL", + "EAI_FAMILY", + "EAI_MEMORY", + "EAI_NODATA", + "EAI_NONAME", + "EAI_SERVICE", + "EAI_SOCKTYPE", + "INADDR_ALLHOSTS_GROUP", + "INADDR_ANY", + "INADDR_BROADCAST", + "INADDR_LOOPBACK", + "INADDR_MAX_LOCAL_GROUP", + "INADDR_NONE", + "INADDR_UNSPEC_GROUP", + "IPPORT_RESERVED", + "IPPORT_USERRESERVED", + "IPPROTO_AH", + "IPPROTO_DSTOPTS", + "IPPROTO_EGP", + "IPPROTO_ESP", + "IPPROTO_FRAGMENT", + "IPPROTO_HOPOPTS", + "IPPROTO_ICMP", + "IPPROTO_ICMPV6", + "IPPROTO_IDP", + "IPPROTO_IGMP", + "IPPROTO_IP", + "IPPROTO_IPV6", + "IPPROTO_NONE", + "IPPROTO_PIM", + "IPPROTO_PUP", + "IPPROTO_RAW", + "IPPROTO_ROUTING", + "IPPROTO_SCTP", + "IPPROTO_TCP", + "IPPROTO_UDP", + "IPV6_CHECKSUM", + "IPV6_JOIN_GROUP", + "IPV6_LEAVE_GROUP", + "IPV6_MULTICAST_HOPS", + "IPV6_MULTICAST_IF", + "IPV6_MULTICAST_LOOP", + "IPV6_RECVTCLASS", + "IPV6_TCLASS", + "IPV6_UNICAST_HOPS", + "IPV6_V6ONLY", + "IP_ADD_MEMBERSHIP", + "IP_DROP_MEMBERSHIP", + "IP_HDRINCL", + "IP_MULTICAST_IF", + "IP_MULTICAST_LOOP", + "IP_MULTICAST_TTL", + "IP_OPTIONS", + "IP_TOS", + "IP_TTL", + "MSG_CTRUNC", + "MSG_DONTROUTE", + "MSG_OOB", + "MSG_PEEK", + "MSG_TRUNC", + "MSG_WAITALL", + "NI_DGRAM", + "NI_MAXHOST", + "NI_MAXSERV", + "NI_NAMEREQD", + "NI_NOFQDN", + "NI_NUMERICHOST", + "NI_NUMERICSERV", + "SHUT_RD", + "SHUT_RDWR", + "SHUT_WR", + "SOCK_DGRAM", + "SOCK_RAW", + "SOCK_RDM", + "SOCK_SEQPACKET", + "SOCK_STREAM", + "SOL_IP", + "SOL_SOCKET", + "SOL_TCP", + "SOL_UDP", + "SOMAXCONN", + "SO_ACCEPTCONN", + "SO_BROADCAST", + "SO_DEBUG", + "SO_DONTROUTE", + "SO_ERROR", + "SO_KEEPALIVE", + "SO_LINGER", + "SO_OOBINLINE", + "SO_RCVBUF", + "SO_RCVLOWAT", + "SO_RCVTIMEO", + "SO_REUSEADDR", + "SO_SNDBUF", + "SO_SNDLOWAT", + "SO_SNDTIMEO", + "SO_TYPE", + "SocketType", + "TCP_FASTOPEN", + "TCP_KEEPCNT", + "TCP_KEEPINTVL", + "TCP_MAXSEG", + "TCP_NODELAY", + "close", + "dup", + "error", + "gaierror", + "getaddrinfo", + "getdefaulttimeout", + "gethostbyaddr", + "gethostbyname", + "gethostbyname_ex", + "gethostname", + "getnameinfo", + "getprotobyname", + "getservbyname", + "getservbyport", + "has_ipv6", + "herror", + "htonl", + "htons", + "if_indextoname", + "if_nameindex", + "if_nametoindex", + "inet_aton", + "inet_ntoa", + "inet_ntop", + "inet_pton", + "ntohl", + "ntohs", + "setdefaulttimeout", + "socket", + "socketpair", + "timeout", +] + if sys.platform == "win32": from _socket import ( + IPPROTO_CBT as IPPROTO_CBT, + IPPROTO_ICLFXBM as IPPROTO_ICLFXBM, + IPPROTO_IGP as IPPROTO_IGP, + IPPROTO_L2TP as IPPROTO_L2TP, + IPPROTO_PGM as IPPROTO_PGM, + IPPROTO_RDP as IPPROTO_RDP, + IPPROTO_ST as IPPROTO_ST, RCVALL_MAX as RCVALL_MAX, RCVALL_OFF as RCVALL_OFF, RCVALL_ON as RCVALL_ON, @@ -151,6 +313,28 @@ if sys.platform == "win32": SO_EXCLUSIVEADDRUSE as SO_EXCLUSIVEADDRUSE, ) + __all__ += [ + "IPPROTO_CBT", + "IPPROTO_ICLFXBM", + "IPPROTO_IGP", + "IPPROTO_L2TP", + "IPPROTO_PGM", + "IPPROTO_RDP", + "IPPROTO_ST", + "RCVALL_MAX", + "RCVALL_OFF", + "RCVALL_ON", + "RCVALL_SOCKETLEVELONLY", + "SIO_KEEPALIVE_VALS", + "SIO_LOOPBACK_FAST_PATH", + "SIO_RCVALL", + "SO_EXCLUSIVEADDRUSE", + "fromshare", + "errorTab", + "MSG_BCAST", + "MSG_MCAST", + ] + if sys.platform != "darwin" or sys.version_info >= (3, 9): from _socket import ( IPV6_DONTFRAG as IPV6_DONTFRAG, @@ -161,33 +345,26 @@ if sys.platform != "darwin" or sys.version_info >= (3, 9): IPV6_RTHDR as IPV6_RTHDR, ) + __all__ += ["IPV6_DONTFRAG", "IPV6_HOPLIMIT", "IPV6_HOPOPTS", "IPV6_PKTINFO", "IPV6_RECVRTHDR", "IPV6_RTHDR"] + if sys.platform == "darwin": from _socket import PF_SYSTEM as PF_SYSTEM, SYSPROTO_CONTROL as SYSPROTO_CONTROL + __all__ += ["PF_SYSTEM", "SYSPROTO_CONTROL", "AF_SYSTEM"] + if sys.platform != "darwin": - from _socket import ( - IPPROTO_CBT as IPPROTO_CBT, - IPPROTO_ICLFXBM as IPPROTO_ICLFXBM, - IPPROTO_IGP as IPPROTO_IGP, - IPPROTO_L2TP as IPPROTO_L2TP, - IPPROTO_PGM as IPPROTO_PGM, - IPPROTO_RDP as IPPROTO_RDP, - IPPROTO_ST as IPPROTO_ST, - TCP_KEEPIDLE as TCP_KEEPIDLE, - ) + from _socket import TCP_KEEPIDLE as TCP_KEEPIDLE + + __all__ += ["TCP_KEEPIDLE", "AF_IRDA", "MSG_ERRQUEUE"] if sys.version_info >= (3, 10): from _socket import IP_RECVTOS as IP_RECVTOS -elif sys.platform != "win32" and sys.platform != "darwin": - from _socket import IP_RECVTOS as IP_RECVTOS + + __all__ += ["IP_RECVTOS"] if sys.platform != "win32" and sys.platform != "darwin": from _socket import ( - IP_BIND_ADDRESS_NO_PORT as IP_BIND_ADDRESS_NO_PORT, IP_TRANSPARENT as IP_TRANSPARENT, - IPPROTO_BIP as IPPROTO_BIP, - IPPROTO_MOBILE as IPPROTO_MOBILE, - IPPROTO_VRRP as IPPROTO_VRRP, IPX_TYPE as IPX_TYPE, SCM_CREDENTIALS as SCM_CREDENTIALS, SO_BINDTODEVICE as SO_BINDTODEVICE, @@ -199,7 +376,6 @@ if sys.platform != "win32" and sys.platform != "darwin": SO_PEERSEC as SO_PEERSEC, SO_PRIORITY as SO_PRIORITY, SO_PROTOCOL as SO_PROTOCOL, - SO_SETFIB as SO_SETFIB, SOL_ATALK as SOL_ATALK, SOL_AX25 as SOL_AX25, SOL_HCI as SOL_HCI, @@ -217,15 +393,59 @@ if sys.platform != "win32" and sys.platform != "darwin": TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP, ) + __all__ += [ + "IP_TRANSPARENT", + "SCM_CREDENTIALS", + "SO_BINDTODEVICE", + "SO_DOMAIN", + "SO_MARK", + "SO_PASSCRED", + "SO_PASSSEC", + "SO_PEERCRED", + "SO_PEERSEC", + "SO_PRIORITY", + "SO_PROTOCOL", + "TCP_CONGESTION", + "TCP_CORK", + "TCP_DEFER_ACCEPT", + "TCP_INFO", + "TCP_LINGER2", + "TCP_QUICKACK", + "TCP_SYNCNT", + "TCP_USER_TIMEOUT", + "TCP_WINDOW_CLAMP", + "AF_ASH", + "AF_ATMPVC", + "AF_ATMSVC", + "AF_AX25", + "AF_BRIDGE", + "AF_ECONET", + "AF_KEY", + "AF_LLC", + "AF_NETBEUI", + "AF_NETROM", + "AF_PPPOX", + "AF_ROSE", + "AF_SECURITY", + "AF_WANPIPE", + "AF_X25", + "MSG_CMSG_CLOEXEC", + "MSG_CONFIRM", + "MSG_FASTOPEN", + "MSG_MORE", + ] + +if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11): + from _socket import IP_BIND_ADDRESS_NO_PORT as IP_BIND_ADDRESS_NO_PORT + + __all__ += ["IP_BIND_ADDRESS_NO_PORT"] + if sys.platform != "win32": from _socket import ( CMSG_LEN as CMSG_LEN, CMSG_SPACE as CMSG_SPACE, EAI_ADDRFAMILY as EAI_ADDRFAMILY, - EAI_BADHINTS as EAI_BADHINTS, - EAI_MAX as EAI_MAX, EAI_OVERFLOW as EAI_OVERFLOW, - EAI_PROTOCOL as EAI_PROTOCOL, EAI_SYSTEM as EAI_SYSTEM, IP_DEFAULT_MULTICAST_LOOP as IP_DEFAULT_MULTICAST_LOOP, IP_DEFAULT_MULTICAST_TTL as IP_DEFAULT_MULTICAST_TTL, @@ -233,23 +453,45 @@ if sys.platform != "win32": IP_RECVOPTS as IP_RECVOPTS, IP_RECVRETOPTS as IP_RECVRETOPTS, IP_RETOPTS as IP_RETOPTS, - IPPROTO_EON as IPPROTO_EON, IPPROTO_GRE as IPPROTO_GRE, - IPPROTO_HELLO as IPPROTO_HELLO, - IPPROTO_IPCOMP as IPPROTO_IPCOMP, IPPROTO_IPIP as IPPROTO_IPIP, IPPROTO_RSVP as IPPROTO_RSVP, IPPROTO_TP as IPPROTO_TP, - IPPROTO_XTP as IPPROTO_XTP, IPV6_RTHDR_TYPE_0 as IPV6_RTHDR_TYPE_0, - LOCAL_PEERCRED as LOCAL_PEERCRED, - SCM_CREDS as SCM_CREDS, SCM_RIGHTS as SCM_RIGHTS, SO_REUSEPORT as SO_REUSEPORT, TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT, sethostname as sethostname, ) + __all__ += [ + "CMSG_LEN", + "CMSG_SPACE", + "EAI_ADDRFAMILY", + "EAI_OVERFLOW", + "EAI_SYSTEM", + "IP_DEFAULT_MULTICAST_LOOP", + "IP_DEFAULT_MULTICAST_TTL", + "IP_MAX_MEMBERSHIPS", + "IP_RECVOPTS", + "IP_RECVRETOPTS", + "IP_RETOPTS", + "IPPROTO_GRE", + "IPPROTO_IPIP", + "IPPROTO_RSVP", + "IPPROTO_TP", + "IPV6_RTHDR_TYPE_0", + "SCM_RIGHTS", + "SO_REUSEPORT", + "TCP_NOTSENT_LOWAT", + "sethostname", + "AF_ROUTE", + "AF_UNIX", + "MSG_DONTWAIT", + "MSG_EOR", + "MSG_NOSIGNAL", + ] + if sys.platform != "darwin" or sys.version_info >= (3, 9): from _socket import ( IPV6_DSTOPTS as IPV6_DSTOPTS, @@ -261,19 +503,36 @@ if sys.platform != "win32": IPV6_RECVPATHMTU as IPV6_RECVPATHMTU, IPV6_RECVPKTINFO as IPV6_RECVPKTINFO, IPV6_RTHDRDSTOPTS as IPV6_RTHDRDSTOPTS, - IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU, ) -if sys.platform != "darwin": + __all__ += [ + "IPV6_DSTOPTS", + "IPV6_NEXTHOP", + "IPV6_PATHMTU", + "IPV6_RECVDSTOPTS", + "IPV6_RECVHOPLIMIT", + "IPV6_RECVHOPOPTS", + "IPV6_RECVPATHMTU", + "IPV6_RECVPKTINFO", + "IPV6_RTHDRDSTOPTS", + ] + +if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "win32" or sys.version_info >= (3, 9): from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM + __all__ += ["BDADDR_ANY", "BDADDR_LOCAL", "BTPROTO_RFCOMM"] + if sys.platform == "darwin" and sys.version_info >= (3, 10): from _socket import TCP_KEEPALIVE as TCP_KEEPALIVE + __all__ += ["TCP_KEEPALIVE"] + if sys.platform == "darwin" and sys.version_info >= (3, 11): from _socket import TCP_CONNECTION_INFO as TCP_CONNECTION_INFO + __all__ += ["TCP_CONNECTION_INFO"] + if sys.platform == "linux": from _socket import ( ALG_OP_DECRYPT as ALG_OP_DECRYPT, @@ -317,7 +576,6 @@ if sys.platform == "linux": CAN_ERR_MASK as CAN_ERR_MASK, CAN_ISOTP as CAN_ISOTP, CAN_RAW as CAN_RAW, - CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER, CAN_RAW_FD_FRAMES as CAN_RAW_FD_FRAMES, CAN_RAW_FILTER as CAN_RAW_FILTER, CAN_RAW_LOOPBACK as CAN_RAW_LOOPBACK, @@ -325,19 +583,13 @@ if sys.platform == "linux": CAN_RTR_FLAG as CAN_RTR_FLAG, CAN_SFF_MASK as CAN_SFF_MASK, IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID, - NETLINK_ARPD as NETLINK_ARPD, NETLINK_CRYPTO as NETLINK_CRYPTO, NETLINK_DNRTMSG as NETLINK_DNRTMSG, NETLINK_FIREWALL as NETLINK_FIREWALL, NETLINK_IP6_FW as NETLINK_IP6_FW, NETLINK_NFLOG as NETLINK_NFLOG, NETLINK_ROUTE as NETLINK_ROUTE, - NETLINK_ROUTE6 as NETLINK_ROUTE6, - NETLINK_SKIP as NETLINK_SKIP, - NETLINK_TAPBASE as NETLINK_TAPBASE, - NETLINK_TCPDIAG as NETLINK_TCPDIAG, NETLINK_USERSOCK as NETLINK_USERSOCK, - NETLINK_W1 as NETLINK_W1, NETLINK_XFRM as NETLINK_XFRM, PACKET_BROADCAST as PACKET_BROADCAST, PACKET_FASTROUTE as PACKET_FASTROUTE, @@ -354,7 +606,6 @@ if sys.platform == "linux": RDS_CMSG_RDMA_DEST as RDS_CMSG_RDMA_DEST, RDS_CMSG_RDMA_MAP as RDS_CMSG_RDMA_MAP, RDS_CMSG_RDMA_STATUS as RDS_CMSG_RDMA_STATUS, - RDS_CMSG_RDMA_UPDATE as RDS_CMSG_RDMA_UPDATE, RDS_CONG_MONITOR as RDS_CONG_MONITOR, RDS_FREE_MR as RDS_FREE_MR, RDS_GET_MR as RDS_GET_MR, @@ -404,10 +655,130 @@ if sys.platform == "linux": VMADDR_PORT_ANY as VMADDR_PORT_ANY, ) + __all__ += [ + "ALG_OP_DECRYPT", + "ALG_OP_ENCRYPT", + "ALG_OP_SIGN", + "ALG_OP_VERIFY", + "ALG_SET_AEAD_ASSOCLEN", + "ALG_SET_AEAD_AUTHSIZE", + "ALG_SET_IV", + "ALG_SET_KEY", + "ALG_SET_OP", + "ALG_SET_PUBKEY", + "CAN_BCM", + "CAN_BCM_CAN_FD_FRAME", + "CAN_BCM_RX_ANNOUNCE_RESUME", + "CAN_BCM_RX_CHANGED", + "CAN_BCM_RX_CHECK_DLC", + "CAN_BCM_RX_DELETE", + "CAN_BCM_RX_FILTER_ID", + "CAN_BCM_RX_NO_AUTOTIMER", + "CAN_BCM_RX_READ", + "CAN_BCM_RX_RTR_FRAME", + "CAN_BCM_RX_SETUP", + "CAN_BCM_RX_STATUS", + "CAN_BCM_RX_TIMEOUT", + "CAN_BCM_SETTIMER", + "CAN_BCM_STARTTIMER", + "CAN_BCM_TX_ANNOUNCE", + "CAN_BCM_TX_COUNTEVT", + "CAN_BCM_TX_CP_CAN_ID", + "CAN_BCM_TX_DELETE", + "CAN_BCM_TX_EXPIRED", + "CAN_BCM_TX_READ", + "CAN_BCM_TX_RESET_MULTI_IDX", + "CAN_BCM_TX_SEND", + "CAN_BCM_TX_SETUP", + "CAN_BCM_TX_STATUS", + "CAN_EFF_FLAG", + "CAN_EFF_MASK", + "CAN_ERR_FLAG", + "CAN_ERR_MASK", + "CAN_ISOTP", + "CAN_RAW", + "CAN_RAW_FD_FRAMES", + "CAN_RAW_FILTER", + "CAN_RAW_LOOPBACK", + "CAN_RAW_RECV_OWN_MSGS", + "CAN_RTR_FLAG", + "CAN_SFF_MASK", + "IOCTL_VM_SOCKETS_GET_LOCAL_CID", + "NETLINK_CRYPTO", + "NETLINK_DNRTMSG", + "NETLINK_FIREWALL", + "NETLINK_IP6_FW", + "NETLINK_NFLOG", + "NETLINK_ROUTE", + "NETLINK_USERSOCK", + "NETLINK_XFRM", + "PACKET_BROADCAST", + "PACKET_FASTROUTE", + "PACKET_HOST", + "PACKET_LOOPBACK", + "PACKET_MULTICAST", + "PACKET_OTHERHOST", + "PACKET_OUTGOING", + "PF_CAN", + "PF_PACKET", + "PF_RDS", + "SO_VM_SOCKETS_BUFFER_MAX_SIZE", + "SO_VM_SOCKETS_BUFFER_MIN_SIZE", + "SO_VM_SOCKETS_BUFFER_SIZE", + "SOL_ALG", + "SOL_CAN_BASE", + "SOL_CAN_RAW", + "SOL_RDS", + "SOL_TIPC", + "TIPC_ADDR_ID", + "TIPC_ADDR_NAME", + "TIPC_ADDR_NAMESEQ", + "TIPC_CFG_SRV", + "TIPC_CLUSTER_SCOPE", + "TIPC_CONN_TIMEOUT", + "TIPC_CRITICAL_IMPORTANCE", + "TIPC_DEST_DROPPABLE", + "TIPC_HIGH_IMPORTANCE", + "TIPC_IMPORTANCE", + "TIPC_LOW_IMPORTANCE", + "TIPC_MEDIUM_IMPORTANCE", + "TIPC_NODE_SCOPE", + "TIPC_PUBLISHED", + "TIPC_SRC_DROPPABLE", + "TIPC_SUB_CANCEL", + "TIPC_SUB_PORTS", + "TIPC_SUB_SERVICE", + "TIPC_SUBSCR_TIMEOUT", + "TIPC_TOP_SRV", + "TIPC_WAIT_FOREVER", + "TIPC_WITHDRAWN", + "TIPC_ZONE_SCOPE", + "VM_SOCKETS_INVALID_VERSION", + "VMADDR_CID_ANY", + "VMADDR_CID_HOST", + "VMADDR_PORT_ANY", + "AF_CAN", + "AF_PACKET", + "AF_RDS", + "AF_TIPC", + "AF_ALG", + "AF_NETLINK", + "AF_VSOCK", + "AF_QIPCRTR", + "SOCK_CLOEXEC", + "SOCK_NONBLOCK", + ] + + if sys.version_info < (3, 11): + from _socket import CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER + + __all__ += ["CAN_RAW_ERR_FILTER"] + if sys.platform == "linux" and sys.version_info >= (3, 9): from _socket import ( CAN_J1939 as CAN_J1939, CAN_RAW_JOIN_FILTERS as CAN_RAW_JOIN_FILTERS, + IPPROTO_UDPLITE as IPPROTO_UDPLITE, J1939_EE_INFO_NONE as J1939_EE_INFO_NONE, J1939_EE_INFO_TX_ABORT as J1939_EE_INFO_TX_ABORT, J1939_FILTER_MAX as J1939_FILTER_MAX, @@ -434,11 +805,97 @@ if sys.platform == "linux" and sys.version_info >= (3, 9): UDPLITE_RECV_CSCOV as UDPLITE_RECV_CSCOV, UDPLITE_SEND_CSCOV as UDPLITE_SEND_CSCOV, ) + + __all__ += [ + "CAN_J1939", + "CAN_RAW_JOIN_FILTERS", + "IPPROTO_UDPLITE", + "J1939_EE_INFO_NONE", + "J1939_EE_INFO_TX_ABORT", + "J1939_FILTER_MAX", + "J1939_IDLE_ADDR", + "J1939_MAX_UNICAST_ADDR", + "J1939_NLA_BYTES_ACKED", + "J1939_NLA_PAD", + "J1939_NO_ADDR", + "J1939_NO_NAME", + "J1939_NO_PGN", + "J1939_PGN_ADDRESS_CLAIMED", + "J1939_PGN_ADDRESS_COMMANDED", + "J1939_PGN_MAX", + "J1939_PGN_PDU1_MAX", + "J1939_PGN_REQUEST", + "SCM_J1939_DEST_ADDR", + "SCM_J1939_DEST_NAME", + "SCM_J1939_ERRQUEUE", + "SCM_J1939_PRIO", + "SO_J1939_ERRQUEUE", + "SO_J1939_FILTER", + "SO_J1939_PROMISC", + "SO_J1939_SEND_PRIO", + "UDPLITE_RECV_CSCOV", + "UDPLITE_SEND_CSCOV", + ] if sys.platform == "linux" and sys.version_info >= (3, 10): from _socket import IPPROTO_MPTCP as IPPROTO_MPTCP + + __all__ += ["IPPROTO_MPTCP"] if sys.platform == "linux" and sys.version_info >= (3, 11): from _socket import SO_INCOMING_CPU as SO_INCOMING_CPU + __all__ += ["SO_INCOMING_CPU"] +if sys.platform == "linux" and sys.version_info >= (3, 12): + from _socket import ( + TCP_CC_INFO as TCP_CC_INFO, + TCP_FASTOPEN_CONNECT as TCP_FASTOPEN_CONNECT, + TCP_FASTOPEN_KEY as TCP_FASTOPEN_KEY, + TCP_FASTOPEN_NO_COOKIE as TCP_FASTOPEN_NO_COOKIE, + TCP_INQ as TCP_INQ, + TCP_MD5SIG as TCP_MD5SIG, + TCP_MD5SIG_EXT as TCP_MD5SIG_EXT, + TCP_QUEUE_SEQ as TCP_QUEUE_SEQ, + TCP_REPAIR as TCP_REPAIR, + TCP_REPAIR_OPTIONS as TCP_REPAIR_OPTIONS, + TCP_REPAIR_QUEUE as TCP_REPAIR_QUEUE, + TCP_REPAIR_WINDOW as TCP_REPAIR_WINDOW, + TCP_SAVE_SYN as TCP_SAVE_SYN, + TCP_SAVED_SYN as TCP_SAVED_SYN, + TCP_THIN_DUPACK as TCP_THIN_DUPACK, + TCP_THIN_LINEAR_TIMEOUTS as TCP_THIN_LINEAR_TIMEOUTS, + TCP_TIMESTAMP as TCP_TIMESTAMP, + TCP_TX_DELAY as TCP_TX_DELAY, + TCP_ULP as TCP_ULP, + TCP_ZEROCOPY_RECEIVE as TCP_ZEROCOPY_RECEIVE, + ) + + __all__ += [ + "TCP_CC_INFO", + "TCP_FASTOPEN_CONNECT", + "TCP_FASTOPEN_KEY", + "TCP_FASTOPEN_NO_COOKIE", + "TCP_INQ", + "TCP_MD5SIG", + "TCP_MD5SIG_EXT", + "TCP_QUEUE_SEQ", + "TCP_REPAIR", + "TCP_REPAIR_OPTIONS", + "TCP_REPAIR_QUEUE", + "TCP_REPAIR_WINDOW", + "TCP_SAVED_SYN", + "TCP_SAVE_SYN", + "TCP_THIN_DUPACK", + "TCP_THIN_LINEAR_TIMEOUTS", + "TCP_TIMESTAMP", + "TCP_TX_DELAY", + "TCP_ULP", + "TCP_ZEROCOPY_RECEIVE", + ] + +if sys.platform == "linux" and sys.version_info >= (3, 13): + from _socket import NI_IDN as NI_IDN, SO_BINDTOIFINDEX as SO_BINDTOIFINDEX + + __all__ += ["NI_IDN", "SO_BINDTOIFINDEX"] + if sys.version_info >= (3, 12): from _socket import ( IP_ADD_SOURCE_MEMBERSHIP as IP_ADD_SOURCE_MEMBERSHIP, @@ -448,6 +905,8 @@ if sys.version_info >= (3, 12): IP_UNBLOCK_SOURCE as IP_UNBLOCK_SOURCE, ) + __all__ += ["IP_ADD_SOURCE_MEMBERSHIP", "IP_BLOCK_SOURCE", "IP_DROP_SOURCE_MEMBERSHIP", "IP_PKTINFO", "IP_UNBLOCK_SOURCE"] + if sys.platform == "win32": from _socket import ( HV_GUID_BROADCAST as HV_GUID_BROADCAST, @@ -462,6 +921,20 @@ if sys.version_info >= (3, 12): HVSOCKET_CONNECT_TIMEOUT_MAX as HVSOCKET_CONNECT_TIMEOUT_MAX, HVSOCKET_CONNECTED_SUSPEND as HVSOCKET_CONNECTED_SUSPEND, ) + + __all__ += [ + "HV_GUID_BROADCAST", + "HV_GUID_CHILDREN", + "HV_GUID_LOOPBACK", + "HV_GUID_PARENT", + "HV_GUID_WILDCARD", + "HV_GUID_ZERO", + "HV_PROTOCOL_RAW", + "HVSOCKET_ADDRESS_FLAG_PASSTHRU", + "HVSOCKET_CONNECT_TIMEOUT", + "HVSOCKET_CONNECT_TIMEOUT_MAX", + "HVSOCKET_CONNECTED_SUSPEND", + ] else: from _socket import ( ETHERTYPE_ARP as ETHERTYPE_ARP, @@ -470,13 +943,88 @@ if sys.version_info >= (3, 12): ETHERTYPE_VLAN as ETHERTYPE_VLAN, ) + __all__ += ["ETHERTYPE_ARP", "ETHERTYPE_IP", "ETHERTYPE_IPV6", "ETHERTYPE_VLAN"] + if sys.platform == "linux": from _socket import ETH_P_ALL as ETH_P_ALL + __all__ += ["ETH_P_ALL"] + if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": # FreeBSD >= 14.0 from _socket import PF_DIVERT as PF_DIVERT + __all__ += ["PF_DIVERT", "AF_DIVERT"] + +if sys.platform != "win32" and sys.version_info >= (3, 9): + __all__ += ["send_fds", "recv_fds"] + +if sys.platform != "win32" or sys.version_info >= (3, 9): + if sys.platform != "linux": + __all__ += ["AF_LINK"] + if sys.platform != "darwin" and sys.platform != "linux": + __all__ += ["AF_BLUETOOTH"] + +if sys.platform == "win32" and sys.version_info >= (3, 12): + __all__ += ["AF_HYPERV"] + +if sys.platform != "win32" and sys.platform != "linux": + from _socket import ( + EAI_BADHINTS as EAI_BADHINTS, + EAI_MAX as EAI_MAX, + EAI_PROTOCOL as EAI_PROTOCOL, + IPPROTO_EON as IPPROTO_EON, + IPPROTO_HELLO as IPPROTO_HELLO, + IPPROTO_IPCOMP as IPPROTO_IPCOMP, + IPPROTO_XTP as IPPROTO_XTP, + LOCAL_PEERCRED as LOCAL_PEERCRED, + SCM_CREDS as SCM_CREDS, + ) + + __all__ += [ + "EAI_BADHINTS", + "EAI_MAX", + "EAI_PROTOCOL", + "IPPROTO_EON", + "IPPROTO_HELLO", + "IPPROTO_IPCOMP", + "IPPROTO_XTP", + "LOCAL_PEERCRED", + "SCM_CREDS", + "AI_DEFAULT", + "AI_MASK", + "AI_V4MAPPED_CFG", + "MSG_EOF", + ] + if sys.platform != "darwin" or sys.version_info >= (3, 9): + from _socket import IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU + + __all__ += ["IPV6_USE_MIN_MTU"] + +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": + from _socket import ( + IPPROTO_BIP as IPPROTO_BIP, + IPPROTO_MOBILE as IPPROTO_MOBILE, + IPPROTO_VRRP as IPPROTO_VRRP, + MSG_BTAG as MSG_BTAG, + MSG_ETAG as MSG_ETAG, + SO_SETFIB as SO_SETFIB, + ) + + __all__ += ["SO_SETFIB", "MSG_BTAG", "MSG_ETAG", "IPPROTO_BIP", "IPPROTO_MOBILE", "IPPROTO_VRRP", "MSG_NOTIFICATION"] + +if sys.platform != "linux": + from _socket import ( + IP_RECVDSTADDR as IP_RECVDSTADDR, + IPPROTO_GGP as IPPROTO_GGP, + IPPROTO_IPV4 as IPPROTO_IPV4, + IPPROTO_MAX as IPPROTO_MAX, + IPPROTO_ND as IPPROTO_ND, + SO_USELOOPBACK as SO_USELOOPBACK, + ) + + __all__ += ["IPPROTO_GGP", "IPPROTO_IPV4", "IPPROTO_MAX", "IPPROTO_ND", "IP_RECVDSTADDR", "SO_USELOOPBACK"] + # Re-exported from errno EBADF: int EAGAIN: int @@ -506,10 +1054,10 @@ class AddressFamily(IntEnum): AF_IRDA = 23 if sys.platform != "win32": AF_ROUTE = 16 - AF_SYSTEM = 32 AF_UNIX = 1 + if sys.platform == "darwin": + AF_SYSTEM = 32 if sys.platform != "win32" and sys.platform != "darwin": - AF_AAL5 = ... AF_ASH = 18 AF_ATMPVC = 8 AF_ATMSVC = 20 @@ -535,8 +1083,9 @@ class AddressFamily(IntEnum): AF_VSOCK = 40 AF_QIPCRTR = 42 if sys.platform != "win32" or sys.version_info >= (3, 9): - AF_LINK = 33 - if sys.platform != "darwin": + if sys.platform != "linux": + AF_LINK = 33 + if sys.platform != "darwin" and sys.platform != "linux": AF_BLUETOOTH = 32 if sys.platform == "win32" and sys.version_info >= (3, 12): AF_HYPERV = 34 @@ -557,11 +1106,12 @@ if sys.platform != "darwin": if sys.platform != "win32": AF_ROUTE = AddressFamily.AF_ROUTE - AF_SYSTEM = AddressFamily.AF_SYSTEM AF_UNIX = AddressFamily.AF_UNIX +if sys.platform == "darwin": + AF_SYSTEM = AddressFamily.AF_SYSTEM + if sys.platform != "win32" and sys.platform != "darwin": - AF_AAL5 = AddressFamily.AF_AAL5 AF_ASH = AddressFamily.AF_ASH AF_ATMPVC = AddressFamily.AF_ATMPVC AF_ATMSVC = AddressFamily.AF_ATMSVC @@ -589,8 +1139,9 @@ if sys.platform == "linux": AF_QIPCRTR = AddressFamily.AF_QIPCRTR if sys.platform != "win32" or sys.version_info >= (3, 9): - AF_LINK = AddressFamily.AF_LINK - if sys.platform != "darwin": + if sys.platform != "linux": + AF_LINK = AddressFamily.AF_LINK + if sys.platform != "darwin" and sys.platform != "linux": AF_BLUETOOTH = AddressFamily.AF_BLUETOOTH if sys.platform == "win32" and sys.version_info >= (3, 12): @@ -625,26 +1176,28 @@ class MsgFlag(IntFlag): MSG_PEEK = 2 MSG_TRUNC = 32 MSG_WAITALL = 256 - - if sys.platform != "darwin": + if sys.platform == "win32": MSG_BCAST = 1024 MSG_MCAST = 2048 + + if sys.platform != "darwin": MSG_ERRQUEUE = 8192 if sys.platform != "win32" and sys.platform != "darwin": - MSG_BTAG = ... MSG_CMSG_CLOEXEC = 1073741821 MSG_CONFIRM = 2048 - MSG_ETAG = ... MSG_FASTOPEN = 536870912 MSG_MORE = 32768 - MSG_NOTIFICATION = ... + + if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": + MSG_NOTIFICATION = 8192 if sys.platform != "win32": MSG_DONTWAIT = 64 - MSG_EOF = 256 MSG_EOR = 128 MSG_NOSIGNAL = 16384 # sometimes this exists on darwin, sometimes not + if sys.platform != "win32" and sys.platform != "linux": + MSG_EOF = 256 MSG_CTRUNC = MsgFlag.MSG_CTRUNC MSG_DONTROUTE = MsgFlag.MSG_DONTROUTE @@ -653,26 +1206,30 @@ MSG_PEEK = MsgFlag.MSG_PEEK MSG_TRUNC = MsgFlag.MSG_TRUNC MSG_WAITALL = MsgFlag.MSG_WAITALL -if sys.platform != "darwin": +if sys.platform == "win32": MSG_BCAST = MsgFlag.MSG_BCAST MSG_MCAST = MsgFlag.MSG_MCAST + +if sys.platform != "darwin": MSG_ERRQUEUE = MsgFlag.MSG_ERRQUEUE if sys.platform != "win32": MSG_DONTWAIT = MsgFlag.MSG_DONTWAIT - MSG_EOF = MsgFlag.MSG_EOF MSG_EOR = MsgFlag.MSG_EOR MSG_NOSIGNAL = MsgFlag.MSG_NOSIGNAL # Sometimes this exists on darwin, sometimes not if sys.platform != "win32" and sys.platform != "darwin": - MSG_BTAG = MsgFlag.MSG_BTAG MSG_CMSG_CLOEXEC = MsgFlag.MSG_CMSG_CLOEXEC MSG_CONFIRM = MsgFlag.MSG_CONFIRM - MSG_ETAG = MsgFlag.MSG_ETAG MSG_FASTOPEN = MsgFlag.MSG_FASTOPEN MSG_MORE = MsgFlag.MSG_MORE + +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": MSG_NOTIFICATION = MsgFlag.MSG_NOTIFICATION +if sys.platform != "win32" and sys.platform != "linux": + MSG_EOF = MsgFlag.MSG_EOF + class AddressInfo(IntFlag): AI_ADDRCONFIG = 32 AI_ALL = 16 @@ -681,7 +1238,7 @@ class AddressInfo(IntFlag): AI_NUMERICSERV = 1024 AI_PASSIVE = 1 AI_V4MAPPED = 8 - if sys.platform != "win32": + if sys.platform != "win32" and sys.platform != "linux": AI_DEFAULT = 1536 AI_MASK = 5127 AI_V4MAPPED_CFG = 512 @@ -694,7 +1251,7 @@ AI_NUMERICSERV = AddressInfo.AI_NUMERICSERV AI_PASSIVE = AddressInfo.AI_PASSIVE AI_V4MAPPED = AddressInfo.AI_V4MAPPED -if sys.platform != "win32": +if sys.platform != "win32" and sys.platform != "linux": AI_DEFAULT = AddressInfo.AI_DEFAULT AI_MASK = AddressInfo.AI_MASK AI_V4MAPPED_CFG = AddressInfo.AI_V4MAPPED_CFG @@ -718,7 +1275,7 @@ class socket(_socket.socket): ) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, *args: Unused) -> None: ... - def dup(self) -> Self: ... # noqa: F811 + def dup(self) -> Self: ... def accept(self) -> tuple[socket, _RetAddress]: ... # Note that the makefile's documented windows-specific behavior is not represented # mode strings with duplicates are intentionally excluded diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi index 931e8d03cb75..bc0ff6469d5e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi @@ -63,7 +63,7 @@ from sqlite3.dbapi2 import ( version_info as version_info, ) from types import TracebackType -from typing import Any, Literal, Protocol, SupportsIndex, TypeVar, final, overload +from typing import Any, Literal, Protocol, SupportsIndex, TypeVar, final, overload, type_check_only from typing_extensions import Self, TypeAlias if sys.version_info >= (3, 12): @@ -446,7 +446,9 @@ class Row(Sequence[Any]): def __lt__(self, value: object, /) -> bool: ... def __ne__(self, value: object, /) -> bool: ... +# This class is not exposed. It calls itself sqlite3.Statement. @final +@type_check_only class _Statement: ... if sys.version_info >= (3, 11): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/dump.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/dump.pyi new file mode 100644 index 000000000000..ed95fa46e1c7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/dump.pyi @@ -0,0 +1,2 @@ +# This file is intentionally empty. The runtime module contains only +# private functions. diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi index 1d97c02acc5e..f587b51d5ac0 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi @@ -27,7 +27,7 @@ from _ssl import ( ) from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer from collections.abc import Callable, Iterable -from typing import Any, Literal, NamedTuple, TypedDict, overload +from typing import Any, Literal, NamedTuple, TypedDict, overload, type_check_only from typing_extensions import Never, Self, TypeAlias if sys.version_info >= (3, 13): @@ -309,6 +309,8 @@ ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: AlertDescription ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: AlertDescription ALERT_DESCRIPTION_USER_CANCELLED: AlertDescription +# This class is not exposed. It calls itself ssl._ASN1Object. +@type_check_only class _ASN1ObjectBase(NamedTuple): nid: int shortname: str diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi index d65ddfe3825d..c4b1adca9bc6 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi @@ -5,14 +5,13 @@ from builtins import object as _object from collections.abc import AsyncGenerator, Callable, Sequence from io import TextIOWrapper from types import FrameType, ModuleType, TracebackType -from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final +from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only from typing_extensions import TypeAlias _T = TypeVar("_T") # see https://github.com/python/typeshed/issues/8513#issue-1333671093 for the rationale behind this alias _ExitCode: TypeAlias = str | int | None -_OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall 2022 or later # ----- sys variables ----- if sys.platform != "win32": @@ -90,13 +89,63 @@ _UninstantiableStructseq: TypeAlias = structseq[Any] flags: _flags -if sys.version_info >= (3, 10): - _FlagTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, bool, int, int] -else: - _FlagTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, bool, int] - +# This class is not exposed at runtime. It calls itself sys.flags. +# As a tuple, it can have a length between 15 and 18. We don't model +# the exact length here because that varies by patch version due to +# the backported security fix int_max_str_digits. The exact length shouldn't +# be relied upon. See #13031 +# This can be re-visited when typeshed drops support for 3.10, +# at which point all supported versions will include int_max_str_digits +# in all patch versions. +# 3.8 and 3.9 are 15 or 16-tuple +# 3.10 is 16 or 17-tuple +# 3.11+ is an 18-tuple. @final -class _flags(_UninstantiableStructseq, _FlagTuple): +@type_check_only +class _flags(_UninstantiableStructseq, tuple[int, ...]): + # `safe_path` was added in py311 + if sys.version_info >= (3, 11): + __match_args__: Final = ( + "debug", + "inspect", + "interactive", + "optimize", + "dont_write_bytecode", + "no_user_site", + "no_site", + "ignore_environment", + "verbose", + "bytes_warning", + "quiet", + "hash_randomization", + "isolated", + "dev_mode", + "utf8_mode", + "warn_default_encoding", + "safe_path", + "int_max_str_digits", + ) + elif sys.version_info >= (3, 10): + __match_args__: Final = ( + "debug", + "inspect", + "interactive", + "optimize", + "dont_write_bytecode", + "no_user_site", + "no_site", + "ignore_environment", + "verbose", + "bytes_warning", + "quiet", + "hash_randomization", + "isolated", + "dev_mode", + "utf8_mode", + "warn_default_encoding", + "int_max_str_digits", + ) + @property def debug(self) -> int: ... @property @@ -129,15 +178,39 @@ class _flags(_UninstantiableStructseq, _FlagTuple): def utf8_mode(self) -> int: ... if sys.version_info >= (3, 10): @property - def warn_default_encoding(self) -> int: ... # undocumented + def warn_default_encoding(self) -> int: ... if sys.version_info >= (3, 11): @property def safe_path(self) -> bool: ... + # Whether or not this exists on lower versions of Python + # may depend on which patch release you're using + # (it was backported to all Python versions on 3.8+ as a security fix) + # Added in: 3.8.14, 3.9.14, 3.10.7 + # and present in all versions of 3.11 and later. + @property + def int_max_str_digits(self) -> int: ... float_info: _float_info +# This class is not exposed at runtime. It calls itself sys.float_info. @final +@type_check_only class _float_info(structseq[float], tuple[float, int, int, float, int, int, int, int, float, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ( + "max", + "max_exp", + "max_10_exp", + "min", + "min_exp", + "min_10_exp", + "dig", + "mant_dig", + "epsilon", + "radix", + "rounds", + ) + @property def max(self) -> float: ... # DBL_MAX @property @@ -163,8 +236,13 @@ class _float_info(structseq[float], tuple[float, int, int, float, int, int, int, hash_info: _hash_info +# This class is not exposed at runtime. It calls itself sys.hash_info. @final +@type_check_only class _hash_info(structseq[Any | int], tuple[int, int, int, int, int, str, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("width", "modulus", "inf", "nan", "imag", "algorithm", "hash_bits", "seed_bits", "cutoff") + @property def width(self) -> int: ... @property @@ -186,6 +264,9 @@ class _hash_info(structseq[Any | int], tuple[int, int, int, int, int, str, int, implementation: _implementation +# This class isn't really a thing. At runtime, implementation is an instance +# of types.SimpleNamespace. This allows for better typing. +@type_check_only class _implementation: name: str version: _version_info @@ -198,8 +279,13 @@ class _implementation: int_info: _int_info +# This class is not exposed at runtime. It calls itself sys.int_info. @final +@type_check_only class _int_info(structseq[int], tuple[int, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("bits_per_digit", "sizeof_digit", "default_max_str_digits", "str_digits_check_threshold") + @property def bits_per_digit(self) -> int: ... @property @@ -212,8 +298,13 @@ class _int_info(structseq[int], tuple[int, int, int, int]): _ThreadInfoName: TypeAlias = Literal["nt", "pthread", "pthread-stubs", "solaris"] _ThreadInfoLock: TypeAlias = Literal["semaphore", "mutex+cond"] | None +# This class is not exposed at runtime. It calls itself sys.thread_info. @final +@type_check_only class _thread_info(_UninstantiableStructseq, tuple[_ThreadInfoName, _ThreadInfoLock, str | None]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("name", "lock", "version") + @property def name(self) -> _ThreadInfoName: ... @property @@ -224,8 +315,13 @@ class _thread_info(_UninstantiableStructseq, tuple[_ThreadInfoName, _ThreadInfoL thread_info: _thread_info _ReleaseLevel: TypeAlias = Literal["alpha", "beta", "candidate", "final"] +# This class is not exposed at runtime. It calls itself sys.version_info. @final +@type_check_only class _version_info(_UninstantiableStructseq, tuple[int, int, int, _ReleaseLevel, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("major", "minor", "micro", "releaselevel", "serial") + @property def major(self) -> int: ... @property @@ -318,6 +414,7 @@ if sys.version_info < (3, 9): def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ... # Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily. +@type_check_only class UnraisableHookArgs(Protocol): exc_type: type[BaseException] exc_value: BaseException | None @@ -333,8 +430,13 @@ def audit(event: str, /, *args: Any) -> None: ... _AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None +# This class is not exposed at runtime. It calls itself builtins.asyncgen_hooks. @final +@type_check_only class _asyncgen_hooks(structseq[_AsyncgenHook], tuple[_AsyncgenHook, _AsyncgenHook]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("firstiter", "finalizer") + @property def firstiter(self) -> _AsyncgenHook: ... @property diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/termios.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/termios.pyi index a5378e40fdf2..5a5a1f53be3c 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/termios.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/termios.pyi @@ -10,58 +10,38 @@ _AttrReturn: TypeAlias = list[Any] if sys.platform != "win32": B0: int - B1000000: int B110: int B115200: int - B1152000: int B1200: int B134: int B150: int - B1500000: int B1800: int B19200: int B200: int - B2000000: int B230400: int B2400: int - B2500000: int B300: int - B3000000: int - B3500000: int B38400: int - B4000000: int - B460800: int B4800: int B50: int - B500000: int B57600: int - B576000: int B600: int B75: int - B921600: int B9600: int BRKINT: int BS0: int BS1: int BSDLY: int - CBAUD: int - CBAUDEX: int - CDEL: int CDSUSP: int CEOF: int CEOL: int - CEOL2: int CEOT: int CERASE: int - CESC: int CFLUSH: int - CIBAUD: int CINTR: int CKILL: int CLNEXT: int CLOCAL: int - CNUL: int - COMMON: int CQUIT: int CR0: int CR1: int @@ -80,7 +60,6 @@ if sys.platform != "win32": CSTOP: int CSTOPB: int CSUSP: int - CSWTCH: int CWERASE: int ECHO: int ECHOCTL: int @@ -101,7 +80,6 @@ if sys.platform != "win32": FIONREAD: int FLUSHO: int HUPCL: int - IBSHIFT: int ICANON: int ICRNL: int IEXTEN: int @@ -109,33 +87,21 @@ if sys.platform != "win32": IGNCR: int IGNPAR: int IMAXBEL: int - INIT_C_CC: int INLCR: int INPCK: int - IOCSIZE_MASK: int - IOCSIZE_SHIFT: int ISIG: int ISTRIP: int - IUCLC: int IXANY: int IXOFF: int IXON: int - N_MOUSE: int - N_PPP: int - N_SLIP: int - N_STRIP: int - N_TTY: int - NCC: int NCCS: int NL0: int NL1: int NLDLY: int NOFLSH: int - NSWTCH: int OCRNL: int OFDEL: int OFILL: int - OLCUC: int ONLCR: int ONLRET: int ONOCR: int @@ -149,9 +115,6 @@ if sys.platform != "win32": TAB2: int TAB3: int TABDLY: int - TCFLSH: int - TCGETA: int - TCGETS: int TCIFLUSH: int TCIOFF: int TCIOFLUSH: int @@ -162,28 +125,11 @@ if sys.platform != "win32": TCSADRAIN: int TCSAFLUSH: int TCSANOW: int - TCSASOFT: int - TCSBRK: int - TCSBRKP: int - TCSETA: int - TCSETAF: int - TCSETAW: int - TCSETS: int - TCSETSF: int - TCSETSW: int - TCXONC: int TIOCCONS: int TIOCEXCL: int TIOCGETD: int - TIOCGICOUNT: int - TIOCGLCKTRMIOS: int TIOCGPGRP: int - TIOCGSERIAL: int - TIOCGSIZE: int - TIOCGSOFTCAR: int TIOCGWINSZ: int - TIOCINQ: int - TIOCLINUX: int TIOCM_CAR: int TIOCM_CD: int TIOCM_CTS: int @@ -198,7 +144,6 @@ if sys.platform != "win32": TIOCMBIC: int TIOCMBIS: int TIOCMGET: int - TIOCMIWAIT: int TIOCMSET: int TIOCNOTTY: int TIOCNXCL: int @@ -212,23 +157,10 @@ if sys.platform != "win32": TIOCPKT_STOP: int TIOCPKT: int TIOCSCTTY: int - TIOCSER_TEMT: int - TIOCSERCONFIG: int - TIOCSERGETLSR: int - TIOCSERGETMULTI: int - TIOCSERGSTRUCT: int - TIOCSERGWILD: int - TIOCSERSETMULTI: int - TIOCSERSWILD: int TIOCSETD: int - TIOCSLCKTRMIOS: int TIOCSPGRP: int - TIOCSSERIAL: int - TIOCSSIZE: int - TIOCSSOFTCAR: int TIOCSTI: int TIOCSWINSZ: int - TIOCTTYGSTRUCT: int TOSTOP: int VDISCARD: int VEOF: int @@ -244,15 +176,119 @@ if sys.platform != "win32": VSTART: int VSTOP: int VSUSP: int - VSWTC: int - VSWTCH: int VT0: int VT1: int VTDLY: int VTIME: int VWERASE: int - XCASE: int - XTABS: int + + if sys.version_info >= (3, 13): + EXTPROC: int + IUTF8: int + + if sys.platform == "darwin" and sys.version_info >= (3, 13): + ALTWERASE: int + B14400: int + B28800: int + B7200: int + B76800: int + CCAR_OFLOW: int + CCTS_OFLOW: int + CDSR_OFLOW: int + CDTR_IFLOW: int + CIGNORE: int + CRTS_IFLOW: int + MDMBUF: int + NL2: int + NL3: int + NOKERNINFO: int + ONOEOT: int + OXTABS: int + VDSUSP: int + VSTATUS: int + + if sys.platform == "darwin" and sys.version_info >= (3, 11): + TIOCGSIZE: int + TIOCSSIZE: int + + if sys.platform == "linux": + B1152000: int + B576000: int + CBAUD: int + CBAUDEX: int + CIBAUD: int + IOCSIZE_MASK: int + IOCSIZE_SHIFT: int + IUCLC: int + N_MOUSE: int + N_PPP: int + N_SLIP: int + N_STRIP: int + N_TTY: int + NCC: int + OLCUC: int + TCFLSH: int + TCGETA: int + TCGETS: int + TCSBRK: int + TCSBRKP: int + TCSETA: int + TCSETAF: int + TCSETAW: int + TCSETS: int + TCSETSF: int + TCSETSW: int + TCXONC: int + TIOCGICOUNT: int + TIOCGLCKTRMIOS: int + TIOCGSERIAL: int + TIOCGSOFTCAR: int + TIOCINQ: int + TIOCLINUX: int + TIOCMIWAIT: int + TIOCTTYGSTRUCT: int + TIOCSER_TEMT: int + TIOCSERCONFIG: int + TIOCSERGETLSR: int + TIOCSERGETMULTI: int + TIOCSERGSTRUCT: int + TIOCSERGWILD: int + TIOCSERSETMULTI: int + TIOCSERSWILD: int + TIOCSLCKTRMIOS: int + TIOCSSERIAL: int + TIOCSSOFTCAR: int + VSWTC: int + VSWTCH: int + XCASE: int + XTABS: int + + if sys.platform != "darwin": + B1000000: int + B1500000: int + B2000000: int + B2500000: int + B3000000: int + B3500000: int + B4000000: int + B460800: int + B500000: int + B921600: int + + if sys.platform != "linux": + TCSASOFT: int + + if sys.platform != "darwin" and sys.platform != "linux": + # not available on FreeBSD either. + CDEL: int + CEOL2: int + CESC: int + CNUL: int + COMMON: int + CSWTCH: int + IBSHIFT: int + INIT_C_CC: int + NSWTCH: int def tcgetattr(fd: FileDescriptorLike, /) -> _AttrReturn: ... def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr, /) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi index 5d3550ea62ab..d6a234d67919 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi @@ -1,13 +1,18 @@ import _tkinter import sys -from _typeshed import Incomplete, MaybeNone, StrEnum, StrOrBytesPath +from _typeshed import Incomplete, MaybeNone, StrOrBytesPath from collections.abc import Callable, Iterable, Mapping, Sequence from tkinter.constants import * from tkinter.font import _FontDescription from types import TracebackType -from typing import Any, Generic, Literal, NamedTuple, TypedDict, TypeVar, overload, type_check_only +from typing import Any, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated +if sys.version_info >= (3, 11): + from enum import StrEnum +else: + from enum import Enum + if sys.version_info >= (3, 9): __all__ = [ "TclError", @@ -186,53 +191,99 @@ _XYScrollCommand: TypeAlias = str | Callable[[float, float], object] _TakeFocusValue: TypeAlias = bool | Literal[0, 1, ""] | Callable[[str], bool | None] # -takefocus in manual page named 'options' if sys.version_info >= (3, 11): - class _VersionInfoType(NamedTuple): + @type_check_only + class _VersionInfoTypeBase(NamedTuple): major: int minor: int micro: int releaselevel: str serial: int -class EventType(StrEnum): - Activate = "36" - ButtonPress = "4" - Button = ButtonPress - ButtonRelease = "5" - Circulate = "26" - CirculateRequest = "27" - ClientMessage = "33" - Colormap = "32" - Configure = "22" - ConfigureRequest = "23" - Create = "16" - Deactivate = "37" - Destroy = "17" - Enter = "7" - Expose = "12" - FocusIn = "9" - FocusOut = "10" - GraphicsExpose = "13" - Gravity = "24" - KeyPress = "2" - Key = "2" - KeyRelease = "3" - Keymap = "11" - Leave = "8" - Map = "19" - MapRequest = "20" - Mapping = "34" - Motion = "6" - MouseWheel = "38" - NoExpose = "14" - Property = "28" - Reparent = "21" - ResizeRequest = "25" - Selection = "31" - SelectionClear = "29" - SelectionRequest = "30" - Unmap = "18" - VirtualEvent = "35" - Visibility = "15" + class _VersionInfoType(_VersionInfoTypeBase): ... + +if sys.version_info >= (3, 11): + class EventType(StrEnum): + Activate = "36" + ButtonPress = "4" + Button = ButtonPress + ButtonRelease = "5" + Circulate = "26" + CirculateRequest = "27" + ClientMessage = "33" + Colormap = "32" + Configure = "22" + ConfigureRequest = "23" + Create = "16" + Deactivate = "37" + Destroy = "17" + Enter = "7" + Expose = "12" + FocusIn = "9" + FocusOut = "10" + GraphicsExpose = "13" + Gravity = "24" + KeyPress = "2" + Key = "2" + KeyRelease = "3" + Keymap = "11" + Leave = "8" + Map = "19" + MapRequest = "20" + Mapping = "34" + Motion = "6" + MouseWheel = "38" + NoExpose = "14" + Property = "28" + Reparent = "21" + ResizeRequest = "25" + Selection = "31" + SelectionClear = "29" + SelectionRequest = "30" + Unmap = "18" + VirtualEvent = "35" + Visibility = "15" + +else: + class EventType(str, Enum): + Activate = "36" + ButtonPress = "4" + Button = ButtonPress + ButtonRelease = "5" + Circulate = "26" + CirculateRequest = "27" + ClientMessage = "33" + Colormap = "32" + Configure = "22" + ConfigureRequest = "23" + Create = "16" + Deactivate = "37" + Destroy = "17" + Enter = "7" + Expose = "12" + FocusIn = "9" + FocusOut = "10" + GraphicsExpose = "13" + Gravity = "24" + KeyPress = "2" + Key = "2" + KeyRelease = "3" + Keymap = "11" + Leave = "8" + Map = "19" + MapRequest = "20" + Mapping = "34" + Motion = "6" + MouseWheel = "38" + NoExpose = "14" + Property = "28" + Reparent = "21" + ResizeRequest = "25" + Selection = "31" + SelectionClear = "29" + SelectionRequest = "30" + Unmap = "18" + VirtualEvent = "35" + Visibility = "15" _W = TypeVar("_W", bound=Misc) # Events considered covariant because you should never assign to event.widget. @@ -576,7 +627,8 @@ class Misc: def __getitem__(self, key: str) -> Any: ... def cget(self, key: str) -> Any: ... def configure(self, cnf: Any = None) -> Any: ... - # TODO: config is an alias of configure, but adding that here creates lots of mypy errors + # TODO: config is an alias of configure, but adding that here creates + # conflict with the type of config in the subclasses. See #13149 class CallWrapper: func: Incomplete @@ -3403,11 +3455,14 @@ class OptionMenu(Menubutton): # configure, config, cget are inherited from Menubutton # destroy and __getitem__ are overridden, signature does not change -# Marker to indicate that it is a valid bitmap/photo image. PIL implements compatible versions -# which don't share a class hierarchy. The actual API is a __str__() which returns a valid name, -# not something that type checkers can detect. +# This matches tkinter's image classes (PhotoImage and BitmapImage) +# and PIL's tkinter-compatible class (PIL.ImageTk.PhotoImage), +# but not a plain PIL image that isn't tkinter compatible. +# The reason is that PIL has width and height attributes, not methods. @type_check_only -class _Image: ... +class _Image(Protocol): + def width(self) -> int: ... + def height(self) -> int: ... @type_check_only class _BitmapImageLike(_Image): ... @@ -3426,9 +3481,7 @@ class Image(_Image): def __getitem__(self, key): ... configure: Incomplete config: Incomplete - def height(self) -> int: ... def type(self): ... - def width(self) -> int: ... class PhotoImage(Image, _PhotoImageLike): # This should be kept in sync with PIL.ImageTK.PhotoImage.__init__() diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi index 317f3068be63..097c2e4b4382 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi @@ -1,7 +1,8 @@ import _tkinter +import itertools import sys import tkinter -from typing import Any, Final, Literal, TypedDict, overload +from typing import Any, ClassVar, Final, Literal, TypedDict, overload from typing_extensions import TypeAlias if sys.version_info >= (3, 9): @@ -40,6 +41,7 @@ class _MetricsDict(TypedDict): class Font: name: str delete_font: bool + counter: ClassVar[itertools.count[int]] # undocumented def __init__( self, # In tkinter, 'root' refers to tkinter.Tk by convention, but the code diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi index e1c8fedee55c..7e9a945cdc46 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi @@ -4,7 +4,7 @@ from collections.abc import Callable, Generator, Iterable, Sequence from re import Pattern from token import * from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES -from typing import Any, NamedTuple, TextIO +from typing import Any, NamedTuple, TextIO, type_check_only from typing_extensions import TypeAlias __all__ = [ @@ -98,6 +98,8 @@ blank_re: Pattern[bytes] _Position: TypeAlias = tuple[int, int] +# This class is not exposed. It calls itself tokenize.TokenInfo. +@type_check_only class _TokenInfo(NamedTuple): type: int string: str diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/turtle.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/turtle.pyi index 29d289303927..a2ab728de943 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/turtle.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/turtle.pyi @@ -1,7 +1,7 @@ import sys from collections.abc import Callable, Sequence from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar -from typing import Any, ClassVar, overload +from typing import Any, ClassVar, Literal, TypedDict, overload from typing_extensions import Self, TypeAlias __all__ = [ @@ -141,8 +141,18 @@ if sys.version_info < (3, 13): _Color: TypeAlias = str | tuple[float, float, float] _AnyColor: TypeAlias = Any -# TODO: Replace this with a TypedDict once it becomes standardized. -_PenState: TypeAlias = dict[str, Any] +class _PenState(TypedDict): + shown: bool + pendown: bool + pencolor: _Color + fillcolor: _Color + pensize: int + speed: int + resizemode: Literal["auto", "user", "noresize"] + stretchfactor: tuple[float, float] + shearfactor: float + outline: int + tilt: float _Speed: TypeAlias = str | float _PolygonCoords: TypeAlias = Sequence[tuple[float, float]] @@ -283,6 +293,7 @@ class TNavigator: def heading(self) -> float: ... def setheading(self, to_angle: float) -> None: ... def circle(self, radius: float, extent: float | None = None, steps: int | None = None) -> None: ... + def speed(self, s: int | None = 0) -> int | None: ... fd = forward bk = back backward = back @@ -363,7 +374,7 @@ class TPen: st = showturtle ht = hideturtle -class RawTurtle(TPen, TNavigator): +class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods in base classes screen: TurtleScreen screens: ClassVar[list[TurtleScreen]] def __init__( diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi index 27ae11daba70..8f0d4fbb6a02 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi @@ -133,6 +133,8 @@ if sys.version_info >= (3, 13): Any = object() +class _Final: ... + def final(f: _T) -> _T: ... @final class TypeVar: @@ -191,7 +193,7 @@ _promote = object() # N.B. Keep this definition in sync with typing_extensions._SpecialForm @final -class _SpecialForm: +class _SpecialForm(_Final): def __getitem__(self, parameters: Any) -> object: ... if sys.version_info >= (3, 10): def __or__(self, other: Any) -> _SpecialForm: ... @@ -211,8 +213,7 @@ Tuple: _SpecialForm Final: _SpecialForm Literal: _SpecialForm -# TypedDict is a (non-subscriptable) special form. -TypedDict: object +TypedDict: _SpecialForm if sys.version_info >= (3, 11): Self: _SpecialForm @@ -462,7 +463,11 @@ class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _Return @overload @abstractmethod def throw(self, typ: BaseException, val: None = None, tb: TracebackType | None = None, /) -> _YieldT_co: ... - def close(self) -> None: ... + if sys.version_info >= (3, 13): + def close(self) -> _ReturnT_co | None: ... + else: + def close(self) -> None: ... + def __iter__(self) -> Generator[_YieldT_co, _SendT_contra, _ReturnT_co]: ... @property def gi_code(self) -> CodeType: ... @@ -659,7 +664,6 @@ class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, item: object) -> bool: ... def __iter__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... - def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... def __or__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... def __ror__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... def __sub__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... @@ -673,7 +677,6 @@ class KeysView(MappingView, AbstractSet[_KT_co]): def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, key: object) -> bool: ... def __iter__(self) -> Iterator[_KT_co]: ... - def __reversed__(self) -> Iterator[_KT_co]: ... def __or__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... def __ror__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... def __sub__(self, other: Iterable[Any]) -> set[_KT_co]: ... @@ -685,7 +688,6 @@ class ValuesView(MappingView, Collection[_VT_co]): def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[_VT_co]: ... - def __reversed__(self) -> Iterator[_VT_co]: ... class Mapping(Collection[_KT], Generic[_KT, _VT_co]): # TODO: We wish the key type could also be covariant, but that doesn't work, @@ -973,7 +975,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): def __ior__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... # type: ignore[misc] @final -class ForwardRef: +class ForwardRef(_Final): __forward_arg__: str __forward_code__: CodeType __forward_evaluated__: bool diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi index 93c1dfb31da0..eec84bdce4c7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi @@ -58,6 +58,7 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039 TextIO as TextIO, Tuple as Tuple, Type as Type, + TypedDict as TypedDict, Union as Union, ValuesView as ValuesView, _Alias, @@ -190,8 +191,10 @@ _T = typing.TypeVar("_T") _F = typing.TypeVar("_F", bound=Callable[..., Any]) _TC = typing.TypeVar("_TC", bound=type[object]) +class _Final: ... # This should be imported from typing but that breaks pytype + # unfortunately we have to duplicate this class definition from typing.pyi or we break pytype -class _SpecialForm: +class _SpecialForm(_Final): def __getitem__(self, parameters: Any) -> object: ... if sys.version_info >= (3, 10): def __or__(self, other: Any) -> _SpecialForm: ... @@ -253,9 +256,6 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): # supposedly incompatible definitions of `__ior__` and `__or__`: def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc] -# TypedDict is a (non-subscriptable) special form. -TypedDict: object - OrderedDict = _Alias() def get_type_hints( @@ -409,8 +409,11 @@ else: def __or__(self, right: Any) -> _SpecialForm: ... def __ror__(self, left: Any) -> _SpecialForm: ... + # mypy and pyright object to this being both ABC and Protocol. + # At runtime it inherits from ABC and is not a Protocol, but it is on the + # allowlist for use as a Protocol. @runtime_checkable - class Buffer(Protocol): + class Buffer(Protocol, abc.ABC): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Not actually a Protocol at runtime; see # https://github.com/python/typeshed/issues/10224 for why we're defining it this way def __buffer__(self, flags: int, /) -> memoryview: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/webbrowser.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/webbrowser.pyi index d7bf033172f6..773786c24821 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/webbrowser.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/webbrowser.pyi @@ -66,6 +66,7 @@ if sys.platform == "darwin": if sys.version_info < (3, 13): @deprecated("Deprecated in 3.11, to be removed in 3.13.") class MacOSX(BaseBrowser): + def __init__(self, name: str) -> None: ... def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename` diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/wsgiref/types.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/wsgiref/types.pyi index 86212df8ccdc..57276fd05ea8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/wsgiref/types.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/wsgiref/types.pyi @@ -1,5 +1,5 @@ +from _typeshed import OptExcInfo from collections.abc import Callable, Iterable, Iterator -from sys import _OptExcInfo from typing import Any, Protocol from typing_extensions import TypeAlias @@ -7,7 +7,7 @@ __all__ = ["StartResponse", "WSGIEnvironment", "WSGIApplication", "InputStream", class StartResponse(Protocol): def __call__( - self, status: str, headers: list[tuple[str, str]], exc_info: _OptExcInfo | None = ..., / + self, status: str, headers: list[tuple[str, str]], exc_info: OptExcInfo | None = ..., / ) -> Callable[[bytes], object]: ... WSGIEnvironment: TypeAlias = dict[str, Any] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xml/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xml/__init__.pyi index a487d2467f41..7a240965136e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/xml/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xml/__init__.pyi @@ -1 +1,3 @@ -from xml import parsers as parsers +# At runtime, listing submodules in __all__ without them being imported is +# valid, and causes them to be included in a star import. See #6523 +__all__ = ["dom", "parsers", "sax", "etree"] # noqa: F822 # pyright: ignore[reportUnsupportedDunderAll] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi index 933acf2c4803..a7248ba7ab72 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi @@ -12,6 +12,8 @@ _ReadWriteBinaryMode: TypeAlias = Literal["r", "w", "rb", "wb"] _ZF = TypeVar("_ZF", bound=ZipFile) if sys.version_info >= (3, 12): + __all__ = ["Path"] + class InitializedState: def __init__(self, *args: object, **kwargs: object) -> None: ... def __getstate__(self) -> tuple[list[object], dict[object, object]]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/zlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/zlib.pyi index 2f6c40656038..7cafb44b34a7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/zlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/zlib.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import ReadableBuffer -from typing import Final +from typing import Any, Final, final, type_check_only +from typing_extensions import Self DEFLATED: Final = 8 DEF_MEM_LEVEL: int # can change @@ -27,17 +28,30 @@ Z_TREES: Final = 6 class error(Exception): ... +# This class is not exposed at runtime. It calls itself zlib.Compress. +@final +@type_check_only class _Compress: - def compress(self, data: ReadableBuffer) -> bytes: ... - def flush(self, mode: int = ...) -> bytes: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: Any, /) -> Self: ... + def compress(self, data: ReadableBuffer, /) -> bytes: ... + def flush(self, mode: int = 4, /) -> bytes: ... def copy(self) -> _Compress: ... +# This class is not exposed at runtime. It calls itself zlib.Decompress. +@final +@type_check_only class _Decompress: - unused_data: bytes - unconsumed_tail: bytes - eof: bool - def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... - def flush(self, length: int = ...) -> bytes: ... + @property + def unused_data(self) -> bytes: ... + @property + def unconsumed_tail(self) -> bytes: ... + @property + def eof(self) -> bool: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: Any, /) -> Self: ... + def decompress(self, data: ReadableBuffer, /, max_length: int = 0) -> bytes: ... + def flush(self, length: int = 16384, /) -> bytes: ... def copy(self) -> _Decompress: ... def adler32(data: ReadableBuffer, value: int = 1, /) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/METADATA.toml index b491184aeaf7..3a87312127ac 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/METADATA.toml @@ -1,3 +1,3 @@ -version = "1.2.*" +version = "~=1.2.15" upstream_repository = "https://github.com/tantale/deprecated" requires = [] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/classic.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/classic.pyi index d5b794ad9ed7..7eadb72db809 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/classic.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/classic.pyi @@ -13,7 +13,12 @@ class ClassicAdapter: action: _Actions | None category: type[Warning] def __init__( - self, reason: str = "", version: str = "", action: _Actions | None = None, category: type[Warning] = ... + self, + reason: str = "", + version: str = "", + action: _Actions | None = None, + category: type[Warning] = ..., + extra_stacklevel: int = 0, ) -> None: ... def get_deprecated_msg(self, wrapped: Callable[..., Any], instance: object) -> str: ... def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/sphinx.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/sphinx.pyi index c83bfe9f579d..b99aef3de208 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/sphinx.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/Deprecated/deprecated/sphinx.pyi @@ -18,6 +18,7 @@ class SphinxAdapter(ClassicAdapter): version: str = "", action: _Actions | None = None, category: type[Warning] = ..., + extra_stacklevel: int = 0, line_length: int = 70, ) -> None: ... def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/bleach/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/bleach/METADATA.toml index c5926af4801e..7dfbd41a855e 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/bleach/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/bleach/METADATA.toml @@ -1,4 +1,4 @@ -version = "6.1.*" +version = "6.2.*" requires = ["types-html5lib"] upstream_repository = "https://github.com/mozilla/bleach" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/core.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/core.pyi index 0f6820f054ea..5e22026bed1e 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/core.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/core.pyi @@ -1,3 +1,218 @@ from _typeshed import Incomplete -def __getattr__(name: str) -> Incomplete: ... +from docutils.writers import _WriterParts + +__docformat__: str + +class Publisher: + document: Incomplete + reader: Incomplete + parser: Incomplete + writer: Incomplete + source: Incomplete + source_class: Incomplete + destination: Incomplete + destination_class: Incomplete + settings: Incomplete + def __init__( + self, + reader: Incomplete | None = None, + parser: Incomplete | None = None, + writer: Incomplete | None = None, + source: Incomplete | None = None, + source_class=..., + destination: Incomplete | None = None, + destination_class=..., + settings: Incomplete | None = None, + ) -> None: ... + def set_reader(self, reader_name, parser, parser_name) -> None: ... + def set_writer(self, writer_name) -> None: ... + def set_components(self, reader_name, parser_name, writer_name) -> None: ... + def setup_option_parser( + self, + usage: Incomplete | None = None, + description: Incomplete | None = None, + settings_spec: Incomplete | None = None, + config_section: Incomplete | None = None, + **defaults, + ): ... + def get_settings( + self, + usage: Incomplete | None = None, + description: Incomplete | None = None, + settings_spec: Incomplete | None = None, + config_section: Incomplete | None = None, + **defaults, + ): ... + def process_programmatic_settings(self, settings_spec, settings_overrides, config_section) -> None: ... + def process_command_line( + self, + argv: Incomplete | None = None, + usage: Incomplete | None = None, + description: Incomplete | None = None, + settings_spec: Incomplete | None = None, + config_section: Incomplete | None = None, + **defaults, + ) -> None: ... + def set_io(self, source_path: Incomplete | None = None, destination_path: Incomplete | None = None) -> None: ... + def set_source(self, source: Incomplete | None = None, source_path: Incomplete | None = None) -> None: ... + def set_destination(self, destination: Incomplete | None = None, destination_path: Incomplete | None = None) -> None: ... + def apply_transforms(self) -> None: ... + def publish( + self, + argv: Incomplete | None = None, + usage: Incomplete | None = None, + description: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, + ): ... + def debugging_dumps(self) -> None: ... + def prompt(self) -> None: ... + def report_Exception(self, error) -> None: ... + def report_SystemMessage(self, error) -> None: ... + def report_UnicodeError(self, error) -> None: ... + +default_usage: str +default_description: str + +def publish_cmdline( + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = True, + argv: Incomplete | None = None, + usage=..., + description=..., +): ... +def publish_file( + source: Incomplete | None = None, + source_path: Incomplete | None = None, + destination: Incomplete | None = None, + destination_path: Incomplete | None = None, + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, +): ... +def publish_string( + source, + source_path: Incomplete | None = None, + destination_path: Incomplete | None = None, + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, +): ... +def publish_parts( + source, + source_path: Incomplete | None = None, + source_class=..., + destination_path: Incomplete | None = None, + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, +) -> _WriterParts: ... +def publish_doctree( + source, + source_path: Incomplete | None = None, + source_class=..., + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, +): ... +def publish_from_doctree( + document, + destination_path: Incomplete | None = None, + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = False, +): ... +def publish_cmdline_to_binary( + reader: Incomplete | None = None, + reader_name: str = "standalone", + parser: Incomplete | None = None, + parser_name: str = "restructuredtext", + writer: Incomplete | None = None, + writer_name: str = "pseudoxml", + settings: Incomplete | None = None, + settings_spec: Incomplete | None = None, + settings_overrides: Incomplete | None = None, + config_section: Incomplete | None = None, + enable_exit_status: bool = True, + argv: Incomplete | None = None, + usage=..., + description=..., + destination: Incomplete | None = None, + destination_class=..., +): ... +def publish_programmatically( + source_class, + source, + source_path, + destination_class, + destination, + destination_path, + reader, + reader_name, + parser, + parser_name, + writer, + writer_name, + settings, + settings_spec, + settings_overrides, + config_section, + enable_exit_status, +): ... +def rst2something(writer, documenttype, doc_path: str = "") -> None: ... +def rst2html() -> None: ... +def rst2html4() -> None: ... +def rst2html5() -> None: ... +def rst2latex() -> None: ... +def rst2man() -> None: ... +def rst2odt() -> None: ... +def rst2pseudoxml() -> None: ... +def rst2s5() -> None: ... +def rst2xetex() -> None: ... +def rst2xml() -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi index 9f7ba543dbc9..58c40200aaf0 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi @@ -1,4 +1,5 @@ -from typing import Any, Generic, TypeVar +from typing import Any, Generic, TypedDict, TypeVar, type_check_only +from typing_extensions import Required from docutils import Component, nodes from docutils.io import Output @@ -6,8 +7,65 @@ from docutils.languages import LanguageImporter _S = TypeVar("_S") +# It would probably be better to specialize writers for subclasses, +# but this gives us all possible Writer items w/o instance checks +@type_check_only +class _WriterParts(TypedDict, total=False): + # Parts Provided by All Writers https://docutils.sourceforge.io/docs/api/publisher.html#parts-provided-by-all-writers + + # See Writer.assemble_parts + whole: Required[str | bytes] + encoding: Required[str] + errors: Required[str] + version: Required[str] + + # Parts Provided by the HTML Writers https://docutils.sourceforge.io/docs/api/publisher.html#parts-provided-by-the-html-writers + + # HTML4 Writer https://docutils.sourceforge.io/docs/api/publisher.html#html4-writer + # + HTML5 Writer https://docutils.sourceforge.io/docs/api/publisher.html#html5-writer + body: str + body_prefix: str + body_pre_docinfo: str + body_suffix: str + docinfo: str + footer: str + fragment: str + head: str + head_prefix: str + header: str + html_body: str + html_head: str + html_prolog: str + html_subtitle: str + html_title: str + meta: str + stylesheet: str + subtitle: str + title: str + # PEP/HTML Writer https://docutils.sourceforge.io/docs/api/publisher.html#pep-html-writer + # + S5/HTML Writer https://docutils.sourceforge.io/docs/api/publisher.html#s5-html-writer + pepnum: str + + # Parts Provided by the (Xe)LaTeX Writers https://docutils.sourceforge.io/docs/api/publisher.html#parts-provided-by-the-xe-latex-writers + + # (commenting out those already included) + abstract: str + # body: str + # body_pre_docinfo: str + dedication: str + # docinfo: str + fallbacks: str + # head_prefix: str + latex_preamble: str + pdfsetup: str + requirements: str + # stylesheet: str + # subtitle: str + # title: str + titledata: str + class Writer(Component, Generic[_S]): - parts: dict[str, Any] + parts: _WriterParts language: LanguageImporter | None = None def __init__(self) -> None: ... document: nodes.document | None = None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gevent/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/gevent/METADATA.toml index 1db1f9d5c3b6..960f4c760e7f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gevent/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/gevent/METADATA.toml @@ -1,4 +1,4 @@ -version = "24.10.*" +version = "24.11.*" upstream_repository = "https://github.com/gevent/gevent" requires = ["types-greenlet", "types-psutil"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/events.pyi b/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/events.pyi index f905ef73e1cc..fd11a1c80827 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/events.pyi @@ -49,13 +49,15 @@ class IEventLoopBlocked(Interface): greenlet: greenlet_t blocking_time: float info: Sequence[str] + hub: Hub | None @implementer(IEventLoopBlocked) class EventLoopBlocked: greenlet: greenlet_t blocking_time: float info: Sequence[str] - def __init__(self, greenlet: greenlet_t, blocking_time: float, info: Sequence[str]) -> None: ... + hub: Hub | None + def __init__(self, greenlet: greenlet_t, blocking_time: float, info: Sequence[str], *, hub: Hub | None = None) -> None: ... class IMemoryUsageThresholdExceeded(Interface): mem_usage: int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml index df95fc7f8607..18d11b38fe89 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml @@ -1,6 +1,10 @@ -version = "~= 6.0.1" +version = "6.1.*" upstream_repository = "https://github.com/collective/icalendar" -requires = ["types-python-dateutil", "backports.zoneinfo; python_version<'3.9'"] +requires = [ + "types-python-dateutil", + "types-pytz", + "backports.zoneinfo; python_version<'3.9'", +] [tool.stubtest] stubtest_requirements = ["pytz"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi index 7aa257843278..b4651f094bf6 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi @@ -1,3 +1,11 @@ +from .alarms import ( + Alarms as Alarms, + AlarmTime as AlarmTime, + ComponentEndMissing as ComponentEndMissing, + ComponentStartMissing as ComponentStartMissing, + IncompleteAlarmInformation as IncompleteAlarmInformation, + LocalTimezoneMissing as LocalTimezoneMissing, +) from .cal import ( Alarm as Alarm, Calendar as Calendar, @@ -87,4 +95,10 @@ __all__ = [ "vMonth", "IncompleteComponent", "InvalidCalendar", + "Alarms", + "AlarmTime", + "ComponentEndMissing", + "ComponentStartMissing", + "IncompleteAlarmInformation", + "LocalTimezoneMissing", ] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/alarms.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/alarms.pyi new file mode 100644 index 000000000000..52eab13aaebf --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/alarms.pyi @@ -0,0 +1,54 @@ +import datetime +from typing_extensions import TypeAlias + +from .cal import Alarm, Event, Todo + +__all__ = [ + "Alarms", + "AlarmTime", + "IncompleteAlarmInformation", + "ComponentEndMissing", + "ComponentStartMissing", + "LocalTimezoneMissing", +] + +Parent: TypeAlias = Event | Todo + +class IncompleteAlarmInformation(ValueError): ... +class ComponentStartMissing(IncompleteAlarmInformation): ... +class ComponentEndMissing(IncompleteAlarmInformation): ... +class LocalTimezoneMissing(IncompleteAlarmInformation): ... + +class AlarmTime: + def __init__( + self, + alarm: Alarm, + trigger: datetime.datetime, + acknowledged_until: datetime.datetime | None = None, + snoozed_until: datetime.datetime | None = None, + parent: Parent | None = None, + ): ... + @property + def acknowledged(self) -> datetime.datetime | None: ... + @property + def alarm(self) -> Alarm: ... + @property + def parent(self) -> Parent | None: ... + def is_active(self) -> bool: ... + @property + def trigger(self) -> datetime.date: ... + +class Alarms: + def __init__(self, component: Alarm | Event | Todo | None = None): ... + def add_component(self, component: Alarm | Parent) -> None: ... + def set_parent(self, parent: Parent) -> None: ... + def add_alarm(self, alarm: Alarm) -> None: ... + def set_start(self, dt: datetime.date | None) -> None: ... + def set_end(self, dt: datetime.date | None) -> None: ... + def acknowledge_until(self, dt: datetime.date | None) -> None: ... + def snooze_until(self, dt: datetime.date | None) -> None: ... + def set_local_timezone(self, tzinfo: datetime.tzinfo | str | None) -> None: ... + @property + def times(self) -> list[AlarmTime]: ... + @property + def active(self) -> list[AlarmTime]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi index 2b1b1542f0c8..dfd5161666bb 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi @@ -1,12 +1,14 @@ import datetime from _typeshed import Incomplete, SupportsItems from collections.abc import Callable -from typing import Any, ClassVar, Final, Literal, overload -from typing_extensions import TypeIs +from typing import Any, ClassVar, Final, Literal, NamedTuple, overload +from typing_extensions import Self +from .alarms import Alarms from .caselessdict import CaselessDict from .parser import Contentline, Contentlines from .prop import TypesFactory +from .timezone.tzp import TZP __all__ = [ "Alarm", @@ -37,6 +39,8 @@ INLINE: CaselessDict[int] class InvalidCalendar(ValueError): ... class IncompleteComponent(ValueError): ... +def create_utc_property(name: str, docs: str) -> property: ... + class Component(CaselessDict[Incomplete]): name: ClassVar[str | None] required: ClassVar[tuple[str, ...]] @@ -64,8 +68,8 @@ class Component(CaselessDict[Incomplete]): def get_inline(self, name, decode: bool = True): ... def set_inline(self, name, values, encode: bool = True) -> None: ... def add_component(self, component: Component) -> None: ... - def walk(self, name: str | None = None, select: Callable[[Component], bool] = ...): ... - def property_items(self, recursive: bool = True, sorted: bool = True): ... + def walk(self, name: str | None = None, select: Callable[[Component], bool] = ...) -> list[Component]: ... + def property_items(self, recursive: bool = True, sorted: bool = True) -> list[tuple[str, object]]: ... @overload @classmethod def from_ical(cls, st: str, multiple: Literal[False] = False) -> Component: ... # or any of its subclasses @@ -76,16 +80,27 @@ class Component(CaselessDict[Incomplete]): def content_lines(self, sorted: bool = True) -> Contentlines: ... def to_ical(self, sorted: bool = True) -> bytes: ... def __eq__(self, other: Component) -> bool: ... # type: ignore[override] + @property + def DTSTAMP(self) -> datetime.datetime | None: ... + @DTSTAMP.setter + def DTSTAMP(self, value: datetime.datetime) -> None: ... + @property + def LAST_MODIFIED(self) -> datetime.datetime | None: ... + @LAST_MODIFIED.setter + def LAST_MODIFIED(self, value: datetime.datetime) -> None: ... + def is_thunderbird(self) -> bool: ... # type_def is a TypeForm -def create_single_property(prop: str, value_attr: str, value_type: tuple[type, ...], type_def: Any, doc: str) -> property: ... -def is_date(dt: datetime.date) -> bool: ... # TypeIs[datetime.date and not datetime.datetime] -def is_datetime(dt: datetime.date) -> TypeIs[datetime.datetime]: ... +def create_single_property( + prop: str, value_attr: str | None, value_type: tuple[type, ...], type_def: Any, doc: str, vProp: type[Incomplete] = ... +) -> property: ... class Event(Component): name: ClassVar[Literal["VEVENT"]] + @property + def alarms(self) -> Alarms: ... @classmethod - def example(cls, name: str) -> Event: ... + def example(cls, name: str = "rfc_9074_example_3") -> Event: ... @property def DTSTART(self) -> datetime.date | datetime.datetime | None: ... @DTSTART.setter @@ -108,9 +123,49 @@ class Event(Component): def end(self) -> datetime.date | datetime.datetime: ... @end.setter def end(self, value: datetime.date | datetime.datetime | None) -> None: ... + @property + def X_MOZ_SNOOZE_TIME(self) -> datetime.datetime | None: ... + @X_MOZ_SNOOZE_TIME.setter + def X_MOZ_SNOOZE_TIME(self, value: datetime.datetime) -> None: ... + @property + def X_MOZ_LASTACK(self) -> datetime.datetime | None: ... + @X_MOZ_LASTACK.setter + def X_MOZ_LASTACK(self, value: datetime.datetime) -> None: ... class Todo(Component): name: ClassVar[Literal["VTODO"]] + @property + def DTSTART(self) -> datetime.datetime | datetime.date | None: ... + @DTSTART.setter + def DTSTART(self, value: datetime.datetime | datetime.date | None) -> None: ... + @property + def DUE(self) -> datetime.datetime | datetime.date | None: ... + @DUE.setter + def DUE(self, value: datetime.datetime | datetime.date | None) -> None: ... + @property + def DURATION(self) -> datetime.timedelta | None: ... + @DURATION.setter + def DURATION(self, value: datetime.timedelta | None) -> None: ... + @property + def start(self) -> datetime.datetime | datetime.date: ... + @start.setter + def start(self, value: datetime.datetime | datetime.date | None) -> None: ... + @property + def end(self) -> datetime.datetime | datetime.date: ... + @end.setter + def end(self, value: datetime.datetime | datetime.date | None) -> None: ... + @property + def duration(self) -> datetime.timedelta: ... + @property + def X_MOZ_SNOOZE_TIME(self) -> datetime.datetime | None: ... + @X_MOZ_SNOOZE_TIME.setter + def X_MOZ_SNOOZE_TIME(self, value: datetime.datetime) -> None: ... + @property + def X_MOZ_LASTACK(self) -> datetime.datetime | None: ... + @X_MOZ_LASTACK.setter + def X_MOZ_LASTACK(self, value: datetime.datetime) -> None: ... + @property + def alarms(self) -> Alarms: ... class Journal(Component): name: ClassVar[Literal["VJOURNAL"]] @@ -132,25 +187,96 @@ class FreeBusy(Component): class Timezone(Component): name: ClassVar[Literal["VTIMEZONE"]] @classmethod - def example(cls, name: str) -> Calendar: ... - def to_tz(self, tzp=...): ... # FIXME -> DstTzInfo: ... + def example(cls, name: str = "pacific_fiji") -> Calendar: ... + def to_tz(self, tzp: TZP = ..., lookup_tzid: bool = True) -> datetime.tzinfo: ... @property def tz_name(self) -> str: ... def get_transitions(self) -> tuple[list[datetime.datetime], list[tuple[datetime.timedelta, datetime.timedelta, str]]]: ... + @classmethod + def from_tzinfo( + cls, timezone: datetime.tzinfo, tzid: str | None = None, first_date: datetime.date = ..., last_date: datetime.date = ... + ) -> Self: ... + @classmethod + def from_tzid(cls, tzid: str, tzp: TZP = ..., first_date: datetime.date = ..., last_date: datetime.date = ...) -> Self: ... + @property + def standard(self) -> list[TimezoneStandard]: ... + @property + def daylight(self) -> list[TimezoneDaylight]: ... class TimezoneStandard(Component): name: ClassVar[Literal["STANDARD"]] + @property + def DTSTART(self) -> datetime.date | datetime.datetime | None: ... + @DTSTART.setter + def DTSTART(self, value: datetime.date | datetime.datetime | None) -> None: ... + @property + def TZOFFSETTO(self) -> datetime.timedelta | None: ... + @TZOFFSETTO.setter + def TZOFFSETTO(self, value: datetime.timedelta | None) -> None: ... + @property + def TZOFFSETFROM(self) -> datetime.timedelta | None: ... + @TZOFFSETFROM.setter + def TZOFFSETFROM(self, value: datetime.timedelta | None) -> None: ... class TimezoneDaylight(Component): name: ClassVar[Literal["DAYLIGHT"]] + @property + def DTSTART(self) -> datetime.date | datetime.datetime | None: ... + @DTSTART.setter + def DTSTART(self, value: datetime.date | datetime.datetime | None) -> None: ... + @property + def TZOFFSETTO(self) -> datetime.timedelta | None: ... + @TZOFFSETTO.setter + def TZOFFSETTO(self, value: datetime.timedelta | None) -> None: ... + @property + def TZOFFSETFROM(self) -> datetime.timedelta | None: ... + @TZOFFSETFROM.setter + def TZOFFSETFROM(self, value: datetime.timedelta | None) -> None: ... class Alarm(Component): name: ClassVar[Literal["VALARM"]] + @property + def REPEAT(self) -> int: ... + @REPEAT.setter + def REPEAT(self, value: int) -> None: ... + @property + def DURATION(self) -> datetime.timedelta | None: ... + @DURATION.setter + def DURATION(self, value: datetime.timedelta | None) -> None: ... + @property + def ACKNOWLEDGED(self) -> datetime.datetime | None: ... + @ACKNOWLEDGED.setter + def ACKNOWLEDGED(self, value: datetime.datetime | None) -> None: ... + @property + def TRIGGER(self) -> datetime.timedelta | datetime.datetime | None: ... + @TRIGGER.setter + def TRIGGER(self, value: datetime.timedelta | datetime.datetime | None) -> None: ... + @property + def TRIGGER_RELATED(self) -> Literal["START", "END"]: ... + @TRIGGER_RELATED.setter + def TRIGGER_RELATED(self, value: Literal["START", "END"]) -> None: ... + + class Triggers(NamedTuple): + start: tuple[datetime.timedelta, ...] + end: tuple[datetime.timedelta, ...] + absolute: tuple[datetime.datetime, ...] + + @property + def triggers(self) -> Alarm.Triggers: ... class Calendar(Component): name: ClassVar[Literal["VCALENDAR"]] @classmethod - def example(cls, name: str) -> Calendar: ... + def example(cls, name: str = "example") -> Calendar: ... + @property + def events(self) -> list[Event]: ... + @property + def todos(self) -> list[Todo]: ... + def get_used_tzids(self) -> set[str]: ... + def get_missing_tzids(self) -> set[str]: ... + @property + def timezones(self) -> list[Timezone]: ... + def add_missing_timezones(self, first_date: datetime.date = ..., last_date: datetime.date = ...) -> None: ... types_factory: Final[TypesFactory] component_factory: Final[ComponentFactory] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi index 5256204ccc87..17d79298b676 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi @@ -9,13 +9,13 @@ from typing_extensions import Self, TypeAlias from .caselessdict import CaselessDict from .parser import Parameters from .parser_tools import ICAL_TYPE +from .timezone import tzid_from_dt as tzid_from_dt, tzid_from_tzinfo as tzid_from_tzinfo __all__ = [ "DURATION_REGEX", "TimeBase", "TypesFactory", "WEEKDAY_RULE", - "tzid_from_dt", "vBinary", "vBoolean", "vCalAddress", @@ -39,6 +39,8 @@ __all__ = [ "vUTCOffset", "vUri", "vWeekday", + "tzid_from_dt", + "tzid_from_tzinfo", ] _PropType: TypeAlias = type[Any] # any of the v* classes in this file @@ -47,8 +49,6 @@ _vRecurT = TypeVar("_vRecurT", bound=vRecur) DURATION_REGEX: Final[Pattern[str]] WEEKDAY_RULE: Final[Pattern[str]] -def tzid_from_dt(dt: datetime.datetime) -> str | None: ... - class vBinary: obj: Incomplete params: Parameters @@ -140,7 +140,7 @@ class vDatetime(TimeBase): def __init__(self, dt) -> None: ... def to_ical(self) -> bytes: ... @staticmethod - def from_ical(ical, timezone: str | None = None) -> datetime.datetime: ... + def from_ical(ical, timezone: datetime.timezone | str | None = None) -> datetime.datetime: ... class vDuration(TimeBase): td: Incomplete @@ -241,13 +241,14 @@ class vGeo: class vUTCOffset: ignore_exceptions: bool - td: Incomplete + td: datetime.timedelta params: Parameters - def __init__(self, td) -> None: ... + def __init__(self, td: datetime.timedelta) -> None: ... def to_ical(self) -> bytes: ... @classmethod def from_ical(cls, ical): ... - def __eq__(self, other): ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... class vInline(str): params: Parameters diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi index a7021d39f29d..4cd6dade83ae 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi @@ -1,6 +1,7 @@ -from ..timezone.tzp import TZP # to prevent "tzp" from being defined here +from ..timezone.tzp import TZP as TZP # to prevent "tzp" from being defined here +from .tzid import tzid_from_dt as tzid_from_dt, tzid_from_tzinfo as tzid_from_tzinfo, tzids_from_tzinfo as tzids_from_tzinfo -__all__ = ["tzp", "use_pytz", "use_zoneinfo"] +__all__ = ["TZP", "tzp", "use_pytz", "use_zoneinfo", "tzid_from_tzinfo", "tzid_from_dt", "tzids_from_tzinfo"] tzp: TZP diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids.pyi new file mode 100644 index 000000000000..046385bb0c92 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids.pyi @@ -0,0 +1,15 @@ +import datetime +from collections.abc import Callable +from typing import Final + +__all__ = ["main"] + +def check(dt: datetime.datetime, tz: datetime.tzinfo) -> tuple[datetime.datetime, datetime.timedelta]: ... +def checks(tz: datetime.tzinfo) -> list[tuple[datetime.datetime, datetime.timedelta]]: ... + +START: Final[datetime.datetime] +END: Final[datetime.datetime] + +DTS: Final[list[datetime.datetime]] + +def main(create_timezones: list[Callable[[str], datetime.tzinfo]], name: str, pool_size: int = ...) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids_result.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids_result.pyi new file mode 100644 index 000000000000..db990d137ae2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/equivalent_timezone_ids_result.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete +from typing import Final + +__all__ = ["lookup"] + +lookup: Final[Incomplete] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzid.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzid.pyi new file mode 100644 index 000000000000..c70bc41cf2e2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzid.pyi @@ -0,0 +1,8 @@ +import datetime + +__all__ = ["tzid_from_tzinfo", "tzid_from_dt", "tzids_from_tzinfo"] + +def tzids_from_tzinfo(tzinfo: datetime.tzinfo | None) -> tuple[str, ...]: ... +def tzid_from_tzinfo(tzinfo: datetime.tzinfo | None) -> str | None: ... +def tzid_from_dt(dt: datetime.datetime) -> str | None: ... +def tzinfo2tzids(tzinfo: datetime.tzinfo | None) -> set[str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi index 0796edc88a63..7a2102561c60 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi @@ -17,8 +17,8 @@ class TZP: def use_zoneinfo(self) -> None: ... def use(self, provider: str | TZProvider) -> None: ... def use_default(self) -> None: ... - def localize_utc(self, dt: datetime.datetime) -> datetime.datetime: ... - def localize(self, dt: datetime.datetime, tz: datetime.tzinfo | str) -> datetime.datetime: ... + def localize_utc(self, dt: datetime.date) -> datetime.datetime: ... + def localize(self, dt: datetime.date, tz: datetime.tzinfo | str) -> datetime.datetime: ... def cache_timezone_component(self, timezone_component: Timezone) -> None: ... def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ... def create_timezone(self, timezone_component: Timezone) -> datetime.tzinfo: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi index 6b9dd1480cac..d58219227c0b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi @@ -1,8 +1,12 @@ +import datetime from typing import Final +from typing_extensions import TypeGuard, TypeIs + +from pytz.tzinfo import BaseTzInfo from .prop import vText -__all__ = ["UIDGenerator"] +__all__ = ["UIDGenerator", "is_date", "is_datetime", "to_datetime", "is_pytz", "is_pytz_dt", "normalize_pytz"] class UIDGenerator: chars: Final[list[str]] @@ -10,3 +14,10 @@ class UIDGenerator: def rnd_string(length: int = 16) -> str: ... @staticmethod def uid(host_name: str = "example.com", unique: str = "") -> vText: ... + +def is_date(dt: datetime.date) -> bool: ... # and not datetime.date +def is_datetime(dt: datetime.date) -> TypeIs[datetime.datetime]: ... +def to_datetime(dt: datetime.date) -> datetime.datetime: ... +def is_pytz(tz: datetime.tzinfo) -> TypeIs[BaseTzInfo]: ... +def is_pytz_dt(dt: datetime.date) -> TypeGuard[datetime.datetime]: ... # and dt.tzinfo is BaseTZInfo +def normalize_pytz(dt: datetime.date) -> datetime.datetime: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml index 13f24dd25d38..97f4bd7321ca 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml @@ -1,4 +1,4 @@ -version = "3.3" +version = "3.4.2" upstream_repository = "https://github.com/networkx/networkx" # requires a version of numpy with a `py.typed` file requires = ["numpy>=1.20"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi index d510d8c03574..93d76806aed3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/components/strongly_connected.pyi @@ -9,8 +9,6 @@ def strongly_connected_components(G: Graph[_Node]) -> Generator[set[_Node], None @_dispatchable def kosaraju_strongly_connected_components(G: Graph[_Node], source: _Node | None = None) -> Generator[set[_Node], None, None]: ... @_dispatchable -def strongly_connected_components_recursive(G: Graph[_Node]) -> Generator[set[_Node], None, None]: ... -@_dispatchable def number_strongly_connected_components(G: Graph[Hashable]) -> int: ... @_dispatchable def is_strongly_connected(G: Graph[Hashable]) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/branchings.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/branchings.pyi index 8131ff2ce3ba..5bed2ab210ef 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/branchings.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/branchings.pyi @@ -2,8 +2,6 @@ from _typeshed import Incomplete from collections.abc import Iterator from dataclasses import dataclass -from networkx.classes.graph import _Node -from networkx.classes.multidigraph import MultiDiGraph from networkx.utils.backends import _dispatchable __all__ = [ @@ -14,41 +12,12 @@ __all__ = [ "maximum_spanning_arborescence", "minimum_spanning_arborescence", "ArborescenceIterator", - "Edmonds", ] @_dispatchable def branching_weight(G, attr: str = "weight", default: float = 1): ... @_dispatchable def greedy_branching(G, attr: str = "weight", default: float = 1, kind: str = "max", seed: Incomplete | None = None): ... - -class MultiDiGraph_EdgeKey(MultiDiGraph[_Node]): - edge_index: Incomplete - def __init__(self, incoming_graph_data: Incomplete | None = None, **attr) -> None: ... - def remove_node(self, n) -> None: ... - def remove_nodes_from(self, nbunch) -> None: ... - def add_edge(self, u_for_edge, v_for_edge, key_for_edge, **attr) -> None: ... # type: ignore[override] # Graph.add_edge won't accept a `key_for_edge` keyword argument. - def add_edges_from(self, ebunch_to_add, **attr) -> None: ... - def remove_edge_with_key(self, key) -> None: ... - def remove_edges_from(self, ebunch) -> None: ... - -class Edmonds: - G_original: Incomplete - store: bool - edges: Incomplete - template: Incomplete - def __init__(self, G, seed: Incomplete | None = None) -> None: ... - def find_optimum( - self, - attr: str = "weight", - default: float = 1, - kind: str = "max", - style: str = "branching", - preserve_attrs: bool = False, - partition: Incomplete | None = None, - seed: Incomplete | None = None, - ): ... - @_dispatchable def maximum_branching( G, attr: str = "weight", default: float = 1, preserve_attrs: bool = False, partition: Incomplete | None = None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/operations.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/operations.pyi index 5a3981c63c6f..feab02594790 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/operations.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/algorithms/tree/operations.pyi @@ -3,4 +3,4 @@ from _typeshed import Incomplete from networkx.utils.backends import _dispatchable @_dispatchable -def join(rooted_trees, label_attribute: Incomplete | None = None): ... +def join_trees(rooted_trees, label_attribute: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/reportviews.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/reportviews.pyi index f6abe1194f3c..e64320435cd5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/reportviews.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/reportviews.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete, Unused +from abc import ABC from collections.abc import Iterable, Iterator, Mapping, Set as AbstractSet from typing import Any, Generic, Literal, TypeVar, overload from typing_extensions import Self @@ -45,8 +46,9 @@ class MultiDegreeView(DiDegreeView[_Node]): ... class DiMultiDegreeView(DiDegreeView[_Node]): ... class InMultiDegreeView(DiDegreeView[_Node]): ... class OutMultiDegreeView(DiDegreeView[_Node]): ... +class EdgeViewABC(ABC): ... -class OutEdgeDataView(Generic[_Node, _D]): +class OutEdgeDataView(EdgeViewABC, Generic[_Node, _D]): def __init__( self, viewer, nbunch: _NBunch[_Node] = None, data: bool = False, *, default: Incomplete | None = None ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/drawing/layout.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/drawing/layout.pyi index d84ae0b55131..8d5f3dd1d1e9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/drawing/layout.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/drawing/layout.pyi @@ -1,5 +1,7 @@ from _typeshed import Incomplete +import numpy + def random_layout(G, center: Incomplete | None = None, dim: int = 2, seed: Incomplete | None = None): ... def circular_layout(G, scale: float = 1, center: Incomplete | None = None, dim: int = 2): ... def shell_layout( @@ -54,6 +56,8 @@ def arf_layout( etol: float = 1e-06, dt: float = 0.001, max_iter: int = 1000, + *, + seed: int | numpy.random.RandomState | None = None, ): ... def rescale_layout(pos, scale: float = 1): ... def rescale_layout_dict(pos, scale: float = 1): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/generators/trees.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/generators/trees.pyi index f511c2d87dee..238bc03ef9ee 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/generators/trees.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/generators/trees.pyi @@ -1,10 +1,6 @@ -from _typeshed import Incomplete - from networkx.utils.backends import _dispatchable @_dispatchable def prefix_tree(paths): ... @_dispatchable def prefix_tree_recursive(paths): ... -@_dispatchable -def random_tree(n, seed: Incomplete | None = None, create_using: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/json_graph/node_link.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/json_graph/node_link.pyi index e37e34838277..cb4c7e6766c2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/json_graph/node_link.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/json_graph/node_link.pyi @@ -3,7 +3,15 @@ from _typeshed import Incomplete from networkx.utils.backends import _dispatchable def node_link_data( - G, *, source: str = "source", target: str = "target", name: str = "id", key: str = "key", link: str = "links" + G, + *, + source: str = "source", + target: str = "target", + name: str = "id", + key: str = "key", + edges: str | None = None, + nodes: str = "nodes", + link: str | None = None, ): ... @_dispatchable def node_link_graph( @@ -16,5 +24,7 @@ def node_link_graph( target: str = "target", name: str = "id", key: str = "key", - link: str = "links", + edges: str | None = None, + nodes: str = "nodes", + link: str | None = None, ): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/text.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/text.pyi index 83d92915bc8d..1f96ae0a135a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/text.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/readwrite/text.pyi @@ -2,7 +2,7 @@ from _typeshed import Incomplete from collections.abc import Generator from typing import ClassVar -__all__ = ["forest_str", "generate_network_text", "write_network_text"] +__all__ = ["generate_network_text", "write_network_text"] class _AsciiBaseGlyphs: empty: ClassVar[str] @@ -58,6 +58,3 @@ def write_network_text( end: str = "\n", vertical_chains=False, ) -> None: ... -def forest_str( - graph, with_labels: bool = True, sources: Incomplete | None = None, write: Incomplete | None = None, ascii_only: bool = False -): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/utils/configs.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/utils/configs.pyi index c9f8cb49d2dd..1e6548df50b9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/utils/configs.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/utils/configs.pyi @@ -26,7 +26,25 @@ class NetworkXConfig(Config): backend_priority: list[str] backends: Config cache_converted_graphs: bool - def __init__(self, *, backend_priority: list[str], backends: Config, cache_converted_graphs: bool) -> None: ... - def __new__(cls, *, backend_priority: list[str], backends: Config, cache_converted_graphs: bool) -> Self: ... + fallback_to_nx: bool + warnings_to_ignore: set[str] + def __init__( + self, + *, + backend_priority: list[str], + backends: Config, + cache_converted_graphs: bool, + fallback_to_nx: bool, + warnings_to_ignore: set[str], + ) -> None: ... + def __new__( + cls, + *, + backend_priority: list[str], + backends: Config, + cache_converted_graphs: bool, + fallback_to_nx: bool, + warnings_to_ignore: set[str], + ) -> Self: ... config: NetworkXConfig diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/__init__.pyi index 0c1f04c63b93..de5224812ce7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/__init__.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrPath, SupportsRead +from _typeshed import StrPath, SupportsRead, SupportsWrite from typing import IO, Literal, Protocol from typing_extensions import TypeAlias @@ -25,6 +25,7 @@ _VisibilityType: TypeAlias = Literal["visible", "hidden", "veryHidden"] # noqa: # TODO: Use a proper protocol from ZipFile. See: #10880 # This alias is to minimize false-positives _ZipFileFileProtocol: TypeAlias = StrPath | IO[bytes] | SupportsRead[bytes] # noqa: Y047 +_ZipFileFileWriteProtocol: TypeAlias = StrPath | IO[bytes] | SupportsWrite[bytes] # noqa: Y047 class _Decodable(Protocol): # noqa: Y046 def decode(self, encoding: str, /) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/__init__.pyi index 725383e2bcd1..54641897e49a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/__init__.pyi @@ -22,3 +22,5 @@ _CellValue: TypeAlias = ( # noqa: Y047 # Used in other modules | ArrayFormula ) _AnyCellValue: TypeAlias = Any # Any of _CellValue # noqa: Y047 # Used in other modules + +_CellOrMergedCell: TypeAlias = Cell | MergedCell # noqa: Y047 # Used in other modules diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/_writer.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/_writer.pyi index a546a3241df0..da72488a1370 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/_writer.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/_writer.pyi @@ -1,7 +1,9 @@ from _typeshed import Incomplete, Unused -def etree_write_cell(xf, worksheet: Unused, cell, styled: Incomplete | None = None) -> None: ... -def lxml_write_cell(xf, worksheet: Unused, cell, styled: bool = False) -> None: ... +from openpyxl.cell import _CellOrMergedCell + +def etree_write_cell(xf, worksheet: Unused, cell: _CellOrMergedCell, styled: Incomplete | None = None) -> None: ... +def lxml_write_cell(xf, worksheet: Unused, cell: _CellOrMergedCell, styled: bool = False) -> None: ... write_cell = lxml_write_cell write_cell = etree_write_cell diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/cell.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/cell.pyi index 9eb5ebc07178..dea71e03d8a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/cell.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/cell.pyi @@ -3,7 +3,7 @@ from datetime import datetime from re import Pattern from typing import Final, Literal, overload -from openpyxl.cell import _CellValue, _TimeTypes +from openpyxl.cell import _CellOrMergedCell, _CellValue, _TimeTypes from openpyxl.comments.comments import Comment from openpyxl.compat.numbers import NUMERIC_TYPES as NUMERIC_TYPES # cell numeric types from openpyxl.styles.cell_style import StyleArray @@ -75,7 +75,7 @@ class Cell(StyleableObject): def hyperlink(self, val: Hyperlink | str | None) -> None: ... @property def is_date(self) -> bool: ... - def offset(self, row: int = 0, column: int = 0) -> Cell: ... + def offset(self, row: int = 0, column: int = 0) -> _CellOrMergedCell: ... @property def comment(self) -> Comment | None: ... @comment.setter diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi index f7fd4b59ee50..f7069a43bd03 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi @@ -3,6 +3,7 @@ from collections.abc import Generator from typing import ClassVar, Literal, overload from typing_extensions import TypeAlias +from openpyxl.cell import _CellOrMergedCell from openpyxl.cell.text import Text from openpyxl.comments.author import AuthorList from openpyxl.comments.comments import Comment @@ -101,7 +102,7 @@ class CommentRecord(Serialisable): width: int = 144, ) -> None: ... @classmethod - def from_cell(cls, cell): ... + def from_cell(cls, cell: _CellOrMergedCell): ... @property def content(self) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/workbook.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/workbook.pyi index 9756e5f7a5b2..f93f634796d5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/workbook.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/workbook.pyi @@ -5,7 +5,7 @@ from typing import Any, Final, type_check_only from typing_extensions import TypeAlias, deprecated from zipfile import ZipFile -from openpyxl import _Decodable, _ZipFileFileProtocol +from openpyxl import _Decodable, _ZipFileFileWriteProtocol from openpyxl.chartsheet.chartsheet import Chartsheet from openpyxl.styles.named_styles import NamedStyle from openpyxl.utils.indexed_list import IndexedList @@ -112,7 +112,7 @@ class Workbook: def named_styles(self) -> list[str]: ... @property def mime_type(self) -> str: ... - def save(self, filename: _ZipFileFileProtocol) -> None: ... + def save(self, filename: _ZipFileFileWriteProtocol) -> None: ... @property def style_names(self) -> list[str]: ... # A write_only and read_only workbooks can't use this method as it requires both reading and writing. diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi index d5a32d36a8e7..0579afc366a4 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi @@ -1,10 +1,8 @@ from _typeshed import SupportsGetItem -from collections.abc import Generator, Iterator -from typing import Any, overload +from collections.abc import Generator from openpyxl import _VisibilityType -from openpyxl.cell import _CellValue -from openpyxl.cell.cell import Cell +from openpyxl.cell import _CellOrMergedCell, _CellValue from openpyxl.utils.cell import _RangeBoundariesTuple from openpyxl.workbook.workbook import Workbook from openpyxl.worksheet.worksheet import Worksheet @@ -21,16 +19,9 @@ class ReadOnlyWorksheet: # Same as Worksheet.rows # https://github.com/python/mypy/issues/6700 @property - def rows(self) -> Generator[tuple[Cell, ...], None, None]: ... - # From Worksheet.__getitem__ - @overload - def __getitem__(self, key: int) -> tuple[Cell, ...]: ... - @overload - def __getitem__(self, key: slice) -> tuple[Any, ...]: ... # tuple[AnyOf[Cell, tuple[Cell, ...]]] - @overload - def __getitem__(self, key: str) -> Any: ... # AnyOf[Cell, tuple[Cell, ...], tuple[tuple[Cell, ...], ...]] - # From Worksheet.__iter__ - def __iter__(self) -> Iterator[tuple[Cell, ...]]: ... + def rows(self) -> Generator[tuple[_CellOrMergedCell, ...], None, None]: ... + __getitem__ = Worksheet.__getitem__ + __iter__ = Worksheet.__iter__ parent: Workbook title: str sheet_state: _VisibilityType diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_reader.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_reader.pyi index feec1c6c5dcc..420fc3dac2d9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_reader.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_reader.pyi @@ -4,8 +4,7 @@ from datetime import datetime from typing import Final from xml.etree.ElementTree import _FileRead -from openpyxl.cell import _AnyCellValue -from openpyxl.cell.cell import Cell +from openpyxl.cell import _AnyCellValue, _CellOrMergedCell from openpyxl.cell.rich_text import CellRichText from openpyxl.descriptors.serialisable import _ChildSerialisableTreeElement, _SerialisableTreeElement from openpyxl.formula.translate import Translator @@ -111,7 +110,7 @@ class WorksheetReader: def bind_tables(self) -> None: ... def bind_merged_cells(self) -> None: ... def bind_hyperlinks(self) -> None: ... - def normalize_merged_cell_link(self, coord: str) -> Cell | None: ... + def normalize_merged_cell_link(self, coord: str) -> _CellOrMergedCell | None: ... def bind_col_dimensions(self) -> None: ... def bind_row_dimensions(self) -> None: ... def bind_properties(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_writer.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_writer.pyi index 06059186e2c8..6261170ee21d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_writer.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_writer.pyi @@ -1,8 +1,9 @@ from _typeshed import Incomplete, ReadableBuffer, StrPath, Unused -from collections.abc import Generator +from collections.abc import Generator, Iterable from typing import Protocol from typing_extensions import TypeAlias +from openpyxl.cell import _CellOrMergedCell from openpyxl.worksheet._write_only import WriteOnlyWorksheet from openpyxl.worksheet.worksheet import Worksheet @@ -30,9 +31,9 @@ class WorksheetWriter: def write_views(self) -> None: ... def write_cols(self) -> None: ... def write_top(self) -> None: ... - def rows(self) -> list[tuple[int, list[Incomplete]]]: ... + def rows(self) -> list[tuple[int, list[_CellOrMergedCell]]]: ... def write_rows(self) -> None: ... - def write_row(self, xf, row, row_idx) -> None: ... + def write_row(self, xf, row: Iterable[_CellOrMergedCell], row_idx) -> None: ... def write_protection(self) -> None: ... def write_scenarios(self) -> None: ... def write_filter(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/merge.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/merge.pyi index bbf8c225be9e..7faa6cfaea71 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/merge.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/merge.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete, Unused from typing import ClassVar +from openpyxl.cell import _CellOrMergedCell from openpyxl.descriptors.serialisable import Serialisable from openpyxl.worksheet.worksheet import Worksheet @@ -29,7 +30,7 @@ class MergeCells(Serialisable): class MergedCellRange(CellRange): ws: Worksheet - start_cell: Incomplete + start_cell: _CellOrMergedCell def __init__(self, worksheet: Worksheet, coord) -> None: ... def format(self) -> None: ... def __contains__(self, coord: str) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi index 0fd8a84ef379..6b40a85a7be6 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi @@ -6,7 +6,7 @@ from typing import Any, Final, Literal, NoReturn, overload from typing_extensions import deprecated from openpyxl import _Decodable, _VisibilityType -from openpyxl.cell import _CellValue +from openpyxl.cell import _CellOrMergedCell, _CellValue from openpyxl.cell.cell import Cell from openpyxl.chart._chart import ChartBase from openpyxl.drawing.image import Image @@ -51,6 +51,7 @@ class Worksheet(_WorkbookChild): ORIENTATION_PORTRAIT: Final = "portrait" ORIENTATION_LANDSCAPE: Final = "landscape" + _cells: dict[tuple[int, int], _CellOrMergedCell] # private but very useful to understand typing row_dimensions: DimensionHolder[int, RowDimension] column_dimensions: DimensionHolder[str, ColumnDimension] row_breaks: RowBreak @@ -85,19 +86,21 @@ class Worksheet(_WorkbookChild): @property def freeze_panes(self) -> str | None: ... @freeze_panes.setter - def freeze_panes(self, topLeftCell: str | Cell | None = ...) -> None: ... - def cell(self, row: int, column: int, value: _CellValue | None = None) -> Cell: ... + def freeze_panes(self, topLeftCell: str | Cell | None = None) -> None: ... + def cell(self, row: int, column: int, value: _CellValue | None = None) -> _CellOrMergedCell: ... # An int is necessarily a row selection @overload - def __getitem__(self, key: int) -> tuple[Cell, ...]: ... + def __getitem__(self, key: int) -> tuple[_CellOrMergedCell, ...]: ... # A slice is necessarily a row or rows, even if targetting a single cell @overload - def __getitem__(self, key: slice) -> tuple[Any, ...]: ... # tuple[AnyOf[Cell, tuple[Cell, ...]]] + def __getitem__(self, key: slice) -> tuple[Any, ...]: ... # tuple[AnyOf[_CellOrMergedCell, tuple[_CellOrMergedCell, ...]]] # A str could be an individual cell, row, column or full range @overload - def __getitem__(self, key: str) -> Any: ... # AnyOf[Cell, tuple[Cell, ...], tuple[tuple[Cell, ...], ...]] + def __getitem__( + self, key: str + ) -> Any: ... # AnyOf[_CellOrMergedCell, tuple[_CellOrMergedCell, ...], tuple[tuple[_CellOrMergedCell, ...], ...]] def __setitem__(self, key: str, value: _CellValue) -> None: ... - def __iter__(self) -> Iterator[tuple[Cell, ...]]: ... + def __iter__(self) -> Iterator[tuple[_CellOrMergedCell, ...]]: ... def __delitem__(self, key: str) -> None: ... @property def min_row(self) -> int: ... @@ -132,11 +135,13 @@ class Worksheet(_WorkbookChild): min_col: int | None = None, max_col: int | None = None, values_only: Literal[False] = False, - ) -> Generator[tuple[Cell, ...], None, None]: ... + ) -> Generator[tuple[_CellOrMergedCell, ...], None, None]: ... @overload def iter_rows( self, min_row: int | None, max_row: int | None, min_col: int | None, max_col: int | None, values_only: bool - ) -> Generator[tuple[Cell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None]: ... + ) -> ( + Generator[tuple[_CellOrMergedCell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None] + ): ... @overload def iter_rows( self, @@ -146,9 +151,11 @@ class Worksheet(_WorkbookChild): max_col: int | None = None, *, values_only: bool, - ) -> Generator[tuple[Cell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None]: ... + ) -> ( + Generator[tuple[_CellOrMergedCell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None] + ): ... @property - def rows(self) -> Generator[tuple[Cell, ...], None, None]: ... + def rows(self) -> Generator[tuple[_CellOrMergedCell, ...], None, None]: ... @property def values(self) -> Generator[tuple[_CellValue | None, ...]]: ... @overload @@ -173,11 +180,13 @@ class Worksheet(_WorkbookChild): min_row: int | None = None, max_row: int | None = None, values_only: Literal[False] = False, - ) -> Generator[tuple[Cell, ...], None, None]: ... + ) -> Generator[tuple[_CellOrMergedCell, ...], None, None]: ... @overload def iter_cols( self, min_col: int | None, max_col: int | None, min_row: int | None, max_row: int | None, values_only: bool - ) -> Generator[tuple[Cell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None]: ... + ) -> ( + Generator[tuple[_CellOrMergedCell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None] + ): ... @overload def iter_cols( self, @@ -187,9 +196,11 @@ class Worksheet(_WorkbookChild): max_row: int | None = None, *, values_only: bool, - ) -> Generator[tuple[Cell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None]: ... + ) -> ( + Generator[tuple[_CellOrMergedCell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None] + ): ... @property - def columns(self) -> Generator[tuple[Cell, ...], None, None]: ... + def columns(self) -> Generator[tuple[_CellOrMergedCell, ...], None, None]: ... @property def column_groups(self) -> list[str]: ... def set_printer_settings( @@ -241,11 +252,11 @@ class Worksheet(_WorkbookChild): def append( self, iterable: ( - list[Incomplete] - | tuple[Incomplete, ...] + list[Any] # lists are invariant, but any subtype or union will do + | tuple[_CellOrMergedCell | str | float | datetime | None, ...] | range - | GeneratorType[Incomplete, object, object] - | dict[int | str, Incomplete] + | GeneratorType[_CellOrMergedCell | str | float | datetime | None, object, object] + | dict[int | str, str | float | datetime | None] ), ) -> None: ... def insert_rows(self, idx: int, amount: int = 1) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml index e40722fa5d0b..c7f85d6f78af 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml @@ -1,4 +1,4 @@ -version = "3.17.7" +version = "3.17.8" upstream_repository = "https://github.com/coleifer/peewee" # We're not providing stubs for all playhouse modules right now # https://github.com/python/typeshed/pull/11731#issuecomment-2065729058 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi index c02589ccf54d..511b205e8845 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi @@ -1674,7 +1674,9 @@ class Model(metaclass=ModelBase): def is_dirty(self) -> bool: ... @property def dirty_fields(self): ... - def dependencies(self, search_nullable: bool = ...) -> Generator[Incomplete, None, None]: ... + def dependencies( + self, search_nullable: bool = True, exclude_null_children: bool = False + ) -> Generator[Incomplete, None, None]: ... def delete_instance(self, recursive: bool = ..., delete_nullable: bool = ...): ... def __hash__(self) -> int: ... def __eq__(self, other) -> Expression | bool: ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/_util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/_util.pyi index 3c2ff84802c6..9b9affebf48d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/_util.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/_util.pyi @@ -1,5 +1,5 @@ -import sys import threading +from _typeshed import OptExcInfo from collections.abc import Callable from queue import Queue from types import ModuleType, TracebackType @@ -28,7 +28,7 @@ class AbstractListener(threading.Thread): _thread: threading.Thread # undocumented _condition: threading.Condition # undocumented _ready: bool # undocumented - _queue: Queue[sys._OptExcInfo | None] # undocumented + _queue: Queue[OptExcInfo | None] # undocumented daemon: bool def __init__(self, suppress: bool = False, **kwargs: Callable[..., bool | None] | None) -> None: ... @property diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pysftp/pysftp/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pysftp/pysftp/__init__.pyi index ec68da0741aa..188e13aff8ac 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pysftp/pysftp/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pysftp/pysftp/__init__.pyi @@ -25,7 +25,7 @@ from pysftp.helpers import ( ) class CnOpts: - log: bool + log: bool | str compression: bool ciphers: Sequence[str] | None hostkeys: paramiko.HostKeys | None @@ -45,7 +45,7 @@ class Connection: port: int = 22, private_key_pass: str | None = None, ciphers: Sequence[str] | None = None, - log: bool = False, + log: bool | str = False, cnopts: CnOpts | None = None, default_path: _Path | None = None, ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pywin32/isapi/install.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/isapi/install.pyi new file mode 100644 index 000000000000..7f224506f6d7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/isapi/install.pyi @@ -0,0 +1,98 @@ +from _typeshed import Incomplete + +this_dir: Incomplete + +class FilterParameters: + Name: Incomplete + Description: Incomplete + Path: Incomplete + Server: Incomplete + AddExtensionFile: bool + AddExtensionFile_Enabled: bool + AddExtensionFile_GroupID: Incomplete + AddExtensionFile_CanDelete: bool + AddExtensionFile_Description: Incomplete + def __init__(self, **kw) -> None: ... + +class VirtualDirParameters: + Name: Incomplete + Description: Incomplete + AppProtection: Incomplete + Headers: Incomplete + Path: Incomplete + Type: Incomplete + AccessExecute: Incomplete + AccessRead: Incomplete + AccessWrite: Incomplete + AccessScript: Incomplete + ContentIndexed: Incomplete + EnableDirBrowsing: Incomplete + EnableDefaultDoc: Incomplete + DefaultDoc: Incomplete + ScriptMaps: list[ScriptMapParams] + ScriptMapUpdate: str + Server: Incomplete + def __init__(self, **kw) -> None: ... + def is_root(self): ... + def split_path(self): ... + +class ScriptMapParams: + Extension: Incomplete + Module: Incomplete + Flags: int + Verbs: str + AddExtensionFile: bool + AddExtensionFile_Enabled: bool + AddExtensionFile_GroupID: Incomplete + AddExtensionFile_CanDelete: bool + AddExtensionFile_Description: Incomplete + def __init__(self, **kw) -> None: ... + +class ISAPIParameters: + ServerName: Incomplete + Filters: list[FilterParameters] + VirtualDirs: list[VirtualDirParameters] + def __init__(self, **kw) -> None: ... + +verbose: int + +def log(level, what) -> None: ... + +class InstallationError(Exception): ... +class ItemNotFound(InstallationError): ... +class ConfigurationError(InstallationError): ... + +def FindPath(options, server, name): ... +def LocateWebServerPath(description): ... +def GetWebServer(description: Incomplete | None = None): ... +def LoadWebServer(path): ... +def FindWebServer(options, server_desc): ... +def split_path(path): ... +def CreateDirectory(params, options): ... +def AssignScriptMaps(script_maps, target, update: str = "replace") -> None: ... +def get_unique_items(sequence, reference): ... +def CreateISAPIFilter(filterParams, options): ... +def DeleteISAPIFilter(filterParams, options) -> None: ... +def AddExtensionFiles(params, options) -> None: ... +def DeleteExtensionFileRecords(params, options) -> None: ... +def CheckLoaderModule(dll_name) -> None: ... +def Install(params, options) -> None: ... +def RemoveDirectory(params, options) -> None: ... +def RemoveScriptMaps(vd_params, options) -> None: ... +def Uninstall(params, options) -> None: ... +def GetLoaderModuleName(mod_name, check_module: Incomplete | None = None): ... +def InstallModule(conf_module_name, params, options, log=...) -> None: ... +def UninstallModule(conf_module_name, params, options, log=...) -> None: ... + +standard_arguments: Incomplete + +def build_usage(handler_map): ... +def MergeStandardOptions(options, params) -> None: ... +def HandleCommandLine( + params, + argv: Incomplete | None = None, + conf_module_name: Incomplete | None = None, + default_arg: str = "install", + opt_parser: Incomplete | None = None, + custom_arg_handlers={}, +) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pywin32/win32/win32clipboard.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/win32/win32clipboard.pyi index bb25a5b3a5a1..355b97a533c0 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pywin32/win32/win32clipboard.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/win32/win32clipboard.pyi @@ -1,3 +1,5 @@ +from typing import Any, Final + from win32.lib.pywintypes import error as error def ChangeClipboardChain(hWndRemove: int, hWndNewNext: int, /): ... @@ -5,7 +7,7 @@ def CloseClipboard(): ... def CountClipboardFormats(): ... def EmptyClipboard(): ... def EnumClipboardFormats(_format: int = ..., /): ... -def GetClipboardData(_format, /) -> str: ... +def GetClipboardData(_format, /) -> Any: ... # str or bytes depending on the dib format def GetClipboardDataHandle(_format, /): ... def GetClipboardFormatName(_format, /) -> str: ... def GetClipboardOwner(): ... @@ -21,27 +23,27 @@ def SetClipboardData(_format, hMem, /): ... def SetClipboardText(text, _format, /): ... def SetClipboardViewer(hWndNewViewer: int, /) -> int: ... -CF_BITMAP: int -CF_DIB: int -CF_DIBV5: int -CF_DIF: int -CF_DSPBITMAP: int -CF_DSPENHMETAFILE: int -CF_DSPMETAFILEPICT: int -CF_DSPTEXT: int -CF_ENHMETAFILE: int -CF_HDROP: int -CF_LOCALE: int -CF_MAX: int -CF_METAFILEPICT: int -CF_OEMTEXT: int -CF_OWNERDISPLAY: int -CF_PALETTE: int -CF_PENDATA: int -CF_RIFF: int -CF_SYLK: int -CF_TEXT: int -CF_TIFF: int -CF_UNICODETEXT: int -CF_WAVE: int +CF_BITMAP: Final[int] +CF_DIB: Final[int] +CF_DIBV5: Final[int] +CF_DIF: Final[int] +CF_DSPBITMAP: Final[int] +CF_DSPENHMETAFILE: Final[int] +CF_DSPMETAFILEPICT: Final[int] +CF_DSPTEXT: Final[int] +CF_ENHMETAFILE: Final[int] +CF_HDROP: Final[int] +CF_LOCALE: Final[int] +CF_MAX: Final[int] +CF_METAFILEPICT: Final[int] +CF_OEMTEXT: Final[int] +CF_OWNERDISPLAY: Final[int] +CF_PALETTE: Final[int] +CF_PENDATA: Final[int] +CF_RIFF: Final[int] +CF_SYLK: Final[int] +CF_TEXT: Final[int] +CF_TIFF: Final[int] +CF_UNICODETEXT: Final[int] +CF_WAVE: Final[int] UNICODE: bool diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml index 4595928ea56d..8b7ea28be095 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "75.3.*" +version = "75.6.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ If using `setuptools >= 71.1` *only* for `pkg_resources`, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/distutils/spawn.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/distutils/spawn.pyi new file mode 100644 index 000000000000..4432100c0024 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/distutils/spawn.pyi @@ -0,0 +1 @@ +from setuptools._distutils.spawn import * diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi index 8bba3da5b5ad..815e1336ce50 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete, StrPath +from _typeshed import Incomplete from abc import abstractmethod -from collections.abc import Iterable, Mapping, Sequence +from collections.abc import Mapping, Sequence from typing import Any, Literal, TypedDict, TypeVar, overload, type_check_only from typing_extensions import NotRequired @@ -27,6 +27,7 @@ from .command.saveopts import saveopts from .command.sdist import sdist from .command.setopt import setopt from .depends import Require as Require +from .discovery import _Finder from .dist import Distribution as Distribution from .extension import Extension as Extension from .warnings import SetuptoolsDeprecationWarning as SetuptoolsDeprecationWarning @@ -54,11 +55,9 @@ class _BuildInfo(TypedDict): include_dirs: NotRequired[list[str]] cflags: NotRequired[list[str]] -# Pytype fails with the following: -# find_packages = PackageFinder.find -# find_namespace_packages = PEP420PackageFinder.find -def find_packages(where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... -def find_namespace_packages(where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... +find_packages = _Finder.find +find_namespace_packages = _Finder.find + def setup( *, name: str = ..., diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi index b0de290333e7..dafed2a0464f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi @@ -1,5 +1,5 @@ from _typeshed import BytesPath, StrPath, Unused -from collections.abc import Callable, Iterable, Sequence +from collections.abc import Callable, Iterable, MutableSequence, Sequence from typing import ClassVar, Literal, TypeVar, overload from typing_extensions import TypeAlias, TypeVarTuple, Unpack @@ -169,7 +169,7 @@ class CCompiler: def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... - def spawn(self, cmd: list[str]) -> None: ... + def spawn(self, cmd: MutableSequence[str]) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... @overload def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi index e43d941b0945..5fb3f42316bf 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -1,6 +1,6 @@ from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused from abc import abstractmethod -from collections.abc import Callable, Iterable +from collections.abc import Callable, MutableSequence from typing import Any, ClassVar, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack @@ -79,7 +79,7 @@ class Command: def move_file(self, src: StrPath, dst: _StrPathT, level: Unused = 1) -> _StrPathT | str: ... @overload def move_file(self, src: BytesPath, dst: _BytesPathT, level: Unused = 1) -> _BytesPathT | bytes: ... - def spawn(self, cmd: Iterable[str], search_path: bool = True, level: Unused = 1) -> None: ... + def spawn(self, cmd: MutableSequence[str], search_path: bool = True, level: Unused = 1) -> None: ... @overload def make_archive( self, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/spawn.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/spawn.pyi new file mode 100644 index 000000000000..5deb19d0d619 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/spawn.pyi @@ -0,0 +1,7 @@ +from collections.abc import MutableSequence +from subprocess import _ENV + +def spawn( + cmd: MutableSequence[str], search_path: bool = True, verbose: bool = False, dry_run: bool = False, env: _ENV | None = None +) -> None: ... +def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi index bfc403ef9e77..04de70231d33 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi @@ -1,5 +1,7 @@ from _typeshed import Incomplete, StrPath from collections.abc import Mapping +from contextlib import _GeneratorContextManager +from typing import NoReturn from typing_extensions import TypeAlias from . import dist @@ -24,9 +26,9 @@ class SetupRequirementsError(BaseException): def __init__(self, specifiers) -> None: ... class Distribution(dist.Distribution): - def fetch_build_eggs(self, specifiers) -> None: ... + def fetch_build_eggs(self, specifiers) -> NoReturn: ... @classmethod - def patch(cls) -> None: ... + def patch(cls) -> _GeneratorContextManager[None]: ... class _BuildMetaBackend: def run_setup(self, setup_script: str = "setup.py") -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi index 02e498367689..762976ad5949 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, StrPath -from collections.abc import Generator -from typing import ClassVar, Final, TypeVar +from _typeshed import GenericPath, Incomplete, StrPath +from collections.abc import Iterator +from types import CodeType +from typing import AnyStr, ClassVar, Final, Literal, TypeVar from zipfile import _ZipFileMode from .. import Command @@ -8,7 +9,7 @@ from .. import Command _StrPathT = TypeVar("_StrPathT", bound=StrPath) def strip_module(filename): ... -def sorted_walk(dir) -> Generator[Incomplete, None, None]: ... +def sorted_walk(dir: GenericPath[AnyStr]) -> Iterator[tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... def write_stub(resource, pyfile) -> None: ... class bdist_egg(Command): @@ -32,21 +33,21 @@ class bdist_egg(Command): def run(self) -> None: ... def zap_pyfiles(self) -> None: ... def zip_safe(self): ... - def gen_header(self): ... + def gen_header(self) -> Literal["w"]: ... def copy_metadata_to(self, target_dir) -> None: ... def get_ext_outputs(self): ... NATIVE_EXTENSIONS: Final[dict[str, None]] -def walk_egg(egg_dir) -> Generator[Incomplete, None, None]: ... +def walk_egg(egg_dir: StrPath) -> Iterator[tuple[str, list[str], list[str]]]: ... def analyze_egg(egg_dir, stubs): ... def write_safety_flag(egg_dir, safe) -> None: ... safety_flags: Incomplete def scan_module(egg_dir, base, name, stubs): ... -def iter_symbols(code) -> Generator[Incomplete, None, None]: ... -def can_scan(): ... +def iter_symbols(code: CodeType) -> Iterator[str]: ... +def can_scan() -> bool: ... INSTALL_DIRECTORY_ATTRS: Final[list[str]] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi index 70025a98b5a8..08a298dfbbc2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi @@ -1,5 +1,5 @@ -from _typeshed import ExcInfo, Incomplete, Unused -from collections.abc import Callable, Iterable +from _typeshed import Incomplete +from collections.abc import Iterable from typing import ClassVar, Final, Literal from setuptools import Command @@ -17,8 +17,6 @@ def get_flag(var: str, fallback: bool, expected: bool = True, warn: bool = True) def get_abi_tag() -> str | None: ... def safer_name(name: str) -> str: ... def safer_version(version: str) -> str: ... -def remove_readonly(func: Callable[[str], Unused], path: str, excinfo: ExcInfo) -> None: ... -def remove_readonly_exc(func: Callable[[str], Unused], path: str, exc: BaseException) -> None: ... class bdist_wheel(Command): description: ClassVar[str] @@ -27,7 +25,7 @@ class bdist_wheel(Command): boolean_options: ClassVar[list[str]] bdist_dir: str | None - data_dir: str | None + data_dir: str plat_name: str | None plat_tag: str | None format: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi index ad53ac20163a..6f4e74424a27 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi @@ -30,7 +30,8 @@ class build_ext(_build_ext): compiler: Incomplete def build_extension(self, ext) -> None: ... def links_to_dynamic(self, ext): ... - def get_outputs(self): ... + def get_source_files(self) -> list[str]: ... + def get_outputs(self) -> list[str]: ... def get_output_mapping(self) -> dict[str, str]: ... def write_stub(self, output_dir, ext, compile: bool = False) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi index 64eca7a74c70..7a2435bed01c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi @@ -24,21 +24,20 @@ class build_py(orig.build_py): level: Unused = 1, ) -> tuple[_StrPathT | str, bool]: ... def run(self) -> None: ... - data_files: list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]] + data_files: list[tuple[str, str, str, list[str]]] def __getattr__(self, attr: str): ... - def build_module(self, module, module_file, package): ... - def get_data_files_without_manifest(self) -> list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]]: ... - def find_data_files(self, package, src_dir): ... + def get_data_files_without_manifest(self) -> list[tuple[str, str, str, list[str]]]: ... + def find_data_files(self, package, src_dir) -> list[str]: ... def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override] # Using a real boolean instead of 0|1 def build_package_data(self) -> None: ... - manifest_files: dict[Incomplete, Incomplete] + manifest_files: dict[str, list[str]] def get_output_mapping(self) -> dict[str, str]: ... def analyze_manifest(self) -> None: ... def get_data_files(self) -> None: ... def check_package(self, package, package_dir): ... - packages_checked: dict[Incomplete, Incomplete] def initialize_options(self) -> None: ... - def get_package_dir(self, package): ... + packages_checked: dict[Incomplete, Incomplete] + def get_package_dir(self, package: str) -> str: ... def exclude_data_files(self, package, src_dir, files): ... def assert_relative(path): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi index 08129d8a55de..0255102d8d8b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi @@ -1,16 +1,14 @@ from _typeshed import Incomplete -from collections.abc import Callable, Iterable, Iterator -from typing import Any, ClassVar, Literal, TypedDict, TypeVar, type_check_only +from collections.abc import Iterable, Iterator +from typing import Any, ClassVar, Literal, NoReturn, TypedDict from typing_extensions import Self -from pkg_resources import Environment +from pkg_resources import Distribution, Environment from setuptools.package_index import PackageIndex from .. import Command, SetuptoolsDeprecationWarning -_T = TypeVar("_T") - -__all__ = ["easy_install", "PthDistributions", "extract_wininst_cfg", "get_exe_prefixes"] +__all__ = ["PthDistributions", "easy_install", "extract_wininst_cfg", "get_exe_prefixes"] class easy_install(Command): description: str @@ -54,7 +52,7 @@ class easy_install(Command): all_site_dirs: list[str] shadow_path: list[str] local_index: Environment - outputs: list[Incomplete] + outputs: list[str] def finalize_options(self) -> None: ... def expand_basedirs(self) -> None: ... def expand_dirs(self) -> None: ... @@ -62,28 +60,28 @@ class easy_install(Command): def pseudo_tempname(self): ... def warn_deprecated_options(self) -> None: ... def check_site_dir(self) -> None: ... - def cant_write_to_target(self) -> None: ... + def cant_write_to_target(self) -> NoReturn: ... def check_pth_processing(self): ... def install_egg_scripts(self, dist) -> None: ... def add_output(self, path) -> None: ... def not_editable(self, spec) -> None: ... def check_editable(self, spec) -> None: ... - def easy_install(self, spec, deps: bool = False): ... - def install_item(self, spec, download, tmpdir, deps, install_needed: bool = False): ... + def easy_install(self, spec, deps: bool = False) -> Distribution | None: ... + def install_item(self, spec, download, tmpdir, deps, install_needed: bool = False) -> Distribution | None: ... def select_scheme(self, name) -> None: ... def process_distribution(self, requirement, dist, deps: bool = True, *info) -> None: ... - def should_unzip(self, dist): ... + def should_unzip(self, dist) -> bool: ... def maybe_move(self, spec, dist_filename, setup_base): ... def install_wrapper_scripts(self, dist) -> None: ... def install_script(self, dist, script_name, script_text, dev_path: Incomplete | None = None) -> None: ... def write_script(self, script_name, contents, mode: str = "t", blockers=()) -> None: ... - def install_eggs(self, spec, dist_filename, tmpdir): ... + def install_eggs(self, spec, dist_filename, tmpdir) -> list[Distribution]: ... def egg_distribution(self, egg_path): ... def install_egg(self, egg_path, tmpdir): ... def install_exe(self, dist_filename, tmpdir): ... - def exe_to_egg(self, dist_filename, egg_tmp): ... + def exe_to_egg(self, dist_filename, egg_tmp) -> None: ... def install_wheel(self, wheel_path, tmpdir): ... - def installation_report(self, req, dist, what: str = "Installed"): ... + def installation_report(self, req, dist, what: str = "Installed") -> str: ... def report_editable(self, spec, setup_script): ... def run_setup(self, setup_script, setup_base, args) -> None: ... def build_and_install(self, setup_script, setup_base): ... @@ -114,9 +112,6 @@ class RewritePthDistributions(PthDistributions): prelude: str postlude: str -# Must match shutil._OnExcCallback -def auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T: ... -@type_check_only class _SplitArgs(TypedDict, total=False): comments: bool posix: bool diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi index bcbec3e17ad6..3080f4d690a1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/editable_wheel.pyi @@ -71,7 +71,7 @@ class _NamespaceInstaller(namespaces.Installer): src_root: Incomplete installation_dir: Incomplete editable_name: Incomplete - outputs: list[Incomplete] + outputs: list[str] dry_run: bool def __init__(self, distribution, installation_dir, editable_name, src_root) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi index 1e17156f5f85..db57845ec268 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi @@ -30,7 +30,7 @@ class egg_info(InfoCommon, Command): egg_version: Incomplete def initialize_options(self) -> None: ... @property - def tag_svn_revision(self) -> None: ... + def tag_svn_revision(self) -> int | None: ... @tag_svn_revision.setter def tag_svn_revision(self, value) -> None: ... def save_version_info(self, filename) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_egg_info.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_egg_info.pyi index d1a8dd4fef53..2c32f1a6bac2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_egg_info.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_egg_info.pyi @@ -10,7 +10,7 @@ class install_egg_info(namespaces.Installer, Command): def initialize_options(self) -> None: ... source: Incomplete target: str - outputs: list[Incomplete] + outputs: list[str] def finalize_options(self) -> None: ... def run(self) -> None: ... def get_outputs(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/sdist.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/sdist.pyi index 84589f740711..77c87df95d0b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/sdist.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/sdist.pyi @@ -1,11 +1,12 @@ from _typeshed import Incomplete +from collections.abc import Iterator from typing import ClassVar from setuptools.dist import Distribution from .._distutils.command import sdist as orig -def walk_revctrl(dirname: str = "") -> None: ... +def walk_revctrl(dirname: str = "") -> Iterator[Incomplete]: ... class sdist(orig.sdist): distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/test.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/test.pyi index d9d2eb900c4d..8d7e6744c7fa 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/test.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/test.pyi @@ -1,4 +1,4 @@ -from typing import ClassVar +from typing import ClassVar, NoReturn from typing_extensions import deprecated from .. import Command @@ -14,4 +14,4 @@ class test(Command): user_options: ClassVar[list[tuple[str, str, str]]] def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... - def run(self) -> None: ... + def run(self) -> NoReturn: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/__init__.pyi index dbb468cd5d8c..61e17fdccf16 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/__init__.pyi @@ -1,16 +1,3 @@ -from _typeshed import Incomplete, StrPath -from collections.abc import Callable -from typing import TypeVar +from .setupcfg import parse_configuration as parse_configuration, read_configuration as read_configuration -from setuptools.config.setupcfg import AllCommandOptions, ConfigMetadataHandler, ConfigOptionsHandler -from setuptools.dist import Distribution - -Fn = TypeVar("Fn", bound=Callable[..., Incomplete]) # noqa: Y001 # Exists at runtime __all__ = ("parse_configuration", "read_configuration") - -def read_configuration( - filepath: StrPath, find_others: bool = False, ignore_option_errors: bool = False -) -> dict[Incomplete, Incomplete]: ... -def parse_configuration( - distribution: Distribution, command_options: AllCommandOptions, ignore_option_errors: bool = False -) -> tuple[ConfigMetadataHandler, ConfigOptionsHandler]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi index c57ed4d46229..c85a43bfcfea 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi @@ -41,7 +41,7 @@ class EnsurePackagesDiscovered: self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... @property - def package_dir(self) -> Mapping[str, str]: ... + def package_dir(self) -> LazyMappingProxy[str, str]: ... class LazyMappingProxy(Mapping[_K, _V_co]): def __init__(self, obtain_mapping_value: Callable[[], Mapping[_K, _V_co]]) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/setupcfg.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/setupcfg.pyi index 7d0cabbd9665..7c78eefd9250 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/setupcfg.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/setupcfg.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete, StrPath -from collections.abc import Iterable +from abc import abstractmethod +from collections.abc import Callable, Iterable from typing import Any, ClassVar, Generic, TypeVar from typing_extensions import TypeAlias @@ -38,7 +39,8 @@ class ConfigHandler(Generic[Target]): ensure_discovered: expand.EnsurePackagesDiscovered, ) -> None: ... @property - def parsers(self) -> None: ... + @abstractmethod + def parsers(self) -> dict[str, Callable[..., Incomplete]]: ... def __setitem__(self, option_name, value): ... def parse_section(self, section_options) -> None: ... def parse(self) -> None: ... @@ -59,7 +61,7 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): root_dir: StrPath | None = ".", ) -> None: ... @property - def parsers(self): ... + def parsers(self) -> dict[str, Callable[..., Incomplete]]: ... class ConfigOptionsHandler(ConfigHandler[Distribution]): section_prefix: str @@ -73,10 +75,10 @@ class ConfigOptionsHandler(ConfigHandler[Distribution]): ensure_discovered: expand.EnsurePackagesDiscovered, ) -> None: ... @property - def parsers(self): ... + def parsers(self) -> dict[str, Callable[..., Incomplete]]: ... def parse_section_packages__find(self, section_options): ... def parse_section_entry_points(self, section_options) -> None: ... def parse_section_package_data(self, section_options) -> None: ... def parse_section_exclude_package_data(self, section_options) -> None: ... - def parse_section_extras_require(self, section_options): ... + def parse_section_extras_require(self, section_options) -> None: ... def parse_section_data_files(self, section_options) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/depends.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/depends.pyi index d47ac2d77af5..c0ddba05e919 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/depends.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/depends.pyi @@ -1,5 +1,7 @@ from _typeshed import Incomplete -from typing import IO, Any, Literal +from typing import IO, Any, Literal, TypeVar + +_T = TypeVar("_T") __all__ = ["Require", "find_module", "get_module_constant", "extract_constant"] @@ -19,9 +21,11 @@ class Require: ) -> None: ... def full_name(self): ... def version_ok(self, version): ... - def get_version(self, paths: Incomplete | None = None, default: str = "unknown"): ... + def get_version( + self, paths: Incomplete | None = None, default: _T | Literal["unknown"] = "unknown" + ) -> _T | Literal["unknown"] | None | Any: ... def is_present(self, paths: Incomplete | None = None): ... def is_current(self, paths: Incomplete | None = None): ... -def get_module_constant(module, symbol, default: str | int = -1, paths: Incomplete | None = None) -> Any: ... -def extract_constant(code, symbol, default: str | int = -1) -> Any: ... +def get_module_constant(module, symbol, default: _T | int = -1, paths: Incomplete | None = None) -> _T | int | None | Any: ... +def extract_constant(code, symbol, default: _T | int = -1) -> _T | int | None | Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/dist.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/dist.pyi index ea4bf2a92f81..928c55c7131a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/dist.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/dist.pyi @@ -187,7 +187,7 @@ class Distribution(_Distribution): def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ... def include(self, **attrs) -> None: ... def exclude_package(self, package: str) -> None: ... - def has_contents_for(self, package: str) -> bool | None: ... + def has_contents_for(self, package: str) -> bool: ... def exclude(self, **attrs) -> None: ... def get_cmdline_options(self) -> dict[str, dict[str, str | None]]: ... def iter_distribution_names(self) -> Iterator[str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/msvc.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/msvc.pyi index f07c4833d85f..af55d1c21720 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/msvc.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/msvc.pyi @@ -1,5 +1,5 @@ import sys -from typing import Final, TypedDict, overload, type_check_only +from typing import Final, TypedDict, overload from typing_extensions import LiteralString, NotRequired if sys.platform == "win32": @@ -59,7 +59,7 @@ class RegistryInfo: def microsoft(self, key: LiteralString, x86: bool = False) -> LiteralString: ... @overload def microsoft(self, key: str, x86: bool = False) -> str: ... # type: ignore[misc] - def lookup(self, key: str, name: str) -> str: ... + def lookup(self, key: str, name: str) -> str | None: ... class SystemInfo: WinDir: Final[str] @@ -80,11 +80,11 @@ class SystemInfo: @property def VCInstallDir(self) -> str: ... @property - def WindowsSdkVersion(self) -> tuple[str, ...] | None: ... + def WindowsSdkVersion(self) -> tuple[LiteralString, ...]: ... @property def WindowsSdkLastVersion(self) -> str: ... @property - def WindowsSdkDir(self) -> str: ... + def WindowsSdkDir(self) -> str | None: ... @property def WindowsSDKExecutablePath(self) -> str | None: ... @property @@ -94,7 +94,7 @@ class SystemInfo: @property def UniversalCRTSdkLastVersion(self) -> str: ... @property - def NetFxSdkVersion(self) -> tuple[str, ...]: ... + def NetFxSdkVersion(self) -> tuple[LiteralString, ...]: ... @property def NetFxSdkDir(self) -> str: ... @property @@ -102,11 +102,10 @@ class SystemInfo: @property def FrameworkDir64(self) -> str: ... @property - def FrameworkVersion32(self) -> tuple[str, ...] | None: ... + def FrameworkVersion32(self) -> tuple[str, ...]: ... @property - def FrameworkVersion64(self) -> tuple[str, ...] | None: ... + def FrameworkVersion64(self) -> tuple[str, ...]: ... -@type_check_only class _EnvironmentDict(TypedDict): include: str lib: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/package_index.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/package_index.pyi index 802486e2ae20..37871ddfe342 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/package_index.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/package_index.pyi @@ -1,20 +1,24 @@ import configparser import urllib.request from _typeshed import Incomplete +from collections.abc import Generator from hashlib import _Hash from re import Pattern from typing import ClassVar from typing_extensions import NamedTuple -from pkg_resources import Environment +from pkg_resources import Distribution, Environment __all__ = ["PackageIndex", "distros_for_url", "parse_bdist_wininst", "interpret_distro_name"] def parse_bdist_wininst(name): ... -def distros_for_url(url, metadata: Incomplete | None = None) -> None: ... +def distros_for_url(url, metadata: Incomplete | None = None) -> Generator[Distribution]: ... +def distros_for_location( + location, basename, metadata: Incomplete | None = None +) -> list[Distribution] | Generator[Distribution]: ... def interpret_distro_name( location, basename, metadata, py_version: Incomplete | None = None, precedence=1, platform: Incomplete | None = None -) -> None: ... +) -> Generator[Distribution]: ... class ContentChecker: def feed(self, block) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/sandbox.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/sandbox.pyi index a1c47b0eb7c0..ee5935c056ec 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/sandbox.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/sandbox.pyi @@ -1,6 +1,6 @@ import sys from types import TracebackType -from typing import ClassVar, Literal +from typing import ClassVar from typing_extensions import Self from ._distutils.errors import DistutilsError @@ -13,9 +13,7 @@ class UnpickleableException(Exception): class ExceptionSaver: def __enter__(self) -> Self: ... - def __exit__( - self, type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None - ) -> Literal[True] | None: ... + def __exit__(self, type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> bool: ... def resume(self) -> None: ... def run_setup(setup_script, args): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/METADATA.toml index b24cf310c561..fddf4c03eb49 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/METADATA.toml @@ -1,5 +1,6 @@ -version = "4.66.*" +version = "4.67.*" upstream_repository = "https://github.com/tqdm/tqdm" +requires = ["types-requests"] [tool.stubtest] extras = ["slack", "telegram"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi index b60753658568..20f141c3a469 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/contrib/discord.pyi @@ -1,17 +1,28 @@ from _typeshed import Incomplete, SupportsWrite from collections.abc import Iterable, Mapping +from concurrent.futures import Future from typing import NoReturn, TypeVar, overload +from requests import Session + from ..auto import tqdm as tqdm_auto from .utils_worker import MonoWorker __all__ = ["DiscordIO", "tqdm_discord", "tdrange", "tqdm", "trange"] class DiscordIO(MonoWorker): - text: Incomplete + API: str = "https://discord.com/api/v10" + UA: str = ... + channel_id: Incomplete message: Incomplete + session: Session + text: Incomplete + token: Incomplete def __init__(self, token, channel_id) -> None: ... def write(self, s): ... + def delete(self) -> Future[Incomplete]: ... + @property + def message_id(self): ... _T = TypeVar("_T") @@ -79,8 +90,8 @@ class tqdm_discord(tqdm_auto[_T]): gui: bool = ..., **kwargs, ) -> None: ... - def display( - self, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style=..., check_delay: bool = ... + def display( # type: ignore[override] + self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style=..., check_delay: bool = ... ) -> None: ... def clear(self, *args, **kwargs) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/waitress/waitress/runner.pyi b/packages/pyright-internal/typeshed-fallback/stubs/waitress/waitress/runner.pyi index bf023947d9a9..a018f52e8c5c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/waitress/waitress/runner.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/waitress/waitress/runner.pyi @@ -1,14 +1,10 @@ from _typeshed import Unused from collections.abc import Callable, Sequence from io import TextIOWrapper -from re import Pattern -from typing import Any, Final +from typing import Final HELP: Final[str] -RUNNER_PATTERN: Final[Pattern[str]] -def match(obj_name: str) -> tuple[str, str]: ... -def resolve(module_name: str, object_name: str) -> Any: ... # Any module attribute def show_help(stream: TextIOWrapper, name: str, error: str | None = None) -> None: ... def show_exception(stream: TextIOWrapper) -> None: ... def run(argv: Sequence[str] = ..., _serve: Callable[..., Unused] = ...) -> None: ...