From 1163a91aa437f6d4c643fc40c68f9da224835ef1 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 17 May 2026 00:04:26 +0100 Subject: [PATCH] Upgrade black to 26.5.0 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 + stdlib/_asyncio.pyi | 2 + stdlib/_bisect.pyi | 3 + stdlib/_codecs.pyi | 2 + stdlib/_contextvars.pyi | 5 + stdlib/_ctypes.pyi | 15 ++ stdlib/_curses.pyi | 36 +++++ stdlib/_dbm.pyi | 2 + stdlib/_frozen_importlib_external.pyi | 2 + stdlib/_gdbm.pyi | 2 + stdlib/_hashlib.pyi | 1 + stdlib/_interpreters.pyi | 1 + stdlib/_operator.pyi | 12 ++ stdlib/_pickle.pyi | 4 + stdlib/_socket.pyi | 6 + stdlib/_sqlite3.pyi | 2 +- stdlib/_ssl.pyi | 4 + stdlib/_struct.pyi | 1 + stdlib/_thread.pyi | 5 + stdlib/_tkinter.pyi | 2 + stdlib/_typeshed/__init__.pyi | 1 + stdlib/_typeshed/_type_checker_internals.pyi | 4 + stdlib/_warnings.pyi | 1 - stdlib/_weakrefset.pyi | 1 + stdlib/_winapi.pyi | 6 + stdlib/abc.pyi | 1 + stdlib/annotationlib.pyi | 6 + stdlib/argparse.pyi | 9 ++ stdlib/array.pyi | 5 + stdlib/ast.pyi | 6 +- stdlib/asyncio/base_events.pyi | 1 + stdlib/asyncio/coroutines.pyi | 2 - stdlib/asyncio/events.pyi | 1 + stdlib/asyncio/graph.pyi | 1 + stdlib/asyncio/tasks.pyi | 2 + stdlib/asyncio/trsock.pyi | 8 ++ stdlib/asyncore.pyi | 2 + stdlib/builtins.pyi | 136 +++++++++++++++++- stdlib/bz2.pyi | 2 + stdlib/calendar.pyi | 4 + stdlib/cgi.pyi | 1 + stdlib/codecs.pyi | 2 + stdlib/collections/__init__.pyi | 38 +++++ stdlib/compression/zstd/__init__.pyi | 1 + stdlib/compression/zstd/_zstdfile.pyi | 1 + stdlib/concurrent/futures/interpreter.pyi | 3 + stdlib/concurrent/futures/thread.pyi | 3 + stdlib/configparser.pyi | 14 ++ stdlib/contextlib.pyi | 3 + stdlib/csv.pyi | 2 + stdlib/ctypes/__init__.pyi | 1 + stdlib/dataclasses.pyi | 4 +- stdlib/datetime.pyi | 9 ++ stdlib/decimal.pyi | 2 + stdlib/difflib.pyi | 1 + stdlib/distutils/archive_util.pyi | 1 + stdlib/distutils/ccompiler.pyi | 6 + stdlib/distutils/cmd.pyi | 9 ++ stdlib/distutils/dist.pyi | 4 + stdlib/distutils/fancy_getopt.pyi | 2 + stdlib/distutils/file_util.pyi | 2 + stdlib/distutils/filelist.pyi | 3 + stdlib/distutils/sysconfig.pyi | 3 + stdlib/email/__init__.pyi | 3 + stdlib/email/charset.pyi | 2 + stdlib/email/feedparser.pyi | 2 + stdlib/email/generator.pyi | 2 + stdlib/email/message.pyi | 15 ++ stdlib/email/parser.pyi | 3 + stdlib/email/policy.pyi | 2 + stdlib/email/utils.pyi | 3 + stdlib/enum.pyi | 1 + stdlib/fcntl.pyi | 2 + stdlib/fileinput.pyi | 2 + stdlib/fractions.pyi | 20 ++- stdlib/ftplib.pyi | 1 + stdlib/functools.pyi | 8 +- stdlib/genericpath.pyi | 1 - stdlib/gettext.pyi | 3 +- stdlib/graphlib.pyi | 1 + stdlib/gzip.pyi | 2 + stdlib/http/client.pyi | 3 + stdlib/http/cookiejar.pyi | 2 + stdlib/http/cookies.pyi | 1 + stdlib/imaplib.pyi | 1 + stdlib/importlib/abc.pyi | 2 + stdlib/importlib/metadata/__init__.pyi | 7 + stdlib/importlib/metadata/_meta.pyi | 2 + stdlib/importlib/resources/_common.pyi | 1 + stdlib/importlib/resources/_functional.pyi | 4 + stdlib/importlib/resources/abc.pyi | 2 + stdlib/importlib/resources/simple.pyi | 2 + stdlib/inspect.pyi | 5 + stdlib/ipaddress.pyi | 2 + stdlib/itertools.pyi | 11 ++ stdlib/lib2to3/pgen2/pgen.pyi | 1 + stdlib/lib2to3/refactor.pyi | 3 + stdlib/logging/__init__.pyi | 5 + stdlib/logging/config.pyi | 1 + stdlib/lzma.pyi | 1 + stdlib/mailbox.pyi | 6 + stdlib/math/__init__.pyi | 4 + stdlib/mmap.pyi | 3 + stdlib/multiprocessing/context.pyi | 9 ++ stdlib/multiprocessing/managers.pyi | 17 +++ stdlib/multiprocessing/shared_memory.pyi | 2 + stdlib/multiprocessing/sharedctypes.pyi | 11 ++ stdlib/multiprocessing/util.pyi | 1 + stdlib/numbers.pyi | 3 + stdlib/operator.pyi | 2 + stdlib/optparse.pyi | 4 + stdlib/os/__init__.pyi | 15 +- stdlib/pathlib/__init__.pyi | 4 + stdlib/poplib.pyi | 3 + stdlib/posixpath.pyi | 12 +- stdlib/pstats.pyi | 2 + stdlib/random.pyi | 1 + stdlib/re.pyi | 24 ++++ stdlib/select.pyi | 1 + stdlib/shelve.pyi | 2 + stdlib/shutil.pyi | 9 +- stdlib/smtplib.pyi | 4 + stdlib/socket.pyi | 2 + stdlib/sqlite3/__init__.pyi | 4 + stdlib/sre_parse.pyi | 1 - stdlib/ssl.pyi | 10 ++ stdlib/string/__init__.pyi | 2 + stdlib/subprocess.pyi | 2 - stdlib/sysconfig.pyi | 4 +- stdlib/syslog.pyi | 1 + stdlib/tarfile.pyi | 9 ++ stdlib/tempfile.pyi | 9 +- stdlib/tkinter/__init__.pyi | 110 +++++++++++++- stdlib/tkinter/font.pyi | 6 + stdlib/tkinter/ttk.pyi | 63 ++++++++ stdlib/tomllib.pyi | 1 + stdlib/traceback.pyi | 6 +- stdlib/tracemalloc.pyi | 2 + stdlib/turtle.pyi | 65 +++++++++ stdlib/types.pyi | 12 ++ stdlib/typing.pyi | 31 ++++ stdlib/typing_extensions.pyi | 10 ++ stdlib/unicodedata.pyi | 14 ++ stdlib/unittest/case.pyi | 12 ++ stdlib/unittest/mock.pyi | 6 + stdlib/unittest/signals.pyi | 1 + stdlib/urllib/error.pyi | 1 + stdlib/urllib/parse.pyi | 12 +- stdlib/urllib/request.pyi | 3 + stdlib/weakref.pyi | 15 ++ stdlib/winreg.pyi | 2 + stdlib/winsound.pyi | 2 + stdlib/wsgiref/headers.pyi | 2 + stdlib/xml/dom/minidom.pyi | 15 ++ stdlib/xml/etree/ElementInclude.pyi | 1 + stdlib/xml/etree/ElementPath.pyi | 2 + stdlib/xml/etree/ElementTree.pyi | 16 +++ stdlib/xml/sax/expatreader.pyi | 3 + stdlib/xml/sax/xmlreader.pyi | 4 + stdlib/xmlrpc/client.pyi | 2 + stdlib/zipfile/__init__.pyi | 4 + stdlib/zipfile/_path/__init__.pyi | 4 + stdlib/zoneinfo/__init__.pyi | 1 + stubs/Authlib/authlib/common/encoding.pyi | 2 + stubs/Authlib/authlib/common/urls.pyi | 2 + .../integrations/flask_client/apps.pyi | 1 + stubs/Authlib/authlib/jose/rfc7519/jwt.pyi | 2 + stubs/Authlib/authlib/oauth1/client.pyi | 3 + stubs/Authlib/authlib/oauth2/client.pyi | 2 + .../oauth2/rfc6749/authorization_server.pyi | 2 + .../authlib/oauth2/rfc6749/requests.pyi | 2 + .../Authlib/authlib/oauth2/rfc7521/client.pyi | 2 + stubs/Flask-Cors/flask_cors/core.pyi | 4 + .../flask_socketio/__init__.pyi | 2 + stubs/JACK-Client/jack/__init__.pyi | 8 ++ stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi | 1 + stubs/Markdown/markdown/util.pyi | 4 + stubs/PyMeeus/pymeeus/Angle.pyi | 5 + stubs/PyMeeus/pymeeus/Coordinates.pyi | 4 + stubs/PyMeeus/pymeeus/CurveFitting.pyi | 2 + stubs/PyMeeus/pymeeus/Epoch.pyi | 10 ++ stubs/PyMeeus/pymeeus/Interpolation.pyi | 2 + stubs/PyMeeus/pymeeus/JupiterMoons.pyi | 5 + stubs/PyMySQL/pymysql/connections.pyi | 3 + stubs/PyScreeze/pyscreeze/__init__.pyi | 2 + stubs/PySocks/socks.pyi | 2 + stubs/PyYAML/yaml/__init__.pyi | 11 ++ stubs/PyYAML/yaml/_yaml.pyi | 1 + stubs/Pygments/pygments/__init__.pyi | 2 + stubs/Pygments/pygments/formatter.pyi | 2 + stubs/WTForms/wtforms/fields/numeric.pyi | 1 + stubs/WTForms/wtforms/i18n.pyi | 1 + stubs/WTForms/wtforms/meta.pyi | 2 + stubs/WTForms/wtforms/validators.pyi | 4 + stubs/WebOb/webob/_types.pyi | 1 + stubs/WebOb/webob/acceptparse.pyi | 38 +++++ stubs/WebOb/webob/byterange.pyi | 4 + stubs/WebOb/webob/cachecontrol.pyi | 8 ++ stubs/WebOb/webob/cookies.pyi | 6 + stubs/WebOb/webob/dec.pyi | 7 + stubs/WebOb/webob/descriptors.pyi | 4 + stubs/WebOb/webob/headers.pyi | 1 + stubs/WebOb/webob/multidict.pyi | 18 +++ stubs/WebOb/webob/request.pyi | 12 ++ stubs/WebOb/webob/response.pyi | 2 + stubs/aiofiles/aiofiles/os.pyi | 4 + stubs/aiofiles/aiofiles/tempfile/__init__.pyi | 2 +- stubs/antlr4-python3-runtime/antlr4/Lexer.pyi | 8 ++ .../antlr4/Recognizer.pyi | 1 + stubs/antlr4-python3-runtime/antlr4/Token.pyi | 3 + stubs/assertpy/assertpy/collection.pyi | 1 + stubs/atheris/atheris/utils.pyi | 2 + .../aws_xray_sdk/core/context.pyi | 1 + .../aws_xray_sdk/core/lambda_launcher.pyi | 1 + .../aws_xray_sdk/core/models/entity.pyi | 2 + .../aws_xray_sdk/core/plugins/ec2_plugin.pyi | 1 + .../aws_xray_sdk/core/recorder.pyi | 11 ++ .../aws_xray_sdk/core/sampling/connector.pyi | 1 + .../aws_xray_sdk/core/sampling/rule_cache.pyi | 2 + .../aws_xray_sdk/core/sampling/sampler.pyi | 1 + .../core/sampling/sampling_rule.pyi | 4 + .../core/streaming/default_streaming.pyi | 1 + stubs/aws-xray-sdk/aws_xray_sdk/ext/util.pyi | 2 + stubs/boltons/boltons/cacheutils.pyi | 7 + stubs/boltons/boltons/dictutils.pyi | 4 + stubs/boltons/boltons/fileutils.pyi | 1 + stubs/boltons/boltons/mathutils.pyi | 2 + stubs/boltons/boltons/setutils.pyi | 2 + stubs/boltons/boltons/statsutils.pyi | 3 + stubs/boltons/boltons/strutils.pyi | 2 + stubs/boltons/boltons/urlutils.pyi | 2 + .../bank_account_instant_verification_jwt.pyi | 1 + .../customer_recommendations_payload.pyi | 1 + stubs/braintree/braintree/util/crypto.pyi | 1 + stubs/cachetools/cachetools/__init__.pyi | 5 + stubs/cachetools/cachetools/func.pyi | 4 + stubs/cffi/_cffi_backend.pyi | 13 ++ stubs/cffi/cffi/api.pyi | 6 + stubs/channels/channels/consumer.pyi | 1 + stubs/channels/channels/layers.pyi | 5 + stubs/channels/channels/testing/websocket.pyi | 1 + .../click_default_group.pyi | 1 + stubs/colorful/colorful/core.pyi | 2 + .../consolemenu/format/menu_margins.pyi | 4 + .../consolemenu/format/menu_padding.pyi | 4 + .../consolemenu/format/menu_style.pyi | 4 + .../consolemenu/menu_component.pyi | 4 + stubs/convertdate/convertdate/mayan.pyi | 2 + stubs/convertdate/convertdate/utils.pyi | 10 ++ stubs/croniter/croniter/croniter.pyi | 12 ++ stubs/dateparser/dateparser/date.pyi | 2 + .../dateparser/languages/dictionary.pyi | 1 + .../import_export/resources.pyi | 2 + .../import_export/widgets.pyi | 1 + stubs/docker/docker/api/container.pyi | 3 + stubs/docker/docker/api/daemon.pyi | 2 + stubs/docker/docker/api/exec_api.pyi | 1 + stubs/docker/docker/client.pyi | 2 + stubs/docker/docker/models/containers.pyi | 6 + stubs/docker/docker/models/images.pyi | 2 + stubs/docker/docker/types/containers.pyi | 10 ++ stubs/docker/docker/types/healthcheck.pyi | 5 + stubs/docker/docker/utils/socket.pyi | 2 + stubs/docker/docker/utils/utils.pyi | 6 + stubs/docutils/docutils/examples.pyi | 2 + stubs/docutils/docutils/frontend.pyi | 3 + stubs/docutils/docutils/nodes.pyi | 13 ++ .../docutils/parsers/recommonmark_wrapper.pyi | 1 + stubs/docutils/docutils/statemachine.pyi | 3 + .../docutils/transforms/references.pyi | 1 + .../docutils/utils/math/mathml_elements.pyi | 2 + .../docutils/writers/latex2e/__init__.pyi | 2 + stubs/ephem/ephem/__init__.pyi | 2 + stubs/ephem/ephem/_libastro.pyi | 14 ++ .../et_xmlfile/incremental_tree.pyi | 3 + stubs/flake8-bugbear/bugbear.pyi | 2 + stubs/fpdf2/fpdf/drawing.pyi | 27 ++++ stubs/fpdf2/fpdf/encryption.pyi | 2 + stubs/fpdf2/fpdf/fpdf.pyi | 3 + stubs/fpdf2/fpdf/graphics_state.pyi | 27 ++++ stubs/fpdf2/fpdf/line_break.pyi | 2 + stubs/fpdf2/fpdf/prefs.pyi | 12 ++ stubs/fpdf2/fpdf/svg.pyi | 5 + stubs/fpdf2/fpdf/syntax.pyi | 1 + stubs/fpdf2/fpdf/table.pyi | 1 + stubs/gdb/gdb/__init__.pyi | 9 ++ stubs/gdb/gdb/dap/server.pyi | 1 + stubs/gdb/gdb/types.pyi | 1 + stubs/gdb/gdb/xmethod.pyi | 1 + stubs/geopandas/geopandas/array.pyi | 8 ++ stubs/geopandas/geopandas/base.pyi | 5 + stubs/geopandas/geopandas/geodataframe.pyi | 12 ++ stubs/geopandas/geopandas/geoseries.pyi | 5 + stubs/geopandas/geopandas/io/file.pyi | 1 + stubs/geopandas/geopandas/plotting.pyi | 1 + stubs/geopandas/geopandas/sindex.pyi | 3 + stubs/gevent/gevent/_config.pyi | 1 + stubs/gevent/gevent/_ffi/watcher.pyi | 5 + stubs/gevent/gevent/_fileobjectcommon.pyi | 1 + stubs/gevent/gevent/_greenlet_primitives.pyi | 1 + stubs/gevent/gevent/_hub_primitives.pyi | 2 + stubs/gevent/gevent/_types.pyi | 2 + stubs/gevent/gevent/_util.pyi | 3 + stubs/gevent/gevent/_waiter.pyi | 2 + stubs/gevent/gevent/backdoor.pyi | 2 + stubs/gevent/gevent/event.pyi | 3 + stubs/gevent/gevent/fileobject.pyi | 1 + stubs/gevent/gevent/greenlet.pyi | 5 + stubs/gevent/gevent/hub.pyi | 5 + stubs/gevent/gevent/libev/corecext.pyi | 1 + stubs/gevent/gevent/libev/watcher.pyi | 6 + stubs/gevent/gevent/libuv/watcher.pyi | 2 + stubs/gevent/gevent/pool.pyi | 4 + stubs/gevent/gevent/pywsgi.pyi | 4 + stubs/gevent/gevent/queue.pyi | 5 + stubs/gevent/gevent/server.pyi | 3 + stubs/gevent/gevent/threadpool.pyi | 3 + stubs/gevent/gevent/timeout.pyi | 2 + .../google/cloud/ndb/context.pyi | 2 + stubs/greenlet/greenlet/_greenlet.pyi | 6 + .../grpc_health/v1/health.pyi | 2 + stubs/grpcio/grpc/aio/__init__.pyi | 2 + stubs/gunicorn/gunicorn/config.pyi | 10 ++ stubs/gunicorn/gunicorn/glogging.pyi | 1 + stubs/hdbcli/hdbcli/dbapi.pyi | 2 + stubs/hdbcli/hdbcli/resultrow.pyi | 2 + stubs/hnswlib/hnswlib.pyi | 3 + stubs/html5lib/html5lib/_inputstream.pyi | 6 + stubs/html5lib/html5lib/_tokenizer.pyi | 2 + stubs/html5lib/html5lib/_utils.pyi | 2 + stubs/html5lib/html5lib/html5parser.pyi | 1 + stubs/html5lib/html5lib/serializer.pyi | 4 + stubs/hvac/hvac/api/secrets_engines/kv.pyi | 2 + stubs/hvac/hvac/api/vault_api_category.pyi | 2 + stubs/hvac/hvac/v1/__init__.pyi | 8 ++ stubs/ibm-db/ibm_db.pyi | 2 + stubs/icalendar/icalendar/cal.pyi | 64 +++++++++ stubs/icalendar/icalendar/caselessdict.pyi | 4 + stubs/icalendar/icalendar/parser.pyi | 1 + stubs/icalendar/icalendar/parser_tools.pyi | 1 + stubs/icalendar/icalendar/prop.pyi | 6 + stubs/inifile/inifile.pyi | 7 + stubs/jsonschema/jsonschema/_utils.pyi | 2 + stubs/jsonschema/jsonschema/validators.pyi | 3 + stubs/jwcrypto/jwcrypto/jwe.pyi | 2 + stubs/jwcrypto/jwcrypto/jwk.pyi | 13 ++ stubs/jwcrypto/jwcrypto/jws.pyi | 2 + stubs/jwcrypto/jwcrypto/jwt.pyi | 7 + stubs/ldap3/ldap3/abstract/cursor.pyi | 3 + stubs/ldap3/ldap3/core/connection.pyi | 2 + stubs/ldap3/ldap3/utils/asn1.pyi | 2 + stubs/lunardate/lunardate.pyi | 2 + stubs/m3u8/m3u8/mixins.pyi | 3 + stubs/m3u8/m3u8/model.pyi | 8 ++ stubs/m3u8/m3u8/parser.pyi | 1 + stubs/mock/mock/mock.pyi | 3 + stubs/mypy-extensions/mypy_extensions.pyi | 9 ++ stubs/netaddr/netaddr/eui/__init__.pyi | 5 + stubs/netaddr/netaddr/ip/__init__.pyi | 8 ++ stubs/netaddr/netaddr/ip/glob.pyi | 1 + .../networkx/networkx/algorithms/boundary.pyi | 1 + .../networkx/networkx/algorithms/bridges.pyi | 1 + stubs/networkx/networkx/algorithms/clique.pyi | 2 + .../networkx/algorithms/flow/utils.pyi | 1 + .../algorithms/shortest_paths/generic.pyi | 3 + stubs/networkx/networkx/classes/function.pyi | 7 + stubs/networkx/networkx/classes/graph.pyi | 6 + .../networkx/networkx/classes/graphviews.pyi | 2 + .../networkx/networkx/classes/multigraph.pyi | 4 + .../networkx/networkx/classes/reportviews.pyi | 16 +++ stubs/networkx/networkx/convert_matrix.pyi | 5 + stubs/networkx/networkx/drawing/nx_pylab.pyi | 2 + stubs/networkx/networkx/relabel.pyi | 1 + stubs/networkx/networkx/utils/backends.pyi | 4 + stubs/oauthlib/oauthlib/common.pyi | 5 + .../oauth2/rfc6749/endpoints/base.pyi | 3 + .../oauthlib/oauth2/rfc6749/utils.pyi | 2 + stubs/openpyxl/openpyxl/cell/cell.pyi | 7 + stubs/openpyxl/openpyxl/cell/read_only.pyi | 1 + stubs/openpyxl/openpyxl/cell/rich_text.pyi | 1 + stubs/openpyxl/openpyxl/chart/axis.pyi | 1 + stubs/openpyxl/openpyxl/chart/chartspace.pyi | 3 + stubs/openpyxl/openpyxl/chart/data_source.pyi | 1 + stubs/openpyxl/openpyxl/chart/pivot.pyi | 1 + stubs/openpyxl/openpyxl/chart/reference.pyi | 2 + stubs/openpyxl/openpyxl/chartsheet/custom.pyi | 1 + .../openpyxl/openpyxl/chartsheet/publish.pyi | 1 + .../openpyxl/comments/comment_sheet.pyi | 1 + stubs/openpyxl/openpyxl/comments/comments.pyi | 1 + stubs/openpyxl/openpyxl/compat/singleton.pyi | 2 + stubs/openpyxl/openpyxl/descriptors/base.pyi | 17 +++ .../openpyxl/openpyxl/descriptors/nested.pyi | 13 ++ stubs/openpyxl/openpyxl/drawing/colors.pyi | 1 + stubs/openpyxl/openpyxl/drawing/connector.pyi | 1 + stubs/openpyxl/openpyxl/drawing/drawing.pyi | 3 + stubs/openpyxl/openpyxl/drawing/effect.pyi | 2 + stubs/openpyxl/openpyxl/drawing/geometry.pyi | 1 + .../openpyxl/openpyxl/drawing/properties.pyi | 1 + stubs/openpyxl/openpyxl/formatting/rule.pyi | 1 + stubs/openpyxl/openpyxl/packaging/core.pyi | 1 + .../openpyxl/packaging/relationship.pyi | 1 + stubs/openpyxl/openpyxl/pivot/cache.pyi | 7 + stubs/openpyxl/openpyxl/pivot/fields.pyi | 3 + stubs/openpyxl/openpyxl/pivot/table.pyi | 8 ++ stubs/openpyxl/openpyxl/styles/colors.pyi | 7 + stubs/openpyxl/openpyxl/styles/numbers.pyi | 3 + stubs/openpyxl/openpyxl/workbook/child.pyi | 8 ++ .../openpyxl/openpyxl/workbook/protection.pyi | 5 + stubs/openpyxl/openpyxl/workbook/views.pyi | 1 + stubs/openpyxl/openpyxl/workbook/web.pyi | 1 + stubs/openpyxl/openpyxl/workbook/workbook.pyi | 4 + .../openpyxl/worksheet/_write_only.pyi | 5 + .../openpyxl/worksheet/cell_range.pyi | 1 + .../openpyxl/openpyxl/worksheet/controls.pyi | 1 + stubs/openpyxl/openpyxl/worksheet/filters.pyi | 2 + stubs/openpyxl/openpyxl/worksheet/ole.pyi | 2 + stubs/openpyxl/openpyxl/worksheet/page.pyi | 3 + .../openpyxl/worksheet/print_settings.pyi | 4 + .../openpyxl/worksheet/protection.pyi | 3 + .../openpyxl/openpyxl/worksheet/scenario.pyi | 2 + .../openpyxl/openpyxl/worksheet/smart_tag.pyi | 1 + stubs/openpyxl/openpyxl/worksheet/table.pyi | 3 + .../openpyxl/openpyxl/worksheet/worksheet.pyi | 14 ++ stubs/paramiko/paramiko/_winapi.pyi | 1 + stubs/paramiko/paramiko/transport.pyi | 5 + stubs/peewee/peewee.pyi | 15 ++ stubs/pexpect/pexpect/pty_spawn.pyi | 2 + stubs/pexpect/pexpect/spawnbase.pyi | 6 + stubs/pika/pika/connection.pyi | 16 +++ stubs/pika/pika/validators.pyi | 2 + stubs/polib/polib.pyi | 2 + stubs/pony/pony/orm/dbproviders/sqlite.pyi | 1 + stubs/pony/pony/utils/utils.pyi | 3 + .../google/protobuf/internal/containers.pyi | 10 ++ stubs/psutil/psutil/__init__.pyi | 9 ++ stubs/psutil/psutil/_common.pyi | 5 + stubs/psutil/psutil/_psaix.pyi | 1 + stubs/psutil/psutil/_psbsd.pyi | 1 + stubs/psutil/psutil/_pslinux.pyi | 3 + stubs/psutil/psutil/_pssunos.pyi | 1 + stubs/psutil/psutil/_psutil_bsd.pyi | 4 + stubs/psutil/psutil/_pswindows.pyi | 5 + stubs/psycopg2/psycopg2/_psycopg.pyi | 8 ++ stubs/psycopg2/psycopg2/_range.pyi | 1 + stubs/punq/punq/__init__.pyi | 2 + stubs/pycocotools/pycocotools/coco.pyi | 2 + stubs/pycocotools/pycocotools/mask.pyi | 1 + stubs/pyflakes/pyflakes/checker.pyi | 5 + stubs/pyinstaller/PyInstaller/compat.pyi | 2 + stubs/pyjks/jks/jks.pyi | 4 + stubs/pyluach/pyluach/dates.pyi | 2 + stubs/pyluach/pyluach/hebrewcal.pyi | 6 + stubs/pynput/pynput/mouse/_base.pyi | 2 + stubs/pyserial/serial/serialutil.pyi | 17 +++ .../serial/urlhandler/protocol_spy.pyi | 1 + stubs/pysftp/pysftp/__init__.pyi | 2 + stubs/pysftp/pysftp/helpers.pyi | 3 + .../pytest_lazyfixture.pyi | 1 + stubs/python-crontab/crontab.pyi | 8 ++ .../dateutil/parser/_parser.pyi | 1 + .../dateutil/relativedelta.pyi | 6 + .../dateutil/zoneinfo/__init__.pyi | 1 + .../python_http_client/exceptions.pyi | 2 + stubs/python-jenkins/jenkins/__init__.pyi | 3 + stubs/python-xlib/Xlib/display.pyi | 2 + stubs/python-xlib/Xlib/protocol/display.pyi | 5 + stubs/python-xlib/Xlib/protocol/rq.pyi | 7 + stubs/python-xlib/Xlib/rdb.pyi | 2 + stubs/pytz/pytz/tzinfo.pyi | 2 + stubs/pywin32/_win32typing.pyi | 30 ++++ stubs/pywin32/pythoncom.pyi | 2 + stubs/pywin32/win32/lib/pywintypes.pyi | 1 + stubs/pywin32/win32/lib/win32gui_struct.pyi | 11 ++ stubs/pywin32/win32/lib/win32timezone.pyi | 8 ++ stubs/pywin32/win32/win32api.pyi | 2 + stubs/pywin32/win32/win32console.pyi | 2 + stubs/pywin32/win32/win32file.pyi | 10 ++ stubs/pywin32/win32/win32security.pyi | 7 + stubs/pywin32/win32com/client/__init__.pyi | 1 + stubs/pywin32/win32com/client/dynamic.pyi | 1 + stubs/pyxdg/xdg/IniFile.pyi | 2 + stubs/pyxdg/xdg/Menu.pyi | 1 + stubs/pyxdg/xdg/MenuEditor.pyi | 7 + stubs/qrbill/qrbill/bill.pyi | 3 + stubs/qrcode/qrcode/image/svg.pyi | 3 + stubs/qrcode/qrcode/main.pyi | 7 + stubs/qrcode/qrcode/util.pyi | 2 + stubs/regex/regex/_main.pyi | 41 ++++++ .../reportlab/graphics/barcode/common.pyi | 3 + .../reportlab/graphics/barcode/dmtx.pyi | 9 ++ .../reportlab/graphics/barcode/usps4s.pyi | 16 +++ .../reportlab/graphics/charts/lineplots.pyi | 2 + .../reportlab/graphics/charts/textlabels.pyi | 2 + stubs/reportlab/reportlab/lib/boxstuff.pyi | 1 + stubs/reportlab/reportlab/lib/colors.pyi | 5 + stubs/reportlab/reportlab/lib/sequencer.pyi | 1 + stubs/reportlab/reportlab/lib/styles.pyi | 2 + stubs/reportlab/reportlab/lib/utils.pyi | 2 + stubs/reportlab/reportlab/pdfbase/ttfonts.pyi | 2 + stubs/reportlab/reportlab/platypus/para.pyi | 2 + stubs/reportlab/reportlab/platypus/tables.pyi | 2 + .../requests_oauthlib/oauth1_session.pyi | 2 + .../requests_oauthlib/oauth2_session.pyi | 7 + stubs/requests/requests/structures.pyi | 1 + stubs/seaborn/seaborn/_core/data.pyi | 1 + stubs/seaborn/seaborn/external/docscrape.pyi | 4 + stubs/seaborn/seaborn/matrix.pyi | 1 + stubs/seaborn/seaborn/palettes.pyi | 10 ++ stubs/seaborn/seaborn/regression.pyi | 2 + stubs/seaborn/seaborn/utils.pyi | 2 + stubs/seaborn/seaborn/widgets.pyi | 4 + stubs/setuptools/setuptools/__init__.pyi | 3 + .../setuptools/_distutils/archive_util.pyi | 1 + .../setuptools/setuptools/_distutils/cmd.pyi | 8 ++ .../_distutils/compilers/C/base.pyi | 10 ++ .../setuptools/setuptools/_distutils/dist.pyi | 4 + .../setuptools/_distutils/filelist.pyi | 2 + .../setuptools/_distutils/spawn.pyi | 1 + .../setuptools/_distutils/sysconfig.pyi | 2 + .../setuptools/command/egg_info.pyi | 2 + stubs/setuptools/setuptools/dist.pyi | 4 + stubs/setuptools/setuptools/monkey.pyi | 1 + stubs/setuptools/setuptools/msvc.pyi | 2 + stubs/shapely/shapely/_coverage.pyi | 1 + stubs/shapely/shapely/_geometry.pyi | 21 +++ stubs/shapely/shapely/affinity.pyi | 2 + stubs/shapely/shapely/constructive.pyi | 26 ++++ stubs/shapely/shapely/coordinates.pyi | 3 + stubs/shapely/shapely/coords.pyi | 2 + stubs/shapely/shapely/creation.pyi | 9 ++ stubs/shapely/shapely/geometry/base.pyi | 35 +++++ stubs/shapely/shapely/geometry/collection.pyi | 2 + stubs/shapely/shapely/geometry/point.pyi | 2 + stubs/shapely/shapely/geometry/polygon.pyi | 1 + stubs/shapely/shapely/io.pyi | 5 + stubs/shapely/shapely/lib.pyi | 2 + stubs/shapely/shapely/linear.pyi | 4 + stubs/shapely/shapely/measurement.pyi | 7 + stubs/shapely/shapely/ops.pyi | 4 + stubs/shapely/shapely/plotting.pyi | 3 + stubs/shapely/shapely/predicates.pyi | 30 ++++ stubs/shapely/shapely/set_operations.pyi | 9 ++ stubs/shapely/shapely/strtree.pyi | 3 + stubs/shapely/shapely/vectorized/__init__.pyi | 1 + stubs/shapely/shapely/wkb.pyi | 2 + stubs/simplejson/simplejson/__init__.pyi | 4 + stubs/singledispatch/singledispatch.pyi | 4 + stubs/six/six/__init__.pyi | 2 + stubs/str2bool/str2bool/__init__.pyi | 1 + stubs/tensorflow/tensorflow/__init__.pyi | 11 ++ stubs/tensorflow/tensorflow/autodiff.pyi | 2 + .../tensorflow/autograph/experimental.pyi | 1 + stubs/tensorflow/tensorflow/bitwise.pyi | 5 + .../compiler/xla/service/metrics_pb2.pyi | 1 + .../core/framework/dataset_options_pb2.pyi | 4 + .../optimized_function_graph_pb2.pyi | 1 + stubs/tensorflow/tensorflow/data/__init__.pyi | 4 + .../tensorflow/keras/constraints.pyi | 1 + .../tensorflow/keras/initializers.pyi | 1 + .../tensorflow/keras/layers/__init__.pyi | 4 + .../tensorflow/keras/regularizers.pyi | 1 + stubs/tensorflow/tensorflow/linalg.pyi | 1 + stubs/tensorflow/tensorflow/math.pyi | 44 ++++++ stubs/tensorflow/tensorflow/nn.pyi | 2 + stubs/tensorflow/tensorflow/strings.pyi | 22 +++ .../tensorflow/tsl/protobuf/dnn_pb2.pyi | 1 + .../tensorflow/types/experimental.pyi | 1 + stubs/toml/toml/decoder.pyi | 3 + stubs/toml/toml/encoder.pyi | 4 + stubs/tqdm/tqdm/asyncio.pyi | 1 + stubs/tqdm/tqdm/contrib/concurrent.pyi | 1 + stubs/tqdm/tqdm/contrib/discord.pyi | 2 + stubs/tqdm/tqdm/contrib/slack.pyi | 2 + stubs/tqdm/tqdm/contrib/telegram.pyi | 2 + stubs/tqdm/tqdm/gui.pyi | 1 + stubs/tqdm/tqdm/notebook.pyi | 4 + stubs/tqdm/tqdm/rich.pyi | 1 + stubs/tqdm/tqdm/std.pyi | 3 + stubs/tqdm/tqdm/tk.pyi | 1 + stubs/uWSGI/uwsgi.pyi | 9 ++ stubs/uWSGI/uwsgidecorators.pyi | 8 ++ stubs/unidiff/unidiff/patch.pyi | 3 + stubs/vobject/vobject/base.pyi | 3 + stubs/vobject/vobject/icalendar.pyi | 1 + .../watchpoints/watchpoints/watch_element.pyi | 2 + stubs/workalendar/workalendar/core.pyi | 1 + stubs/www-authenticate/www_authenticate.pyi | 2 + stubs/xlrd/xlrd/sheet.pyi | 2 + stubs/xmldiff/xmldiff/main.pyi | 3 + stubs/xmltodict/xmltodict.pyi | 1 + stubs/yt-dlp/yt_dlp/extractor/common.pyi | 4 + stubs/yt-dlp/yt_dlp/networking/common.pyi | 5 + stubs/yt-dlp/yt_dlp/utils/_utils.pyi | 7 + stubs/yt-dlp/yt_dlp/utils/networking.pyi | 4 + stubs/yt-dlp/yt_dlp/utils/progress.pyi | 2 + stubs/yt-dlp/yt_dlp/utils/traversal.pyi | 4 + stubs/zxcvbn/zxcvbn/matching.pyi | 1 + 598 files changed, 3028 insertions(+), 37 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 450206d677d3..aed73938e69e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - "--unsafe-fixes" files: '.*test_cases/.+\.py$' - repo: https://github.com/psf/black-pre-commit-mirror - rev: 26.3.1 + rev: 26.5.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 diff --git a/pyproject.toml b/pyproject.toml index 9f81d46f0b11..b2b851541d4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ requires-python = ">=3.10" # Minimum version to run tests, used by uv run line-length = 130 target-version = ["py310"] skip-magic-trailing-comma = true +preview = true [tool.ruff] line-length = 130 diff --git a/stdlib/_asyncio.pyi b/stdlib/_asyncio.pyi index 76fd3048f654..23b690a9c2da 100644 --- a/stdlib/_asyncio.pyi +++ b/stdlib/_asyncio.pyi @@ -16,10 +16,12 @@ class Future(Awaitable[_T]): @property def _exception(self) -> BaseException | None: ... _blocking: bool + @property def _log_traceback(self) -> bool: ... @_log_traceback.setter def _log_traceback(self, val: Literal[False]) -> None: ... + _asyncio_future_blocking: bool # is a part of duck-typing contract for `Future` def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ... def __del__(self) -> None: ... diff --git a/stdlib/_bisect.pyi b/stdlib/_bisect.pyi index a0890c94457a..b87dd8f3fb87 100644 --- a/stdlib/_bisect.pyi +++ b/stdlib/_bisect.pyi @@ -38,6 +38,7 @@ def bisect_left( def bisect_left( a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT] ) -> int: ... + @overload def bisect_right( a: SupportsLenAndGetItem[SupportsRichComparisonT], @@ -72,6 +73,7 @@ def bisect_right( def bisect_right( a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT] ) -> int: ... + @overload def insort_left( a: MutableSequence[SupportsRichComparisonT], @@ -85,6 +87,7 @@ def insort_left( def insort_left( a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT] ) -> None: ... + @overload def insort_right( a: MutableSequence[SupportsRichComparisonT], diff --git a/stdlib/_codecs.pyi b/stdlib/_codecs.pyi index 22389aaffab8..38cf857d0569 100644 --- a/stdlib/_codecs.pyi +++ b/stdlib/_codecs.pyi @@ -49,6 +49,7 @@ def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = " def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap] @overload def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ... + @overload def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap] @overload @@ -67,6 +68,7 @@ def decode( def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ... @overload def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ... + def lookup(encoding: str, /) -> codecs.CodecInfo: ... def charmap_build(map: str, /) -> _CharMap: ... def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ... diff --git a/stdlib/_contextvars.pyi b/stdlib/_contextvars.pyi index 4c945121b1fe..56440884a150 100644 --- a/stdlib/_contextvars.pyi +++ b/stdlib/_contextvars.pyi @@ -14,15 +14,18 @@ class ContextVar(Generic[_T]): def __new__(cls, name: str) -> Self: ... @overload def __new__(cls, name: str, *, default: _T) -> Self: ... + def __hash__(self) -> int: ... @property def name(self) -> str: ... + @overload def get(self) -> _T: ... @overload def get(self, default: _T, /) -> _T: ... @overload def get(self, default: _D, /) -> _D | _T: ... + def set(self, value: _T, /) -> Token[_T]: ... def reset(self, token: Token[_T], /) -> None: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -49,12 +52,14 @@ def copy_context() -> Context: ... @final class Context(Mapping[ContextVar[Any], Any]): def __init__(self) -> None: ... + @overload def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ... @overload def get(self, key: ContextVar[_T], default: _T, /) -> _T: ... @overload def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ... + def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... def copy(self) -> Context: ... __hash__: ClassVar[None] # type: ignore[assignment] diff --git a/stdlib/_ctypes.pyi b/stdlib/_ctypes.pyi index ce0ad45f775c..d800ac5c20d0 100644 --- a/stdlib/_ctypes.pyi +++ b/stdlib/_ctypes.pyi @@ -127,14 +127,17 @@ class _PyCPointerType(_CTypeBaseType): class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType): _type_: type[_CT] contents: _CT + @overload def __init__(self) -> None: ... @overload def __init__(self, arg: _CT) -> None: ... + @overload def __getitem__(self, key: int, /) -> Any: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ... + def __setitem__(self, key: int, value: Any, /) -> None: ... if sys.version_info < (3, 14): @@ -142,6 +145,7 @@ if sys.version_info < (3, 14): def POINTER(type: None, /) -> type[c_void_p]: ... @overload def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ... + def pointer(obj: _CT, /) -> _Pointer[_CT]: ... # This class is not exposed. It calls itself _ctypes.CArgObject. @@ -177,6 +181,7 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType): errcheck: _ECT # Abstract attribute that must be defined on subclasses _flags_: ClassVar[int] + @overload def __new__(cls) -> Self: ... @overload @@ -209,10 +214,12 @@ if sys.version_info >= (3, 14): bit_offset: int bit_size: int is_anonymous: bool + @overload def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ... @overload def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ... + def __set__(self, instance: Any, value: _SetT, /) -> None: ... _CField = CField @@ -223,10 +230,12 @@ else: class _CField(Generic[_CT, _GetT, _SetT]): offset: int size: int + @overload def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ... @overload def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ... + def __set__(self, instance: Any, value: _SetT, /) -> None: ... # This class is not exposed. It calls itself _ctypes.UnionType. @@ -308,16 +317,19 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType): def _length_(self) -> int: ... @_length_.setter def _length_(self, value: int) -> None: ... + @property @abstractmethod def _type_(self) -> type[_CT]: ... @_type_.setter def _type_(self, value: type[_CT]) -> None: ... + # Note: only available if _CT == c_char @property def raw(self) -> bytes: ... @raw.setter def raw(self, value: ReadableBuffer) -> None: ... + value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise # TODO: These methods cannot be annotated correctly at the moment. # All of these "Any"s stand for the array's element type, but it's not possible to use _CT @@ -332,14 +344,17 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType): # This special behavior is not easy to model in a stub, so for now all places where # the array element type would belong are annotated with Any instead. def __init__(self, *args: Any) -> None: ... + @overload def __getitem__(self, key: int, /) -> Any: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ... + @overload def __setitem__(self, key: int, value: Any, /) -> None: ... @overload def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[Any], /) -> None: ... + def __iter__(self) -> Iterator[Any]: ... # Can't inherit from Sized because the metaclass conflict between # Sized and _CData prevents using _CDataMeta. diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index ed7dfce6de31..449cf75dad42 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -375,18 +375,22 @@ class error(Exception): ... @final class window: # undocumented encoding: str + @overload def addch(self, ch: _ChType, attr: int = ...) -> None: ... @overload def addch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ... + @overload def addnstr(self, str: str, n: int, attr: int = ...) -> None: ... @overload def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... + @overload def addstr(self, str: str, attr: int = ...) -> None: ... @overload def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... + def attroff(self, attr: int, /) -> None: ... def attron(self, attr: int, /) -> None: ... def attrset(self, attr: int, /) -> None: ... @@ -403,10 +407,12 @@ class window: # undocumented bl: _ChType = ..., br: _ChType = ..., ) -> None: ... + @overload def box(self) -> None: ... @overload def box(self, vertch: _ChType = 0, horch: _ChType = 0) -> None: ... + @overload def chgat(self, attr: int) -> None: ... @overload @@ -415,39 +421,49 @@ class window: # undocumented def chgat(self, y: int, x: int, attr: int) -> None: ... @overload def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... + def clear(self) -> None: ... def clearok(self, yes: int) -> None: ... def clrtobot(self) -> None: ... def clrtoeol(self) -> None: ... def cursyncup(self) -> None: ... + @overload def delch(self) -> None: ... @overload def delch(self, y: int, x: int) -> None: ... + def deleteln(self) -> None: ... + @overload def derwin(self, begin_y: int, begin_x: int) -> window: ... @overload def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ... + def echochar(self, ch: _ChType, attr: int = 0, /) -> None: ... def enclose(self, y: int, x: int, /) -> bool: ... def erase(self) -> None: ... def getbegyx(self) -> tuple[int, int]: ... def getbkgd(self) -> tuple[int, int]: ... + @overload def getch(self) -> int: ... @overload def getch(self, y: int, x: int) -> int: ... + @overload def get_wch(self) -> int | str: ... @overload def get_wch(self, y: int, x: int) -> int | str: ... + @overload def getkey(self) -> str: ... @overload def getkey(self, y: int, x: int) -> str: ... + def getmaxyx(self) -> tuple[int, int]: ... def getparyx(self) -> tuple[int, int]: ... + @overload def getstr(self) -> bytes: ... @overload @@ -456,36 +472,46 @@ class window: # undocumented def getstr(self, y: int, x: int) -> bytes: ... @overload def getstr(self, y: int, x: int, n: int) -> bytes: ... + def getyx(self) -> tuple[int, int]: ... + @overload def hline(self, ch: _ChType, n: int) -> None: ... @overload def hline(self, y: int, x: int, ch: _ChType, n: int) -> None: ... + def idcok(self, flag: bool) -> None: ... def idlok(self, yes: bool) -> None: ... def immedok(self, flag: bool) -> None: ... + @overload def inch(self) -> int: ... @overload def inch(self, y: int, x: int) -> int: ... + @overload def insch(self, ch: _ChType, attr: int = ...) -> None: ... @overload def insch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ... + def insdelln(self, nlines: int) -> None: ... def insertln(self) -> None: ... + @overload def insnstr(self, str: str, n: int, attr: int = ...) -> None: ... @overload def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... + @overload def insstr(self, str: str, attr: int = ...) -> None: ... @overload def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... + @overload def instr(self, n: int = 2047) -> bytes: ... @overload def instr(self, y: int, x: int, n: int = 2047) -> bytes: ... + def is_linetouched(self, line: int, /) -> bool: ... def is_wintouched(self) -> bool: ... def keypad(self, yes: bool, /) -> None: ... @@ -495,43 +521,52 @@ class window: # undocumented def mvwin(self, new_y: int, new_x: int) -> None: ... def nodelay(self, yes: bool) -> None: ... def notimeout(self, yes: bool) -> None: ... + @overload def noutrefresh(self) -> None: ... @overload def noutrefresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... + @overload def overlay(self, destwin: window) -> None: ... @overload def overlay( self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int ) -> None: ... + @overload def overwrite(self, destwin: window) -> None: ... @overload def overwrite( self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int ) -> None: ... + def putwin(self, file: SupportsWrite[bytes], /) -> None: ... def redrawln(self, beg: int, num: int, /) -> None: ... def redrawwin(self) -> None: ... + @overload def refresh(self) -> None: ... @overload def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... + def resize(self, nlines: int, ncols: int) -> None: ... def scroll(self, lines: int = 1) -> None: ... def scrollok(self, flag: bool) -> None: ... def setscrreg(self, top: int, bottom: int, /) -> None: ... def standend(self) -> None: ... def standout(self) -> None: ... + @overload def subpad(self, begin_y: int, begin_x: int) -> window: ... @overload def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ... + @overload def subwin(self, begin_y: int, begin_x: int) -> window: ... @overload def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ... + def syncdown(self) -> None: ... def syncok(self, flag: bool) -> None: ... def syncup(self) -> None: ... @@ -539,6 +574,7 @@ class window: # undocumented def touchline(self, start: int, count: int, changed: bool = True) -> None: ... def touchwin(self) -> None: ... def untouchwin(self) -> None: ... + @overload def vline(self, ch: _ChType, n: int) -> None: ... @overload diff --git a/stdlib/_dbm.pyi b/stdlib/_dbm.pyi index 615b5272a4f5..29d9b4c2fadc 100644 --- a/stdlib/_dbm.pyi +++ b/stdlib/_dbm.pyi @@ -28,10 +28,12 @@ if sys.platform != "win32": 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: ... @overload def get(self, k: _KeyType, default: _T, /) -> bytes | _T: ... + def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = b"", /) -> bytes: ... # This isn't true, but the class can't be instantiated. See #13024 diff --git a/stdlib/_frozen_importlib_external.pyi b/stdlib/_frozen_importlib_external.pyi index f5b1045a11f0..907e8def9380 100644 --- a/stdlib/_frozen_importlib_external.pyi +++ b/stdlib/_frozen_importlib_external.pyi @@ -30,6 +30,7 @@ MAGIC_NUMBER: Final[bytes] def cache_from_source(path: StrPath, debug_override: bool, *, optimization: None = None) -> str: ... @overload def cache_from_source(path: StrPath, debug_override: None = None, *, optimization: Any | None = None) -> str: ... + def source_from_cache(path: StrPath) -> str: ... def decode_source(source_bytes: ReadableBuffer) -> str: ... def spec_from_file_location( @@ -39,6 +40,7 @@ def spec_from_file_location( loader: LoaderProtocol | None = None, submodule_search_locations: list[str] | None = ..., ) -> importlib.machinery.ModuleSpec | None: ... + @deprecated( "Deprecated since Python 3.6. Use site configuration instead. " "Future versions of Python may not enable this finder by default." diff --git a/stdlib/_gdbm.pyi b/stdlib/_gdbm.pyi index 98c18f8bf4f0..b7a01a453120 100644 --- a/stdlib/_gdbm.pyi +++ b/stdlib/_gdbm.pyi @@ -32,10 +32,12 @@ if sys.platform != "win32": 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: ... @overload 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 diff --git a/stdlib/_hashlib.pyi b/stdlib/_hashlib.pyi index 5c1a75eaa7fc..b98edc5757c3 100644 --- a/stdlib/_hashlib.pyi +++ b/stdlib/_hashlib.pyi @@ -58,6 +58,7 @@ class HMAC: 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: ReadableBuffer, msg: ReadableBuffer = b"", digestmod: _DigestMod = None) -> HMAC: ... diff --git a/stdlib/_interpreters.pyi b/stdlib/_interpreters.pyi index c4cbeccaa571..3885669278f5 100644 --- a/stdlib/_interpreters.pyi +++ b/stdlib/_interpreters.pyi @@ -47,6 +47,7 @@ def set___main___attrs(id: SupportsIndex, updates: _SharedDict, *, restrict: boo def incref(id: SupportsIndex, *, implieslink: bool = False, restrict: bool = False) -> None: ... def decref(id: SupportsIndex, *, restrict: bool = False) -> None: ... def is_shareable(obj: object) -> bool: ... + @overload def capture_exception(exc: BaseException) -> types.SimpleNamespace: ... @overload diff --git a/stdlib/_operator.pyi b/stdlib/_operator.pyi index 1007c387ee02..04dae79dcd52 100644 --- a/stdlib/_operator.pyi +++ b/stdlib/_operator.pyi @@ -69,56 +69,68 @@ def truth(a: object, /) -> bool: ... def is_(a: object, b: object, /) -> bool: ... def is_not(a: object, b: object, /) -> bool: ... def abs(a: SupportsAbs[_T], /) -> _T: ... + @overload def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ... @overload def add(a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co: ... + def and_(a, b, /): ... def floordiv(a, b, /): ... def index(a: SupportsIndex, /) -> int: ... def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ... def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ... def lshift(a, b, /): ... + @overload def mod(a: SupportsMod[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ... @overload def mod(a: _T_contra, b: SupportsRMod[_T_contra, _T_co], /) -> _T_co: ... + @overload def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ... @overload def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ... + def matmul(a, b, /): ... def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ... def or_(a, b, /): ... def pos(a: _SupportsPos[_T_co], /) -> _T_co: ... def pow(a, b, /): ... def rshift(a, b, /): ... + @overload def sub(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ... @overload def sub(a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co: ... + def truediv(a, b, /): ... def xor(a, b, /): ... def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ... def contains(a: Container[object], b: object, /) -> bool: ... def countOf(a: Iterable[object], b: object, /) -> int: ... + @overload def delitem(a: MutableSequence[Any], b: int, /) -> None: ... @overload def delitem(a: MutableSequence[Any], b: slice[int | None], /) -> None: ... @overload def delitem(a: MutableMapping[_K, Any], b: _K, /) -> None: ... + @overload def getitem(a: Sequence[_T], b: slice[int | None], /) -> Sequence[_T]: ... @overload def getitem(a: SupportsGetItem[_K, _V], b: _K, /) -> _V: ... + def indexOf(a: Iterable[_T], b: _T, /) -> int: ... + @overload def setitem(a: MutableSequence[_T], b: int, c: _T, /) -> None: ... @overload def setitem(a: MutableSequence[_T], b: slice[int | None], c: Sequence[_T], /) -> None: ... @overload def setitem(a: MutableMapping[_K, _V], b: _K, c: _V, /) -> None: ... + def length_hint(obj: object, default: int = 0, /) -> int: ... def iadd(a, b, /): ... def iand(a, b, /): ... diff --git a/stdlib/_pickle.pyi b/stdlib/_pickle.pyi index 120619f95ffa..f8411c6abc4b 100644 --- a/stdlib/_pickle.pyi +++ b/stdlib/_pickle.pyi @@ -69,10 +69,12 @@ class Pickler: fix_imports: bool = True, buffer_callback: _BufferCallback = None, ) -> None: ... + @property def memo(self) -> PicklerMemoProxy: ... @memo.setter def memo(self, value: PicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ... + def dump(self, obj: Any, /) -> None: ... def clear_memo(self) -> None: ... @@ -99,10 +101,12 @@ class Unpickler: errors: str = "strict", buffers: Iterable[Any] | None = (), ) -> None: ... + @property def memo(self) -> UnpicklerMemoProxy: ... @memo.setter def memo(self, value: UnpicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ... + def load(self) -> Any: ... def find_class(self, module_name: str, global_name: str, /) -> Any: ... diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index 4cc723b7db05..bb9b08e2f79a 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -788,10 +788,12 @@ class socket: def fileno(self) -> int: ... def getpeername(self) -> _RetAddress: ... def getsockname(self) -> _RetAddress: ... + @overload def getsockopt(self, level: int, optname: int, /) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int, /) -> bytes: ... + def getblocking(self) -> bool: ... def gettimeout(self) -> float | None: ... if sys.platform == "win32": @@ -810,10 +812,12 @@ class socket: def recv_into(self, buffer: WriteableBuffer, nbytes: int = 0, flags: int = 0) -> int: ... def send(self, data: ReadableBuffer, flags: int = 0, /) -> int: ... def sendall(self, data: ReadableBuffer, flags: int = 0, /) -> None: ... + @overload def sendto(self, data: ReadableBuffer, address: _Address, /) -> int: ... @overload def sendto(self, data: ReadableBuffer, flags: int, address: _Address, /) -> int: ... + if sys.platform != "win32": def sendmsg( self, @@ -830,10 +834,12 @@ class socket: def setblocking(self, flag: bool, /) -> None: ... def settimeout(self, value: float | None, /) -> None: ... + @overload def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer, /) -> None: ... @overload def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ... + if sys.platform == "win32": def share(self, process_id: int, /) -> bytes: ... diff --git a/stdlib/_sqlite3.pyi b/stdlib/_sqlite3.pyi index 65fffe7aa47b..b6d96121afa9 100644 --- a/stdlib/_sqlite3.pyi +++ b/stdlib/_sqlite3.pyi @@ -220,6 +220,7 @@ if sys.version_info >= (3, 11): def adapt(obj: Any, proto: Any, /) -> Any: ... @overload def adapt(obj: Any, proto: Any, alt: _T, /) -> Any | _T: ... + def complete_statement(statement: str) -> bool: ... if sys.version_info >= (3, 12): @@ -261,7 +262,6 @@ if sys.version_info >= (3, 12): uri: bool = False, autocommit: bool = ..., ) -> _ConnectionT: ... - else: @overload def connect( diff --git a/stdlib/_ssl.pyi b/stdlib/_ssl.pyi index e7cb1d94d363..87023d90e13b 100644 --- a/stdlib/_ssl.pyi +++ b/stdlib/_ssl.pyi @@ -67,6 +67,7 @@ if sys.platform == "win32": def txt2obj(txt: str, name: bool = False) -> tuple[int, str, str, str]: ... def nid2obj(nid: int, /) -> tuple[int, str, str, str]: ... + @disjoint_base class _SSLContext: check_hostname: bool @@ -83,12 +84,14 @@ class _SSLContext: verify_mode: int def __new__(cls, protocol: int, /) -> Self: ... def cert_store_stats(self) -> dict[str, int]: ... + @overload def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ... @overload def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ... @overload def get_ca_certs(self, binary_form: bool = False) -> Any: ... + def get_ciphers(self) -> list[_Cipher]: ... def load_cert_chain( self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = None, password: _PasswordType | None = None @@ -152,6 +155,7 @@ class SSLSession: @final class Certificate: def get_info(self) -> _CertInfo: ... + @overload def public_bytes(self) -> str: ... @overload diff --git a/stdlib/_struct.pyi b/stdlib/_struct.pyi index a8fac2aea1b0..c13e440e10aa 100644 --- a/stdlib/_struct.pyi +++ b/stdlib/_struct.pyi @@ -9,6 +9,7 @@ def unpack(format: str | bytes, buffer: ReadableBuffer, /) -> tuple[Any, ...]: . def unpack_from(format: str | bytes, /, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... def iter_unpack(format: str | bytes, buffer: ReadableBuffer, /) -> Iterator[tuple[Any, ...]]: ... def calcsize(format: str | bytes, /) -> int: ... + @disjoint_base class Struct: @property diff --git a/stdlib/_thread.pyi b/stdlib/_thread.pyi index 69fac7a5a694..e2d257c9ec0b 100644 --- a/stdlib/_thread.pyi +++ b/stdlib/_thread.pyi @@ -12,6 +12,7 @@ _Ts = TypeVarTuple("_Ts") error = RuntimeError def _count() -> int: ... + @final class RLock: def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... @@ -33,6 +34,7 @@ if sys.version_info >= (3, 13): def start_joinable_thread( function: Callable[[], object], handle: _ThreadHandle | None = None, daemon: bool = True ) -> _ThreadHandle: ... + @final class lock: def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... @@ -71,12 +73,14 @@ else: def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ... @overload def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... + @overload @deprecated("Obsolete synonym. Use `start_new_thread()` instead.") def start_new(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ... # undocumented @overload @deprecated("Obsolete synonym. Use `start_new_thread()` instead.") def start_new(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... # undocumented + def interrupt_main(signum: signal.Signals = signal.SIGINT, /) -> None: ... def exit() -> NoReturn: ... @deprecated("Obsolete synonym. Use `exit()` instead.") @@ -90,6 +94,7 @@ def stack_size(size: int = 0, /) -> int: ... TIMEOUT_MAX: Final[float] def get_native_id() -> int: ... # only available on some platforms + @final class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]): __match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread") diff --git a/stdlib/_tkinter.pyi b/stdlib/_tkinter.pyi index 318c35b352c5..500345f91e06 100644 --- a/stdlib/_tkinter.pyi +++ b/stdlib/_tkinter.pyi @@ -91,6 +91,7 @@ class TkappType: def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ... def unsetvar(self, *args, **kwargs): ... + if sys.version_info >= (3, 14): @overload def wantobjects(self) -> Literal[0, 1]: ... @@ -100,6 +101,7 @@ class TkappType: @overload def wantobjects(self, wantobjects: Literal[0, 1] | bool, /) -> None: ... + def willdispatch(self) -> None: ... if sys.version_info >= (3, 12): def gettrace(self, /) -> _TkinterTraceFunc | None: ... diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index c96f212b42e9..e74ddc687e8c 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -313,6 +313,7 @@ class IndexableBuffer(Buffer, Protocol): class SupportsGetItemBuffer(SliceableBuffer, IndexableBuffer, Protocol): def __contains__(self, x: Any, /) -> bool: ... + @overload def __getitem__(self, slice: slice[SupportsIndex | None], /) -> Sequence[int]: ... @overload diff --git a/stdlib/_typeshed/_type_checker_internals.pyi b/stdlib/_typeshed/_type_checker_internals.pyi index feb22aae0073..375e997e2c93 100644 --- a/stdlib/_typeshed/_type_checker_internals.pyi +++ b/stdlib/_typeshed/_type_checker_internals.pyi @@ -40,14 +40,17 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta): def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... + @overload def __or__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... @overload def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... + @overload def __ror__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... @overload def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... + # supposedly incompatible definitions of __or__ and __ior__ def __ior__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... # type: ignore[misc] @@ -67,6 +70,7 @@ class NamedTupleFallback(tuple[Any, ...]): "Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15" ) def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ... + @classmethod def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ... def _asdict(self) -> dict[str, Any]: ... diff --git a/stdlib/_warnings.pyi b/stdlib/_warnings.pyi index 2dbc7b855281..5f4648259025 100644 --- a/stdlib/_warnings.pyi +++ b/stdlib/_warnings.pyi @@ -24,7 +24,6 @@ if sys.version_info >= (3, 12): *, skip_file_prefixes: tuple[str, ...] = (), ) -> None: ... - else: @overload def warn(message: str, category: type[Warning] | None = None, stacklevel: int = 1, source: Any | None = None) -> None: ... diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index dad1ed7a4fb5..82ffa4463f48 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -13,6 +13,7 @@ class WeakSet(MutableSet[_T]): def __init__(self, data: None = None) -> None: ... @overload def __init__(self, data: Iterable[_T]) -> None: ... + def add(self, item: _T) -> None: ... def discard(self, item: _T) -> None: ... def copy(self) -> Self: ... diff --git a/stdlib/_winapi.pyi b/stdlib/_winapi.pyi index 253f6af447f6..784cdba5d28d 100644 --- a/stdlib/_winapi.pyi +++ b/stdlib/_winapi.pyi @@ -175,12 +175,14 @@ if sys.platform == "win32": COPY_FILE_DIRECTORY: Final = 0x00000080 def CloseHandle(handle: int, /) -> None: ... + @overload def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ... @overload def ConnectNamedPipe(handle: int, overlapped: Literal[False] = False) -> None: ... @overload def ConnectNamedPipe(handle: int, overlapped: bool) -> Overlapped | None: ... + def CreateFile( file_name: str, desired_access: int, @@ -244,12 +246,14 @@ if sys.platform == "win32": def PeekNamedPipe(handle: int, size: int = 0, /) -> tuple[int, int] | tuple[bytes, int, int]: ... def LCMapStringEx(locale: str, flags: int, src: str) -> str: ... def UnmapViewOfFile(address: int, /) -> None: ... + @overload def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> tuple[Overlapped, int]: ... @overload def ReadFile(handle: int, size: int, overlapped: Literal[False] = False) -> tuple[bytes, int]: ... @overload def ReadFile(handle: int, size: int, overlapped: int | bool) -> tuple[Any, int]: ... + def SetNamedPipeHandleState( named_pipe: int, mode: int | None, max_collection_count: int | None, collect_data_timeout: int | None, / ) -> None: ... @@ -258,12 +262,14 @@ if sys.platform == "win32": def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = 0xFFFFFFFF, /) -> int: ... def WaitForSingleObject(handle: int, milliseconds: int, /) -> int: ... def WaitNamedPipe(name: str, timeout: int, /) -> None: ... + @overload def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[True]) -> tuple[Overlapped, int]: ... @overload def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[False] = False) -> tuple[int, int]: ... @overload def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: int | bool) -> tuple[Any, int]: ... + @final class Overlapped: event: int diff --git a/stdlib/abc.pyi b/stdlib/abc.pyi index 2e8eff936c83..a43a641489a4 100644 --- a/stdlib/abc.pyi +++ b/stdlib/abc.pyi @@ -28,6 +28,7 @@ class ABCMeta(type): def register(cls: ABCMeta, subclass: type[_T]) -> type[_T]: ... def abstractmethod(funcobj: _FuncT) -> _FuncT: ... + @deprecated("Deprecated since Python 3.3. Use `@classmethod` stacked on top of `@abstractmethod` instead.") class abstractclassmethod(classmethod[_T, _P, _R_co]): __isabstractmethod__: Literal[True] diff --git a/stdlib/annotationlib.pyi b/stdlib/annotationlib.pyi index 96450e441be7..c3e843d95d9a 100644 --- a/stdlib/annotationlib.pyi +++ b/stdlib/annotationlib.pyi @@ -50,6 +50,7 @@ if sys.version_info >= (3, 14): def __init__( self, arg: str, *, module: str | None = None, owner: object = None, is_argument: bool = True, is_class: bool = False ) -> None: ... + @overload def evaluate( self, @@ -80,6 +81,7 @@ if sys.version_info >= (3, 14): owner: object = None, format: Format = Format.VALUE, # noqa: Y011 ) -> AnnotationForm: ... + @deprecated("Use `ForwardRef.evaluate()` or `typing.evaluate_forward_ref()` instead.") def _evaluate( self, @@ -108,6 +110,7 @@ if sys.version_info >= (3, 14): ) -> AnnotationForm | ForwardRef: ... @overload def call_evaluate_function(evaluate: EvaluateFunc, format: Format, *, owner: object = None) -> AnnotationForm: ... + @overload def call_annotate_function( annotate: AnnotateFunc, format: Literal[Format.STRING], *, owner: object = None @@ -118,7 +121,9 @@ if sys.version_info >= (3, 14): ) -> dict[str, AnnotationForm | ForwardRef]: ... @overload def call_annotate_function(annotate: AnnotateFunc, format: Format, *, owner: object = None) -> dict[str, AnnotationForm]: ... + def get_annotate_from_class_namespace(obj: Mapping[str, object]) -> AnnotateFunc | None: ... + @overload def get_annotations( obj: Any, # any object with __annotations__ or __annotate__ @@ -146,5 +151,6 @@ if sys.version_info >= (3, 14): eval_str: bool = False, format: Format = Format.VALUE, # noqa: Y011 ) -> dict[str, AnnotationForm]: ... + def type_repr(value: object) -> str: ... def annotations_to_string(annotations: SupportsItems[str, object]) -> dict[str, str]: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 1a8702ddad94..22d330a089ef 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -91,6 +91,7 @@ class _ActionsContainer: version: str = ..., **kwargs: Any, ) -> Action: ... + @overload def add_argument_group( self, @@ -112,6 +113,7 @@ class _ActionsContainer: argument_default: Any = ..., conflict_handler: str = ..., ) -> _ArgumentGroup: ... + def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ... def _add_action(self, action: _ActionT) -> _ActionT: ... def _remove_action(self, action: Action) -> None: ... @@ -213,6 +215,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def parse_args(self, args: Iterable[str] | None, namespace: _N) -> _N: ... @overload def parse_args(self, *, namespace: _N) -> _N: ... + @overload def add_subparsers( self: _ArgumentParserT, @@ -242,6 +245,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): help: str | None = None, metavar: str | None = None, ) -> _SubParsersAction[_ArgumentParserT]: ... + def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ... def print_help(self, file: SupportsWrite[str] | None = None) -> None: ... if sys.version_info >= (3, 15): @@ -258,15 +262,18 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def parse_known_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]: ... @overload def parse_known_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ... + def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ... def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ... def error(self, message: str) -> NoReturn: ... + @overload def parse_intermixed_args(self, args: Iterable[str] | None = None, namespace: None = None) -> Namespace: ... @overload def parse_intermixed_args(self, args: Iterable[str] | None, namespace: _N) -> _N: ... @overload def parse_intermixed_args(self, *, namespace: _N) -> _N: ... + @overload def parse_known_intermixed_args( self, args: Iterable[str] | None = None, namespace: None = None @@ -275,6 +282,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def parse_known_intermixed_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]: ... @overload def parse_known_intermixed_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ... + # undocumented def _get_optional_actions(self) -> list[Action]: ... def _get_positional_actions(self) -> list[Action]: ... @@ -536,6 +544,7 @@ class FileType: class _ArgumentGroup(_ActionsContainer): title: str | None _group_actions: list[Action] + @overload def __init__( self, diff --git a/stdlib/array.pyi b/stdlib/array.pyi index 4ff1e171ecfc..2c83146edbf0 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -29,6 +29,7 @@ class array(MutableSequence[_T]): def typecode(self) -> _TypeCode: ... @property def itemsize(self) -> int: ... + @overload def __new__( cls: type[array[int]], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., / @@ -58,6 +59,7 @@ class array(MutableSequence[_T]): def __new__(cls, typecode: str, initializer: Iterable[_T], /) -> Self: ... @overload def __new__(cls, typecode: str, initializer: bytes | bytearray = ..., /) -> Self: ... + def append(self, v: _T, /) -> None: ... def buffer_info(self) -> tuple[int, int]: ... def byteswap(self) -> None: ... @@ -79,14 +81,17 @@ class array(MutableSequence[_T]): __hash__: ClassVar[None] # type: ignore[assignment] def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... + @overload def __getitem__(self, key: SupportsIndex, /) -> _T: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> array[_T]: ... + @overload # type: ignore[override] def __setitem__(self, key: SupportsIndex, value: _T, /) -> None: ... @overload def __setitem__(self, key: slice[SupportsIndex | None], value: array[_T], /) -> None: ... + def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> None: ... def __add__(self, value: array[_T], /) -> array[_T]: ... def __eq__(self, value: object, /) -> bool: ... diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 0e07cf9c9950..14a98b9a5fca 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -417,6 +417,7 @@ class AnnAssign(stmt): annotation: expr value: expr | None simple: int + @overload def __init__( self, @@ -756,7 +757,6 @@ class ImportFrom(stmt): is_lazy: bool | None = None, **kwargs: Unpack[_Attributes], ) -> None: ... - elif sys.version_info >= (3, 13): @overload def __init__(self, module: str | None, names: list[alias], level: int, **kwargs: Unpack[_Attributes]) -> None: ... @@ -1108,6 +1108,7 @@ class Constant(expr): @n.setter @deprecated("Removed in Python 3.14. Use `value` instead.") def n(self, value: _ConstantValue) -> None: ... + @property @deprecated("Removed in Python 3.14. Use `value` instead.") def s(self) -> _ConstantValue: ... @@ -1410,6 +1411,7 @@ class keyword(AST): end_col_offset: int | None arg: str | None value: expr + @overload def __init__(self, arg: str | None, value: expr, **kwargs: Unpack[_Attributes]) -> None: ... @overload @@ -1815,7 +1817,6 @@ if sys.version_info >= (3, 15): optimize: Literal[-1, 0, 1, 2] = -1, module: str | None = None, ) -> mod: ... - elif sys.version_info >= (3, 13): @overload def parse( @@ -1904,7 +1905,6 @@ elif sys.version_info >= (3, 13): feature_version: None | int | tuple[int, int] = None, optimize: Literal[-1, 0, 1, 2] = -1, ) -> mod: ... - else: @overload def parse( diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 1aec5847c367..1fae6d659505 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -117,6 +117,7 @@ class BaseEventLoop(AbstractEventLoop): flags: int = 0, ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ... + if sys.version_info >= (3, 12): @overload async def create_connection( diff --git a/stdlib/asyncio/coroutines.pyi b/stdlib/asyncio/coroutines.pyi index 62d0bc4db8b9..7599c692949b 100644 --- a/stdlib/asyncio/coroutines.pyi +++ b/stdlib/asyncio/coroutines.pyi @@ -32,11 +32,9 @@ if sys.version_info >= (3, 11): @overload @deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.") def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ... - else: # Sometimes needed in Python < 3.11 due to the fact that it supports @coroutine # which was removed in 3.11 which the inspect version doesn't support. - @overload def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... @overload diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index b3a6c18fd2b9..d4be117b1417 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -208,6 +208,7 @@ class AbstractEventLoop: ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... @abstractmethod async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ... + if sys.version_info >= (3, 11): @overload @abstractmethod diff --git a/stdlib/asyncio/graph.pyi b/stdlib/asyncio/graph.pyi index 18a8a6457d75..2f89de71b16b 100644 --- a/stdlib/asyncio/graph.pyi +++ b/stdlib/asyncio/graph.pyi @@ -22,6 +22,7 @@ if sys.version_info >= (3, 14): def capture_call_graph(future: None = None, /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ... @overload def capture_call_graph(future: Future[Any], /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ... + def format_call_graph(future: Future[Any] | None = None, /, *, depth: int = 1, limit: int | None = None) -> str: ... def print_call_graph( future: Future[Any] | None = None, /, *, file: SupportsWrite[str] | None = None, depth: int = 1, limit: int | None = None diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index e1491877ce24..66c31f15e6fb 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -218,10 +218,12 @@ def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: bool) -> Futur # unlike some asyncio apis, This does strict runtime checking of actually being a coroutine, not of any future-like. def run_coroutine_threadsafe(coro: Coroutine[Any, Any, _T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... def shield(arg: _FutureLike[_T]) -> Future[_T]: ... + @overload async def sleep(delay: float) -> None: ... @overload async def sleep(delay: float, result: _T) -> _T: ... + async def wait_for(fut: _FutureLike[_T], timeout: float | None) -> _T: ... if sys.version_info >= (3, 11): diff --git a/stdlib/asyncio/trsock.pyi b/stdlib/asyncio/trsock.pyi index 1249fac4c8b6..f621240d668a 100644 --- a/stdlib/asyncio/trsock.pyi +++ b/stdlib/asyncio/trsock.pyi @@ -27,14 +27,17 @@ class TransportSocket: def dup(self) -> socket.socket: ... def get_inheritable(self) -> bool: ... def shutdown(self, how: int) -> None: ... + @overload def getsockopt(self, level: int, optname: int) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... + @overload def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer) -> None: ... @overload def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ... + def getpeername(self) -> _RetAddress: ... def getsockname(self) -> _RetAddress: ... def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through? @@ -51,6 +54,7 @@ class TransportSocket: def connect_ex(self, address: _Address) -> int: ... @deprecated("Removed in Python 3.11") def bind(self, address: _Address) -> None: ... + if sys.platform == "win32": @deprecated("Removed in Python 3.11") def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ... @@ -68,6 +72,7 @@ class TransportSocket: def close(self) -> None: ... @deprecated("Removed in Python 3.11") def detach(self) -> int: ... + if sys.platform == "linux": @deprecated("Removed in Python 3.11") def sendmsg_afalg( @@ -88,18 +93,21 @@ class TransportSocket: address: _Address | None = None, /, ) -> int: ... + @overload @deprecated("Removed in Python 3.11.") def sendto(self, data: ReadableBuffer, address: _Address) -> int: ... @overload @deprecated("Removed in Python 3.11.") def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ... + @deprecated("Removed in Python 3.11.") def send(self, data: ReadableBuffer, flags: int = 0) -> int: ... @deprecated("Removed in Python 3.11.") def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ... @deprecated("Removed in Python 3.11.") def set_inheritable(self, inheritable: bool) -> None: ... + if sys.platform == "win32": @deprecated("Removed in Python 3.11.") def share(self, process_id: int) -> bytes: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 17ed4f11d020..96f9f637c733 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -74,10 +74,12 @@ if sys.platform != "win32": def __init__(self, fd: int) -> None: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... def send(self, data: bytes, flags: int = ...) -> int: ... + @overload def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... + def read(self, bufsize: int, flags: int = ...) -> bytes: ... def write(self, data: bytes, flags: int = ...) -> int: ... def close(self) -> None: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 49d91004cd5a..0fe6d9a69651 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -103,10 +103,12 @@ class object: __dict__: dict[str, Any] __module__: str __annotations__: dict[str, Any] + @property def __class__(self) -> type[Self]: ... @__class__.setter 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. @@ -142,10 +144,12 @@ class staticmethod(Generic[_P, _R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self, f: Callable[_P, _R_co], /) -> None: ... + @overload def __get__(self, instance: None, owner: type, /) -> Callable[_P, _R_co]: ... @overload def __get__(self, instance: _T, owner: type[_T] | None = None, /) -> Callable[_P, _R_co]: ... + @property def __wrapped__(self) -> Callable[_P, _R_co]: ... def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ... @@ -162,10 +166,12 @@ class classmethod(Generic[_T, _P, _R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self, f: Callable[Concatenate[type[_T], _P], _R_co], /) -> None: ... + @overload def __get__(self, instance: _T, owner: type[_T] | None = None, /) -> Callable[_P, _R_co]: ... @overload def __get__(self, instance: None, owner: type[_T], /) -> Callable[_P, _R_co]: ... + @property def __wrapped__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ... if sys.version_info >= (3, 14): @@ -198,16 +204,19 @@ class type: def __text_signature__(self) -> str | None: ... @property def __weakrefoffset__(self) -> int: ... + @overload def __init__(self, o: object, /) -> None: ... @overload def __init__(self, name: str, bases: tuple[type, ...], dict: dict[str, Any], /, **kwds: Any) -> None: ... + @overload def __new__(cls, o: object, /) -> type: ... @overload def __new__( cls: type[_typeshed.Self], name: str, bases: tuple[type, ...], namespace: dict[str, Any], /, **kwds: Any ) -> _typeshed.Self: ... + def __call__(self, *args: Any, **kwds: Any) -> Any: ... def __subclasses__(self: _typeshed.Self) -> list[_typeshed.Self]: ... # Note: the documentation doesn't specify what the return type is, the standard @@ -246,6 +255,7 @@ class int: def __new__(cls, x: ConvertibleToInt = 0, /) -> Self: ... @overload def __new__(cls, x: str | bytes | bytearray, /, base: SupportsIndex) -> Self: ... + def as_integer_ratio(self) -> tuple[int, Literal[1]]: ... @property def real(self) -> int: ... @@ -299,6 +309,7 @@ class int: def __rtruediv__(self, value: int, /) -> float: ... def __rmod__(self, value: int, /) -> int: ... def __rdivmod__(self, value: int, /) -> tuple[int, int]: ... + @overload def __pow__(self, x: Literal[0], /) -> Literal[1]: ... @overload @@ -313,6 +324,7 @@ class int: def __pow__(self, value: int, mod: None = None, /) -> Any: ... @overload def __pow__(self, value: int, mod: int, /) -> int: ... + def __rpow__(self, value: int, mod: int | None = None, /) -> Any: ... def __and__(self, value: int, /) -> int: ... def __or__(self, value: int, /) -> int: ... @@ -370,12 +382,14 @@ class float: def __truediv__(self, value: float, /) -> float: ... def __mod__(self, value: float, /) -> float: ... def __divmod__(self, value: float, /) -> tuple[float, float]: ... + @overload def __pow__(self, value: int, mod: None = None, /) -> float: ... # positive __value -> float; negative __value -> complex # return type must be Any as `float | complex` causes too many false-positive errors @overload def __pow__(self, value: float, mod: None = None, /) -> Any: ... + def __radd__(self, value: float, /) -> float: ... def __rsub__(self, value: float, /) -> float: ... def __rmul__(self, value: float, /) -> float: ... @@ -383,6 +397,7 @@ class float: def __rtruediv__(self, value: float, /) -> float: ... def __rmod__(self, value: float, /) -> float: ... def __rdivmod__(self, value: float, /) -> tuple[float, float]: ... + @overload def __rpow__(self, value: _PositiveInteger, mod: None = None, /) -> float: ... @overload @@ -390,14 +405,17 @@ class float: # Returning `complex` for the general case gives too many false-positive errors. @overload def __rpow__(self, value: float, mod: None = None, /) -> Any: ... + def __getnewargs__(self) -> tuple[float]: ... def __trunc__(self) -> int: ... def __ceil__(self) -> int: ... def __floor__(self) -> int: ... + @overload def __round__(self, ndigits: None = None, /) -> int: ... @overload def __round__(self, ndigits: SupportsIndex, /) -> float: ... + def __eq__(self, value: object, /) -> bool: ... def __ne__(self, value: object, /) -> bool: ... def __lt__(self, value: float, /) -> bool: ... @@ -427,6 +445,7 @@ class complex: ) -> Self: ... @overload def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ... + @property def real(self) -> float: ... @property @@ -470,32 +489,40 @@ class str(Sequence[str]): def __new__(cls, object: object = "") -> Self: ... @overload def __new__(cls, object: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> Self: ... + @overload def capitalize(self: LiteralString) -> LiteralString: ... @overload def capitalize(self) -> str: ... # type: ignore[misc] + @overload def casefold(self: LiteralString) -> LiteralString: ... @overload def casefold(self) -> str: ... # type: ignore[misc] + @overload def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ... @overload def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc] + def count(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ... def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ... def endswith( self, suffix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, / ) -> bool: ... + @overload def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ... @overload def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc] + def find(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ... + @overload def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ... @overload def format(self, *args: object, **kwargs: object) -> str: ... + def format_map(self, mapping: _FormatMapMapping, /) -> str: ... def index(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ... def isalnum(self) -> bool: ... @@ -510,26 +537,32 @@ class str(Sequence[str]): def isspace(self) -> bool: ... def istitle(self) -> bool: ... def isupper(self) -> bool: ... + @overload def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ... @overload def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc] + @overload def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ... @overload def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc] + @overload def lower(self: LiteralString) -> LiteralString: ... @overload def lower(self) -> str: ... # type: ignore[misc] + @overload def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ... @overload def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc] + @overload def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ... @overload def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc] + if sys.version_info >= (3, 13): @overload def replace( @@ -549,60 +582,76 @@ class str(Sequence[str]): def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ... @overload def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc] + @overload def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ... @overload def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc] + def rfind(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ... def rindex(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ... + @overload def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ... @overload def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc] + @overload def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ... @overload def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc] + @overload def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... @overload def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] + @overload def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ... @overload def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc] + @overload def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... @overload def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] + @overload def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ... @overload def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc] + def startswith( self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, / ) -> bool: ... + @overload def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ... @overload def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc] + @overload def swapcase(self: LiteralString) -> LiteralString: ... @overload def swapcase(self) -> str: ... # type: ignore[misc] + @overload def title(self: LiteralString) -> LiteralString: ... @overload def title(self) -> str: ... # type: ignore[misc] + def translate(self, table: _TranslateTable, /) -> str: ... + @overload def upper(self: LiteralString) -> LiteralString: ... @overload def upper(self) -> str: ... # type: ignore[misc] + @overload def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ... @overload def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc] + if sys.version_info >= (3, 15): @staticmethod @overload @@ -628,40 +677,51 @@ class str(Sequence[str]): @staticmethod @overload def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ... + @overload def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ... @overload def __add__(self, value: str, /) -> str: ... # type: ignore[misc] + # Incompatible with Sequence.__contains__ def __contains__(self, key: str, /) -> bool: ... # type: ignore[override] def __eq__(self, value: object, /) -> bool: ... def __ge__(self, value: str, /) -> bool: ... + @overload def __getitem__(self: LiteralString, key: SupportsIndex | slice[SupportsIndex | None], /) -> LiteralString: ... @overload def __getitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> str: ... # type: ignore[misc] + def __gt__(self, value: str, /) -> bool: ... def __hash__(self) -> int: ... + @overload def __iter__(self: LiteralString) -> Iterator[LiteralString]: ... @overload def __iter__(self) -> Iterator[str]: ... # type: ignore[misc] + def __le__(self, value: str, /) -> bool: ... def __len__(self) -> int: ... def __lt__(self, value: str, /) -> bool: ... + @overload def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ... @overload def __mod__(self, value: Any, /) -> str: ... + @overload def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ... @overload def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc] + def __ne__(self, value: object, /) -> bool: ... + @overload def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ... @overload def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc] + def __getnewargs__(self) -> tuple[str]: ... def __format__(self, format_spec: str, /) -> str: ... @@ -673,6 +733,7 @@ class bytes(Sequence[int]): def __new__(cls, string: str, /, encoding: str, errors: str = "strict") -> Self: ... @overload def __new__(cls) -> Self: ... + def capitalize(self) -> bytes: ... def center(self, width: SupportsIndex, fillchar: bytes = b" ", /) -> bytes: ... def count( @@ -739,6 +800,7 @@ class bytes(Sequence[int]): def translate(self, table: ReadableBuffer | None, /, delete: ReadableBuffer = b"") -> bytes: ... def upper(self) -> bytes: ... def zfill(self, width: SupportsIndex, /) -> bytes: ... + if sys.version_info >= (3, 14): @classmethod def fromhex(cls, string: str | ReadableBuffer, /) -> Self: ... @@ -751,10 +813,12 @@ class bytes(Sequence[int]): def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... def __hash__(self) -> int: ... + @overload def __getitem__(self, key: SupportsIndex, /) -> int: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytes: ... + def __add__(self, value: ReadableBuffer, /) -> bytes: ... def __mul__(self, value: SupportsIndex, /) -> bytes: ... def __rmul__(self, value: SupportsIndex, /) -> bytes: ... @@ -781,6 +845,7 @@ class bytearray(MutableSequence[int]): def __init__(self, ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer, /) -> None: ... @overload def __init__(self, string: str, /, encoding: str, errors: str = "strict") -> None: ... + def append(self, item: SupportsIndex, /) -> None: ... def capitalize(self) -> bytearray: ... def center(self, width: SupportsIndex, fillchar: bytes = b" ", /) -> bytearray: ... @@ -856,6 +921,7 @@ class bytearray(MutableSequence[int]): def upper(self) -> bytearray: ... def zfill(self, width: SupportsIndex, /) -> bytearray: ... + if sys.version_info >= (3, 14): @classmethod def fromhex(cls, string: str | ReadableBuffer, /) -> Self: ... @@ -868,14 +934,17 @@ class bytearray(MutableSequence[int]): def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... __hash__: ClassVar[None] # type: ignore[assignment] + @overload def __getitem__(self, key: SupportsIndex, /) -> int: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytearray: ... + @overload def __setitem__(self, key: SupportsIndex, value: SupportsIndex, /) -> None: ... @overload def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[SupportsIndex] | bytes, /) -> None: ... + def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> None: ... def __add__(self, value: ReadableBuffer, /) -> bytearray: ... # The superclass wants us to accept Iterable[int], but that fails at runtime. @@ -937,6 +1006,7 @@ class memoryview(Sequence[_I]): exc_tb: TracebackType | None, /, ) -> None: ... + @overload def cast(self, format: Literal["c", "@c"], shape: list[int] | tuple[int, ...] = ...) -> memoryview[bytes]: ... @overload @@ -945,19 +1015,23 @@ class memoryview(Sequence[_I]): def cast(self, format: Literal["?"], shape: list[int] | tuple[int, ...] = ...) -> memoryview[bool]: ... @overload def cast(self, format: _IntegerFormats, shape: list[int] | tuple[int, ...] = ...) -> memoryview: ... + @overload def __getitem__(self, key: SupportsIndex | tuple[SupportsIndex, ...], /) -> _I: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> memoryview[_I]: ... + def __contains__(self, x: object, /) -> bool: ... def __iter__(self) -> Iterator[_I]: ... def __len__(self) -> int: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... + @overload def __setitem__(self, key: slice[SupportsIndex | None], value: ReadableBuffer, /) -> None: ... @overload def __setitem__(self, key: SupportsIndex | tuple[SupportsIndex, ...], value: _I, /) -> None: ... + def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ... def tolist(self) -> list[int]: ... def toreadonly(self) -> memoryview: ... @@ -980,32 +1054,39 @@ class memoryview(Sequence[_I]): @final class bool(int): def __new__(cls, o: object = False, /) -> Self: ... + # The following overloads could be represented more elegantly with a TypeVar("_B", bool, int), # however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880). @overload def __and__(self, value: bool, /) -> bool: ... @overload def __and__(self, value: int, /) -> int: ... + @overload def __or__(self, value: bool, /) -> bool: ... @overload def __or__(self, value: int, /) -> int: ... + @overload def __xor__(self, value: bool, /) -> bool: ... @overload def __xor__(self, value: int, /) -> int: ... + @overload def __rand__(self, value: bool, /) -> bool: ... @overload def __rand__(self, value: int, /) -> int: ... + @overload def __ror__(self, value: bool, /) -> bool: ... @overload def __ror__(self, value: int, /) -> int: ... + @overload def __rxor__(self, value: bool, /) -> bool: ... @overload def __rxor__(self, value: int, /) -> int: ... + def __getnewargs__(self) -> tuple[int]: ... @deprecated("Will throw an error in Python 3.16. Use `not` for logical negation of bools instead.") def __invert__(self) -> int: ... @@ -1018,6 +1099,7 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]): def step(self) -> _StepT_co: ... @property def stop(self) -> _StopT_co: ... + # Note: __new__ overloads map `None` to `Any`, since users expect slice(x, None) # to be compatible with slice(None, x). # generic slice -------------------------------------------------------------------- @@ -1042,6 +1124,7 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]): def __new__(cls, start: None, stop: _T2, step: _T3, /) -> slice[Any, _T2, _T3]: ... @overload def __new__(cls, start: _T1, stop: _T2, step: _T3, /) -> slice[_T1, _T2, _T3]: ... + def __eq__(self, value: object, /) -> bool: ... if sys.version_info >= (3, 12): def __hash__(self) -> int: ... @@ -1057,10 +1140,12 @@ class tuple(Sequence[_T_co]): def __new__(cls, iterable: Iterable[_T_co] = (), /) -> Self: ... def __len__(self) -> int: ... def __contains__(self, key: object, /) -> bool: ... + @overload def __getitem__(self, key: SupportsIndex, /) -> _T_co: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> tuple[_T_co, ...]: ... + def __iter__(self) -> Iterator[_T_co]: ... def __lt__(self, value: tuple[_T_co, ...], /) -> bool: ... def __le__(self, value: tuple[_T_co, ...], /) -> bool: ... @@ -1068,10 +1153,12 @@ class tuple(Sequence[_T_co]): def __ge__(self, value: tuple[_T_co, ...], /) -> bool: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... + @overload def __add__(self, value: tuple[_T_co, ...], /) -> tuple[_T_co, ...]: ... @overload def __add__(self, value: tuple[_T, ...], /) -> tuple[_T_co | _T, ...]: ... + def __mul__(self, value: SupportsIndex, /) -> tuple[_T_co, ...]: ... def __rmul__(self, value: SupportsIndex, /) -> tuple[_T_co, ...]: ... def count(self, value: Any, /) -> int: ... @@ -1134,6 +1221,7 @@ class list(MutableSequence[_T]): def __init__(self) -> None: ... @overload def __init__(self, iterable: Iterable[_T], /) -> None: ... + def copy(self) -> list[_T]: ... def append(self, object: _T, /) -> None: ... def extend(self, iterable: Iterable[_T], /) -> None: ... @@ -1144,6 +1232,7 @@ class list(MutableSequence[_T]): def count(self, value: _T, /) -> int: ... def insert(self, index: SupportsIndex, object: _T, /) -> None: ... def remove(self, value: _T, /) -> None: ... + # Signature of `list.sort` should be kept inline with `collections.UserList.sort()` # and multiprocessing.managers.ListProxy.sort() # @@ -1153,23 +1242,29 @@ class list(MutableSequence[_T]): def sort(self: list[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ... @overload def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ... + def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... __hash__: ClassVar[None] # type: ignore[assignment] + @overload def __getitem__(self, i: SupportsIndex, /) -> _T: ... @overload def __getitem__(self, s: slice[SupportsIndex | None], /) -> list[_T]: ... + @overload def __setitem__(self, key: SupportsIndex, value: _T, /) -> None: ... @overload def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[_T], /) -> None: ... + def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> None: ... + # Overloading looks unnecessary, but is needed to work around complex mypy problems @overload def __add__(self, value: list[_T], /) -> list[_T]: ... @overload def __add__(self, value: list[_S], /) -> list[_S | _T]: ... + def __iadd__(self, value: Iterable[_T], /) -> Self: ... # type: ignore[misc] def __mul__(self, value: SupportsIndex, /) -> list[_T]: ... def __rmul__(self, value: SupportsIndex, /) -> list[_T]: ... @@ -1215,11 +1310,13 @@ class dict(MutableMapping[_KT, _VT]): def __init__(self: dict[str, str], iterable: Iterable[list[str]], /) -> None: ... @overload def __init__(self: dict[bytes, bytes], iterable: Iterable[list[bytes]], /) -> None: ... + def __new__(cls, /, *args: Any, **kwargs: Any) -> Self: ... def copy(self) -> dict[_KT, _VT]: ... def keys(self) -> dict_keys[_KT, _VT]: ... def values(self) -> dict_values[_KT, _VT]: ... def items(self) -> dict_items[_KT, _VT]: ... + # Signature of `dict.fromkeys` should be kept identical to # `fromkeys` methods of `OrderedDict`/`ChainMap`/`UserDict` in `collections` # TODO: the true signature of `dict.fromkeys` is not expressible in the current type system. @@ -1230,6 +1327,7 @@ class dict(MutableMapping[_KT, _VT]): @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> dict[_T, _S]: ... + # Positional-only in dict, but not in MutableMapping @overload # type: ignore[override] def get(self, key: _KT, default: None = None, /) -> _VT | None: ... @@ -1237,12 +1335,14 @@ class dict(MutableMapping[_KT, _VT]): def get(self, key: _KT, default: _VT, /) -> _VT: ... @overload def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + @overload def pop(self, key: _KT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _VT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def __len__(self) -> int: ... def __getitem__(self, key: _KT, /) -> _VT: ... def __setitem__(self, key: _KT, value: _VT, /) -> None: ... @@ -1254,6 +1354,7 @@ class dict(MutableMapping[_KT, _VT]): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... if sys.version_info >= (3, 15): def __or__(self, value: dict[_T1, _T2] | frozendict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... @overload @@ -1261,6 +1362,7 @@ class dict(MutableMapping[_KT, _VT]): else: def __or__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... + # dict.__ior__ should be kept roughly in line with MutableMapping.update() @overload # type: ignore[misc] def __ior__(self, value: SupportsKeysAndGetItem[_KT, _VT], /) -> Self: ... @@ -1286,20 +1388,24 @@ if sys.version_info >= (3, 15): def __new__( cls: type[frozendict[str, _VT]], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT ) -> frozendict[str, _VT]: ... + def __init__(self) -> None: ... def copy(self) -> frozendict[_KT, _VT]: ... + @overload @classmethod def fromkeys(cls, iterable: Iterable[_T], value: None = None, /) -> frozendict[_T, Any | None]: ... @overload @classmethod def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> frozendict[_T, _S]: ... + @overload # type: ignore[override] def get(self, key: _KT, default: None = None, /) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT, /) -> _VT: ... @overload def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + def keys(self) -> dict_keys[_KT, _VT]: ... def values(self) -> dict_values[_KT, _VT]: ... def items(self) -> dict_items[_KT, _VT]: ... @@ -1310,6 +1416,7 @@ if sys.version_info >= (3, 15): def __hash__(self) -> int: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... def __or__(self, value: dict[_T1, _T2] | frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... @overload @@ -1321,6 +1428,7 @@ class set(MutableSet[_T]): def __init__(self) -> None: ... @overload def __init__(self, iterable: Iterable[_T], /) -> None: ... + def add(self, element: _T, /) -> None: ... def copy(self) -> set[_T]: ... def difference(self, *s: Iterable[object]) -> set[_T]: ... @@ -1361,6 +1469,7 @@ class frozenset(AbstractSet[_T_co]): def __new__(cls) -> Self: ... @overload def __new__(cls, iterable: Iterable[_T_co], /) -> Self: ... + def copy(self) -> frozenset[_T_co]: ... def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ... def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ... @@ -1399,10 +1508,12 @@ class range(Sequence[int]): def stop(self) -> int: ... @property def step(self) -> int: ... + @overload def __new__(cls, stop: SupportsIndex, /) -> Self: ... @overload def __new__(cls, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = 1, /) -> Self: ... + def count(self, value: int, /) -> int: ... def index(self, value: int, /) -> int: ... # type: ignore[override] def __len__(self) -> int: ... @@ -1410,10 +1521,12 @@ class range(Sequence[int]): def __hash__(self) -> int: ... def __contains__(self, key: object, /) -> bool: ... def __iter__(self) -> Iterator[int]: ... + @overload def __getitem__(self, key: SupportsIndex, /) -> int: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> range: ... + def __reversed__(self) -> Iterator[int]: ... @disjoint_base @@ -1435,10 +1548,12 @@ class property: def getter(self, fget: Callable[[Any], Any], /) -> property: ... def setter(self, fset: Callable[[Any, Any], None], /) -> property: ... def deleter(self, fdel: Callable[[Any], None], /) -> property: ... + @overload def __get__(self, instance: None, owner: type, /) -> Self: ... @overload def __get__(self, instance: Any, owner: type | None = None, /) -> Any: ... + def __set__(self, instance: Any, value: Any, /) -> None: ... def __delete__(self, instance: Any, /) -> None: ... @@ -1457,6 +1572,7 @@ def breakpoint(*args: Any, **kws: Any) -> None: ... def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ... def chr(i: SupportsIndex, /) -> str: ... def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ... + @type_check_only class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]): def __anext__(self) -> _AwaitableT_co: ... @@ -1520,7 +1636,6 @@ if sys.version_info >= (3, 15): module: str | None = None, _feature_version: int = -1, ) -> Any: ... - else: @overload def compile( @@ -1571,6 +1686,7 @@ credits: _sitebuiltins._Printer def delattr(obj: object, name: str, /) -> None: ... def dir(o: object = ..., /) -> list[str]: ... + @overload def divmod(x: SupportsDivMod[_T_contra, _T_co], y: _T_contra, /) -> _T_co: ... @overload @@ -1653,10 +1769,12 @@ class filter(Generic[_T]): def __new__(cls, function: Callable[[_S], TypeIs[_T]], iterable: Iterable[_S], /) -> Self: ... @overload def __new__(cls, function: Callable[[_T], Any], iterable: Iterable[_T], /) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T: ... def format(value: object, format_spec: str = "", /) -> str: ... + @overload def getattr(o: object, name: str, /) -> Any: ... @@ -1673,6 +1791,7 @@ def getattr(o: object, name: str, default: list[Any], /) -> Any | list[Any]: ... def getattr(o: object, name: str, default: dict[Any, Any], /) -> Any | dict[Any, Any]: ... @overload def getattr(o: object, name: str, default: _T, /) -> Any | _T: ... + def globals() -> dict[str, Any]: ... def hasattr(obj: object, name: str, /) -> bool: ... def hash(obj: object, /) -> int: ... @@ -1687,6 +1806,7 @@ else: def id(obj: object, /) -> int: ... def input(prompt: object = "", /) -> str: ... + @type_check_only class _GetItemIterable(Protocol[_T_co]): def __getitem__(self, i: int, /) -> _T_co: ... @@ -1709,6 +1829,7 @@ def len(obj: Sized, /) -> int: ... license: _sitebuiltins._Printer def locals() -> dict[str, Any]: ... + @disjoint_base class map(Generic[_S]): # 3.14 adds `strict` argument. @@ -1830,6 +1951,7 @@ def max(iterable: Iterable[_T], /, *, key: Callable[[_T], SupportsRichComparison def max(iterable: Iterable[SupportsRichComparisonT], /, *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ... @overload def max(iterable: Iterable[_T1], /, *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ... + @overload def min( arg1: SupportsRichComparisonT, arg2: SupportsRichComparisonT, /, *_args: SupportsRichComparisonT, key: None = None @@ -1844,6 +1966,7 @@ def min(iterable: Iterable[_T], /, *, key: Callable[[_T], SupportsRichComparison def min(iterable: Iterable[SupportsRichComparisonT], /, *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ... @overload def min(iterable: Iterable[_T1], /, *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ... + @overload def next(i: SupportsNext[_T], /) -> _T: ... @overload @@ -1943,7 +2066,9 @@ def open( closefd: bool = True, opener: _Opener | None = None, ) -> IO[Any]: ... + def ord(c: str | bytes | bytearray, /) -> int: ... + @type_check_only class _SupportsWriteAndFlush(SupportsWrite[_T_contra], SupportsFlush, Protocol[_T_contra]): ... @@ -2027,6 +2152,7 @@ class reversed(Generic[_T]): def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc] @overload def __new__(cls, sequence: SupportsLenAndGetItem[_T], /) -> Iterator[_T]: ... # type: ignore[misc] + def __iter__(self) -> Self: ... def __next__(self) -> _T: ... def __length_hint__(self) -> int: ... @@ -2097,6 +2223,7 @@ def sum(iterable: Iterable[_AddableT1], /, start: _AddableT2) -> _AddableT1 | _A def vars(object: type, /) -> types.MappingProxyType[str, Any]: ... @overload def vars(object: Any = ..., /) -> dict[str, Any]: ... + @disjoint_base class zip(Generic[_T_co]): @overload @@ -2138,6 +2265,7 @@ class zip(Generic[_T_co]): *iterables: Iterable[Any], strict: bool = False, ) -> zip[tuple[Any, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... @@ -2370,6 +2498,7 @@ if sys.version_info >= (3, 11): def message(self) -> str: ... @property def exceptions(self) -> tuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]: ... + @overload def subgroup( self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], / @@ -2382,6 +2511,7 @@ if sys.version_info >= (3, 11): def subgroup( self, matcher_value: Callable[[_BaseExceptionT_co | Self], bool], / ) -> BaseExceptionGroup[_BaseExceptionT_co] | None: ... + @overload def split( self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], / @@ -2394,11 +2524,13 @@ if sys.version_info >= (3, 11): def split( self, matcher_value: Callable[[_BaseExceptionT_co | Self], bool], / ) -> tuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ... + # In reality it is `NonEmptySequence`: @overload def derive(self, excs: Sequence[_ExceptionT], /) -> ExceptionGroup[_ExceptionT]: ... @overload def derive(self, excs: Sequence[_BaseExceptionT], /) -> BaseExceptionGroup[_BaseExceptionT]: ... + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... class ExceptionGroup(BaseExceptionGroup[_ExceptionT_co], Exception): @@ -2406,6 +2538,7 @@ if sys.version_info >= (3, 11): def __init__(self, message: str, exceptions: Sequence[_ExceptionT_co], /) -> None: ... @property def exceptions(self) -> tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]: ... + # We accept a narrower type, but that's OK. @overload # type: ignore[override] def subgroup( @@ -2415,6 +2548,7 @@ if sys.version_info >= (3, 11): def subgroup( self, matcher_value: Callable[[_ExceptionT_co | Self], bool], / ) -> ExceptionGroup[_ExceptionT_co] | None: ... + @overload # type: ignore[override] def split( self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], / diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index 9660ffd53fbb..fec6b30af2f5 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -100,6 +100,7 @@ def open( class BZ2File(BaseStream, IO[bytes]): def __enter__(self) -> Self: ... + @overload def __init__(self, filename: _WritableFileobj, mode: _WriteBinaryMode, *, compresslevel: int = 9) -> None: ... @overload @@ -108,6 +109,7 @@ class BZ2File(BaseStream, IO[bytes]): def __init__( self, filename: StrOrBytesPath, mode: _ReadBinaryMode | _WriteBinaryMode = "r", *, compresslevel: int = 9 ) -> None: ... + def read(self, size: int | None = -1) -> bytes: ... def read1(self, size: int = -1) -> bytes: ... def readline(self, size: SupportsIndex = -1) -> bytes: ... # type: ignore[override] diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 3971c0b5a967..45c0c7b8346c 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -163,19 +163,23 @@ def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... class _localized_month: format: str def __init__(self, format: str) -> None: ... + @overload def __getitem__(self, i: int) -> str: ... @overload def __getitem__(self, i: slice) -> list[str]: ... + def __len__(self) -> int: ... class _localized_day: format: str def __init__(self, format: str) -> None: ... + @overload def __getitem__(self, i: int) -> str: ... @overload def __getitem__(self, i: slice) -> list[str]: ... + def __len__(self) -> int: ... day_name: _localized_day diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 0f9d4343b630..b7f88ded315f 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -32,6 +32,7 @@ def parse( def parse_multipart( fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&" ) -> dict[str, list[Any]]: ... + @type_check_only class _Environ(Protocol): def __getitem__(self, k: str, /) -> str: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index 4927267e3ed7..b341d0f813c4 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -185,10 +185,12 @@ else: def getencoder(encoding: str) -> _Encoder: ... def getdecoder(encoding: str) -> _Decoder: ... def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ... + @overload def getincrementaldecoder(encoding: _BufferedEncoding) -> _BufferedIncrementalDecoder: ... @overload def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... + def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... @deprecated("Deprecated since Python 3.14. Use `open()` instead.") diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 699d4544bf4a..d9c2e342c587 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -43,6 +43,7 @@ def namedtuple( class UserDict(MutableMapping[_KT, _VT]): data: dict[_KT, _VT] + # __init__ should be kept roughly in line with `dict.__init__`, which has the same semantics @overload def __init__(self, dict: None = None, /) -> None: ... @@ -72,6 +73,7 @@ class UserDict(MutableMapping[_KT, _VT]): def __init__(self: UserDict[str, str], iterable: Iterable[list[str]], /) -> None: ... @overload def __init__(self: UserDict[bytes, bytes], iterable: Iterable[list[bytes]], /) -> None: ... + def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, item: _VT) -> None: ... @@ -90,19 +92,23 @@ class UserDict(MutableMapping[_KT, _VT]): @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ... + @overload def __or__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ... @overload def __or__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ... @overload def __ror__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ... + # UserDict.__ior__ should be kept roughly in line with MutableMapping.update() @overload # type: ignore[misc] def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... @overload def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... + if sys.version_info >= (3, 12): @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @@ -113,10 +119,12 @@ class UserDict(MutableMapping[_KT, _VT]): class UserList(MutableSequence[_T]): data: list[_T] + @overload def __init__(self, initlist: None = None) -> None: ... @overload def __init__(self, initlist: Iterable[_T]) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... def __le__(self, other: list[_T] | UserList[_T]) -> bool: ... @@ -125,14 +133,17 @@ class UserList(MutableSequence[_T]): def __eq__(self, other: object) -> bool: ... def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... + @overload def __getitem__(self, i: SupportsIndex) -> _T: ... @overload def __getitem__(self, i: slice[SupportsIndex | None]) -> Self: ... + @overload def __setitem__(self, i: SupportsIndex, item: _T) -> None: ... @overload def __setitem__(self, i: slice[SupportsIndex | None], item: Iterable[_T]) -> None: ... + def __delitem__(self, i: SupportsIndex | slice[SupportsIndex | None]) -> None: ... def __add__(self, other: Iterable[_T]) -> Self: ... def __radd__(self, other: Iterable[_T]) -> Self: ... @@ -151,11 +162,13 @@ class UserList(MutableSequence[_T]): # to `list.index`. In order to give more precise types, we pretend that the # `item` argument is positional-only. def index(self, item: _T, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int: ... + # All arguments are passed to `list.sort` at runtime, so the signature should be kept in line with `list.sort`. @overload def sort(self: UserList[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ... @overload def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ... + def extend(self, other: Iterable[_T]) -> None: ... class UserString(Sequence[UserString]): @@ -234,10 +247,12 @@ class UserString(Sequence[UserString]): class deque(MutableSequence[_T]): @property def maxlen(self) -> int | None: ... + @overload def __init__(self, *, maxlen: int | None = None) -> None: ... @overload def __init__(self, iterable: Iterable[_T], maxlen: int | None = None) -> None: ... + def append(self, x: _T, /) -> None: ... def appendleft(self, x: _T, /) -> None: ... def copy(self) -> Self: ... @@ -279,17 +294,20 @@ class Counter(dict[_T, int], Generic[_T]): def __init__(self, mapping: SupportsKeysAndGetItem[_T, int], /) -> None: ... @overload def __init__(self, iterable: Iterable[_T], /) -> None: ... + def copy(self) -> Self: ... def elements(self) -> Iterator[_T]: ... def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: ... @classmethod def fromkeys(cls, iterable: Any, v: int | None = None) -> NoReturn: ... # type: ignore[override] + @overload def subtract(self, iterable: None = None, /) -> None: ... @overload def subtract(self, mapping: Mapping[_T, int], /) -> None: ... @overload def subtract(self, iterable: Iterable[_T], /) -> None: ... + # Unlike dict.update(), use Mapping instead of SupportsKeysAndGetItem for the first overload # (source code does an `isinstance(other, Mapping)` check) # @@ -302,6 +320,7 @@ class Counter(dict[_T, int], Generic[_T]): def update(self, iterable: Iterable[_T], /, **kwargs: int) -> None: ... @overload def update(self, iterable: None = None, /, **kwargs: int) -> None: ... + def total(self) -> int: ... def __missing__(self, key: _T) -> int: ... def __delitem__(self, elem: object) -> None: ... @@ -367,6 +386,7 @@ class OrderedDict(dict[_KT, _VT]): def keys(self) -> _odict_keys[_KT, _VT]: ... def items(self) -> _odict_items[_KT, _VT]: ... def values(self) -> _odict_values[_KT, _VT]: ... + # The signature of OrderedDict.fromkeys should be kept in line with `dict.fromkeys`, modulo positional-only differences. # Like dict.fromkeys, its true signature is not expressible in the current type system. # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @@ -376,11 +396,13 @@ class OrderedDict(dict[_KT, _VT]): @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ... + # Keep OrderedDict.setdefault in line with MutableMapping.setdefault, modulo positional-only differences. @overload def setdefault(self: OrderedDict[_KT, _T | None], key: _KT, default: None = None) -> _T | None: ... @overload def setdefault(self, key: _KT, default: _VT) -> _VT: ... + # Same as dict.pop, but accepts keyword arguments @overload def pop(self, key: _KT) -> _VT: ... @@ -388,12 +410,15 @@ class OrderedDict(dict[_KT, _VT]): def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + def __eq__(self, value: object, /) -> bool: ... + if sys.version_info >= (3, 15): @overload def __or__(self, value: dict[_KT, _VT] | frozendict[_KT, _VT], /) -> Self: ... @overload def __or__(self, value: dict[_T1, _T2] | frozendict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ... + @overload # type: ignore[override] def __ror__(self, value: dict[_KT, _VT] | frozendict[_KT, _VT], /) -> Self: ... # type: ignore[override,misc] @overload @@ -405,6 +430,7 @@ class OrderedDict(dict[_KT, _VT]): def __or__(self, value: dict[_KT, _VT], /) -> Self: ... @overload def __or__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, value: dict[_KT, _VT], /) -> Self: ... @overload @@ -413,6 +439,7 @@ class OrderedDict(dict[_KT, _VT]): @disjoint_base class defaultdict(dict[_KT, _VT]): default_factory: Callable[[], _VT] | None + @overload def __init__(self) -> None: ... @overload @@ -446,15 +473,18 @@ class defaultdict(dict[_KT, _VT]): /, **kwargs: _VT, ) -> None: ... + def __missing__(self, key: _KT, /) -> _VT: ... def __copy__(self) -> Self: ... def copy(self) -> Self: ... + # defaultdict rejects frozendict in its direct __or__/__ror__ methods, even though dict accepts it. # See https://github.com/python/cpython/issues/149534. @overload # type: ignore[override] def __or__(self, value: dict[_KT, _VT], /) -> Self: ... @overload def __or__(self, value: dict[_T1, _T2], /) -> defaultdict[_KT | _T1, _VT | _T2]: ... + @overload # type: ignore[override] def __ror__(self, value: dict[_KT, _VT], /) -> Self: ... @overload @@ -472,25 +502,30 @@ class ChainMap(MutableMapping[_KT, _VT]): def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... def __contains__(self, key: object) -> bool: ... + @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT) -> _VT: ... @overload def get(self, key: _KT, default: _T) -> _VT | _T: ... + def __missing__(self, key: _KT) -> _VT: ... # undocumented def __bool__(self) -> bool: ... + # Keep ChainMap.setdefault in line with MutableMapping.setdefault, modulo positional-only differences. @overload def setdefault(self: ChainMap[_KT, _T | None], key: _KT, default: None = None) -> _T | None: ... @overload def setdefault(self, key: _KT, default: _VT) -> _VT: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + def copy(self) -> Self: ... __copy__ = copy # All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime, @@ -511,14 +546,17 @@ class ChainMap(MutableMapping[_KT, _VT]): @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> ChainMap[_T, _S]: ... + @overload def __or__(self, other: Mapping[_KT, _VT]) -> Self: ... @overload def __or__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, other: Mapping[_KT, _VT]) -> Self: ... @overload def __ror__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ... + # ChainMap.__ior__ should be kept roughly in line with MutableMapping.update() @overload # type: ignore[misc] def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... diff --git a/stdlib/compression/zstd/__init__.pyi b/stdlib/compression/zstd/__init__.pyi index acfbe4913b5d..8673c59a41c2 100644 --- a/stdlib/compression/zstd/__init__.pyi +++ b/stdlib/compression/zstd/__init__.pyi @@ -52,6 +52,7 @@ def compress( def decompress( data: ReadableBuffer, zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None, options: Mapping[int, int] | None = None ) -> bytes: ... + @final class CompressionParameter(enum.IntEnum): compression_level = _zstd.ZSTD_c_compressionLevel diff --git a/stdlib/compression/zstd/_zstdfile.pyi b/stdlib/compression/zstd/_zstdfile.pyi index 0c42e99e0d16..b16b43c1da0a 100644 --- a/stdlib/compression/zstd/_zstdfile.pyi +++ b/stdlib/compression/zstd/_zstdfile.pyi @@ -48,6 +48,7 @@ class ZstdFile(_streams.BaseStream): options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | tuple[ZstdDict, int] | None = None, ) -> None: ... + def write(self, data: ReadableBuffer, /) -> int: ... def flush(self, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 1) -> bytes: ... # type: ignore[override] def read(self, size: int | None = -1) -> bytes: ... diff --git a/stdlib/concurrent/futures/interpreter.pyi b/stdlib/concurrent/futures/interpreter.pyi index 7899521e12da..f6925806a5eb 100644 --- a/stdlib/concurrent/futures/interpreter.pyi +++ b/stdlib/concurrent/futures/interpreter.pyi @@ -25,6 +25,7 @@ if sys.version_info >= (3, 14): class WorkerContext(ThreadWorkerContext): interp: Interpreter | None results: Queue | None + @overload # type: ignore[override] @classmethod def prepare( @@ -33,6 +34,7 @@ if sys.version_info >= (3, 14): @overload @classmethod def prepare(cls, initializer: Callable[[], object], initargs: tuple[()]) -> tuple[Callable[[], Self], _TaskFunc]: ... + def __init__(self, initdata: _Task) -> None: ... def __del__(self) -> None: ... def run(self, task: _Task) -> None: ... # type: ignore[override] @@ -52,6 +54,7 @@ if sys.version_info >= (3, 14): def prepare_context( cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]] ) -> tuple[Callable[[], WorkerContext], _TaskFunc]: ... + @overload def __init__( self, diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index 7e0bdec8bd5d..685bf1cfc104 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -43,10 +43,12 @@ if sys.version_info >= (3, 14): def prepare( cls, initializer: Callable[[], object], initargs: tuple[()] ) -> tuple[Callable[[], Self], _ResolveTaskFunc]: ... + @overload def __init__(self, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]) -> None: ... @overload def __init__(self, initializer: Callable[[], object], initargs: tuple[()]) -> None: ... + def initialize(self) -> None: ... def finalize(self) -> None: ... def run(self, task: _Task) -> None: ... @@ -136,5 +138,6 @@ class ThreadPoolExecutor(Executor): initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]], ) -> None: ... + def _adjust_thread_count(self) -> None: ... def _initializer_failed(self) -> None: ... diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index a345d3a37e50..385336ec154a 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -269,6 +269,7 @@ class RawConfigParser(_Parser): def has_section(self, section: _SectionName) -> bool: ... def options(self, section: _SectionName) -> list[str]: ... def has_option(self, section: _SectionName, option: str) -> bool: ... + @overload def read(self, filenames: GenericPath[AnyStr], encoding: str | None = None) -> list[AnyStr]: ... @overload @@ -277,12 +278,14 @@ class RawConfigParser(_Parser): def read(self, filenames: Iterable[BytesPath], encoding: str | None = None) -> list[bytes]: ... @overload def read(self, filenames: Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str | bytes]: ... + def read_file(self, f: Iterable[str], source: str | None = None) -> None: ... def read_string(self, string: str, source: str = "") -> None: ... def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = "") -> None: ... if sys.version_info < (3, 12): @deprecated("Deprecated since Python 3.2; removed in Python 3.12. Use `parser.read_file()` instead.") def readfp(self, fp: Iterable[str], filename: str | None = None) -> None: ... + # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together @overload @@ -291,18 +294,21 @@ class RawConfigParser(_Parser): def getint( self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T ) -> int | _T: ... + @overload def getfloat(self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None) -> float: ... @overload def getfloat( self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T ) -> float | _T: ... + @overload def getboolean(self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool: ... @overload def getboolean( self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T ) -> bool | _T: ... + def _get_conv( self, section: _SectionName, @@ -313,6 +319,7 @@ class RawConfigParser(_Parser): vars: _Section | None = None, fallback: _T = ..., ) -> _T: ... + # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] def get(self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | MaybeNone: ... @@ -320,10 +327,12 @@ class RawConfigParser(_Parser): def get( self, section: _SectionName, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T ) -> str | _T | MaybeNone: ... + @overload def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ... @overload def items(self, section: _SectionName, raw: bool = False, vars: _Section | None = None) -> list[tuple[str, str]]: ... + def set(self, section: _SectionName, option: str, value: str | None = None) -> None: ... def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ... def remove_option(self, section: _SectionName, option: str) -> bool: ... @@ -357,6 +366,7 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... + # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] def get( @@ -380,20 +390,24 @@ class SectionProxy(MutableMapping[str, str]): _impl: Any | None = None, **kwargs: Any, # passed to the underlying parser's get() method ) -> 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 = False, vars: _Section | None = None) -> int | None: ... @overload def getint(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> int | _T: ... + @overload def getfloat(self, option: str, *, raw: bool = False, vars: _Section | None = None) -> float | None: ... @overload def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> float | _T: ... + @overload def getboolean(self, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool | None: ... @overload def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> bool | _T: ... + # SectionProxy can have arbitrary attributes when custom converters are used def __getattr__(self, key: str) -> Callable[..., Any]: ... diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 67f5a8b1be5c..b95c23502a8b 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -115,6 +115,7 @@ def asynccontextmanager(func: Callable[_P, AsyncGenerator[_T_co]]) -> Callable[_ "Use `-> AsyncGenerator[Foo]` instead." ) def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ... + @type_check_only class _SupportsClose(Protocol): def close(self) -> object: ... @@ -202,10 +203,12 @@ class AsyncExitStack(_BaseExitStackAbstract[_ExitT_co]): class nullcontext(AbstractContextManager[_T, None], AbstractAsyncContextManager[_T, None]): enter_result: _T + @overload def __init__(self: nullcontext[None]) -> None: ... @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 + def __enter__(self) -> _T: ... def __exit__(self, *exctype: Unused) -> None: ... async def __aenter__(self) -> _T: ... diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 24c1c54bba5a..f8ab5f000a04 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -76,6 +76,7 @@ class DictReader(Generic[_T]): reader: Reader dialect: _DialectLike line_num: int + @overload def __init__( self, @@ -112,6 +113,7 @@ class DictReader(Generic[_T]): quoting: _QuotingType = 0, strict: bool = False, ) -> None: ... + def __iter__(self) -> Self: ... def __next__(self) -> dict[_T | Any, str | Any]: ... if sys.version_info >= (3, 12): diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 41fc4d7f25eb..7eee1b760063 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -50,6 +50,7 @@ if sys.version_info >= (3, 14): def POINTER(cls: None) -> type[c_void_p]: ... @overload def POINTER(cls: type[_CT]) -> type[_Pointer[_CT]]: ... + def pointer(obj: _CT) -> _Pointer[_CT]: ... else: diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index f24ff6a3dd50..1a7b8fd64558 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -64,6 +64,7 @@ class KW_ONLY: ... def asdict(obj: DataclassInstance) -> dict[str, Any]: ... @overload def asdict(obj: DataclassInstance, *, dict_factory: Callable[[list[tuple[str, Any]]], _T]) -> _T: ... + @overload def astuple(obj: DataclassInstance) -> tuple[Any, ...]: ... @overload @@ -102,7 +103,6 @@ if sys.version_info >= (3, 11): slots: bool = False, weakref_slot: bool = False, ) -> Callable[[type[_T]], type[_T]]: ... - else: @overload def dataclass( @@ -256,7 +256,6 @@ if sys.version_info >= (3, 14): kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ..., doc: str | None = None, ) -> Any: ... - else: @overload # `default` and `default_factory` are optional and mutually exclusive. def field( @@ -311,6 +310,7 @@ class InitVar(Generic[_T]): __slots__ = ("type",) type: Type[_T] def __init__(self, type: Type[_T]) -> None: ... + @overload def __class_getitem__(cls, type: Type[_T]) -> InitVar[_T]: ... # pyright: ignore[reportInvalidTypeForm] @overload diff --git a/stdlib/datetime.pyi b/stdlib/datetime.pyi index 5b109d922f3a..95c62a9c1b71 100644 --- a/stdlib/datetime.pyi +++ b/stdlib/datetime.pyi @@ -63,6 +63,7 @@ class date: def today(cls) -> Self: ... @classmethod def fromordinal(cls, n: int, /) -> Self: ... + if sys.version_info >= (3, 15): @classmethod def fromisoformat(cls, string: str, /) -> Self: ... @@ -111,12 +112,14 @@ class date: def __eq__(self, value: object, /) -> bool: ... def __add__(self, value: timedelta, /) -> Self: ... def __radd__(self, value: timedelta, /) -> Self: ... + @overload def __sub__(self, value: datetime, /) -> NoReturn: ... @overload def __sub__(self, value: Self, /) -> timedelta: ... @overload def __sub__(self, value: timedelta, /) -> Self: ... + def __hash__(self) -> int: ... def weekday(self) -> int: ... def isoweekday(self) -> int: ... @@ -156,6 +159,7 @@ class time: def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... def isoformat(self, timespec: str = "auto") -> str: ... + if sys.version_info >= (3, 15): @classmethod def fromisoformat(cls, string: str, /) -> Self: ... @@ -241,14 +245,17 @@ class timedelta: def __abs__(self) -> timedelta: ... def __mul__(self, value: float, /) -> timedelta: ... def __rmul__(self, value: float, /) -> timedelta: ... + @overload def __floordiv__(self, value: timedelta, /) -> int: ... @overload def __floordiv__(self, value: int, /) -> timedelta: ... + @overload def __truediv__(self, value: timedelta, /) -> float: ... @overload def __truediv__(self, value: float, /) -> timedelta: ... + def __mod__(self, value: timedelta, /) -> timedelta: ... def __divmod__(self, value: timedelta, /) -> tuple[int, timedelta]: ... def __le__(self, value: timedelta, /) -> bool: ... @@ -348,6 +355,7 @@ class datetime(date): ) -> Self: ... def astimezone(self, tz: _TzInfo | None = None) -> Self: ... def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ... + if sys.version_info >= (3, 15): @classmethod def strptime(cls, string: str, format: str, /) -> Self: ... @@ -364,6 +372,7 @@ class datetime(date): def __gt__(self, value: datetime, /) -> bool: ... # type: ignore[override] def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... + @overload # type: ignore[override] def __sub__(self, value: Self, /) -> timedelta: ... @overload diff --git a/stdlib/decimal.pyi b/stdlib/decimal.pyi index 42cc2ff4eafb..f16fa8aaae31 100644 --- a/stdlib/decimal.pyi +++ b/stdlib/decimal.pyi @@ -118,10 +118,12 @@ class Decimal: def imag(self) -> Decimal: ... def conjugate(self) -> Decimal: ... def __complex__(self) -> complex: ... + @overload def __round__(self) -> int: ... @overload def __round__(self, ndigits: int, /) -> Decimal: ... + def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 4ab59ac637b2..a3bda7f9b2d0 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -39,6 +39,7 @@ class SequenceMatcher(Generic[_T]): b: Sequence[str] = "", autojunk: bool = True, ) -> None: ... + def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... def set_seq1(self, a: Sequence[_T]) -> None: ... def set_seq2(self, b: Sequence[_T]) -> None: ... diff --git a/stdlib/distutils/archive_util.pyi b/stdlib/distutils/archive_util.pyi index 16684ff06956..5de23bad6bdb 100644 --- a/stdlib/distutils/archive_util.pyi +++ b/stdlib/distutils/archive_util.pyi @@ -23,6 +23,7 @@ def make_archive( owner: str | None = None, group: str | None = None, ) -> str: ... + def make_tarball( base_name: str, base_dir: StrPath, diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index ef81e807a5db..83bbada6c4c4 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -148,29 +148,35 @@ class CCompiler: extra_preargs: list[str] | None = None, extra_postargs: list[str] | None = None, ) -> None: ... + @overload def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ... @overload def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ... + def library_filename( self, libname: str, lib_type: str = "static", strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath = "" ) -> str: ... def object_filenames( self, source_filenames: Iterable[StrPath], strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath | None = "" ) -> list[str]: ... + @overload def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ... @overload def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ... + def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> 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: ... @overload def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ... + def announce(self, msg: str, level: int = 1) -> None: ... def warn(self, msg: str) -> None: ... def debug_print(self, msg: str) -> None: ... diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index 7f97bc3a2c9e..35b991aba088 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -49,6 +49,7 @@ class Command: def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... + # NOTE: This list comes directly from the distutils/command folder. Minus bdist_msi and bdist_wininst. @overload def get_finalized_command(self, command: Literal["bdist"], create: bool | Literal[0, 1] = 1) -> bdist: ... @@ -94,6 +95,7 @@ class Command: def get_finalized_command(self, command: Literal["upload"], create: bool | Literal[0, 1] = 1) -> upload: ... @overload def get_finalized_command(self, command: str, create: bool | Literal[0, 1] = 1) -> Command: ... + @overload def reinitialize_command(self, command: Literal["bdist"], reinit_subcommands: bool | Literal[0, 1] = 0) -> bdist: ... @overload @@ -154,6 +156,7 @@ class Command: def reinitialize_command(self, command: str, reinit_subcommands: bool | Literal[0, 1] = 0) -> Command: ... @overload def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool | Literal[0, 1] = 0) -> _CommandT: ... + def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... @@ -161,6 +164,7 @@ class Command: self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... + @overload def copy_file( self, @@ -181,6 +185,7 @@ class Command: link: str | None = None, level: Unused = 1, ) -> tuple[_BytesPathT | bytes, bool]: ... + def copy_tree( self, infile: StrPath, @@ -190,11 +195,14 @@ class Command: preserve_symlinks: bool | Literal[0, 1] = 0, level: Unused = 1, ) -> list[str]: ... + @overload 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 | Literal[0, 1] = 1, level: Unused = 1) -> None: ... + @overload def make_archive( self, @@ -215,6 +223,7 @@ class Command: owner: str | None = None, group: str | None = None, ) -> str: ... + def make_file( self, infiles: str | list[str] | tuple[str, ...], diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index b4283c9a013c..58650e853cce 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -121,6 +121,7 @@ class Distribution: def print_commands(self) -> None: ... def get_command_list(self): ... def get_command_packages(self): ... + # NOTE: This list comes directly from the distutils/command folder. Minus bdist_msi and bdist_wininst. @overload def get_command_obj(self, command: Literal["bdist"], create: Literal[1, True] = 1) -> bdist: ... @@ -167,6 +168,7 @@ class Distribution: # Not replicating the overloads for "Command | None", user may use "isinstance" @overload def get_command_obj(self, command: str, create: Literal[0, False]) -> Command | None: ... + @overload def get_command_class(self, command: Literal["bdist"]) -> type[bdist]: ... @overload @@ -209,6 +211,7 @@ class Distribution: def get_command_class(self, command: Literal["upload"]) -> type[upload]: ... @overload def get_command_class(self, command: str) -> type[Command]: ... + @overload def reinitialize_command(self, command: Literal["bdist"], reinit_subcommands: bool = False) -> bdist: ... @overload @@ -255,6 +258,7 @@ class Distribution: def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ... @overload def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ... + def announce(self, msg, level: int = 2) -> None: ... def run_commands(self) -> None: ... def run_command(self, command: str) -> None: ... diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index 29c052365628..676ce1bea313 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -12,6 +12,7 @@ longopt_xlate: Final[dict[int, int]] class FancyGetopt: def __init__(self, option_table: list[_Option] | None = None) -> None: ... + # TODO: kinda wrong, `getopt(object=object())` is invalid @overload def getopt( @@ -21,6 +22,7 @@ class FancyGetopt: def getopt( self, args: _SliceableT[_StrSequenceT_co] | None, object: Any ) -> _StrSequenceT_co: ... # object is an arbitrary non-slotted object + def get_option_order(self) -> list[tuple[str, str]]: ... def generate_help(self, header: str | None = None) -> list[str]: ... diff --git a/stdlib/distutils/file_util.pyi b/stdlib/distutils/file_util.pyi index c763f91a958d..9d5bf5080b05 100644 --- a/stdlib/distutils/file_util.pyi +++ b/stdlib/distutils/file_util.pyi @@ -27,6 +27,7 @@ def copy_file( verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0, ) -> tuple[_BytesPathT | bytes, bool]: ... + @overload def move_file( src: StrPath, dst: _StrPathT, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0 @@ -35,4 +36,5 @@ def move_file( def move_file( src: BytesPath, dst: _BytesPathT, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0 ) -> _BytesPathT | bytes: ... + def write_file(filename: StrOrBytesPath, contents: Iterable[str]) -> None: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 607a78a1fbac..c3347fe7d1d2 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -15,6 +15,7 @@ class FileList: def sort(self) -> None: ... def remove_duplicates(self) -> None: ... def process_template_line(self, line: str) -> None: ... + @overload def include_pattern( self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 @@ -29,6 +30,7 @@ class FileList: prefix: str | None = None, is_regex: bool | Literal[0, 1] = 0, ) -> bool: ... + @overload def exclude_pattern( self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 @@ -46,6 +48,7 @@ class FileList: def findall(dir: str = ".") -> list[str]: ... def glob_to_re(pattern: str) -> str: ... + @overload def translate_pattern( pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[False, 0] = 0 diff --git a/stdlib/distutils/sysconfig.pyi b/stdlib/distutils/sysconfig.pyi index 0ed567b98d74..7c8e0e7b149e 100644 --- a/stdlib/distutils/sysconfig.pyi +++ b/stdlib/distutils/sysconfig.pyi @@ -11,15 +11,18 @@ project_base: Final[str] python_build: Final[bool] def expand_makefile_vars(s: str, vars: Mapping[str, str]) -> str: ... + @overload @deprecated("SO is deprecated, use EXT_SUFFIX. Support is removed in Python 3.11") def get_config_var(name: Literal["SO"]) -> int | str | None: ... @overload def get_config_var(name: str) -> int | str | None: ... + @overload def get_config_vars() -> dict[str, str | int]: ... @overload def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ... + def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... def get_python_inc(plat_specific: bool | Literal[0, 1] = 0, prefix: str | None = None) -> str: ... diff --git a/stdlib/email/__init__.pyi b/stdlib/email/__init__.pyi index 7aa977709b05..aabdca32d506 100644 --- a/stdlib/email/__init__.pyi +++ b/stdlib/email/__init__.pyi @@ -37,6 +37,7 @@ def message_from_string(s: str) -> Message: ... def message_from_string(s: str, _class: Callable[[], _MessageT]) -> _MessageT: ... @overload def message_from_string(s: str, _class: Callable[[], _MessageT] = ..., *, policy: Policy[_MessageT]) -> _MessageT: ... + @overload def message_from_bytes(s: bytes | bytearray) -> Message: ... @overload @@ -45,12 +46,14 @@ def message_from_bytes(s: bytes | bytearray, _class: Callable[[], _MessageT]) -> def message_from_bytes( s: bytes | bytearray, _class: Callable[[], _MessageT] = ..., *, policy: Policy[_MessageT] ) -> _MessageT: ... + @overload def message_from_file(fp: IO[str]) -> Message: ... @overload def message_from_file(fp: IO[str], _class: Callable[[], _MessageT]) -> _MessageT: ... @overload def message_from_file(fp: IO[str], _class: Callable[[], _MessageT] = ..., *, policy: Policy[_MessageT]) -> _MessageT: ... + @overload def message_from_binary_file(fp: IO[bytes]) -> Message: ... @overload diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index e1930835bbd1..353cdeb0b9dd 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -27,10 +27,12 @@ class Charset: def get_output_charset(self) -> str | None: ... def header_encode(self, string: str) -> str: ... def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str | None]: ... + @overload def body_encode(self, string: None) -> None: ... @overload def body_encode(self, string: str | bytes) -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... diff --git a/stdlib/email/feedparser.pyi b/stdlib/email/feedparser.pyi index d9279e9cd996..ec92eef67886 100644 --- a/stdlib/email/feedparser.pyi +++ b/stdlib/email/feedparser.pyi @@ -11,6 +11,7 @@ class FeedParser(Generic[_MessageT]): def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy[Message] = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ... + def feed(self, data: str) -> None: ... def close(self) -> _MessageT: ... @@ -19,4 +20,5 @@ class BytesFeedParser(FeedParser[_MessageT]): def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy[Message] = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ... + def feed(self, data: bytes | bytearray) -> None: ... # type: ignore[override] diff --git a/stdlib/email/generator.pyi b/stdlib/email/generator.pyi index d30e686299fa..c2a9bb0921d7 100644 --- a/stdlib/email/generator.pyi +++ b/stdlib/email/generator.pyi @@ -12,6 +12,7 @@ _MessageT = TypeVar("_MessageT", bound=Message[Any, Any], default=Any) class Generator(Generic[_MessageT]): maxheaderlen: int | None policy: Policy[_MessageT] | None + @overload def __init__( self: Generator[Any], # The Policy of the message is used. @@ -30,6 +31,7 @@ class Generator(Generic[_MessageT]): *, policy: Policy[_MessageT], ) -> None: ... + def write(self, s: str) -> None: ... def flatten(self, msg: _MessageT, unixfrom: bool = False, linesep: str | None = None) -> None: ... def clone(self, fp: SupportsWrite[str]) -> Self: ... diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index af6036bd6b74..784c2cace425 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -44,6 +44,7 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): def set_unixfrom(self, unixfrom: str) -> None: ... def get_unixfrom(self) -> str | None: ... def attach(self, payload: _PayloadType) -> None: ... + # `i: int` without a multipart payload results in an error # `| MaybeNone` acts like `| Any`: can be None for cleared or unset payload, but annoying to check @overload # multipart @@ -56,6 +57,7 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): def get_payload(self, i: None = None, *, decode: Literal[True]) -> _EncodedPayloadType | MaybeNone: ... @overload # not multipart, IDEM but w/o kwarg def get_payload(self, i: None, decode: Literal[True]) -> _EncodedPayloadType | MaybeNone: ... + # If `charset=None` and payload supports both `encode` AND `decode`, # then an invalid payload could be passed, but this is unlikely # Not[_SupportsEncodeToPayload] @@ -69,6 +71,7 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): payload: _SupportsEncodeToPayload | _SupportsDecodeToPayload | _PayloadType | _MultipartPayloadType, charset: Charset | str, ) -> None: ... + def set_charset(self, charset: _CharsetType) -> None: ... def get_charset(self) -> _CharsetType: ... def __len__(self) -> int: ... @@ -84,14 +87,17 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): def keys(self) -> list[str]: ... def values(self) -> list[_HeaderT_co]: ... def items(self) -> list[tuple[str, _HeaderT_co]]: ... + @overload def get(self, name: str, failobj: None = None) -> _HeaderT_co | None: ... @overload def get(self, name: str, failobj: _T) -> _HeaderT_co | _T: ... + @overload def get_all(self, name: str, failobj: None = None) -> list[_HeaderT_co] | None: ... @overload def get_all(self, name: str, failobj: _T) -> list[_HeaderT_co] | _T: ... + def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... def replace_header(self, _name: str, _value: _HeaderParamT_contra) -> None: ... def get_content_type(self) -> str: ... @@ -99,37 +105,46 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... + @overload def get_params( self, failobj: None = None, header: str = "content-type", unquote: bool = True ) -> list[tuple[str, str]] | None: ... @overload def get_params(self, failobj: _T, header: str = "content-type", unquote: bool = True) -> list[tuple[str, str]] | _T: ... + @overload def get_param( self, param: str, failobj: None = None, header: str = "content-type", unquote: bool = True ) -> _ParamType | None: ... @overload def get_param(self, param: str, failobj: _T, header: str = "content-type", unquote: bool = True) -> _ParamType | _T: ... + def del_param(self, param: str, header: str = "content-type", requote: bool = True) -> None: ... def set_type(self, type: str, header: str = "Content-Type", requote: bool = True) -> None: ... + @overload def get_filename(self, failobj: None = None) -> str | None: ... @overload def get_filename(self, failobj: _T) -> str | _T: ... + @overload def get_boundary(self, failobj: None = None) -> str | None: ... @overload def get_boundary(self, failobj: _T) -> str | _T: ... + def set_boundary(self, boundary: str) -> None: ... + @overload def get_content_charset(self) -> str | None: ... @overload def get_content_charset(self, failobj: _T) -> str | _T: ... + @overload def get_charsets(self, failobj: None = None) -> list[str | None]: ... @overload def get_charsets(self, failobj: _T) -> list[str | _T]: ... + def walk(self) -> Generator[Self]: ... def get_content_disposition(self) -> str | None: ... def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy[Any] | None = None) -> str: ... diff --git a/stdlib/email/parser.pyi b/stdlib/email/parser.pyi index a4924a6cbd88..f1b418ee30a0 100644 --- a/stdlib/email/parser.pyi +++ b/stdlib/email/parser.pyi @@ -16,6 +16,7 @@ class Parser(Generic[_MessageT]): def __init__(self, _class: None = None, *, policy: Policy[_MessageT]) -> None: ... @overload def __init__(self, _class: Callable[[], _MessageT] | None, *, policy: Policy[_MessageT] = ...) -> None: ... + def parse(self, fp: SupportsRead[str], headersonly: bool = False) -> _MessageT: ... def parsestr(self, text: str, headersonly: bool = False) -> _MessageT: ... @@ -25,12 +26,14 @@ class HeaderParser(Parser[_MessageT]): class BytesParser(Generic[_MessageT]): parser: Parser[_MessageT] + @overload def __init__(self: BytesParser[Message[str, str]], _class: None = None) -> None: ... @overload def __init__(self, _class: None = None, *, policy: Policy[_MessageT]) -> None: ... @overload def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ... + def parse(self, fp: _WrappedBuffer, headersonly: bool = False) -> _MessageT: ... def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> _MessageT: ... diff --git a/stdlib/email/policy.pyi b/stdlib/email/policy.pyi index 35c999919eed..6b719f3c93fa 100644 --- a/stdlib/email/policy.pyi +++ b/stdlib/email/policy.pyi @@ -12,6 +12,7 @@ class EmailPolicy(Policy[_MessageT]): refold_source: str header_factory: Callable[[str, Any], Any] content_manager: ContentManager + @overload def __init__( self: EmailPolicy[EmailMessage], @@ -46,6 +47,7 @@ class EmailPolicy(Policy[_MessageT]): header_factory: Callable[[str, str], str] = ..., content_manager: ContentManager = ..., ) -> None: ... + def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ... def header_store_parse(self, name: str, value: Any) -> tuple[str, Any]: ... def header_fetch_parse(self, name: str, value: str) -> Any: ... diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 4b314b9d056c..6b47950a2ef8 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -36,14 +36,17 @@ def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") - # `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5 def getaddresses(fieldvalues: Iterable[str], *, strict: bool = True) -> list[tuple[str, str]]: ... + @overload def parsedate(data: None) -> None: ... @overload def parsedate(data: str) -> tuple[int, int, int, int, int, int, int, int, int] | None: ... + @overload def parsedate_tz(data: None) -> None: ... @overload def parsedate_tz(data: str) -> _PDTZ | None: ... + def parsedate_to_datetime(data: str) -> datetime.datetime: ... def mktime_tz(data: _PDTZ) -> int: ... def formatdate(timeval: float | None = None, localtime: bool = False, usegmt: bool = False) -> str: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index afb6961b9594..ee4cb33e1965 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -81,6 +81,7 @@ class _EnumDict(dict[str, Any]): def update(self, members: SupportsKeysAndGetItem[str, Any], **more_members: Any) -> None: ... @overload def update(self, members: Iterable[tuple[str, Any]], **more_members: Any) -> None: ... + if sys.version_info >= (3, 13): @property def member_names(self) -> list[str]: ... diff --git a/stdlib/fcntl.pyi b/stdlib/fcntl.pyi index d58ad309e5a2..c17f31c4bebe 100644 --- a/stdlib/fcntl.pyi +++ b/stdlib/fcntl.pyi @@ -137,6 +137,7 @@ if sys.platform != "win32": def fcntl(fd: FileDescriptorLike, cmd: int, arg: int = 0, /) -> int: ... @overload def fcntl(fd: FileDescriptorLike, cmd: int, arg: str | ReadOnlyBuffer, /) -> bytes: ... + # If arg is an int, return int @overload def ioctl(fd: FileDescriptorLike, request: int, arg: int = 0, mutate_flag: bool = True, /) -> int: ... @@ -151,5 +152,6 @@ if sys.platform != "win32": def ioctl(fd: FileDescriptorLike, request: int, arg: WriteableBuffer, mutate_flag: Literal[False], /) -> bytes: ... @overload def ioctl(fd: FileDescriptorLike, request: int, arg: Buffer, mutate_flag: bool = True, /) -> Any: ... + def flock(fd: FileDescriptorLike, operation: int, /) -> None: ... def lockf(fd: FileDescriptorLike, cmd: int, len: int = 0, start: int = 0, whence: int = 0, /) -> Any: ... diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 7a4f7e166970..37783254c70f 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -64,6 +64,7 @@ def input( encoding: str | None = None, errors: str | None = None, ) -> FileInput[Any]: ... + def close() -> None: ... def nextfile() -> None: ... def filename() -> str: ... @@ -111,6 +112,7 @@ class FileInput(Generic[AnyStr]): encoding: str | None = None, errors: str | None = None, ) -> None: ... + def __del__(self) -> None: ... def close(self) -> None: ... def __enter__(self) -> Self: ... diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index ad0a187bb472..42947f2e2266 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -15,11 +15,11 @@ class _ConvertibleToIntegerRatio(Protocol): class Fraction(Rational): __slots__ = ("_numerator", "_denominator") + @overload def __new__(cls, numerator: int | Rational = 0, denominator: int | Rational | None = None) -> Self: ... @overload def __new__(cls, numerator: float | Decimal | str) -> Self: ... - if sys.version_info >= (3, 14): @overload def __new__(cls, numerator: _ConvertibleToIntegerRatio) -> Self: ... @@ -37,78 +37,93 @@ class Fraction(Rational): def numerator(a) -> int: ... @property def denominator(a) -> int: ... + @overload def __add__(a, b: int | Fraction) -> Fraction: ... @overload def __add__(a, b: float) -> float: ... @overload def __add__(a, b: complex) -> complex: ... + @overload def __radd__(b, a: int | Fraction) -> Fraction: ... @overload def __radd__(b, a: float) -> float: ... @overload def __radd__(b, a: complex) -> complex: ... + @overload def __sub__(a, b: int | Fraction) -> Fraction: ... @overload def __sub__(a, b: float) -> float: ... @overload def __sub__(a, b: complex) -> complex: ... + @overload def __rsub__(b, a: int | Fraction) -> Fraction: ... @overload def __rsub__(b, a: float) -> float: ... @overload def __rsub__(b, a: complex) -> complex: ... + @overload def __mul__(a, b: int | Fraction) -> Fraction: ... @overload def __mul__(a, b: float) -> float: ... @overload def __mul__(a, b: complex) -> complex: ... + @overload def __rmul__(b, a: int | Fraction) -> Fraction: ... @overload def __rmul__(b, a: float) -> float: ... @overload def __rmul__(b, a: complex) -> complex: ... + @overload def __truediv__(a, b: int | Fraction) -> Fraction: ... @overload def __truediv__(a, b: float) -> float: ... @overload def __truediv__(a, b: complex) -> complex: ... + @overload def __rtruediv__(b, a: int | Fraction) -> Fraction: ... @overload def __rtruediv__(b, a: float) -> float: ... @overload def __rtruediv__(b, a: complex) -> complex: ... + @overload def __floordiv__(a, b: int | Fraction) -> int: ... @overload def __floordiv__(a, b: float) -> float: ... + @overload def __rfloordiv__(b, a: int | Fraction) -> int: ... @overload def __rfloordiv__(b, a: float) -> float: ... + @overload def __mod__(a, b: int | Fraction) -> Fraction: ... @overload def __mod__(a, b: float) -> float: ... + @overload def __rmod__(b, a: int | Fraction) -> Fraction: ... @overload def __rmod__(b, a: float) -> float: ... + @overload def __divmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ... @overload def __divmod__(a, b: float) -> tuple[float, Fraction]: ... + @overload def __rdivmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ... @overload def __rdivmod__(a, b: float) -> tuple[float, Fraction]: ... + if sys.version_info >= (3, 14): @overload def __pow__(a, b: int, modulo: None = None) -> Fraction: ... @@ -123,6 +138,7 @@ class Fraction(Rational): def __pow__(a, b: float | Fraction) -> float: ... @overload def __pow__(a, b: complex) -> complex: ... + if sys.version_info >= (3, 14): @overload def __rpow__(b, a: float | Fraction, modulo: None = None) -> float: ... @@ -140,10 +156,12 @@ class Fraction(Rational): def __trunc__(a) -> int: ... def __floor__(a) -> int: ... def __ceil__(a) -> int: ... + @overload def __round__(self, ndigits: None = None) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... + def __hash__(self) -> int: ... # type: ignore[override] def __eq__(a, b: object) -> bool: ... def __lt__(a, b: _ComparableNum) -> bool: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 73eaa8a34e57..1b7222fc94f7 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -154,6 +154,7 @@ class FTP_TLS(FTP): *, encoding: str = "utf-8", ) -> None: ... + ssl_version: int keyfile: StrOrBytesPath | None certfile: StrOrBytesPath | None diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 32b14c42b770..5619a64f6ed2 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -47,7 +47,6 @@ _RWrapper = TypeVar("_RWrapper") if sys.version_info >= (3, 14): @overload def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], /, initial: _T) -> _T: ... - else: @overload def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], initial: _T, /) -> _T: ... @@ -167,6 +166,7 @@ else: def total_ordering(cls: type[_T]) -> type[_T]: ... def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ... + @disjoint_base class partial(Generic[_T]): @property @@ -211,6 +211,7 @@ else: class _SingleDispatchCallable(Generic[_T]): registry: types.MappingProxyType[Any, Callable[..., _T]] def dispatch(self, cls: Any) -> Callable[..., _T]: ... + # @fun.register(complex) # def _(arg, verbose=False): ... @overload @@ -222,6 +223,7 @@ class _SingleDispatchCallable(Generic[_T]): # fun.register(int, lambda x: x) @overload def register(self, cls: _RegType, func: Callable[..., _T]) -> Callable[..., _T]: ... + def _clear_cache(self) -> None: ... def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ... @@ -233,22 +235,26 @@ class singledispatchmethod(Generic[_T]): def __init__(self, func: Callable[..., _T]) -> None: ... @property def __isabstractmethod__(self) -> bool: ... + @overload def register(self, cls: _RegType, method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ... @overload def register(self, cls: _RegType, method: Callable[..., _T]) -> Callable[..., _T]: ... + def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ... class cached_property(Generic[_T_co]): func: Callable[[Any], _T_co] attrname: str | None def __init__(self, func: Callable[[Any], _T_co]) -> None: ... + @overload def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... @overload def __get__(self, instance: object, owner: type[Any] | None = None) -> _T_co: ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable def __set__(self, instance: object, value: _T_co) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index d260726a33e5..07c58cc496b6 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -45,7 +45,6 @@ if sys.version_info >= (3, 15): @overload @deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.") def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]], /) -> Sequence[SupportsRichComparisonT]: ... - else: @overload def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ... diff --git a/stdlib/gettext.pyi b/stdlib/gettext.pyi index e9ffd7a4a4a4..aac2d3edf7d9 100644 --- a/stdlib/gettext.pyi +++ b/stdlib/gettext.pyi @@ -110,8 +110,8 @@ if sys.version_info >= (3, 11): class_: Callable[[io.BufferedReader], NullTranslations] | None = None, fallback: bool = False, ) -> NullTranslations: ... - def install(domain: str, localedir: StrPath | None = None, *, names: Container[str] | None = None) -> None: ... + def install(domain: str, localedir: StrPath | None = None, *, names: Container[str] | None = None) -> None: ... else: @overload def translation( @@ -150,6 +150,7 @@ else: fallback: bool = False, codeset: str | None = ..., ) -> NullTranslations: ... + @overload def install(domain: str, localedir: StrPath | None = None, names: Container[str] | None = None) -> None: ... @overload diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index 1ca8cbe12b08..f0ac72b6135e 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -15,6 +15,7 @@ class TopologicalSorter(Generic[_T]): def __init__(self, graph: None = None) -> None: ... @overload def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ... + def add(self, node: _T, *predecessors: _T) -> None: ... def prepare(self) -> None: ... def is_active(self) -> bool: ... diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index 0202a927c806..4322e6c84c90 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -96,6 +96,7 @@ class GzipFile(BaseStream): name: str compress: zlib._Compress fileobj: _ReadableFileobj | _WritableFileobj + @overload def __init__( self, @@ -141,6 +142,7 @@ class GzipFile(BaseStream): fileobj: _ReadableFileobj | _WritableFileobj | None = None, mtime: float | None = None, ) -> None: ... + if sys.version_info < (3, 12): @property @deprecated("Deprecated since Python 2.6; removed in Python 3.12. Use `name` attribute instead.") diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index fa89c0669680..d22335b56c54 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -149,10 +149,12 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp def read1(self, n: int = -1) -> bytes: ... def readinto(self, b: WriteableBuffer) -> int: ... def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override] + @overload def getheader(self, name: str) -> str | None: ... @overload def getheader(self, name: str, default: _T) -> str | _T: ... + def getheaders(self) -> list[tuple[str, str]]: ... def isclosed(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... @@ -280,6 +282,7 @@ class HTTPSConnection(HTTPConnection): check_hostname: bool | None = None, blocksize: int = 8192, ) -> None: ... + key_file: StrOrBytesPath | None cert_file: StrOrBytesPath | None diff --git a/stdlib/http/cookiejar.pyi b/stdlib/http/cookiejar.pyi index 8be4ce5e3d2c..2cbe432c5586 100644 --- a/stdlib/http/cookiejar.pyi +++ b/stdlib/http/cookiejar.pyi @@ -148,9 +148,11 @@ class Cookie: rfc2109: bool = False, ) -> None: ... def has_nonstandard_attr(self, name: str) -> bool: ... + @overload def get_nonstandard_attr(self, name: str) -> str | None: ... @overload def get_nonstandard_attr(self, name: str, default: _T) -> str | _T: ... + def set_nonstandard_attr(self, name: str, value: str) -> None: ... def is_expired(self, now: int | None = None) -> bool: ... diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index b0dd49723cd5..bdec1068b5ea 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -11,6 +11,7 @@ _T = TypeVar("_T") def _quote(str: None) -> None: ... @overload def _quote(str: str) -> str: ... + @overload def _unquote(str: None) -> None: ... @overload diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 5a7443604f0a..fd14e45ed725 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -151,6 +151,7 @@ class IMAP4_SSL(IMAP4): ssl_context: None = None, timeout: float | None = None, ) -> None: ... + keyfile: StrOrBytesPath | None certfile: StrOrBytesPath | None sslobj: SSLSocket diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index b4fa8d9234a3..945b8d2080d1 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -107,6 +107,7 @@ if sys.version_info < (3, 11): def is_file(self) -> bool: ... @abstractmethod def iterdir(self) -> Iterator[Traversable]: ... + if sys.version_info >= (3, 11): @abstractmethod def joinpath(self, *descendants: str) -> Traversable: ... @@ -123,6 +124,7 @@ if sys.version_info < (3, 11): @overload @abstractmethod def open(self, mode: Literal["rb"]) -> IO[bytes]: ... + @property @abstractmethod def name(self) -> str: ... diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi index a1d0cbb912e4..866fd969e2fe 100644 --- a/stdlib/importlib/metadata/__init__.pyi +++ b/stdlib/importlib/metadata/__init__.pyi @@ -162,12 +162,14 @@ else: if sys.version_info < (3, 12): class Deprecated(Generic[_KT, _VT]): def __getitem__(self, name: _KT) -> _VT: ... + @overload def get(self, name: _KT, default: None = None) -> _VT | None: ... @overload def get(self, name: _KT, default: _VT) -> _VT: ... @overload def get(self, name: _KT, default: _T) -> _VT | _T: ... + def __iter__(self) -> Iterator[_KT]: ... def __contains__(self, *args: object) -> bool: ... def keys(self) -> dict_keys[_KT, _VT]: ... @@ -181,6 +183,7 @@ if sys.version_info < (3, 12): def groups(self) -> set[str]: ... @property def names(self) -> set[str]: ... + @overload def select(self) -> Self: ... @overload @@ -224,6 +227,7 @@ class Distribution(_distribution_parent): def locate_file(self, path: StrPath) -> _SimplePath: ... @classmethod def from_name(cls, name: str) -> Distribution: ... + @overload @classmethod def discover(cls, *, context: DistributionFinder.Context) -> Iterable[Distribution]: ... @@ -232,6 +236,7 @@ class Distribution(_distribution_parent): def discover( cls, *, context: None = None, name: str | None = ..., path: list[str] = ..., **kwargs: Any ) -> Iterable[Distribution]: ... + @staticmethod def at(path: StrPath) -> PathDistribution: ... @property @@ -277,12 +282,14 @@ class PathDistribution(Distribution): def locate_file(self, path: StrPath) -> _SimplePath: ... def distribution(distribution_name: str) -> Distribution: ... + @overload def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ... @overload def distributions( *, context: None = None, name: str | None = ..., path: list[str] = ..., **kwargs: Any ) -> Iterable[Distribution]: ... + def metadata(distribution_name: str) -> PackageMetadata: ... if sys.version_info >= (3, 12): diff --git a/stdlib/importlib/metadata/_meta.pyi b/stdlib/importlib/metadata/_meta.pyi index 9f791dab254f..b9bad7b8a6b0 100644 --- a/stdlib/importlib/metadata/_meta.pyi +++ b/stdlib/importlib/metadata/_meta.pyi @@ -15,10 +15,12 @@ class PackageMetadata(Protocol): def __iter__(self) -> Iterator[str]: ... @property def json(self) -> dict[str, str | list[str]]: ... + @overload def get_all(self, name: str, failobj: None = None) -> list[Any] | None: ... @overload def get_all(self, name: str, failobj: _T) -> list[Any] | _T: ... + if sys.version_info >= (3, 12): @overload def get(self, name: str, failobj: None = None) -> str | None: ... diff --git a/stdlib/importlib/resources/_common.pyi b/stdlib/importlib/resources/_common.pyi index b430c7ef82a0..447cc1ea33b8 100644 --- a/stdlib/importlib/resources/_common.pyi +++ b/stdlib/importlib/resources/_common.pyi @@ -18,6 +18,7 @@ if sys.version_info >= (3, 11): def package_to_anchor( func: Callable[[Anchor | None], Traversable], ) -> Callable[[Anchor | None, Anchor | None], Traversable]: ... + @overload def files(anchor: Anchor | None = None) -> Traversable: ... @overload diff --git a/stdlib/importlib/resources/_functional.pyi b/stdlib/importlib/resources/_functional.pyi index 71e01bcd3d5e..cfd15dc87ce8 100644 --- a/stdlib/importlib/resources/_functional.pyi +++ b/stdlib/importlib/resources/_functional.pyi @@ -12,19 +12,23 @@ if sys.version_info >= (3, 13): from typing_extensions import Unpack, deprecated def open_binary(anchor: Anchor, *path_names: StrPath) -> BinaryIO: ... + @overload def open_text( anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict" ) -> TextIOWrapper: ... @overload def open_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> TextIOWrapper: ... + def read_binary(anchor: Anchor, *path_names: StrPath) -> bytes: ... + @overload def read_text( anchor: Anchor, *path_names: Unpack[tuple[StrPath]], encoding: str | None = "utf-8", errors: str | None = "strict" ) -> str: ... @overload def read_text(anchor: Anchor, *path_names: StrPath, encoding: str | None, errors: str | None = "strict") -> str: ... + def path(anchor: Anchor, *path_names: StrPath) -> AbstractContextManager[Path, Literal[False]]: ... def is_resource(anchor: Anchor, *path_names: StrPath) -> bool: ... @deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.") diff --git a/stdlib/importlib/resources/abc.pyi b/stdlib/importlib/resources/abc.pyi index a3a40127a1f3..20a4b1fc5dfe 100644 --- a/stdlib/importlib/resources/abc.pyi +++ b/stdlib/importlib/resources/abc.pyi @@ -38,12 +38,14 @@ if sys.version_info >= (3, 11): @overload @abstractmethod def open(self, mode: Literal["rb"]) -> IO[bytes]: ... + @property @abstractmethod def name(self) -> str: ... def __truediv__(self, child: StrPath, /) -> Traversable: ... @abstractmethod def read_bytes(self) -> bytes: ... + if sys.version_info >= (3, 15): @abstractmethod def read_text(self, encoding: str | None = None, errors: str | None = None) -> str: ... diff --git a/stdlib/importlib/resources/simple.pyi b/stdlib/importlib/resources/simple.pyi index 946987c7312f..ef9882056a9c 100644 --- a/stdlib/importlib/resources/simple.pyi +++ b/stdlib/importlib/resources/simple.pyi @@ -27,6 +27,7 @@ if sys.version_info >= (3, 11): def __init__(self, parent: ResourceContainer, name: str) -> None: ... def is_file(self) -> Literal[True]: ... def is_dir(self) -> Literal[False]: ... + @overload def open( self, @@ -41,6 +42,7 @@ if sys.version_info >= (3, 11): def open(self, mode: Literal["rb"]) -> BinaryIO: ... @overload def open(self, mode: str) -> IO[Any]: ... + def joinpath(self, name: Never) -> NoReturn: ... # type: ignore[override] class ResourceContainer(Traversable, metaclass=abc.ABCMeta): diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 5a7b74b2d1ba..cc39a7c9f2bc 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -236,6 +236,7 @@ def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: . def isgeneratorfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ... @overload def isgeneratorfunction(obj: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ... + @overload def iscoroutinefunction(obj: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... @overload @@ -244,15 +245,18 @@ def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[ def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ... @overload def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ... + def isgenerator(object: object) -> TypeIs[GeneratorType[Any, Any, Any]]: ... def iscoroutine(object: object) -> TypeIs[CoroutineType[Any, Any, Any]]: ... def isawaitable(object: object) -> TypeIs[Awaitable[Any]]: ... + @overload def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ... @overload def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ... @overload def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... + @type_check_only class _SupportsSet(Protocol[_T_contra, _V_contra]): def __set__(self, instance: _T_contra, value: _V_contra, /) -> None: ... @@ -388,6 +392,7 @@ class Signature: locals: Mapping[str, Any] | None = None, eval_str: bool = False, ) -> Self: ... + if sys.version_info >= (3, 14): def format(self, *, max_width: int | None = None, quote_annotation_strings: bool = True) -> str: ... elif sys.version_info >= (3, 13): diff --git a/stdlib/ipaddress.pyi b/stdlib/ipaddress.pyi index c503a69aad7b..c514abfa569f 100644 --- a/stdlib/ipaddress.pyi +++ b/stdlib/ipaddress.pyi @@ -235,7 +235,9 @@ def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[I def summarize_address_range( first: IPv4Address | IPv6Address, last: IPv4Address | IPv6Address ) -> Iterator[IPv4Network] | Iterator[IPv6Network]: ... + def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ... + @overload def get_mixed_type_key(obj: _A) -> tuple[int, _A]: ... @overload diff --git a/stdlib/itertools.pyi b/stdlib/itertools.pyi index 76844c0cc285..d26a4e1da21e 100644 --- a/stdlib/itertools.pyi +++ b/stdlib/itertools.pyi @@ -35,6 +35,7 @@ class count(Generic[_N]): def __new__(cls, start: _N, step: _Step = 1) -> count[_N]: ... @overload def __new__(cls, *, step: _N) -> count[_N]: ... + def __next__(self) -> _N: ... def __iter__(self) -> Self: ... @@ -50,6 +51,7 @@ class repeat(Generic[_T]): def __new__(cls, object: _T) -> Self: ... @overload def __new__(cls, object: _T, times: int) -> Self: ... + def __next__(self) -> _T: ... def __iter__(self) -> Self: ... def __length_hint__(self) -> int: ... @@ -60,6 +62,7 @@ class accumulate(Generic[_T]): def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = None) -> Self: ... @overload def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = None) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T: ... @@ -97,6 +100,7 @@ class groupby(Generic[_T_co, _S_co]): def __new__(cls, iterable: Iterable[_T1], key: None = None) -> groupby[_T1, _T1]: ... @overload def __new__(cls, iterable: Iterable[_T1], key: Callable[[_T1], _T2]) -> groupby[_T2, _T1]: ... + def __iter__(self) -> Self: ... def __next__(self) -> tuple[_T_co, Iterator[_S_co]]: ... @@ -106,6 +110,7 @@ class islice(Generic[_T]): def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ... @overload def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = 1, /) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T: ... @@ -122,6 +127,7 @@ class takewhile(Generic[_T]): def __next__(self) -> _T: ... def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]: ... + @disjoint_base class zip_longest(Generic[_T_co]): # one iterable (fillvalue doesn't matter) @@ -198,6 +204,7 @@ class zip_longest(Generic[_T_co]): *iterables: Iterable[_T], fillvalue: _T, ) -> zip_longest[tuple[_T, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... @@ -284,6 +291,7 @@ class product(Generic[_T_co]): ) -> product[tuple[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10]]: ... @overload def __new__(cls, *iterables: Iterable[_T1], repeat: int = 1) -> product[tuple[_T1, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... @@ -299,6 +307,7 @@ class permutations(Generic[_T_co]): def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> permutations[tuple[_T, _T, _T, _T, _T]]: ... @overload def __new__(cls, iterable: Iterable[_T], r: int | None = None) -> permutations[tuple[_T, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... @@ -314,6 +323,7 @@ class combinations(Generic[_T_co]): def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> combinations[tuple[_T, _T, _T, _T, _T]]: ... @overload def __new__(cls, iterable: Iterable[_T], r: int) -> combinations[tuple[_T, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... @@ -329,6 +339,7 @@ class combinations_with_replacement(Generic[_T_co]): def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> combinations_with_replacement[tuple[_T, _T, _T, _T, _T]]: ... @overload def __new__(cls, iterable: Iterable[_T], r: int) -> combinations_with_replacement[tuple[_T, ...]]: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T_co: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 5776d100d1da..4b951e1489e1 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -29,6 +29,7 @@ class ParserGenerator: def parse_atom(self) -> tuple[NFAState, NFAState]: ... def expect(self, type: int, value: str | None = None) -> str: ... def gettoken(self) -> None: ... + @overload def raise_error(self, msg: object) -> NoReturn: ... @overload diff --git a/stdlib/lib2to3/refactor.pyi b/stdlib/lib2to3/refactor.pyi index c33347ede38f..dfec28b758b5 100644 --- a/stdlib/lib2to3/refactor.pyi +++ b/stdlib/lib2to3/refactor.pyi @@ -40,14 +40,17 @@ class RefactoringTool: ) -> None: ... def get_fixers(self) -> tuple[list[BaseFix], list[BaseFix]]: ... def log_error(self, msg: str, *args: Iterable[str], **kwargs: _ExcInfoType) -> NoReturn: ... + @overload def log_message(self, msg: object) -> None: ... @overload def log_message(self, msg: str, *args: object) -> None: ... + @overload def log_debug(self, msg: object) -> None: ... @overload def log_debug(self, msg: str, *args: object) -> None: ... + def print_output(self, old_text: str, new_text: str, filename: StrPath, equal: bool) -> None: ... def refactor(self, items: Iterable[str], write: bool = False, doctests_only: bool = False) -> None: ... def refactor_dir(self, dir_name: str, write: bool = False, doctests_only: bool = False) -> None: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 6182981597e4..8e90a68d9453 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -554,6 +554,7 @@ fatal = critical def disable(level: int = 50) -> None: ... def addLevelName(level: int, levelName: str) -> None: ... + @overload def getLevelName(level: int) -> str: ... @overload @@ -564,6 +565,7 @@ if sys.version_info >= (3, 11): def getLevelNamesMapping() -> dict[str, int]: ... def makeLogRecord(dict: Mapping[str, object]) -> LogRecord: ... + @overload # handlers is non-None def basicConfig( *, @@ -599,6 +601,7 @@ def basicConfig( handlers: None = None, force: bool | None = False, ) -> None: ... + def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented def setLoggerClass(klass: type[Logger]) -> None: ... def captureWarnings(capture: bool) -> None: ... @@ -611,10 +614,12 @@ _StreamT = TypeVar("_StreamT", bound=SupportsWrite[str]) class StreamHandler(Handler, Generic[_StreamT]): stream: _StreamT # undocumented terminator: str + @overload def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ... @overload def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 + def setStream(self, stream: _StreamT) -> _StreamT | None: ... if sys.version_info >= (3, 11): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/stdlib/logging/config.pyi b/stdlib/logging/config.pyi index 405d7fb898fc..1c870edc80f8 100644 --- a/stdlib/logging/config.pyi +++ b/stdlib/logging/config.pyi @@ -88,6 +88,7 @@ class ConvertingList(list[Any], ConvertingMixin): # undocumented def __getitem__(self, key: SupportsIndex) -> Any: ... @overload def __getitem__(self, key: slice[SupportsIndex | None]) -> Any: ... + def pop(self, idx: SupportsIndex = -1) -> Any: ... if sys.version_info >= (3, 12): diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index b920f477542e..656ecb168c95 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -172,6 +172,7 @@ def open( errors: str | None = None, newline: str | None = None, ) -> LZMAFile | TextIOWrapper: ... + def compress( data: ReadableBuffer, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None ) -> bytes: ... diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index cbb051905737..961c0f5e81f7 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -70,10 +70,12 @@ class _GetFileReturn(Protocol): class Mailbox(Generic[_MessageT_co]): _path: str # undocumented _factory: Callable[[_GetFileReturn], _MessageT_co] | None # undocumented + @overload def __init__(self, path: StrPath, factory: Callable[[_GetFileReturn], _MessageT_co], create: bool = True) -> None: ... @overload def __init__(self, path: StrPath, factory: None = None, create: bool = True) -> None: ... + @abstractmethod def add(self, message: _MessageData) -> str: ... @abstractmethod @@ -82,10 +84,12 @@ class Mailbox(Generic[_MessageT_co]): def discard(self, key: str) -> None: ... @abstractmethod def __setitem__(self, key: str, message: _MessageData) -> None: ... + @overload def get(self, key: str, default: None = None) -> _MessageT_co | None: ... @overload def get(self, key: str, default: _T) -> _MessageT_co | _T: ... + def __getitem__(self, key: str) -> _MessageT_co: ... @abstractmethod def get_message(self, key: str) -> _MessageT_co: ... @@ -107,10 +111,12 @@ class Mailbox(Generic[_MessageT_co]): @abstractmethod def __len__(self) -> int: ... def clear(self) -> None: ... + @overload def pop(self, key: str, default: None = None) -> _MessageT_co | None: ... @overload def pop(self, key: str, default: _T) -> _MessageT_co | _T: ... + def popitem(self) -> tuple[str, _MessageT_co]: ... def update( self, arg: _HasIteritems | SupportsItems[str, _MessageData] | Iterable[tuple[str, _MessageData]] | None = None diff --git a/stdlib/math/__init__.pyi b/stdlib/math/__init__.pyi index 9f4f7162634b..4839bf7e90df 100644 --- a/stdlib/math/__init__.pyi +++ b/stdlib/math/__init__.pyi @@ -33,6 +33,7 @@ class _SupportsCeil(Protocol[_T_co]): def ceil(x: _SupportsCeil[_T], /) -> _T: ... @overload def ceil(x: _SupportsFloatOrIndex, /) -> int: ... + def comb(n: SupportsIndex, k: SupportsIndex, /) -> int: ... def copysign(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, /) -> float: ... def cos(x: _SupportsFloatOrIndex, /) -> float: ... @@ -49,6 +50,7 @@ if sys.version_info >= (3, 11): def expm1(x: _SupportsFloatOrIndex, /) -> float: ... def fabs(x: _SupportsFloatOrIndex, /) -> float: ... def factorial(x: SupportsIndex, /) -> int: ... + @type_check_only class _SupportsFloor(Protocol[_T_co]): def __floor__(self) -> _T_co: ... @@ -57,6 +59,7 @@ class _SupportsFloor(Protocol[_T_co]): def floor(x: _SupportsFloor[_T], /) -> _T: ... @overload def floor(x: _SupportsFloatOrIndex, /) -> int: ... + def fmod(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, /) -> float: ... if sys.version_info >= (3, 15): @@ -125,6 +128,7 @@ def prod(iterable: Iterable[bool | _LiteralInteger], /, *, start: int = 1) -> in def prod(iterable: Iterable[_SupportsProdNoDefaultT], /) -> _SupportsProdNoDefaultT | Literal[1]: ... @overload def prod(iterable: Iterable[_MultiplicableT1], /, *, start: _MultiplicableT2) -> _MultiplicableT1 | _MultiplicableT2: ... + def radians(x: _SupportsFloatOrIndex, /) -> float: ... def remainder(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, /) -> float: ... def sin(x: _SupportsFloatOrIndex, /) -> float: ... diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index 08cb2d02e3ca..587b91d86c08 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -112,11 +112,14 @@ class mmap: def __getitem__(self, key: SupportsIndex, /) -> int: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytes: ... + def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> NoReturn: ... + @overload def __setitem__(self, key: SupportsIndex, value: int, /) -> None: ... @overload def __setitem__(self, key: slice[SupportsIndex | None], value: ReadableBuffer, /) -> None: ... + # Doesn't actually exist, but the object actually supports "in" because it has __getitem__, # so we claim that there is also a __contains__ to help type checkers. def __contains__(self, o: object, /) -> bool: ... diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index c919774582d5..13fd967515d0 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -74,14 +74,17 @@ class BaseContext: initargs: Iterable[Any] = (), maxtasksperchild: int | None = None, ) -> _Pool: ... + @overload def RawValue(self, typecode_or_type: type[_CT], *args: Any) -> _CT: ... @overload def RawValue(self, typecode_or_type: str, *args: Any) -> Any: ... + @overload def RawArray(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... @overload def RawArray(self, typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ... + @overload def Value( self, typecode_or_type: type[_SimpleCData[_T]], *args: Any, lock: Literal[True] | _LockLike = True @@ -94,6 +97,7 @@ class BaseContext: def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = True) -> Synchronized[Any]: ... @overload def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ... + @overload def Array( self, typecode_or_type: type[_SimpleCData[_T]], size_or_initializer: int | Sequence[Any], *, lock: Literal[False] @@ -118,6 +122,7 @@ class BaseContext: def Array( self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = True ) -> Any: ... + def freeze_support(self) -> None: ... def get_logger(self) -> Logger: ... def log_to_stderr(self, level: _LoggingLevel | None = None) -> Logger: ... @@ -142,15 +147,19 @@ class BaseContext: @overload def get_context(self, method: str) -> BaseContext: ... + @overload def get_start_method(self, allow_none: Literal[False] = False) -> str: ... @overload def get_start_method(self, allow_none: bool) -> str | None: ... + def set_start_method(self, method: str | None, force: bool = False) -> None: ... + @property def reducer(self) -> str: ... @reducer.setter def reducer(self, reduction: str) -> None: ... + def _check_available(self) -> None: ... class Process(BaseProcess): diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index 5e69683d2dda..40639e867834 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -81,18 +81,21 @@ if sys.version_info >= (3, 13): def __delitem__(self, key: _KT, /) -> None: ... def __iter__(self) -> Iterator[_KT]: ... def copy(self) -> dict[_KT, _VT]: ... + @overload # type: ignore[override] def get(self, key: _KT, /) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT, /) -> _VT: ... @overload def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + @overload def pop(self, key: _KT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _VT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def keys(self) -> list[_KT]: ... # type: ignore[override] def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] def values(self) -> list[_VT]: ... # type: ignore[override] @@ -102,15 +105,19 @@ if sys.version_info >= (3, 13): def fromkeys(self, iterable: Iterable[_T], value: None = None, /) -> dict[_T, Any | None]: ... @overload def fromkeys(self, iterable: Iterable[_T], value: _S, /) -> dict[_T, _S]: ... + def __reversed__(self) -> Iterator[_KT]: ... + @overload def __or__(self, value: dict[_KT, _VT], /) -> dict[_KT, _VT]: ... @overload def __or__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... + @overload def __ror__(self, value: dict[_KT, _VT], /) -> dict[_KT, _VT]: ... @overload def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... + @overload # type: ignore[misc] def __ior__(self, value: SupportsKeysAndGetItem[_KT, _VT], /) -> Self: ... @overload @@ -128,18 +135,21 @@ else: def __delitem__(self, key: _KT, /) -> None: ... def __iter__(self) -> Iterator[_KT]: ... def copy(self) -> dict[_KT, _VT]: ... + @overload # type: ignore[override] def get(self, key: _KT, /) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT, /) -> _VT: ... @overload def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + @overload def pop(self, key: _KT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _VT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def keys(self) -> list[_KT]: ... # type: ignore[override] def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] def values(self) -> list[_VT]: ... # type: ignore[override] @@ -194,14 +204,17 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]): def __len__(self) -> int: ... def __add__(self, x: list[_T], /) -> list[_T]: ... def __delitem__(self, i: SupportsIndex | slice[SupportsIndex | None], /) -> None: ... + @overload def __getitem__(self, i: SupportsIndex, /) -> _T: ... @overload def __getitem__(self, s: slice[SupportsIndex | None], /) -> list[_T]: ... + @overload def __setitem__(self, i: SupportsIndex, o: _T, /) -> None: ... @overload def __setitem__(self, s: slice[SupportsIndex | None], o: Iterable[_T], /) -> None: ... + def __mul__(self, n: SupportsIndex, /) -> list[_T]: ... def __rmul__(self, n: SupportsIndex, /) -> list[_T]: ... def __imul__(self, value: SupportsIndex, /) -> Self: ... @@ -217,6 +230,7 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]): # Next methods are copied from builtins.list def clear(self) -> None: ... def copy(self) -> list[_T]: ... + # Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison] # to work around invariance @overload @@ -330,6 +344,7 @@ class SyncManager(BaseManager): def Semaphore(self, value: int = 1) -> threading.Semaphore: ... def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ... def Value(self, typecode: Any, value: _T) -> ValueProxy[_T]: ... + # Overloads are copied from builtins.dict.__init__ @overload def dict(self) -> DictProxy[Any, Any]: ... @@ -347,11 +362,13 @@ class SyncManager(BaseManager): def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ... @overload def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ... + # Overloads are copied from builtins.list.__init__ @overload def list(self, iterable: Iterable[_T], /) -> ListProxy[_T]: ... @overload def list(self) -> ListProxy[Any]: ... + if sys.version_info >= (3, 14): @overload def set(self, iterable: Iterable[_T], /) -> SetProxy[_T]: ... diff --git a/stdlib/multiprocessing/shared_memory.pyi b/stdlib/multiprocessing/shared_memory.pyi index f75a372a69a2..90777a4e771b 100644 --- a/stdlib/multiprocessing/shared_memory.pyi +++ b/stdlib/multiprocessing/shared_memory.pyi @@ -26,10 +26,12 @@ class SharedMemory: class ShareableList(Generic[_SLT]): shm: SharedMemory + @overload def __init__(self, sequence: None = None, *, name: str | None = None) -> None: ... @overload def __init__(self, sequence: Iterable[_SLT], *, name: str | None = None) -> None: ... + def __getitem__(self, position: int) -> _SLT: ... def __setitem__(self, position: int, value: _SLT) -> None: ... def __reduce__(self) -> tuple[Self, tuple[_SLT, ...]]: ... diff --git a/stdlib/multiprocessing/sharedctypes.pyi b/stdlib/multiprocessing/sharedctypes.pyi index f61ca26aab5d..693fd2f70139 100644 --- a/stdlib/multiprocessing/sharedctypes.pyi +++ b/stdlib/multiprocessing/sharedctypes.pyi @@ -16,10 +16,12 @@ _CT = TypeVar("_CT", bound=_CData) def RawValue(typecode_or_type: type[_CT], *args: Any) -> _CT: ... @overload def RawValue(typecode_or_type: str, *args: Any) -> Any: ... + @overload def RawArray(typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... @overload def RawArray(typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ... + @overload def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = None) -> _CT: ... @overload @@ -34,6 +36,7 @@ def Value( def Value( typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True, ctx: BaseContext | None = None ) -> Any: ... + @overload def Array( typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = None @@ -70,7 +73,9 @@ def Array( lock: bool | _LockLike = True, ctx: BaseContext | None = None, ) -> Any: ... + def copy(obj: _CT) -> _CT: ... + @overload def synchronized(obj: _SimpleCData[_T], lock: _LockLike | None = None, ctx: Any | None = None) -> Synchronized[_T]: ... @overload @@ -81,6 +86,7 @@ def synchronized( ) -> SynchronizedArray[_T]: ... @overload def synchronized(obj: _CT, lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedBase[_CT]: ... + @type_check_only class _AcquireFunc(Protocol): def __call__(self, block: bool = ..., timeout: float | None = ..., /) -> bool: ... @@ -102,14 +108,17 @@ class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): class SynchronizedArray(SynchronizedBase[ctypes.Array[_SimpleCData[_T]]], Generic[_T]): def __len__(self) -> int: ... + @overload def __getitem__(self, i: slice[SupportsIndex | None]) -> list[_T]: ... @overload def __getitem__(self, i: SupportsIndex) -> _T: ... + @overload def __setitem__(self, i: slice[SupportsIndex | None], value: Iterable[_T]) -> None: ... @overload def __setitem__(self, i: SupportsIndex, value: _T) -> None: ... + def __getslice__(self, start: SupportsIndex, stop: SupportsIndex) -> list[_T]: ... def __setslice__(self, start: SupportsIndex, stop: SupportsIndex, values: Iterable[_T]) -> None: ... @@ -118,10 +127,12 @@ class SynchronizedString(SynchronizedArray[bytes]): def __getitem__(self, i: slice[SupportsIndex | None]) -> bytes: ... @overload def __getitem__(self, i: SupportsIndex) -> bytes: ... + @overload # type: ignore[override] def __setitem__(self, i: slice[SupportsIndex | None], value: bytes) -> None: ... @overload def __setitem__(self, i: SupportsIndex, value: bytes) -> None: ... + def __getslice__(self, start: SupportsIndex, stop: SupportsIndex) -> bytes: ... # type: ignore[override] def __setslice__(self, start: SupportsIndex, stop: SupportsIndex, values: bytes) -> None: ... # type: ignore[override] diff --git a/stdlib/multiprocessing/util.pyi b/stdlib/multiprocessing/util.pyi index 3583194c77e2..5eb31de77f0f 100644 --- a/stdlib/multiprocessing/util.pyi +++ b/stdlib/multiprocessing/util.pyi @@ -82,6 +82,7 @@ class Finalize(Generic[_R_co]): kwargs: Mapping[str, Any] | None = None, exitpriority: int | None = None, ) -> None: ... + def __call__( self, wr: Unused = None, diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index 64fb16581e95..434e52c4cac8 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -120,12 +120,14 @@ class Real(Complex, _RealLike): def __floor__(self) -> _IntegralLike: ... @abstractmethod def __ceil__(self) -> _IntegralLike: ... + @abstractmethod @overload def __round__(self, ndigits: None = None) -> _IntegralLike: ... @abstractmethod @overload def __round__(self, ndigits: int) -> _RealLike: ... + def __divmod__(self, other) -> tuple[_RealLike, _RealLike]: ... def __rdivmod__(self, other) -> tuple[_RealLike, _RealLike]: ... @abstractmethod @@ -209,6 +211,7 @@ class Integral(Rational, _IntegralLike): def __neg__(self) -> _IntegralLike: ... @abstractmethod def __abs__(self) -> _IntegralLike: ... + @abstractmethod @overload def __round__(self, ndigits: None = None) -> _IntegralLike: ... diff --git a/stdlib/operator.pyi b/stdlib/operator.pyi index 2f919514b0b8..5998d6d16e98 100644 --- a/stdlib/operator.pyi +++ b/stdlib/operator.pyi @@ -192,6 +192,7 @@ class attrgetter(Generic[_T_co]): def __new__(cls, attr: str, attr2: str, attr3: str, attr4: str, /) -> attrgetter[tuple[Any, Any, Any, Any]]: ... @overload def __new__(cls, attr: str, /, *attrs: str) -> attrgetter[tuple[Any, ...]]: ... + def __call__(self, obj: Any, /) -> _T_co: ... @final @@ -200,6 +201,7 @@ class itemgetter(Generic[_T_co]): def __new__(cls, item: _T, /) -> itemgetter[_T]: ... @overload def __new__(cls, item1: _T1, item2: _T2, /, *items: Unpack[_Ts]) -> itemgetter[tuple[_T1, _T2, Unpack[_Ts]]]: ... + # __key: _KT_contra in SupportsGetItem seems to be causing variance issues, ie: # TypeVar "_KT_contra@SupportsGetItem" is contravariant # "tuple[int, int]" is incompatible with protocol "SupportsIndex" diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 305b6a4f06d6..9e5536610272 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -184,6 +184,7 @@ class OptionContainer: def _check_conflict(self, option: Option) -> None: ... def _create_option_mappings(self) -> None: ... def _share_option_mappings(self, parser: OptionParser) -> None: ... + @overload def add_option(self, opt: Option, /) -> Option: ... @overload @@ -206,6 +207,7 @@ class OptionContainer: metavar: str | None = None, **kwargs: Any, # Allow arbitrary keyword arguments for user defined option_class ) -> Option: ... + def add_options(self, option_list: Iterable[Option]) -> None: ... def destroy(self) -> None: ... def format_option_help(self, formatter: HelpFormatter) -> str: ... @@ -280,10 +282,12 @@ class OptionParser(OptionContainer): def _process_args(self, largs: list[str], rargs: list[str], values: Values) -> None: ... def _process_long_opt(self, rargs: list[str], values: Values) -> None: ... def _process_short_opts(self, rargs: list[str], values: Values) -> None: ... + @overload def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ... @overload def add_option_group(self, title: str, /, description: str | None = None) -> OptionGroup: ... + def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: ... def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 95f1f862a391..913e0833665a 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -719,18 +719,21 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): encodevalue: _EnvironCodeFunc[AnyStr], decodevalue: _EnvironCodeFunc[AnyStr], ) -> None: ... + @overload def get(self, key: AnyStr, default: None = None) -> AnyStr | None: ... @overload def get(self, key: AnyStr, default: AnyStr) -> AnyStr: ... @overload def get(self, key: AnyStr, default: _T) -> AnyStr | _T: ... + @overload def pop(self, key: AnyStr) -> AnyStr: ... @overload def pop(self, key: AnyStr, default: AnyStr) -> AnyStr: ... @overload def pop(self, key: AnyStr, default: _T) -> AnyStr | _T: ... + def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... def copy(self) -> dict[AnyStr, AnyStr]: ... def __delitem__(self, key: AnyStr) -> None: ... @@ -740,6 +743,7 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): def __len__(self) -> int: ... def __or__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ... def __ror__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ... + # We use @overload instead of a Union for reasons similar to those given for # overloading MutableMapping.update in stdlib/typing.pyi # The type: ignore is needed due to incompatible __or__/__ior__ signatures @@ -895,6 +899,7 @@ def listdir(path: StrPath | None = None) -> list[str]: ... def listdir(path: BytesPath) -> list[bytes]: ... @overload def listdir(path: int) -> list[str]: ... + @final class DirEntry(Generic[AnyStr]): # This is what the scandir iterator yields @@ -955,18 +960,21 @@ class statvfs_result(structseq[int], tuple[int, int, int, int, int, int, int, in # ----- os function stubs ----- def fsencode(filename: StrOrBytesPath) -> bytes: ... def fsdecode(filename: StrOrBytesPath) -> str: ... + @overload def fspath(path: str) -> str: ... @overload def fspath(path: bytes) -> bytes: ... @overload def fspath(path: PathLike[AnyStr]) -> AnyStr: ... + def get_exec_path(env: Mapping[str, str] | None = None) -> list[str]: ... def getlogin() -> str: ... def getpid() -> int: ... def getppid() -> int: ... def strerror(code: int, /) -> str: ... def umask(mask: int, /) -> int: ... + @final class uname_result(structseq[str], tuple[str, str, str, str, str]): __match_args__: Final = ("sysname", "nodename", "release", "version", "machine") @@ -1026,6 +1034,7 @@ if sys.platform != "win32": def getenvb(key: bytes) -> bytes | None: ... @overload def getenvb(key: bytes, default: _T) -> bytes | _T: ... + def putenv(name: StrOrBytesPath, value: StrOrBytesPath, /) -> None: ... def unsetenv(name: StrOrBytesPath, /) -> None: ... @@ -1112,6 +1121,7 @@ def fdopen( closefd: bool = True, opener: _Opener | None = None, ) -> IO[Any]: ... + def close(fd: int) -> None: ... def closerange(fd_low: int, fd_high: int, /) -> None: ... def device_encoding(fd: int) -> str | None: ... @@ -1261,6 +1271,7 @@ 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: ... + @final @type_check_only class _ScandirIterator(Generic[AnyStr]): @@ -1277,6 +1288,7 @@ def scandir(path: None = None) -> _ScandirIterator[str]: ... def scandir(path: int) -> _ScandirIterator[str]: ... @overload def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]: ... + def stat(path: FileDescriptorOrPath, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> stat_result: ... if sys.platform != "win32": @@ -1325,6 +1337,7 @@ if sys.platform != "win32": follow_symlinks: bool = False, dir_fd: int | None = None, ) -> Iterator[tuple[bytes, list[bytes], list[bytes], int]]: ... + if sys.platform == "linux": def getxattr(path: FileDescriptorOrPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = True) -> bytes: ... def listxattr(path: FileDescriptorOrPath | None = None, *, follow_symlinks: bool = True) -> list[str]: ... @@ -1421,7 +1434,6 @@ if sys.platform != "win32": def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... @deprecated("Soft deprecated. Use the subprocess module instead.") def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - else: @deprecated("Soft deprecated. Use the subprocess module instead.") def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ... @@ -1430,6 +1442,7 @@ else: @deprecated("Soft deprecated. Use the subprocess module instead.") def system(command: StrOrBytesPath) -> int: ... + @final class times_result(structseq[float], tuple[float, float, float, float, float]): __match_args__: Final = ("user", "system", "children_user", "children_system", "elapsed") diff --git a/stdlib/pathlib/__init__.pyi b/stdlib/pathlib/__init__.pyi index 9f5f44f15198..0d3b5aef56bd 100644 --- a/stdlib/pathlib/__init__.pyi +++ b/stdlib/pathlib/__init__.pyi @@ -213,18 +213,22 @@ class Path(PurePath): if sys.version_info >= (3, 14): @property def info(self) -> PathInfo: ... + @overload def move_into(self, target_dir: _PathT) -> _PathT: ... # type: ignore[overload-overlap] @overload def move_into(self, target_dir: StrPath) -> Self: ... # type: ignore[overload-overlap] + @overload def move(self, target: _PathT) -> _PathT: ... # type: ignore[overload-overlap] @overload def move(self, target: StrPath) -> Self: ... # type: ignore[overload-overlap] + @overload def copy_into(self, target_dir: _PathT, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> _PathT: ... # type: ignore[overload-overlap] @overload def copy_into(self, target_dir: StrPath, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> Self: ... # type: ignore[overload-overlap] + @overload def copy(self, target: _PathT, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> _PathT: ... # type: ignore[overload-overlap] @overload diff --git a/stdlib/poplib.pyi b/stdlib/poplib.pyi index 40496ee5286c..d4555a6b5ec0 100644 --- a/stdlib/poplib.pyi +++ b/stdlib/poplib.pyi @@ -44,10 +44,12 @@ class POP3: timestamp: Pattern[str] def apop(self, user: str, password: str) -> bytes: ... def top(self, which: Any, howmuch: int) -> _LongResp: ... + @overload def uidl(self) -> _LongResp: ... @overload def uidl(self, which: Any) -> bytes: ... + def utf8(self) -> bytes: ... def capa(self) -> dict[str, _list[str]]: ... def stls(self, context: ssl.SSLContext | None = None) -> bytes: ... @@ -83,6 +85,7 @@ class POP3_SSL(POP3): timeout: float = ..., context: None = None, ) -> None: ... + keyfile: StrOrBytesPath | None certfile: StrOrBytesPath | None # "context" is actually the last argument, diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index 2de3c2879734..b4068629b698 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -96,16 +96,17 @@ if sys.version_info >= (3, 15): def basename(p: PathLike[AnyStr], /) -> AnyStr: ... @overload def basename(p: AnyOrLiteralStr, /) -> AnyOrLiteralStr: ... + @overload def dirname(p: PathLike[AnyStr], /) -> AnyStr: ... @overload def dirname(p: AnyOrLiteralStr, /) -> AnyOrLiteralStr: ... - else: @overload def basename(p: PathLike[AnyStr]) -> AnyStr: ... @overload def basename(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... + @overload def dirname(p: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -115,6 +116,7 @@ else: def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... @overload def expanduser(path: AnyStr) -> AnyStr: ... + @overload def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -125,7 +127,6 @@ if sys.version_info >= (3, 15): def normcase(s: PathLike[AnyStr], /) -> AnyStr: ... @overload def normcase(s: AnyOrLiteralStr, /) -> AnyOrLiteralStr: ... - else: @overload def normcase(s: PathLike[AnyStr]) -> AnyStr: ... @@ -136,6 +137,7 @@ else: def normpath(path: PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr: ... + @overload def commonpath(paths: Iterable[LiteralString]) -> LiteralString: ... @overload @@ -158,7 +160,6 @@ if sys.version_info >= (3, 15): def realpath(filename: PathLike[AnyStr], /, *, strict: bool | _AllowMissingType = False) -> AnyStr: ... @overload def realpath(filename: AnyStr, /, *, strict: bool | _AllowMissingType = False) -> AnyStr: ... - else: @overload def realpath(filename: PathLike[AnyStr], *, strict: bool | _AllowMissingType = False) -> AnyStr: ... @@ -177,16 +178,17 @@ if sys.version_info >= (3, 15): def split(p: PathLike[AnyStr], /) -> tuple[AnyStr, AnyStr]: ... @overload def split(p: AnyOrLiteralStr, /) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... + @overload def splitdrive(p: PathLike[AnyStr], /) -> tuple[AnyStr, AnyStr]: ... @overload def splitdrive(p: AnyOrLiteralStr, /) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... - else: @overload def split(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload def split(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... + @overload def splitdrive(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload @@ -197,7 +199,6 @@ if sys.version_info >= (3, 15): def splitext(p: PathLike[AnyStr], /) -> tuple[AnyStr, AnyStr]: ... @overload def splitext(p: AnyOrLiteralStr, /) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... - else: @overload def splitext(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @@ -216,6 +217,7 @@ def lexists(path: FileDescriptorOrPath) -> bool: ... if sys.version_info >= (3, 12): def isjunction(path: StrOrBytesPath) -> bool: ... + if sys.version_info >= (3, 15): @overload def splitroot(path: AnyOrLiteralStr, /) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index d8a50571f1c1..19eb683df166 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -72,10 +72,12 @@ class Stats: def add(self, *arg_list: None | str | Profile | _cProfile | Self) -> Self: ... def dump_stats(self, filename: StrOrBytesPath) -> None: ... def get_sort_arg_defs(self) -> _SortArgDict: ... + @overload def sort_stats(self, field: Literal[-1, 0, 1, 2]) -> Self: ... @overload def sort_stats(self, *field: str) -> Self: ... + def reverse_order(self) -> Self: ... def strip_dirs(self) -> Self: ... def calc_callees(self) -> None: ... diff --git a/stdlib/random.pyi b/stdlib/random.pyi index e7911ceeab18..80fd2c7628a5 100644 --- a/stdlib/random.pyi +++ b/stdlib/random.pyi @@ -69,6 +69,7 @@ class Random(_random.Random): @overload @deprecated("The `random` parameter is deprecated since Python 3.9; removed in Python 3.11.") def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = None) -> None: ... + if sys.version_info >= (3, 11): def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ... else: diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 2c81aa93eca5..0183d7a81331 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -79,12 +79,14 @@ class Match(Generic[AnyStr]): # this match instance. @property def re(self) -> Pattern[AnyStr]: ... + @overload def expand(self: Match[str], template: str) -> str: ... @overload def expand(self: Match[bytes], template: ReadableBuffer) -> bytes: ... @overload def expand(self, template: AnyStr) -> AnyStr: ... + # group() returns "AnyStr" or "AnyStr | None", depending on the pattern. @overload def group(self, group: Literal[0] = 0, /) -> AnyStr: ... @@ -92,28 +94,33 @@ class Match(Generic[AnyStr]): def group(self, group: str | int, /) -> AnyStr | MaybeNone: ... @overload def group(self, group1: str | int, group2: str | int, /, *groups: str | int) -> tuple[AnyStr | MaybeNone, ...]: ... + # Each item of groups()'s return tuple is either "AnyStr" or # "AnyStr | None", depending on the pattern. @overload def groups(self) -> tuple[AnyStr | MaybeNone, ...]: ... @overload def groups(self, default: _T) -> tuple[AnyStr | _T, ...]: ... + # Each value in groupdict()'s return dict is either "AnyStr" or # "AnyStr | None", depending on the pattern. @overload def groupdict(self) -> dict[str, AnyStr | MaybeNone]: ... @overload def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ... + def start(self, group: int | str = 0, /) -> int: ... def end(self, group: int | str = 0, /) -> int: ... def span(self, group: int | str = 0, /) -> tuple[int, int]: ... @property def regs(self) -> tuple[tuple[int, int], ...]: ... # undocumented + # __getitem__() returns "AnyStr" or "AnyStr | None", depending on the pattern. @overload def __getitem__(self, key: Literal[0], /) -> AnyStr: ... @overload def __getitem__(self, key: int | str, /) -> AnyStr | MaybeNone: ... + def __copy__(self) -> Match[AnyStr]: ... def __deepcopy__(self, memo: Any, /) -> Match[AnyStr]: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -128,18 +135,21 @@ class Pattern(Generic[AnyStr]): def groups(self) -> int: ... @property def pattern(self) -> AnyStr: ... + @overload def search(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Match[str] | None: ... @overload def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... @overload def search(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ... + @overload def match(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Match[str] | None: ... @overload def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... @overload def match(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ... + if sys.version_info >= (3, 15): prefixmatch = match @@ -151,12 +161,14 @@ class Pattern(Generic[AnyStr]): ) -> Match[bytes] | None: ... @overload def fullmatch(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ... + @overload def split(self: Pattern[str], string: str, maxsplit: int = 0) -> list[str | MaybeNone]: ... @overload def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0) -> list[bytes | MaybeNone]: ... @overload def split(self, string: AnyStr, maxsplit: int = 0) -> list[AnyStr | MaybeNone]: ... + # return type depends on the number of groups in the pattern @overload def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... @@ -164,6 +176,7 @@ class Pattern(Generic[AnyStr]): def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ... @overload def findall(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> list[AnyStr]: ... + @overload def finditer(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[str]]: ... @overload @@ -172,6 +185,7 @@ class Pattern(Generic[AnyStr]): ) -> Iterator[Match[bytes]]: ... @overload def finditer(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[AnyStr]]: ... + @overload def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> str: ... @overload @@ -183,6 +197,7 @@ class Pattern(Generic[AnyStr]): ) -> bytes: ... @overload def sub(self, repl: AnyStr | Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = 0) -> AnyStr: ... + @overload def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> tuple[str, int]: ... @overload @@ -194,6 +209,7 @@ class Pattern(Generic[AnyStr]): ) -> tuple[bytes, int]: ... @overload def subn(self, repl: AnyStr | Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = 0) -> tuple[AnyStr, int]: ... + def __copy__(self) -> Pattern[AnyStr]: ... def __deepcopy__(self, memo: Any, /) -> Pattern[AnyStr]: ... def __eq__(self, value: object, /) -> bool: ... @@ -257,10 +273,12 @@ _FlagsType: TypeAlias = int | RegexFlag def compile(pattern: AnyStr, flags: _FlagsType = 0) -> Pattern[AnyStr]: ... @overload def compile(pattern: Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... + @overload def search(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Match[str] | None: ... @overload def search(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> Match[bytes] | None: ... + @overload def match(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Match[str] | None: ... @overload @@ -276,20 +294,24 @@ if sys.version_info >= (3, 15): def fullmatch(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Match[str] | None: ... @overload def fullmatch(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> Match[bytes] | None: ... + @overload def split(pattern: str | Pattern[str], string: str, maxsplit: int = 0, flags: _FlagsType = 0) -> list[str | MaybeNone]: ... @overload def split( pattern: bytes | Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0, flags: _FlagsType = 0 ) -> list[bytes | MaybeNone]: ... + @overload def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[Any]: ... @overload def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> list[Any]: ... + @overload def finditer(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> Iterator[Match[str]]: ... @overload def finditer(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = 0) -> Iterator[Match[bytes]]: ... + @overload def sub( pattern: str | Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0, flags: _FlagsType = 0 @@ -302,6 +324,7 @@ def sub( count: int = 0, flags: _FlagsType = 0, ) -> bytes: ... + @overload def subn( pattern: str | Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0, flags: _FlagsType = 0 @@ -314,6 +337,7 @@ def subn( count: int = 0, flags: _FlagsType = 0, ) -> tuple[bytes, int]: ... + def escape(pattern: AnyStr) -> AnyStr: ... def purge() -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 1fa3866a8047..ad93cb0b7055 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -121,6 +121,7 @@ if sys.platform == "linux": "Use `os.set_inheritable()` to make the file descriptor inheritable." ) def __new__(self, sizehint: int = -1, flags: int = 0) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index 5e250d6aadbb..c599b0af6138 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -40,12 +40,14 @@ class Shelf(MutableMapping[str, _VT]): def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... + @overload # type: ignore[override] def get(self, key: str, default: None = None) -> _VT | None: ... @overload def get(self, key: str, default: _VT) -> _VT: ... @overload def get(self, key: str, default: _T) -> _VT | _T: ... + def __getitem__(self, key: str) -> _VT: ... def __setitem__(self, key: str, value: _VT) -> None: ... def __delitem__(self, key: str) -> None: ... diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 54e7bdc58bfa..badb0bae220d 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -57,14 +57,17 @@ def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ... def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... + @overload def copy(src: StrPath, dst: _StrPathT, *, follow_symlinks: bool = True) -> _StrPathT | str: ... @overload def copy(src: BytesPath, dst: _BytesPathT, *, follow_symlinks: bool = True) -> _BytesPathT | bytes: ... + @overload def copy2(src: StrPath, dst: _StrPathT, *, follow_symlinks: bool = True) -> _StrPathT | str: ... @overload def copy2(src: BytesPath, dst: _BytesPathT, *, follow_symlinks: bool = True) -> _BytesPathT | bytes: ... + def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], set[str]]: ... def copytree( src: StrPath, @@ -175,7 +178,6 @@ if sys.version_info >= (3, 13): def chown( path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True ) -> None: ... - else: @overload def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ... @@ -195,6 +197,7 @@ if sys.platform == "win32" and sys.version_info < (3, 12): def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | None: ... @overload def which(cmd: bytes, mode: int = 1, path: StrPath | None = None) -> bytes | None: ... + def make_archive( base_name: str, format: str, @@ -207,6 +210,7 @@ def make_archive( logger: Any | None = None, ) -> str: ... def get_archive_formats() -> list[tuple[str, str]]: ... + @overload def register_archive_format( name: str, function: Callable[..., object], extra_args: Sequence[tuple[str, Any] | list[Any]], description: str = "" @@ -215,10 +219,12 @@ def register_archive_format( def register_archive_format( name: str, function: Callable[[str, str], object], extra_args: None = None, description: str = "" ) -> None: ... + def unregister_archive_format(name: str) -> None: ... def unpack_archive( filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: _TarfileFilter | None = None ) -> None: ... + @overload def register_unpack_format( name: str, @@ -231,6 +237,7 @@ def register_unpack_format( def register_unpack_format( name: str, extensions: list[str], function: Callable[[str, str], object], extra_args: None = None, description: str = "" ) -> None: ... + def unregister_unpack_format(name: str) -> None: ... def get_unpack_formats() -> list[tuple[str, list[str], str]]: ... def get_terminal_size(fallback: tuple[int, int] = (80, 24)) -> os.terminal_size: ... diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index 0567a7a05b8a..1aaa5b49664b 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -65,6 +65,7 @@ class SMTPAuthenticationError(SMTPResponseException): ... def quoteaddr(addrstring: str) -> str: ... def quotedata(data: str) -> str: ... + @type_check_only class _AuthObject(Protocol): @overload @@ -121,10 +122,12 @@ class SMTP: user: str password: str def auth(self, mechanism: str, authobject: _AuthObject, *, initial_response_ok: bool = True) -> _Reply: ... + @overload def auth_cram_md5(self, challenge: None = None) -> None: ... @overload def auth_cram_md5(self, challenge: ReadableBuffer) -> str: ... + def auth_plain(self, challenge: ReadableBuffer | None = None) -> str: ... def auth_login(self, challenge: ReadableBuffer | None = None) -> str: ... def login(self, user: str, password: str, *, initial_response_ok: bool = True) -> _Reply: ... @@ -203,6 +206,7 @@ class SMTP_SSL(SMTP): source_address: _SourceAddress | None = None, context: None = None, ) -> None: ... + keyfile: StrOrBytesPath | None certfile: StrOrBytesPath | None diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 39e0981e130a..76ba0a85c128 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -1387,6 +1387,7 @@ class socket(_socket.socket): def __exit__(self, *args: Unused) -> None: ... 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 @overload @@ -1449,6 +1450,7 @@ class socket(_socket.socket): errors: str | None = None, newline: str | None = None, ) -> TextIOWrapper: ... + def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ... @property def family(self) -> AddressFamily: ... diff --git a/stdlib/sqlite3/__init__.pyi b/stdlib/sqlite3/__init__.pyi index 8844abbaebf5..7c033bdf4325 100644 --- a/stdlib/sqlite3/__init__.pyi +++ b/stdlib/sqlite3/__init__.pyi @@ -301,6 +301,7 @@ class Connection: def autocommit(self) -> int: ... @autocommit.setter def autocommit(self, val: int) -> None: ... + row_factory: _RowFactoryOptions text_factory: Any if sys.version_info >= (3, 12): @@ -369,6 +370,7 @@ class Connection: def cursor(self, factory: None = None) -> Cursor: ... @overload def cursor(self, factory: Callable[[Connection], _CursorT]) -> _CursorT: ... + def execute(self, sql: str, parameters: _Parameters = ..., /) -> Cursor: ... def executemany(self, sql: str, parameters: Iterable[_Parameters], /) -> Cursor: ... def executescript(self, sql_script: str, /) -> Cursor: ... @@ -459,10 +461,12 @@ class PrepareProtocol: class Row(Sequence[Any]): def __new__(cls, cursor: Cursor, data: tuple[Any, ...], /) -> Self: ... def keys(self) -> list[str]: ... + @overload # Note: really needs int instead of SupportsIndex def __getitem__(self, key: int | str, /) -> Any: ... @overload # Note: SupportsIndex does work within slices. def __getitem__(self, key: slice[SupportsIndex | None], /) -> tuple[Any, ...]: ... + def __hash__(self) -> int: ... def __iter__(self) -> Iterator[Any]: ... def __len__(self) -> int: ... diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index 88e2d1ee0e4c..6b873f4043b0 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -90,7 +90,6 @@ if sys.version_info >= (3, 12): def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ... @overload def parse_template(source: bytes, pattern: _Pattern[Any]) -> _TemplateByteType: ... - else: @overload def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ... diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index ab7d119bb689..590642d99607 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -283,22 +283,26 @@ class SSLSocket(socket.socket): ) -> tuple[int, socket._RetAddress]: ... def send(self, data: ReadableBuffer, flags: int = 0) -> int: ... def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ... + @overload def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = None) -> int: ... @overload def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ... + def shutdown(self, how: int) -> None: ... @deprecated("Deprecated since Python 3.6. Use `SSLSocket.recv` method instead.") def read(self, len: int = 1024, buffer: WriteableBuffer | None = None) -> bytes: ... @deprecated("Deprecated since Python 3.6. Use `SSLSocket.send` method instead.") def write(self, data: ReadableBuffer) -> int: ... def do_handshake(self, block: bool = False) -> None: ... # block is undocumented + @overload def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... + def cipher(self) -> tuple[str, str, int] | None: ... def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... @@ -374,11 +378,13 @@ class SSLContext(_SSLContext): keylog_filename: str post_handshake_auth: bool security_level: int + @overload def __new__(cls, protocol: int, *args: Any, **kwargs: Any) -> Self: ... @overload @deprecated("Deprecated since Python 3.10. Use a specific version of the SSL protocol.") def __new__(cls, protocol: None = None, *args: Any, **kwargs: Any) -> Self: ... + def load_default_certs(self, purpose: Purpose = Purpose.SERVER_AUTH) -> None: ... def load_verify_locations( self, @@ -386,12 +392,14 @@ class SSLContext(_SSLContext): capath: StrOrBytesPath | None = None, cadata: str | ReadableBuffer | None = None, ) -> None: ... + @overload def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ... @overload def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ... @overload def get_ca_certs(self, binary_form: bool = False) -> Any: ... + def get_ciphers(self) -> list[_Cipher]: ... if sys.version_info >= (3, 15): def set_ciphersuites(self, ciphersuites: str, /) -> None: ... @@ -460,12 +468,14 @@ class SSLObject: def __init__(self, *args: Any, **kwargs: Any) -> None: ... def read(self, len: int = 1024, buffer: WriteableBuffer | None = None) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... + @overload def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... + def selected_alpn_protocol(self) -> str | None: ... @deprecated("Deprecated since Python 3.10. Use ALPN instead.") def selected_npn_protocol(self) -> str | None: ... diff --git a/stdlib/string/__init__.pyi b/stdlib/string/__init__.pyi index c8b32a98e26d..df70cdc6b21c 100644 --- a/stdlib/string/__init__.pyi +++ b/stdlib/string/__init__.pyi @@ -54,12 +54,14 @@ class Formatter: def format(self, format_string: LiteralString, /, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ... @overload def format(self, format_string: str, /, *args: Any, **kwargs: Any) -> str: ... + @overload def vformat( self, format_string: LiteralString, args: Sequence[LiteralString], kwargs: Mapping[LiteralString, LiteralString] ) -> LiteralString: ... @overload def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... + def _vformat( # undocumented self, format_string: str, diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 09c55e37188e..c191f0e35de9 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -293,7 +293,6 @@ if sys.version_info >= (3, 11): pipesize: int = -1, process_group: int | None = None, ) -> CompletedProcess[Any]: ... - else: # 3.10 adds "pipesize" argument @overload # text is True @@ -813,7 +812,6 @@ if sys.version_info >= (3, 11): pipesize: int = -1, process_group: int | None = None, ) -> Any: ... # morally: -> str | bytes - else: # 3.10 adds "pipesize" argument @overload # text is True diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 2ced4364fc65..cfa3fbaceb73 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -21,10 +21,12 @@ __all__ = [ def get_config_var(name: Literal["SO"]) -> Any: ... @overload def get_config_var(name: str) -> Any: ... + @overload def get_config_vars() -> dict[str, Any]: ... @overload def get_config_vars(arg: str, /, *args: str) -> list[Any]: ... + def get_scheme_names() -> tuple[str, ...]: ... def get_default_scheme() -> LiteralString: ... def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> LiteralString: ... @@ -39,14 +41,12 @@ def get_platform() -> str: ... if sys.version_info >= (3, 15): def is_python_build() -> bool: ... - elif sys.version_info >= (3, 11): @overload def is_python_build() -> bool: ... @overload @deprecated("The `check_home` parameter is deprecated since Python 3.12; removed in Python 3.15.") def is_python_build(check_home: object = None) -> bool: ... - else: @overload def is_python_build() -> bool: ... diff --git a/stdlib/syslog.pyi b/stdlib/syslog.pyi index b639c28c7f2d..0cb97dcd3ca7 100644 --- a/stdlib/syslog.pyi +++ b/stdlib/syslog.pyi @@ -51,6 +51,7 @@ if sys.platform != "win32": def closelog() -> None: ... def openlog(ident: str = ..., logoption: int = 0, facility: int = ...) -> None: ... def setlogmask(maskpri: int, /) -> int: ... + @overload def syslog(priority: int, message: str) -> None: ... @overload diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index 3301eaa2468b..6c55683fbaa3 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -213,6 +213,7 @@ class TarFile: debug: Literal[0, 1, 2, 3] | None = None, # default 0 errorlevel: Literal[0, 1, 2] | None = None, # default 1 ) -> Self: ... + if sys.version_info >= (3, 14): @overload @classmethod @@ -515,6 +516,7 @@ class TarFile: errorlevel: Literal[0, 1, 2] | None = None, # default 1 compresslevel: int = 9, ) -> Self: ... + @classmethod def taropen( cls, @@ -532,6 +534,7 @@ class TarFile: debug: Literal[0, 1, 2, 3] | None = None, # default 0 errorlevel: Literal[0, 1, 2] | None = None, # default 1 ) -> Self: ... + @overload @classmethod def gzopen( @@ -568,6 +571,7 @@ class TarFile: debug: Literal[0, 1, 2, 3] | None = None, # default 0 errorlevel: Literal[0, 1, 2] | None = None, # default 1 ) -> Self: ... + @overload @classmethod def bz2open( @@ -604,6 +608,7 @@ class TarFile: debug: Literal[0, 1, 2, 3] | None = None, # default 0 errorlevel: Literal[0, 1, 2] | None = None, # default 1 ) -> Self: ... + @classmethod def xzopen( cls, @@ -805,20 +810,24 @@ class TarInfo: gname: str pax_headers: Mapping[str, str] def __init__(self, name: str = "") -> None: ... + @property @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") def tarfile(self) -> TarFile | None: ... @tarfile.setter @deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.") def tarfile(self, tarfile: TarFile | None) -> None: ... + @classmethod def frombuf(cls, buf: bytes | bytearray, encoding: str, errors: str) -> Self: ... @classmethod def fromtarfile(cls, tarfile: TarFile) -> Self: ... + @property def linkpath(self) -> str: ... @linkpath.setter def linkpath(self, linkname: str) -> None: ... + def replace( self, *, diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 1e8e8679add5..1df04a3d3667 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -81,7 +81,6 @@ if sys.version_info >= (3, 12): errors: str | None = None, delete_on_close: bool = True, ) -> _TemporaryFileWrapper[Any]: ... - else: @overload def NamedTemporaryFile( @@ -249,18 +248,21 @@ class _TemporaryFileWrapper(IO[AnyStr]): def tell(self) -> int: ... def truncate(self, size: int | None = ...) -> int: ... def writable(self) -> bool: ... + @overload def write(self: _TemporaryFileWrapper[str], s: str, /) -> int: ... @overload def write(self: _TemporaryFileWrapper[bytes], s: ReadableBuffer, /) -> int: ... @overload def write(self, s: AnyStr, /) -> int: ... + @overload def writelines(self: _TemporaryFileWrapper[str], lines: Iterable[str]) -> None: ... @overload def writelines(self: _TemporaryFileWrapper[bytes], lines: Iterable[ReadableBuffer]) -> None: ... @overload def writelines(self, lines: Iterable[AnyStr]) -> None: ... + @property def closed(self) -> bool: ... @@ -277,6 +279,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase): def encoding(self) -> str: ... # undocumented @property def newlines(self) -> str | tuple[str, ...] | None: ... # undocumented + # bytes needs to go first, as default mode is to open as bytes @overload def __init__( @@ -348,6 +351,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase): dir: str | None = None, errors: str | None = None, ) -> None: ... + @property def errors(self) -> str | None: ... def rollover(self) -> None: ... @@ -384,12 +388,14 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase): def write(self: SpooledTemporaryFile[bytes], s: ReadableBuffer) -> int: ... @overload def write(self, s: AnyStr) -> int: ... + @overload # type: ignore[override] def writelines(self: SpooledTemporaryFile[str], iterable: Iterable[str]) -> None: ... @overload def writelines(self: SpooledTemporaryFile[bytes], iterable: Iterable[ReadableBuffer]) -> None: ... @overload def writelines(self, iterable: Iterable[AnyStr]) -> None: ... + def __iter__(self) -> Iterator[AnyStr]: ... # type: ignore[override] # These exist at runtime only on 3.11+. def readable(self) -> bool: ... @@ -459,6 +465,7 @@ def mkstemp( def mkdtemp(suffix: str | None = None, prefix: str | None = None, dir: StrPath | None = None) -> str: ... @overload def mkdtemp(suffix: bytes | None = None, prefix: bytes | None = None, dir: BytesPath | None = None) -> bytes: ... + @deprecated("Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.") def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 87d31a921bbb..9f1c346cdc19 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -527,10 +527,12 @@ class Misc: def winfo_y(self) -> int: ... def update(self) -> None: ... def update_idletasks(self) -> None: ... + @overload def bindtags(self, tagList: None = None) -> tuple[str, ...]: ... @overload def bindtags(self, tagList: list[str] | tuple[str, ...]) -> None: ... + # bind with isinstance(func, str) doesn't return anything, but all other # binds do. The default value of func is not str. @overload @@ -544,6 +546,7 @@ class Misc: def bind(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... @overload def bind(self, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... + # There's no way to know what type of widget bind_all and bind_class # callbacks will get, so those are Misc. @overload @@ -557,6 +560,7 @@ class Misc: def bind_all(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... @overload def bind_all(self, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... + @overload def bind_class( self, @@ -569,6 +573,7 @@ class Misc: def bind_class(self, className: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... @overload def bind_class(self, className: str, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... + def unbind(self, sequence: str, funcid: str | None = None) -> None: ... def unbind_all(self, sequence: str) -> None: ... def unbind_class(self, className: str, sequence: str) -> None: ... @@ -581,13 +586,16 @@ class Misc: self, func: Callable[..., object], subst: Callable[..., Sequence[Any]] | None = None, needcleanup: int = 1 ) -> str: ... def keys(self) -> list[str]: ... + @overload def pack_propagate(self, flag: bool) -> bool | None: ... @overload def pack_propagate(self) -> None: ... + propagate = pack_propagate def grid_anchor(self, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] | None = None) -> None: ... anchor = grid_anchor + @overload def grid_bbox( self, column: None = None, row: None = None, col2: None = None, row2: None = None @@ -596,6 +604,7 @@ class Misc: def grid_bbox(self, column: int, row: int, col2: None = None, row2: None = None) -> tuple[int, int, int, int] | None: ... @overload def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> tuple[int, int, int, int] | None: ... + bbox = grid_bbox def grid_columnconfigure( self, @@ -620,10 +629,12 @@ class Misc: columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure def grid_location(self, x: float | str, y: float | str) -> tuple[int, int]: ... + @overload def grid_propagate(self, flag: bool) -> None: ... @overload def grid_propagate(self) -> bool: ... + def grid_size(self) -> tuple[int, int]: ... size = grid_size # Widget because Toplevel or Tk is never a slave @@ -693,7 +704,9 @@ class XView: def xview(self) -> tuple[float, float]: ... @overload def xview(self, *args) -> None: ... + def xview_moveto(self, fraction: float) -> None: ... + @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload @@ -704,7 +717,9 @@ class YView: def yview(self) -> tuple[float, float]: ... @overload def yview(self, *args) -> None: ... + def yview_moveto(self, fraction: float) -> None: ... + @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload @@ -749,13 +764,13 @@ class Wm: def wm_aspect( self, minNumer: None = None, minDenom: None = None, maxNumer: None = None, maxDenom: None = None ) -> tuple[int, int, int, int] | None: ... + aspect = wm_aspect if sys.version_info >= (3, 13): @overload def wm_attributes(self, *, return_python_dict: Literal[False] = False) -> tuple[Any, ...]: ... @overload def wm_attributes(self, *, return_python_dict: Literal[True]) -> _WmAttributes: ... - else: @overload def wm_attributes(self) -> tuple[Any, ...]: ... @@ -855,6 +870,7 @@ class Wm: @overload def wm_attributes(self, option: str, value, /, *__other_option_value_pairs: Any) -> Literal[""]: ... + if sys.version_info >= (3, 13): if sys.platform == "darwin": @overload @@ -891,12 +907,14 @@ class Wm: attributes = wm_attributes def wm_client(self, name: str | None = None) -> str: ... client = wm_client + @overload def wm_colormapwindows(self) -> list[Misc]: ... @overload def wm_colormapwindows(self, wlist: list[Misc] | tuple[Misc, ...], /) -> None: ... @overload def wm_colormapwindows(self, first_wlist_item: Misc, /, *other_wlist_items: Misc) -> None: ... + colormapwindows = wm_colormapwindows def wm_command(self, value: str | None = None) -> str: ... command = wm_command @@ -909,10 +927,12 @@ class Wm: forget = wm_forget def wm_frame(self) -> str: ... frame = wm_frame + @overload def wm_geometry(self, newGeometry: None = None) -> str: ... @overload def wm_geometry(self, newGeometry: str) -> None: ... + geometry = wm_geometry def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): ... grid = wm_grid @@ -934,51 +954,67 @@ class Wm: iconwindow = wm_iconwindow def wm_manage(self, widget) -> None: ... manage = wm_manage + @overload def wm_maxsize(self, width: None = None, height: None = None) -> tuple[int, int]: ... @overload def wm_maxsize(self, width: int, height: int) -> None: ... + maxsize = wm_maxsize + @overload def wm_minsize(self, width: None = None, height: None = None) -> tuple[int, int]: ... @overload def wm_minsize(self, width: int, height: int) -> None: ... + minsize = wm_minsize + @overload def wm_overrideredirect(self, boolean: None = None) -> bool | None: ... # returns True or None @overload def wm_overrideredirect(self, boolean: bool) -> None: ... + overrideredirect = wm_overrideredirect def wm_positionfrom(self, who: Literal["program", "user"] | None = None) -> Literal["", "program", "user"]: ... positionfrom = wm_positionfrom + @overload def wm_protocol(self, name: str, func: Callable[[], object] | str) -> None: ... @overload def wm_protocol(self, name: str, func: None = None) -> str: ... @overload def wm_protocol(self, name: None = None, func: None = None) -> tuple[str, ...]: ... + protocol = wm_protocol + @overload def wm_resizable(self, width: None = None, height: None = None) -> tuple[bool, bool]: ... @overload def wm_resizable(self, width: bool, height: bool) -> None: ... + resizable = wm_resizable def wm_sizefrom(self, who: Literal["program", "user"] | None = None) -> Literal["", "program", "user"]: ... sizefrom = wm_sizefrom + @overload def wm_state(self, newstate: None = None) -> str: ... @overload def wm_state(self, newstate: str) -> None: ... + state = wm_state + @overload def wm_title(self, string: None = None) -> str: ... @overload def wm_title(self, string: str) -> None: ... + title = wm_title + @overload def wm_transient(self, master: None = None) -> _tkinter.Tcl_Obj: ... @overload def wm_transient(self, master: Wm | _tkinter.Tcl_Obj) -> None: ... + transient = wm_transient def wm_withdraw(self) -> None: ... withdraw = wm_withdraw @@ -997,6 +1033,7 @@ class Tk(Misc, Wm): sync: bool = False, use: str | None = None, ) -> None: ... + # Keep this in sync with ttktheme.ThemedTk. See issue #13858 @overload def configure( @@ -1022,6 +1059,7 @@ class Tk(Misc, Wm): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def destroy(self) -> None: ... def readprofile(self, baseName: str, className: str) -> None: ... @@ -1057,6 +1095,7 @@ class Tk(Misc, Wm): def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ... def unsetvar(self, *args, **kwargs): ... + if sys.version_info >= (3, 14): @overload def wantobjects(self) -> Literal[0, 1]: ... @@ -1066,6 +1105,7 @@ class Tk(Misc, Wm): @overload def wantobjects(self, wantobjects: Literal[0, 1] | bool, /) -> None: ... + def willdispatch(self) -> None: ... def Tcl(screenName: str | None = None, baseName: str | None = None, className: str = "Tk", useTk: bool = False) -> Tk: ... @@ -1246,6 +1286,7 @@ class Toplevel(BaseWidget, Wm): visual: str | tuple[str, int] = "", width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -1270,6 +1311,7 @@ class Toplevel(BaseWidget, Wm): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Button(Widget): @@ -1321,6 +1363,7 @@ class Button(Widget): width: float | str = 0, wraplength: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -1365,6 +1408,7 @@ class Button(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def flash(self) -> None: ... def invoke(self) -> Any: ... @@ -1410,6 +1454,7 @@ class Canvas(Widget, XView, YView): yscrollcommand: str | Callable[[float, float], object] = "", yscrollincrement: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -1448,6 +1493,7 @@ class Canvas(Widget, XView, YView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def addtag(self, *args): ... # internal method def addtag_above(self, newtag: str, tagOrId: str | int) -> None: ... @@ -1471,6 +1517,7 @@ class Canvas(Widget, XView, YView): def find_withtag(self, tagOrId: str | int) -> tuple[int, ...]: ... # Incompatible with Misc.bbox(), tkinter violates LSP def bbox(self, *args: str | int) -> tuple[int, int, int, int]: ... # type: ignore[override] + @overload def tag_bind( self, @@ -1485,21 +1532,25 @@ class Canvas(Widget, XView, YView): ) -> None: ... @overload def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... + def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = None) -> None: ... def canvasx(self, screenx, gridspacing=None): ... def canvasy(self, screeny, gridspacing=None): ... + @overload def coords(self, tagOrId: str | int, /) -> list[float]: ... @overload def coords(self, tagOrId: str | int, args: list[int] | list[float] | tuple[float, ...], /) -> None: ... @overload def coords(self, tagOrId: str | int, x1: float, y1: float, /, *args: float) -> None: ... + # create_foo() methods accept coords as a list or tuple, or as separate arguments. # Lists and tuples can be flat as in [1, 2, 3, 4], or nested as in [(1, 2), (3, 4)]. # Keyword arguments should be the same in all overloads of each method. def create_arc(self, *args, **kw) -> int: ... def create_bitmap(self, *args, **kw) -> int: ... def create_image(self, *args, **kw) -> int: ... + @overload def create_line( self, @@ -1598,6 +1649,7 @@ class Canvas(Widget, XView, YView): tags: str | list[str] | tuple[str, ...] = ..., width: float | str = ..., ) -> int: ... + @overload def create_oval( self, @@ -1699,6 +1751,7 @@ class Canvas(Widget, XView, YView): tags: str | list[str] | tuple[str, ...] = ..., width: float | str = ..., ) -> int: ... + @overload def create_polygon( self, @@ -1809,6 +1862,7 @@ class Canvas(Widget, XView, YView): tags: str | list[str] | tuple[str, ...] = ..., width: float | str = ..., ) -> int: ... + @overload def create_rectangle( self, @@ -1910,6 +1964,7 @@ class Canvas(Widget, XView, YView): tags: str | list[str] | tuple[str, ...] = ..., width: float | str = ..., ) -> int: ... + @overload def create_text( self, @@ -1955,6 +2010,7 @@ class Canvas(Widget, XView, YView): text: float | str = ..., width: float | str = ..., ) -> int: ... + @overload def create_window( self, @@ -1982,12 +2038,15 @@ class Canvas(Widget, XView, YView): width: float | str = ..., window: Widget = ..., ) -> int: ... + def dchars(self, *args) -> None: ... def delete(self, *tagsOrCanvasIds: str | int) -> None: ... + @overload def dtag(self, tag: str, tag_to_delete: str | None = ..., /) -> None: ... @overload def dtag(self, id: int, tag_to_delete: str, /) -> None: ... + def focus(self, *args): ... def gettags(self, tagOrId: str | int, /) -> tuple[str, ...]: ... def icursor(self, *args) -> None: ... @@ -2082,6 +2141,7 @@ class Checkbutton(Widget): width: float | str = 0, wraplength: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -2132,6 +2192,7 @@ class Checkbutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def deselect(self) -> None: ... def flash(self) -> None: ... @@ -2184,6 +2245,7 @@ class Entry(Widget, XView): width: int = 20, xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload def configure( self, @@ -2229,6 +2291,7 @@ class Entry(Widget, XView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def delete(self, first: str | int, last: str | int | None = None) -> None: ... def get(self) -> str: ... @@ -2277,6 +2340,7 @@ class Frame(Widget): visual: str | tuple[str, int] = "", # can't be changed with configure() width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -2300,6 +2364,7 @@ class Frame(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Label(Widget): @@ -2341,6 +2406,7 @@ class Label(Widget): width: float | str = 0, wraplength: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -2380,6 +2446,7 @@ class Label(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Listbox(Widget, XView, YView): @@ -2434,6 +2501,7 @@ class Listbox(Widget, XView, YView): xscrollcommand: str | Callable[[float, float], object] = "", yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload def configure( self, @@ -2471,6 +2539,7 @@ class Listbox(Widget, XView, YView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def activate(self, index: str | int) -> None: ... def bbox(self, index: str | int) -> tuple[int, int, int, int] | None: ... # type: ignore[override] @@ -2528,6 +2597,7 @@ class Menu(Widget): title: str = "", type: Literal["menubar", "tearoff", "normal"] = "normal", ) -> None: ... + @overload def configure( self, @@ -2557,6 +2627,7 @@ class Menu(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def tk_popup(self, x: int, y: int, entry: str | int = "") -> None: ... def activate(self, index: str | int) -> None: ... @@ -2808,6 +2879,7 @@ class Menubutton(Widget): width: float | str = 0, wraplength: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -2850,6 +2922,7 @@ class Menubutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Message(Widget): @@ -2883,6 +2956,7 @@ class Message(Widget): # there's width but no height width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -2913,6 +2987,7 @@ class Message(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Radiobutton(Widget): @@ -2964,6 +3039,7 @@ class Radiobutton(Widget): width: float | str = 0, wraplength: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -3013,6 +3089,7 @@ class Radiobutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def deselect(self) -> None: ... def flash(self) -> None: ... @@ -3062,6 +3139,7 @@ class Scale(Widget): variable: IntVar | DoubleVar = ..., width: float | str = 15, ) -> None: ... + @overload def configure( self, @@ -3104,6 +3182,7 @@ class Scale(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def get(self) -> float: ... def set(self, value) -> None: ... @@ -3143,6 +3222,7 @@ class Scrollbar(Widget): troughcolor: str = ..., width: float | str = ..., ) -> None: ... + @overload def configure( self, @@ -3172,6 +3252,7 @@ class Scrollbar(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def activate(self, index=None): ... def delta(self, deltax: int, deltay: int) -> float: ... @@ -3241,6 +3322,7 @@ class Text(Widget, XView, YView): xscrollcommand: str | Callable[[float, float], object] = "", yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload def configure( self, @@ -3294,6 +3376,7 @@ class Text(Widget, XView, YView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def bbox(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int] | None: ... # type: ignore[override] def compare( @@ -3302,6 +3385,7 @@ class Text(Widget, XView, YView): op: Literal["<", "<=", "==", ">=", ">", "!="], index2: str | float | _tkinter.Tcl_Obj | Widget, ) -> bool: ... + if sys.version_info >= (3, 13): @overload def count( @@ -3485,10 +3569,12 @@ class Text(Widget, XView, YView): def debug(self, boolean: None = None) -> bool: ... @overload def debug(self, boolean: bool) -> None: ... + def delete( self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None ) -> None: ... def dlineinfo(self, index: str | float | _tkinter.Tcl_Obj | Widget) -> tuple[int, int, int, int, int] | None: ... + @overload def dump( self, @@ -3531,11 +3617,14 @@ class Text(Widget, XView, YView): text: bool = ..., window: bool = ..., ) -> None: ... + def edit(self, *args): ... # docstring says "Internal method" + @overload def edit_modified(self, arg: None = None) -> bool: ... # actually returns Literal[0, 1] @overload def edit_modified(self, arg: bool) -> None: ... # actually returns empty string + def edit_redo(self) -> None: ... # actually returns empty string def edit_reset(self) -> None: ... # actually returns empty string def edit_separator(self) -> None: ... # actually returns empty string @@ -3543,6 +3632,7 @@ class Text(Widget, XView, YView): def get( self, index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None ) -> str: ... + @overload def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["image", "name"]) -> str: ... @overload @@ -3553,6 +3643,7 @@ class Text(Widget, XView, YView): ) -> Literal["baseline", "bottom", "center", "top"]: ... @overload def image_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ... + @overload def image_configure( self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str @@ -3569,6 +3660,7 @@ class Text(Widget, XView, YView): padx: float | str = ..., pady: float | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... + def image_create( self, index: str | float | _tkinter.Tcl_Obj | Widget, @@ -3585,10 +3677,12 @@ class Text(Widget, XView, YView): def insert( self, index: str | float | _tkinter.Tcl_Obj | Widget, chars: str, *args: str | list[str] | tuple[str, ...] ) -> None: ... + @overload def mark_gravity(self, markName: str, direction: None = None) -> Literal["left", "right"]: ... @overload def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ... # actually returns empty string + def mark_names(self) -> tuple[str, ...]: ... def mark_set(self, markName: str, index: str | float | _tkinter.Tcl_Obj | Widget) -> None: ... def mark_unset(self, *markNames: str) -> None: ... @@ -3659,6 +3753,7 @@ class Text(Widget, XView, YView): def tag_add( self, tagName: str, index1: str | float | _tkinter.Tcl_Obj | Widget, *args: str | float | _tkinter.Tcl_Obj | Widget ) -> None: ... + # tag_bind stuff is very similar to Canvas @overload def tag_bind( @@ -3670,9 +3765,11 @@ class Text(Widget, XView, YView): ) -> str: ... @overload def tag_bind(self, tagName: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... + def tag_unbind(self, tagName: str, sequence: str, funcid: str | None = None) -> None: ... # allowing any string for cget instead of just Literals because there's no other way to look up tag options def tag_cget(self, tagName: str, option: str): ... + @overload def tag_configure( self, @@ -3710,6 +3807,7 @@ class Text(Widget, XView, YView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ... + tag_config = tag_configure def tag_delete(self, first_tag_name: str, /, *tagNames: str) -> None: ... # error if no tag names given def tag_lower(self, tagName: str, belowThis: str | None = None) -> None: ... @@ -3735,6 +3833,7 @@ class Text(Widget, XView, YView): index1: str | float | _tkinter.Tcl_Obj | Widget, index2: str | float | _tkinter.Tcl_Obj | Widget | None = None, ) -> None: ... + @overload def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["padx", "pady"]) -> int: ... @overload @@ -3749,6 +3848,7 @@ class Text(Widget, XView, YView): def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: Literal["create", "window"]) -> str: ... @overload def window_cget(self, index: str | float | _tkinter.Tcl_Obj | Widget, option: str) -> Any: ... + @overload def window_configure( self, index: str | float | _tkinter.Tcl_Obj | Widget, cnf: str @@ -3766,6 +3866,7 @@ class Text(Widget, XView, YView): stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... + window_config = window_configure def window_create( self, @@ -3931,6 +4032,7 @@ class PhotoImage(Image, _PhotoImageLike): background: str | None = None, grayscale: bool = False, ) -> None: ... + @overload def data( self, format: str, *, from_coords: Iterable[int] | None = None, background: str | None = None, grayscale: bool = False @@ -4031,6 +4133,7 @@ class Spinbox(Widget, XView): wrap: bool = False, xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload def configure( self, @@ -4089,6 +4192,7 @@ class Spinbox(Widget, XView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override] def delete(self, first, last=None) -> Literal[""]: ... @@ -4145,6 +4249,7 @@ class LabelFrame(Widget): visual: str | tuple[str, int] = "", # can't be changed with configure() width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -4174,6 +4279,7 @@ class LabelFrame(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class PanedWindow(Widget): @@ -4205,6 +4311,7 @@ class PanedWindow(Widget): showhandle: bool = False, width: float | str = "", ) -> None: ... + @overload def configure( self, @@ -4234,6 +4341,7 @@ class PanedWindow(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def add(self, child: Widget, **kw) -> None: ... def remove(self, child) -> None: ... diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index 5d660c56fe50..d9e0b1315590 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -60,6 +60,7 @@ class Font: ) -> None: ... __hash__: ClassVar[None] # type: ignore[assignment] def __setitem__(self, key: str, value: Any) -> None: ... + @overload def cget(self, option: Literal["family"]) -> str: ... @overload @@ -72,7 +73,9 @@ class Font: def cget(self, option: Literal["underline", "overstrike"]) -> bool: ... @overload def cget(self, option: str) -> Any: ... + __getitem__ = cget + @overload def actual(self, option: Literal["family"], displayof: tkinter.Misc | None = None) -> str: ... @overload @@ -87,6 +90,7 @@ class Font: def actual(self, option: None, displayof: tkinter.Misc | None = None) -> _FontDict: ... @overload def actual(self, *, displayof: tkinter.Misc | None = None) -> _FontDict: ... + def config( self, *, @@ -99,12 +103,14 @@ class Font: ) -> _FontDict | None: ... configure = config def copy(self) -> Font: ... + @overload def metrics(self, option: Literal["ascent", "descent", "linespace"], /, *, displayof: tkinter.Misc | None = ...) -> int: ... @overload def metrics(self, option: Literal["fixed"], /, *, displayof: tkinter.Misc | None = ...) -> bool: ... @overload def metrics(self, *, displayof: tkinter.Misc | None = ...) -> _MetricsDict: ... + def measure(self, text: str, displayof: tkinter.Misc | None = None) -> int: ... def __eq__(self, other: object) -> bool: ... def __del__(self) -> None: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index f546c2851860..06d2be13dc28 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -123,6 +123,7 @@ class Style: master: tkinter.Misc tk: _tkinter.TkappType def __init__(self, master: tkinter.Misc | None = None) -> None: ... + # For these methods, values given vary between options. Returned values # seem to be str, but this might not always be the case. @overload @@ -131,15 +132,19 @@ class Style: def configure(self, style: str, query_opt: str, **kw: Any) -> Any: ... @overload def configure(self, style: str, query_opt: None = None, **kw: Any) -> None: ... + @overload def map(self, style: str, query_opt: str) -> _Statespec: ... @overload def map(self, style: str, query_opt: None = None, **kw: Iterable[_Statespec]) -> dict[str, _Statespec]: ... + def lookup(self, style: str, option: str, state: Iterable[str] | None = None, default: Any | None = None) -> Any: ... + @overload def layout(self, style: str, layoutspec: _LayoutSpec) -> list[Never]: ... # Always seems to return an empty list @overload def layout(self, style: str, layoutspec: None = None) -> _LayoutSpec: ... + @overload def element_create( self, @@ -203,6 +208,7 @@ class Style: def theme_create(self, themename: str, parent: str | None = None, settings: _ThemeSettings | None = None) -> None: ... def theme_settings(self, themename: str, settings: _ThemeSettings) -> None: ... def theme_names(self) -> tuple[str, ...]: ... + @overload def theme_use(self, themename: str) -> None: ... @overload @@ -211,12 +217,14 @@ class Style: class Widget(tkinter.Widget): def __init__(self, master: tkinter.Misc | None, widgetname: str | None, kw: dict[str, Any] | None = None) -> None: ... def identify(self, x: int, y: int) -> str: ... + @overload def instate(self, statespec: Sequence[str], callback: None = None) -> bool: ... @overload def instate( self, statespec: Sequence[str], callback: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs ) -> Literal[False] | _T: ... + def state(self, statespec: Sequence[str] | None = None) -> tuple[str, ...]: ... class Button(Widget): @@ -240,6 +248,7 @@ class Button(Widget): underline: int = -1, width: int | Literal[""] = "", ) -> None: ... + @overload def configure( self, @@ -261,6 +270,7 @@ class Button(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def invoke(self) -> Any: ... @@ -290,6 +300,7 @@ class Checkbutton(Widget): variable: tkinter.Variable = ..., width: int | Literal[""] = "", ) -> None: ... + @overload def configure( self, @@ -313,6 +324,7 @@ class Checkbutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def invoke(self) -> Any: ... @@ -341,6 +353,7 @@ class Entry(Widget, tkinter.Entry): width: int = 20, xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -365,6 +378,7 @@ class Entry(Widget, tkinter.Entry): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + # config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why) @overload # type: ignore[override] def config( @@ -390,6 +404,7 @@ class Entry(Widget, tkinter.Entry): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def bbox(self, index) -> tuple[int, int, int, int]: ... # type: ignore[override] def identify(self, x: int, y: int) -> str: ... def validate(self): ... @@ -421,6 +436,7 @@ class Combobox(Entry): width: int = 20, xscrollcommand: str | Callable[[float, float], object] = ..., # undocumented ) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -448,6 +464,7 @@ class Combobox(Entry): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + # config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why) @overload # type: ignore[override] def config( @@ -476,6 +493,7 @@ class Combobox(Entry): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def current(self, newindex: int | None = None) -> int: ... def set(self, value: Any) -> None: ... @@ -498,6 +516,7 @@ class Frame(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -515,6 +534,7 @@ class Frame(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Label(Widget): @@ -545,6 +565,7 @@ class Label(Widget): width: int | Literal[""] = "", wraplength: float | str = ..., ) -> None: ... + @overload def configure( self, @@ -573,6 +594,7 @@ class Label(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Labelframe(Widget): @@ -596,6 +618,7 @@ class Labelframe(Widget): underline: int = -1, width: float | str = 0, ) -> None: ... + @overload def configure( self, @@ -617,6 +640,7 @@ class Labelframe(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure LabelFrame = Labelframe @@ -642,6 +666,7 @@ class Menubutton(Widget): underline: int = -1, width: int | Literal[""] = "", ) -> None: ... + @overload def configure( self, @@ -663,6 +688,7 @@ class Menubutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Notebook(Widget): @@ -679,6 +705,7 @@ class Notebook(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = 0, ) -> None: ... + @overload def configure( self, @@ -693,6 +720,7 @@ class Notebook(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def add( self, @@ -734,6 +762,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): width: int = 0, ) -> None: ... def add(self, child: tkinter.Widget, *, weight: int = ..., **kw) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -747,6 +776,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + # config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why) @overload # type: ignore[override] def config( @@ -761,6 +791,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + forget = tkinter.PanedWindow.forget def insert(self, pos, child, **kw) -> None: ... def pane(self, pane, option=None, **kw): ... @@ -786,6 +817,7 @@ class Progressbar(Widget): value: float = 0.0, variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> None: ... + @overload def configure( self, @@ -804,6 +836,7 @@ class Progressbar(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def start(self, interval: Literal["idle"] | int | None = None) -> None: ... def step(self, amount: float | None = None) -> None: ... @@ -831,6 +864,7 @@ class Radiobutton(Widget): variable: tkinter.Variable | Literal[""] = ..., width: int | Literal[""] = "", ) -> None: ... + @overload def configure( self, @@ -853,6 +887,7 @@ class Radiobutton(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def invoke(self) -> Any: ... @@ -876,6 +911,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] value: float = 0, variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -895,6 +931,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + # config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why) @overload # type: ignore[override] def config( @@ -915,6 +952,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def get(self, x: int | None = None, y: int | None = None) -> float: ... # type ignore, because identify() methods of Widget and tkinter.Scale are incompatible @@ -931,6 +969,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -944,6 +983,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + # config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why) @overload # type: ignore[override] def config( @@ -971,6 +1011,7 @@ class Separator(Widget): style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... + @overload def configure( self, @@ -983,6 +1024,7 @@ class Separator(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Sizegrip(Widget): @@ -996,6 +1038,7 @@ class Sizegrip(Widget): style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... + @overload def configure( self, @@ -1007,6 +1050,7 @@ class Sizegrip(Widget): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure class Spinbox(Entry): @@ -1040,6 +1084,7 @@ class Spinbox(Entry): wrap: bool = False, xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload # type: ignore[override] def configure( self, @@ -1071,6 +1116,7 @@ class Spinbox(Entry): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure # type: ignore[assignment] def set(self, value: Any) -> None: ... @@ -1129,6 +1175,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): xscrollcommand: str | Callable[[float, float], object] = "", yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... + @overload def configure( self, @@ -1148,10 +1195,12 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure def bbox(self, item: str | int, column: str | int | None = None) -> tuple[int, int, int, int] | Literal[""]: ... # type: ignore[override] def get_children(self, item: str | int | None = None) -> tuple[str, ...]: ... def set_children(self, item: str | int, *newchildren: str | int) -> None: ... + @overload def column(self, column: str | int, option: Literal["width", "minwidth"]) -> int: ... @overload @@ -1174,13 +1223,16 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., # id is read-only ) -> _TreeviewColumnDict | None: ... + def delete(self, *items: str | int) -> None: ... def detach(self, *items: str | int) -> None: ... def exists(self, item: str | int) -> bool: ... + @overload # type: ignore[override] def focus(self, item: None = None) -> str: ... # can return empty string @overload def focus(self, item: str | int) -> Literal[""]: ... + @overload def heading(self, column: str | int, option: Literal["text"]) -> str: ... @overload @@ -1204,6 +1256,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., command: str | Callable[[], object] = ..., ) -> None: ... + # Internal Method. Leave untyped: def identify(self, component, x, y): ... # type: ignore[override] def identify_row(self, y: int) -> str: ... @@ -1224,6 +1277,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., ) -> str: ... + @overload def item(self, item: str | int, option: Literal["text"]) -> str: ... @overload @@ -1250,6 +1304,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., ) -> None: ... + def move(self, item: str | int, parent: str, index: int | Literal["end"]) -> None: ... reattach = move def next(self, item: str | int) -> str: ... # returning empty string means last item @@ -1257,28 +1312,34 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): def prev(self, item: str | int) -> str: ... # returning empty string means first item def see(self, item: str | int) -> None: ... def selection(self) -> tuple[str, ...]: ... + @overload def selection_set(self, items: list[str] | tuple[str, ...] | list[int] | tuple[int, ...], /) -> None: ... @overload def selection_set(self, *items: str | int) -> None: ... + @overload def selection_add(self, items: list[str] | tuple[str, ...] | list[int] | tuple[int, ...], /) -> None: ... @overload def selection_add(self, *items: str | int) -> None: ... + @overload def selection_remove(self, items: list[str] | tuple[str, ...] | list[int] | tuple[int, ...], /) -> None: ... @overload def selection_remove(self, *items: str | int) -> None: ... + @overload def selection_toggle(self, items: list[str] | tuple[str, ...] | list[int] | tuple[int, ...], /) -> None: ... @overload def selection_toggle(self, *items: str | int) -> None: ... + @overload def set(self, item: str | int, column: None = None, value: None = None) -> dict[str, Any]: ... @overload def set(self, item: str | int, column: str | int, value: None = None) -> Any: ... @overload def set(self, item: str | int, column: str | int, value: Any) -> Literal[""]: ... + # There's no tag_unbind() or 'add' argument for whatever reason. # Also, it's 'callback' instead of 'func' here. @overload @@ -1289,6 +1350,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): def tag_bind(self, tagname: str, sequence: str | None, callback: str) -> None: ... @overload def tag_bind(self, tagname: str, *, callback: str) -> None: ... + @overload def tag_configure(self, tagname: str, option: Literal["foreground", "background"]) -> str: ... @overload @@ -1307,6 +1369,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): font: _FontDescription = ..., image: tkinter._Image | str = ..., ) -> _TreeviewTagDict | MaybeNone: ... # can be None but annoying to check + @overload def tag_has(self, tagname: str, item: None = None) -> tuple[str, ...]: ... @overload diff --git a/stdlib/tomllib.pyi b/stdlib/tomllib.pyi index 4ff4097f8313..7f6df1d9380c 100644 --- a/stdlib/tomllib.pyi +++ b/stdlib/tomllib.pyi @@ -13,6 +13,7 @@ if sys.version_info >= (3, 14): pos: int lineno: int colno: int + @overload def __init__(self, msg: str, doc: str, pos: int) -> None: ... @overload diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index 46ebb8b1e607..e5b410afdcbc 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -33,6 +33,7 @@ if sys.version_info >= (3, 14): _FrameSummaryTuple: TypeAlias = tuple[str, int, str, str | None] def print_tb(tb: TracebackType | None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ... + @overload def print_exception( exc: type[BaseException] | None, @@ -47,6 +48,7 @@ def print_exception( def print_exception( exc: BaseException, /, *, limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True ) -> None: ... + @overload def format_exception( exc: type[BaseException] | None, @@ -58,6 +60,7 @@ def format_exception( ) -> list[str]: ... @overload def format_exception(exc: BaseException, /, *, limit: int | None = None, chain: bool = True) -> list[str]: ... + def print_exc(limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... def print_last(limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... def print_stack(f: FrameType | None = None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ... @@ -71,7 +74,6 @@ if sys.version_info >= (3, 13): def format_exception_only(exc: BaseException | None, /, *, show_group: bool = False) -> list[str]: ... @overload def format_exception_only(exc: Unused, /, value: BaseException | None, *, show_group: bool = False) -> list[str]: ... - else: @overload def format_exception_only(exc: BaseException | None, /) -> list[str]: ... @@ -254,6 +256,7 @@ class FrameSummary: locals: dict[str, str] | None @property def line(self) -> str | None: ... + @overload def __getitem__(self, pos: Literal[0]) -> str: ... @overload @@ -266,6 +269,7 @@ class FrameSummary: def __getitem__(self, pos: SupportsIndex) -> Any: ... @overload def __getitem__(self, pos: slice[SupportsIndex | None]) -> tuple[Any, ...]: ... + def __iter__(self) -> Iterator[Any]: ... def __eq__(self, other: object) -> bool: ... def __len__(self) -> Literal[4]: ... diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index 042d1ca94ee7..e56aa19240fd 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -91,10 +91,12 @@ class Traceback(Sequence[Frame]): def total_nframe(self) -> int | None: ... def __init__(self, frames: Sequence[_FrameTuple], total_nframe: int | None = None) -> None: ... def format(self, limit: int | None = None, most_recent_first: bool = False) -> list[str]: ... + @overload def __getitem__(self, index: SupportsIndex) -> Frame: ... @overload def __getitem__(self, index: slice[SupportsIndex | None]) -> Sequence[Frame]: ... + def __contains__(self, frame: Frame) -> bool: ... # type: ignore[override] def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index 0667a8d5dbdd..b1f5198a89c0 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -167,10 +167,12 @@ if sys.version_info >= (3, 12): class Vec2D(tuple[float, float]): def __new__(cls, x: float, y: float) -> Self: ... def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override] + @overload # type: ignore[override] def __mul__(self, other: Vec2D) -> float: ... @overload def __mul__(self, other: float) -> Vec2D: ... + def __rmul__(self, other: float) -> Vec2D: ... # type: ignore[override] def __sub__(self, other: tuple[float, float]) -> Vec2D: ... def __neg__(self) -> Vec2D: ... @@ -182,10 +184,12 @@ else: class Vec2D(tuple[float, float]): def __new__(cls, x: float, y: float) -> Self: ... def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override] + @overload # type: ignore[override] def __mul__(self, other: Vec2D) -> float: ... @overload def __mul__(self, other: float) -> Vec2D: ... + def __rmul__(self, other: float) -> Vec2D: ... # type: ignore[override] def __sub__(self, other: tuple[float, float]) -> Vec2D: ... def __neg__(self) -> Vec2D: ... @@ -231,32 +235,40 @@ class TurtleScreen(TurtleScreenBase): self, cv: Canvas, mode: Literal["standard", "logo", "world"] = "standard", colormode: float = 1.0, delay: int = 10 ) -> None: ... def clear(self) -> None: ... + @overload def mode(self, mode: None = None) -> str: ... @overload def mode(self, mode: Literal["standard", "logo", "world"]) -> None: ... + def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None: ... def register_shape(self, name: str, shape: _PolygonCoords | Shape | None = None) -> None: ... + @overload def colormode(self, cmode: None = None) -> float: ... @overload def colormode(self, cmode: float) -> None: ... + def reset(self) -> None: ... def turtles(self) -> list[Turtle]: ... + @overload def bgcolor(self) -> _AnyColor: ... @overload def bgcolor(self, color: _Color) -> None: ... @overload def bgcolor(self, r: float, g: float, b: float) -> None: ... + @overload def tracer(self, n: None = None) -> int: ... @overload def tracer(self, n: int, delay: int | None = None) -> None: ... + @overload def delay(self, delay: None = None) -> int: ... @overload def delay(self, delay: int) -> None: ... + if sys.version_info >= (3, 14): @contextmanager def no_animation(self) -> Generator[None]: ... @@ -270,15 +282,18 @@ class TurtleScreen(TurtleScreenBase): def onkey(self, fun: Callable[[], object], key: str) -> None: ... def listen(self, xdummy: float | None = None, ydummy: float | None = None) -> None: ... def ontimer(self, fun: Callable[[], object], t: int = 0) -> None: ... + @overload def bgpic(self, picname: None = None) -> str: ... @overload def bgpic(self, picname: str) -> None: ... + @overload def screensize(self, canvwidth: None = None, canvheight: None = None, bg: None = None) -> tuple[int, int]: ... # Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well @overload def screensize(self, canvwidth: int, canvheight: int, bg: _Color | None = None) -> None: ... + if sys.version_info >= (3, 14): def save(self, filename: StrPath, *, overwrite: bool = False) -> None: ... onscreenclick = onclick @@ -307,21 +322,26 @@ class TNavigator: def pos(self) -> Vec2D: ... def xcor(self) -> float: ... def ycor(self) -> float: ... + @overload def goto(self, x: tuple[float, float], y: None = None) -> None: ... @overload def goto(self, x: float, y: float) -> None: ... + def home(self) -> None: ... def setx(self, x: float) -> None: ... def sety(self, y: float) -> None: ... + @overload def distance(self, x: TNavigator | tuple[float, float], y: None = None) -> float: ... @overload def distance(self, x: float, y: float) -> float: ... + @overload def towards(self, x: TNavigator | tuple[float, float], y: None = None) -> float: ... @overload def towards(self, x: float, y: float) -> float: ... + 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: ... @@ -338,33 +358,40 @@ class TNavigator: class TPen: def __init__(self, resizemode: Literal["auto", "user", "noresize"] = "noresize") -> None: ... + @overload def resizemode(self, rmode: None = None) -> str: ... @overload def resizemode(self, rmode: Literal["auto", "user", "noresize"]) -> None: ... + @overload def pensize(self, width: None = None) -> int: ... @overload def pensize(self, width: int) -> None: ... + def penup(self) -> None: ... def pendown(self) -> None: ... def isdown(self) -> bool: ... + @overload def speed(self, speed: None = None) -> int: ... @overload def speed(self, speed: _Speed) -> None: ... + @overload def pencolor(self) -> _AnyColor: ... @overload def pencolor(self, color: _Color) -> None: ... @overload def pencolor(self, r: float, g: float, b: float) -> None: ... + @overload def fillcolor(self) -> _AnyColor: ... @overload def fillcolor(self, color: _Color) -> None: ... @overload def fillcolor(self, r: float, g: float, b: float) -> None: ... + @overload def color(self) -> tuple[_AnyColor, _AnyColor]: ... @overload @@ -373,12 +400,14 @@ class TPen: def color(self, r: float, g: float, b: float) -> None: ... @overload def color(self, color1: _Color, color2: _Color) -> None: ... + if sys.version_info >= (3, 12): def teleport(self, x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... def showturtle(self) -> None: ... def hideturtle(self) -> None: ... def isvisible(self) -> bool: ... + # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload def pen(self) -> _PenState: ... @@ -398,6 +427,7 @@ class TPen: outline: int = ..., tilt: float = ..., ) -> None: ... + width = pensize up = penup pu = penup @@ -421,10 +451,12 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods def undobufferentries(self) -> int: ... def clear(self) -> None: ... def clone(self) -> Self: ... + @overload def shape(self, name: None = None) -> str: ... @overload def shape(self, name: str) -> None: ... + # Unsafely overlaps when no arguments are provided @overload def shapesize(self) -> tuple[float, float, float]: ... @@ -432,10 +464,12 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods def shapesize( self, stretch_wid: float | None = None, stretch_len: float | None = None, outline: float | None = None ) -> None: ... + @overload def shearfactor(self, shear: None = None) -> float: ... @overload def shearfactor(self, shear: float) -> None: ... + # Unsafely overlaps when no arguments are provided @overload def shapetransform(self) -> tuple[float, float, float, float]: ... @@ -443,6 +477,7 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods def shapetransform( self, t11: float | None = None, t12: float | None = None, t21: float | None = None, t22: float | None = None ) -> None: ... + def get_shapepoly(self) -> _PolygonCoords | None: ... if sys.version_info < (3, 13): @@ -453,6 +488,7 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods def tiltangle(self, angle: None = None) -> float: ... @overload def tiltangle(self, angle: float) -> None: ... + def tilt(self, angle: float) -> None: ... # Can return either 'int' or Tuple[int, ...] based on if the stamp is # a compound stamp or not. So, as per the "no Union return" policy, @@ -467,12 +503,14 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods def begin_fill(self) -> None: ... def end_fill(self) -> None: ... + @overload def dot(self, size: int | _Color | None = None) -> None: ... @overload def dot(self, size: int | None, color: _Color, /) -> None: ... @overload def dot(self, size: int | None, r: float, g: float, b: float, /) -> None: ... + def write( self, arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal") ) -> None: ... @@ -525,28 +563,35 @@ def numinput( # Functions copied from TurtleScreen: def clear() -> None: ... + @overload def mode(mode: None = None) -> str: ... @overload def mode(mode: Literal["standard", "logo", "world"]) -> None: ... + def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None: ... def register_shape(name: str, shape: _PolygonCoords | Shape | None = None) -> None: ... + @overload def colormode(cmode: None = None) -> float: ... @overload def colormode(cmode: float) -> None: ... + def reset() -> None: ... def turtles() -> list[Turtle]: ... + @overload def bgcolor() -> _AnyColor: ... @overload def bgcolor(color: _Color) -> None: ... @overload def bgcolor(r: float, g: float, b: float) -> None: ... + @overload def tracer(n: None = None) -> int: ... @overload def tracer(n: int, delay: int | None = None) -> None: ... + @overload def delay(delay: None = None) -> int: ... @overload @@ -565,10 +610,12 @@ def onclick(fun: Callable[[float, float], object], btn: int = 1, add: bool | Non def onkey(fun: Callable[[], object], key: str) -> None: ... def listen(xdummy: float | None = None, ydummy: float | None = None) -> None: ... def ontimer(fun: Callable[[], object], t: int = 0) -> None: ... + @overload def bgpic(picname: None = None) -> str: ... @overload def bgpic(picname: str) -> None: ... + @overload def screensize(canvwidth: None = None, canvheight: None = None, bg: None = None) -> tuple[int, int]: ... @overload @@ -605,21 +652,26 @@ def left(angle: float) -> None: ... def pos() -> Vec2D: ... def xcor() -> float: ... def ycor() -> float: ... + @overload def goto(x: tuple[float, float], y: None = None) -> None: ... @overload def goto(x: float, y: float) -> None: ... + def home() -> None: ... def setx(x: float) -> None: ... def sety(y: float) -> None: ... + @overload def distance(x: TNavigator | tuple[float, float], y: None = None) -> float: ... @overload def distance(x: float, y: float) -> float: ... + @overload def towards(x: TNavigator | tuple[float, float], y: None = None) -> float: ... @overload def towards(x: float, y: float) -> float: ... + def heading() -> float: ... def setheading(to_angle: float) -> None: ... def circle(radius: float, extent: float | None = None, steps: int | None = None) -> None: ... @@ -639,29 +691,35 @@ seth = setheading def resizemode(rmode: None = None) -> str: ... @overload def resizemode(rmode: Literal["auto", "user", "noresize"]) -> None: ... + @overload def pensize(width: None = None) -> int: ... @overload def pensize(width: int) -> None: ... + def penup() -> None: ... def pendown() -> None: ... def isdown() -> bool: ... + @overload def speed(speed: None = None) -> int: ... @overload def speed(speed: _Speed) -> None: ... + @overload def pencolor() -> _AnyColor: ... @overload def pencolor(color: _Color) -> None: ... @overload def pencolor(r: float, g: float, b: float) -> None: ... + @overload def fillcolor() -> _AnyColor: ... @overload def fillcolor(color: _Color) -> None: ... @overload def fillcolor(r: float, g: float, b: float) -> None: ... + @overload def color() -> tuple[_AnyColor, _AnyColor]: ... @overload @@ -670,6 +728,7 @@ def color(color: _Color) -> None: ... def color(r: float, g: float, b: float) -> None: ... @overload def color(color1: _Color, color2: _Color) -> None: ... + def showturtle() -> None: ... def hideturtle() -> None: ... def isvisible() -> bool: ... @@ -705,6 +764,7 @@ ht = hideturtle def setundobuffer(size: int | None) -> None: ... def undobufferentries() -> int: ... + @overload def shape(name: None = None) -> str: ... @overload @@ -718,6 +778,7 @@ if sys.version_info >= (3, 12): def shapesize() -> tuple[float, float, float]: ... @overload def shapesize(stretch_wid: float | None = None, stretch_len: float | None = None, outline: float | None = None) -> None: ... + @overload def shearfactor(shear: None = None) -> float: ... @overload @@ -730,6 +791,7 @@ def shapetransform() -> tuple[float, float, float, float]: ... def shapetransform( t11: float | None = None, t12: float | None = None, t21: float | None = None, t22: float | None = None ) -> None: ... + def get_shapepoly() -> _PolygonCoords | None: ... if sys.version_info < (3, 13): @@ -740,6 +802,7 @@ if sys.version_info < (3, 13): def tiltangle(angle: None = None) -> float: ... @overload def tiltangle(angle: float) -> None: ... + def tilt(angle: float) -> None: ... # Can return either 'int' or Tuple[int, ...] based on if the stamp is @@ -756,12 +819,14 @@ if sys.version_info >= (3, 14): def begin_fill() -> None: ... def end_fill() -> None: ... + @overload def dot(size: int | _Color | None = None) -> None: ... @overload def dot(size: int | None, color: _Color, /) -> None: ... @overload def dot(size: int | None, r: float, g: float, b: float, /) -> None: ... + def write(arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")) -> None: ... if sys.version_info >= (3, 14): diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d2a8335b0908..b9771ffc72da 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -116,6 +116,7 @@ class FunctionType: ) -> Self: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + @overload def __get__(self, instance: None, owner: type, /) -> FunctionType: ... @overload @@ -278,12 +279,14 @@ class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # py def keys(self) -> KeysView[_KT_co]: ... def values(self) -> ValuesView[_VT_co]: ... def items(self) -> ItemsView[_KT_co, _VT_co]: ... + @overload def get(self, key: _KT_co, /) -> _VT_co | None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter @overload def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter @overload def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... def __reversed__(self) -> Iterator[_KT_co]: ... def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ... @@ -374,12 +377,14 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]): def __iter__(self) -> Self: ... def __next__(self) -> _YieldT_co: ... def send(self, arg: _SendT_contra, /) -> _YieldT_co: ... + @overload def throw( self, typ: type[BaseException], val: BaseException | object = ..., tb: TracebackType | None = ..., / ) -> _YieldT_co: ... @overload def throw(self, typ: BaseException, val: None = None, tb: TracebackType | None = ..., /) -> _YieldT_co: ... + if sys.version_info >= (3, 13): def __class_getitem__(cls, item: Any, /) -> Any: ... @@ -405,12 +410,14 @@ class AsyncGeneratorType(AsyncGenerator[_YieldT_co, _SendT_contra]): def __aiter__(self) -> Self: ... def __anext__(self) -> Coroutine[Any, Any, _YieldT_co]: ... def asend(self, val: _SendT_contra, /) -> Coroutine[Any, Any, _YieldT_co]: ... + @overload async def athrow( self, typ: type[BaseException], val: BaseException | object = ..., tb: TracebackType | None = ..., / ) -> _YieldT_co: ... @overload async def athrow(self, typ: BaseException, val: None = None, tb: TracebackType | None = ..., /) -> _YieldT_co: ... + def aclose(self) -> Coroutine[Any, Any, None]: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -442,12 +449,14 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co]): def close(self) -> None: ... def __await__(self) -> Generator[Any, None, _ReturnT_nd_co]: ... def send(self, arg: _SendT_nd_contra, /) -> _YieldT_co: ... + @overload def throw( self, typ: type[BaseException], val: BaseException | object = ..., tb: TracebackType | None = ..., / ) -> _YieldT_co: ... @overload def throw(self, typ: BaseException, val: None = None, tb: TracebackType | None = ..., /) -> _YieldT_co: ... + if sys.version_info >= (3, 13): def __class_getitem__(cls, item: Any, /) -> Any: ... @@ -567,12 +576,14 @@ class FrameType: # An `int | None` annotation here causes too many false-positive errors, so applying `int | Any`. @property def f_lineno(self) -> int | MaybeNone: ... + if sys.version_info >= (3, 15): @property def f_locals(self) -> FrameLocalsProxyType | dict[str, Any]: ... else: @property def f_locals(self) -> dict[str, Any]: ... + f_trace: Callable[[FrameType, str, Any], Any] | None f_trace_lines: bool f_trace_opcodes: bool @@ -672,6 +683,7 @@ _P = ParamSpec("_P") def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Awaitable[_R]]: ... @overload def coroutine(func: _Fn) -> _Fn: ... + @disjoint_base class GenericAlias: @property diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 995b30a919b3..2018a835c632 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -155,6 +155,7 @@ class _Final: __slots__ = ("__weakref__",) def final(f: _T) -> _T: ... + @final class TypeVar: @property @@ -478,6 +479,7 @@ class _ProtocolMeta(ABCMeta): # Abstract base classes. def runtime_checkable(cls: _TC) -> _TC: ... + @runtime_checkable class SupportsInt(Protocol, metaclass=ABCMeta): __slots__ = () @@ -517,6 +519,7 @@ class SupportsAbs(Protocol[_T_co]): @runtime_checkable class SupportsRound(Protocol[_T_co]): __slots__ = () + @overload @abstractmethod def __round__(self) -> int: ... @@ -562,6 +565,7 @@ class Generator(Iterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra, _Retur def __next__(self) -> _YieldT_co: ... @abstractmethod def send(self, value: _SendT_contra, /) -> _YieldT_co: ... + @overload @abstractmethod def throw( @@ -570,6 +574,7 @@ class Generator(Iterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra, _Retur @overload @abstractmethod def throw(self, typ: BaseException, val: None = None, tb: TracebackType | None = None, /) -> _YieldT_co: ... + if sys.version_info >= (3, 13): def close(self) -> _ReturnT_co | None: ... else: @@ -604,6 +609,7 @@ class Coroutine(Awaitable[_ReturnT_nd_co], Generic[_YieldT_co, _SendT_nd_contra, @abstractmethod def send(self, value: _SendT_nd_contra, /) -> _YieldT_co: ... + @overload @abstractmethod def throw( @@ -612,6 +618,7 @@ class Coroutine(Awaitable[_ReturnT_nd_co], Generic[_YieldT_co, _SendT_nd_contra, @overload @abstractmethod def throw(self, typ: BaseException, val: None = None, tb: TracebackType | None = None, /) -> _YieldT_co: ... + @abstractmethod def close(self) -> None: ... @@ -642,6 +649,7 @@ class AsyncGenerator(AsyncIterator[_YieldT_co], Protocol[_YieldT_co, _SendT_cont def __anext__(self) -> Coroutine[Any, Any, _YieldT_co]: ... @abstractmethod def asend(self, value: _SendT_contra, /) -> Coroutine[Any, Any, _YieldT_co]: ... + @overload @abstractmethod def athrow( @@ -652,6 +660,7 @@ class AsyncGenerator(AsyncIterator[_YieldT_co], Protocol[_YieldT_co, _SendT_cont def athrow( self, typ: BaseException, val: None = None, tb: TracebackType | None = None, / ) -> Coroutine[Any, Any, _YieldT_co]: ... + def aclose(self) -> Coroutine[Any, Any, None]: ... _ContainerT_contra = TypeVar("_ContainerT_contra", contravariant=True, default=Any) @@ -676,6 +685,7 @@ class Sequence(Reversible[_T_co], Collection[_T_co]): @overload @abstractmethod def __getitem__(self, index: slice[int | None], /) -> Sequence[_T_co]: ... + # Mixin methods def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... def count(self, value: Any, /) -> int: ... @@ -686,24 +696,28 @@ class Sequence(Reversible[_T_co], Collection[_T_co]): class MutableSequence(Sequence[_T]): @abstractmethod def insert(self, index: int, value: _T, /) -> None: ... + @overload @abstractmethod def __getitem__(self, index: int, /) -> _T: ... @overload @abstractmethod def __getitem__(self, index: slice[int | None], /) -> MutableSequence[_T]: ... + @overload @abstractmethod def __setitem__(self, index: int, value: _T, /) -> None: ... @overload @abstractmethod def __setitem__(self, index: slice[int | None], value: Iterable[_T], /) -> None: ... + @overload @abstractmethod def __delitem__(self, index: int, /) -> None: ... @overload @abstractmethod def __delitem__(self, index: slice[int | None], /) -> None: ... + # Mixin methods def append(self, value: _T, /) -> None: ... def clear(self) -> None: ... @@ -795,6 +809,7 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]): # see discussion in https://github.com/python/typing/pull/273. @abstractmethod def __getitem__(self, key: _KT, /) -> _VT_co: ... + # Mixin methods @overload def get(self, key: _KT, /) -> _VT_co | None: ... @@ -802,6 +817,7 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]): def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter @overload def get(self, key: _KT, default: _T, /) -> _VT_co | _T: ... + def items(self) -> ItemsView[_KT, _VT_co]: ... def keys(self) -> KeysView[_KT]: ... def values(self) -> ValuesView[_VT_co]: ... @@ -814,13 +830,16 @@ class MutableMapping(Mapping[_KT, _VT]): @abstractmethod def __delitem__(self, key: _KT, /) -> None: ... def clear(self) -> None: ... + @overload def pop(self, key: _KT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _VT, /) -> _VT: ... @overload def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def popitem(self) -> tuple[_KT, _VT]: ... + # This overload should be allowed only if the value type is compatible with None. # # Keep the following methods in line with MutableMapping.setdefault, modulo positional-only differences: @@ -831,6 +850,7 @@ class MutableMapping(Mapping[_KT, _VT]): def setdefault(self: MutableMapping[_KT, _T | None], key: _KT, default: None = None, /) -> _T | None: ... @overload def setdefault(self, key: _KT, default: _VT, /) -> _VT: ... + # 'update' used to take a Union, but using overloading is better. # The second overloaded type here is a bit too general, because # Mapping[tuple[_KT, _VT], W] is a subclass of Iterable[tuple[_KT, _VT]], @@ -908,18 +928,21 @@ class IO(Generic[AnyStr]): def truncate(self, size: int | None = None, /) -> int: ... @abstractmethod def writable(self) -> bool: ... + @abstractmethod @overload def write(self: IO[bytes], s: ReadableBuffer, /) -> int: ... @abstractmethod @overload def write(self, s: AnyStr, /) -> int: ... + @abstractmethod @overload def writelines(self: IO[bytes], lines: Iterable[ReadableBuffer], /) -> None: ... @abstractmethod @overload def writelines(self, lines: Iterable[AnyStr], /) -> None: ... + @abstractmethod def __next__(self) -> AnyStr: ... @abstractmethod @@ -987,6 +1010,7 @@ else: ) -> dict[str, Any]: ... # AnnotationForm def get_args(tp: Any) -> tuple[Any, ...]: ... # AnnotationForm + @overload def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ... @overload @@ -995,6 +1019,7 @@ def get_origin(tp: UnionType) -> type[UnionType]: ... def get_origin(tp: GenericAlias) -> type: ... @overload def get_origin(tp: Any) -> Any | None: ... # AnnotationForm + @overload def cast(typ: type[_T], val: Any) -> _T: ... @overload @@ -1034,6 +1059,7 @@ class NamedTuple(tuple[Any, ...]): @overload @deprecated("Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15") def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ... + @classmethod def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ... def _asdict(self) -> dict[str, Any]: ... @@ -1068,14 +1094,17 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... + @overload def __or__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... @overload def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... + @overload def __ror__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... @overload def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... + # supposedly incompatible definitions of __or__ and __ior__ def __ior__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... # type: ignore[misc] @@ -1167,6 +1196,7 @@ if sys.version_info >= (3, 12): ) def override(method: _F, /) -> _F: ... + @final class TypeAliasType: def __new__(cls, name: str, value: Any, *, type_params: tuple[_TypeParameter, ...] = ()) -> Self: ... @@ -1195,6 +1225,7 @@ if sys.version_info >= (3, 12): if sys.version_info >= (3, 13): def is_protocol(tp: type, /) -> bool: ... def get_protocol_members(tp: type, /) -> frozenset[str]: ... + @final @type_check_only class _NoDefaultType: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index ef0da9ff358f..fdbba495c579 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -257,14 +257,17 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... def __delitem__(self, k: Never) -> None: ... + @overload def __or__(self, value: Self, /) -> Self: ... @overload def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... + @overload def __ror__(self, value: Self, /) -> Self: ... @overload def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... + # supposedly incompatible definitions of `__ior__` and `__or__`: # Since this module defines "Self" it is not recognized by Ruff as typing_extensions.Self def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc] @@ -279,6 +282,7 @@ else: ) -> dict[str, AnnotationForm]: ... def get_args(tp: AnnotationForm) -> tuple[AnnotationForm, ...]: ... + @overload def get_origin(tp: UnionType) -> type[UnionType]: ... @overload @@ -337,10 +341,12 @@ else: _field_defaults: ClassVar[dict[str, Any]] _fields: ClassVar[tuple[str, ...]] __orig_bases__: ClassVar[tuple[Any, ...]] + @overload def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ... @overload def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None: ... + @classmethod def _make(cls, iterable: Iterable[Any]) -> Self: ... def _asdict(self) -> dict[str, Any]: ... @@ -419,6 +425,7 @@ else: @runtime_checkable class SupportsRound(Protocol[_T_co]): __slots__ = () + @overload @abc.abstractmethod def __round__(self) -> int: ... @@ -457,6 +464,7 @@ if sys.version_info >= (3, 13): else: def is_protocol(tp: type, /) -> bool: ... def get_protocol_members(tp: type, /) -> frozenset[str]: ... + @final @type_check_only class _NoDefaultType: ... @@ -634,6 +642,7 @@ else: eval_str: bool = False, format: Format = Format.VALUE, # noqa: Y011 ) -> dict[str, AnnotationForm]: ... + @overload def evaluate_forward_ref( forward_ref: ForwardRef, @@ -667,6 +676,7 @@ else: format: Format | None = None, _recursive_guard: Container[str] = ..., ) -> AnnotationForm: ... + def type_repr(value: object) -> str: ... # PEP 661 diff --git a/stdlib/unicodedata.pyi b/stdlib/unicodedata.pyi index 172ddd3ac653..82a73181eed3 100644 --- a/stdlib/unicodedata.pyi +++ b/stdlib/unicodedata.pyi @@ -13,11 +13,14 @@ _NormalizationForm: TypeAlias = Literal["NFC", "NFD", "NFKC", "NFKD"] def bidirectional(chr: str, /) -> str: ... def category(chr: str, /) -> str: ... def combining(chr: str, /) -> int: ... + @overload def decimal(chr: str, /) -> int: ... @overload def decimal(chr: str, default: _T, /) -> int | _T: ... + def decomposition(chr: str, /) -> str: ... + @overload def digit(chr: str, /) -> int: ... @overload @@ -39,15 +42,19 @@ if sys.version_info >= (3, 15): def lookup(name: str | ReadOnlyBuffer, /) -> str: ... def mirrored(chr: str, /) -> int: ... + @overload def name(chr: str, /) -> str: ... @overload def name(chr: str, default: _T, /) -> str | _T: ... + def normalize(form: _NormalizationForm, unistr: str, /) -> str: ... + @overload def numeric(chr: str, /) -> float: ... @overload def numeric(chr: str, default: _T, /) -> float | _T: ... + @final class UCD: # The methods below are constructed from the same array in C @@ -56,24 +63,31 @@ class UCD: def bidirectional(self, chr: str, /) -> str: ... def category(self, chr: str, /) -> str: ... def combining(self, chr: str, /) -> int: ... + @overload def decimal(self, chr: str, /) -> int: ... @overload def decimal(self, chr: str, default: _T, /) -> int | _T: ... + def decomposition(self, chr: str, /) -> str: ... + @overload def digit(self, chr: str, /) -> int: ... @overload def digit(self, chr: str, default: _T, /) -> int | _T: ... + def east_asian_width(self, chr: str, /) -> _EastAsianWidth: ... def is_normalized(self, form: _NormalizationForm, unistr: str, /) -> bool: ... def lookup(self, name: str | ReadOnlyBuffer, /) -> str: ... def mirrored(self, chr: str, /) -> int: ... + @overload def name(self, chr: str, /) -> str: ... @overload def name(self, chr: str, default: _T, /) -> str | _T: ... + def normalize(self, form: _NormalizationForm, unistr: str, /) -> str: ... + @overload def numeric(self, chr: str, /) -> float: ... @overload diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index f40e84366a8d..942154ea53ae 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -109,22 +109,27 @@ class TestCase: def assertNotIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = None) -> None: ... def assertIsInstance(self, obj: object, cls: _ClassInfo, msg: Any = None) -> None: ... def assertNotIsInstance(self, obj: object, cls: _ClassInfo, msg: Any = None) -> None: ... + @overload def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = None) -> None: ... @overload def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = None) -> None: ... + @overload def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = None) -> None: ... @overload def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = None) -> None: ... + @overload def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = None) -> None: ... @overload def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = None) -> None: ... + @overload def assertLessEqual(self, a: SupportsDunderLE[_T], b: _T, msg: Any = None) -> None: ... @overload def assertLessEqual(self, a: _T, b: SupportsDunderGE[_T], msg: Any = None) -> None: ... + # `assertRaises`, `assertRaisesRegex`, and `assertRaisesRegexp` # are not using `ParamSpec` intentionally, # because they might be used with explicitly wrong arg types to raise some error in tests. @@ -140,6 +145,7 @@ class TestCase: def assertRaises( self, expected_exception: type[_E] | tuple[type[_E], ...], *, msg: Any = ... ) -> _AssertRaisesContext[_E]: ... + @overload def assertRaisesRegex( self, @@ -153,6 +159,7 @@ class TestCase: def assertRaisesRegex( self, expected_exception: type[_E] | tuple[type[_E], ...], expected_regex: str | Pattern[str], *, msg: Any = ... ) -> _AssertRaisesContext[_E]: ... + @overload def assertWarns( self, @@ -165,6 +172,7 @@ class TestCase: def assertWarns( self, expected_warning: type[Warning] | tuple[type[Warning], ...], *, msg: Any = ... ) -> _AssertWarnsContext: ... + @overload def assertWarnsRegex( self, @@ -178,6 +186,7 @@ class TestCase: def assertWarnsRegex( self, expected_warning: type[Warning] | tuple[type[Warning], ...], expected_regex: str | Pattern[str], *, msg: Any = ... ) -> _AssertWarnsContext: ... + if sys.version_info >= (3, 15): def assertLogs( self, @@ -193,6 +202,7 @@ class TestCase: def assertNoLogs( self, logger: str | logging.Logger | None = None, level: int | str | None = None ) -> _AssertLogsContext[None]: ... + @overload def assertAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload @@ -217,6 +227,7 @@ class TestCase: msg: Any = None, delta: None = None, ) -> None: ... + @overload def assertNotAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload @@ -241,6 +252,7 @@ class TestCase: msg: Any = None, delta: None = None, ) -> None: ... + def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = None) -> None: ... diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 06d202684cb9..1b6ab756d253 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -259,12 +259,14 @@ class _patch(Generic[_T]): unsafe: bool = False, ) -> None: ... def copy(self) -> _patch[_T]: ... + @overload def __call__(self, func: _TT) -> _TT: ... # If new==DEFAULT, this should add a MagicMock parameter to the function # arguments. See the _patch_default_new class below for this functionality. @overload def __call__(self, func: Callable[_P, _R]) -> Callable[_P, _R]: ... + def decoration_helper( self, patched: _patch[Any], args: Sequence[Any], keywargs: Any ) -> _GeneratorContextManager[tuple[Sequence[Any], Any]]: ... @@ -314,6 +316,7 @@ class _patch_dict: class _patcher: TEST_PREFIX: str dict: type[_patch_dict] + # This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any]. # Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock], # but that's impossible with the current type system. @@ -360,6 +363,7 @@ class _patcher: # kwargs are passed to the MagicMock/AsyncMock constructor **kwargs: Any, ) -> _patch_pass_arg[MagicMock | AsyncMock]: ... + # This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any]. # Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock], # but that's impossible with the current type system. @@ -409,6 +413,7 @@ class _patcher: # kwargs are passed to the MagicMock/AsyncMock constructor **kwargs: Any, ) -> _patch_pass_arg[MagicMock | AsyncMock]: ... + @overload @staticmethod def multiple( @@ -450,6 +455,7 @@ class _patcher: # The kwargs are the mock objects or DEFAULT **kwargs: Any, ) -> _patch[Any]: ... + @staticmethod def stopall() -> None: ... diff --git a/stdlib/unittest/signals.pyi b/stdlib/unittest/signals.pyi index 1c0ed971fa7c..928ab68ae65d 100644 --- a/stdlib/unittest/signals.pyi +++ b/stdlib/unittest/signals.pyi @@ -8,6 +8,7 @@ _T = TypeVar("_T") def installHandler() -> None: ... def registerResult(result: unittest.result.TestResult) -> None: ... def removeResult(result: unittest.result.TestResult) -> bool: ... + @overload def removeHandler(method: None = None) -> None: ... @overload diff --git a/stdlib/urllib/error.pyi b/stdlib/urllib/error.pyi index 2173d7e6efaa..6255f1ae7db0 100644 --- a/stdlib/urllib/error.pyi +++ b/stdlib/urllib/error.pyi @@ -15,6 +15,7 @@ class HTTPError(URLError, addinfourl): def headers(self) -> Message: ... @headers.setter def headers(self, headers: Message) -> None: ... + @property def reason(self) -> str: ... # type: ignore[override] code: int diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index d9ba692bd6e9..b83a0f4e8678 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -170,23 +170,27 @@ def parse_qsl( max_num_fields: int | None = None, separator: str = "&", ) -> list[tuple[AnyStr, AnyStr]]: ... + @overload def quote(string: str, safe: str | Iterable[int] = "/", encoding: str | None = None, errors: str | None = None) -> str: ... @overload def quote(string: bytes | bytearray, safe: str | Iterable[int] = "/") -> str: ... + def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = "/") -> str: ... + @overload def quote_plus(string: str, safe: str | Iterable[int] = "", encoding: str | None = None, errors: str | None = None) -> str: ... @overload def quote_plus(string: bytes | bytearray, safe: str | Iterable[int] = "") -> str: ... + def unquote(string: str | bytes, encoding: str = "utf-8", errors: str = "replace") -> str: ... def unquote_to_bytes(string: str | bytes | bytearray) -> bytes: ... def unquote_plus(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... + @overload def urldefrag(url: str) -> DefragResult: ... @overload def urldefrag(url: bytes | bytearray | None) -> DefragResultBytes: ... - if sys.version_info >= (3, 15): @overload def urldefrag(url: str, *, missing_as_none: Literal[True]) -> DefragResult[str | None]: ... @@ -229,13 +233,13 @@ def urlencode( quote_via: _QuoteVia = ..., ) -> str: ... def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = True) -> AnyStr: ... + @overload def urlparse(url: str, scheme: str = "", allow_fragments: bool = True) -> ParseResult: ... @overload def urlparse( url: bytes | bytearray | None, scheme: bytes | bytearray | None | Literal[""] = "", allow_fragments: bool = True ) -> ParseResultBytes: ... - if sys.version_info >= (3, 15): @overload def urlparse( @@ -282,13 +286,11 @@ if sys.version_info >= (3, 11): def urlsplit( url: bytes | None, scheme: bytes | None | Literal[""] = "", allow_fragments: bool = True ) -> SplitResultBytes: ... - else: @overload def urlsplit( url: bytes | bytearray | None, scheme: bytes | bytearray | None | Literal[""] = "", allow_fragments: bool = True ) -> SplitResultBytes: ... - if sys.version_info >= (3, 15): @overload def urlsplit( @@ -329,7 +331,6 @@ if sys.version_info >= (3, 15): def urlunparse(components: Iterable[None], *, keep_empty: bool = ...) -> Literal[b""]: ... # type: ignore[overload-overlap] @overload def urlunparse(components: Iterable[AnyStr | None], *, keep_empty: bool = ...) -> AnyStr: ... - else: # Requires an iterable of length 6 @overload @@ -343,7 +344,6 @@ if sys.version_info >= (3, 15): def urlunsplit(components: Iterable[None], *, keep_empty: bool = ...) -> Literal[b""]: ... # type: ignore[overload-overlap] @overload def urlunsplit(components: Iterable[AnyStr | None], *, keep_empty: bool = ...) -> AnyStr: ... - else: # Requires an iterable of length 5 @overload diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index cb3273e86144..0ec26052b23c 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -124,6 +124,7 @@ class Request: def full_url(self, value: str) -> None: ... @full_url.deleter def full_url(self) -> None: ... + type: str host: str origin_req_host: str @@ -150,10 +151,12 @@ class Request: def remove_header(self, header_name: str) -> None: ... def get_full_url(self) -> str: ... def set_proxy(self, host: str, type: str) -> None: ... + @overload def get_header(self, header_name: str) -> str | None: ... @overload def get_header(self, header_name: str, default: _T) -> str | _T: ... + def header_items(self) -> list[tuple[str, str]]: ... def has_proxy(self) -> bool: ... diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index 53310c91b83a..3308ae42e1cf 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -89,6 +89,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): /, **kwargs: _VT, ) -> None: ... + def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... @@ -98,12 +99,14 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def copy(self) -> WeakValueDictionary[_KT, _VT]: ... __copy__ = copy def __deepcopy__(self, memo: Any) -> Self: ... + @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT) -> _VT: ... @overload def get(self, key: _KT, default: _T) -> _VT | _T: ... + # These are incompatible with Mapping def keys(self) -> Iterator[_KT]: ... # type: ignore[override] def values(self) -> Iterator[_VT]: ... # type: ignore[override] @@ -111,20 +114,24 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... def setdefault(self, key: _KT, default: _VT) -> _VT: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + @overload def update(self, other: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... @overload def update(self, other: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... @overload def update(self, other: None = None, /, **kwargs: _VT) -> None: ... + def __or__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... def __ror__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... + # WeakValueDictionary.__ior__ should be kept roughly in line with MutableMapping.update() @overload # type: ignore[misc] def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... @@ -142,6 +149,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def __init__(self, dict: None = None) -> None: ... @overload def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... + def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... @@ -151,36 +159,43 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... __copy__ = copy def __deepcopy__(self, memo: Any) -> Self: ... + @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT) -> _VT: ... @overload def get(self, key: _KT, default: _T) -> _VT | _T: ... + # These are incompatible with Mapping def keys(self) -> Iterator[_KT]: ... # type: ignore[override] def values(self) -> Iterator[_VT]: ... # type: ignore[override] def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def keyrefs(self) -> list[ref[_KT]]: ... + # Keep WeakKeyDictionary.setdefault in line with MutableMapping.setdefault, modulo positional-only differences @overload def setdefault(self: WeakKeyDictionary[_KT, _VT | None], key: _KT, default: None = None) -> _VT: ... @overload def setdefault(self, key: _KT, default: _VT) -> _VT: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + @overload def update(self, dict: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... @overload def update(self, dict: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... @overload def update(self, dict: None = None, /, **kwargs: _VT) -> None: ... + def __or__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... def __ror__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... + # WeakKeyDictionary.__ior__ should be kept roughly in line with MutableMapping.update() @overload # type: ignore[misc] def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... diff --git a/stdlib/winreg.pyi b/stdlib/winreg.pyi index 61c591a9b4a5..a04178020377 100644 --- a/stdlib/winreg.pyi +++ b/stdlib/winreg.pyi @@ -25,6 +25,7 @@ if sys.platform == "win32": def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]: ... def SaveKey(key: _KeyType, file_name: str, /) -> None: ... def SetValue(key: _KeyType, sub_key: str | None, type: int, value: str, /) -> None: ... + @overload # type=REG_DWORD|REG_QWORD def SetValueEx( key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, / @@ -55,6 +56,7 @@ if sys.platform == "win32": value: int | str | list[str] | ReadableBuffer | None, /, ) -> None: ... + def DisableReflectionKey(key: _KeyType, /) -> None: ... def EnableReflectionKey(key: _KeyType, /) -> None: ... def QueryReflectionKey(key: _KeyType, /) -> bool: ... diff --git a/stdlib/winsound.pyi b/stdlib/winsound.pyi index 39dfa7b8b9c4..9c7f314fd6ca 100644 --- a/stdlib/winsound.pyi +++ b/stdlib/winsound.pyi @@ -30,9 +30,11 @@ if sys.platform == "win32": MB_ICONWARNING: Final = 48 def Beep(frequency: int, duration: int) -> None: ... + # Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible @overload def PlaySound(sound: ReadableBuffer | None, flags: Literal[4]) -> None: ... @overload def PlaySound(sound: str | ReadableBuffer | None, flags: int) -> None: ... + def MessageBeep(type: int = 0) -> None: ... diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index f249ffcf0223..6a0fb571a0d0 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -13,10 +13,12 @@ class Headers: def __getitem__(self, name: str) -> str | None: ... def __contains__(self, name: str) -> bool: ... def get_all(self, name: str) -> list[str]: ... + @overload def get(self, name: str, default: str) -> str: ... @overload def get(self, name: str, default: str | None = None) -> str | None: ... + def keys(self) -> list[str]: ... def values(self) -> list[str]: ... def items(self) -> _HeaderList: ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index fdc35f0de7c1..c54b0de86e55 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -52,6 +52,7 @@ def parse( file: str | SupportsRead[ReadableBuffer | str], parser: XMLReader | None = None, bufsize: int | None = None ) -> Document: ... def parseString(string: str | ReadableBuffer, parser: XMLReader | None = None) -> Document: ... + @overload def getDOMImplementation(features: None = None) -> DOMImplementation: ... @overload @@ -89,10 +90,12 @@ class Node(xml.dom.Node): @property def localName(self) -> str | None: ... # non-null only for Element and Attr def __bool__(self) -> Literal[True]: ... + @overload def toxml(self, encoding: str, standalone: bool | None = None) -> bytes: ... @overload def toxml(self, encoding: None = None, standalone: bool | None = None) -> str: ... + @overload def toprettyxml( self, @@ -122,6 +125,7 @@ class Node(xml.dom.Node): encoding: str, standalone: bool | None = None, ) -> bytes: ... + def hasChildNodes(self) -> bool: ... def insertBefore( # type: ignore[misc] self: _NodesWithChildren, # pyright: ignore[reportGeneralTypeIssues] @@ -131,6 +135,7 @@ class Node(xml.dom.Node): def appendChild( # type: ignore[misc] self: _NodesWithChildren, node: _ChildNodePlusFragmentVar # pyright: ignore[reportGeneralTypeIssues] ) -> _ChildNodePlusFragmentVar: ... + @overload def replaceChild( # type: ignore[misc] self: _NodesWithChildren, newChild: DocumentFragment, oldChild: _ChildNodeVar @@ -139,6 +144,7 @@ class Node(xml.dom.Node): def replaceChild( # type: ignore[misc] self: _NodesWithChildren, newChild: _NodesThatAreChildren, oldChild: _ChildNodeVar ) -> _ChildNodeVar | None: ... + def removeChild(self: _NodesWithChildren, oldChild: _ChildNodeVar) -> _ChildNodeVar: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] def normalize(self: _NodesWithChildren) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] def cloneNode(self, deep: bool) -> Self | None: ... @@ -178,10 +184,12 @@ class DocumentFragment(Node): self, newChild: _DFChildrenPlusFragment, refChild: _DocumentFragmentChildren | None ) -> _DFChildrenPlusFragment: ... def appendChild(self, node: _DFChildrenPlusFragment) -> _DFChildrenPlusFragment: ... # type: ignore[override] + @overload # type: ignore[override] def replaceChild(self, newChild: DocumentFragment, oldChild: _DFChildrenVar) -> _DFChildrenVar | DocumentFragment: ... @overload def replaceChild(self, newChild: _DocumentFragmentChildren, oldChild: _DFChildrenVar) -> _DFChildrenVar | None: ... # type: ignore[override] + def removeChild(self, oldChild: _DFChildrenVar) -> _DFChildrenVar: ... # type: ignore[override] _AttrChildrenVar = TypeVar("_AttrChildrenVar", bound=_AttrChildren) @@ -223,10 +231,12 @@ class Attr(Node): def schemaType(self) -> TypeInfo: ... def insertBefore(self, newChild: _AttrChildrenPlusFragment, refChild: _AttrChildren | None) -> _AttrChildrenPlusFragment: ... # type: ignore[override] def appendChild(self, node: _AttrChildrenPlusFragment) -> _AttrChildrenPlusFragment: ... # type: ignore[override] + @overload # type: ignore[override] def replaceChild(self, newChild: DocumentFragment, oldChild: _AttrChildrenVar) -> _AttrChildrenVar | DocumentFragment: ... @overload def replaceChild(self, newChild: _AttrChildren, oldChild: _AttrChildrenVar) -> _AttrChildrenVar | None: ... # type: ignore[override] + def removeChild(self, oldChild: _AttrChildrenVar) -> _AttrChildrenVar: ... # type: ignore[override] # In the DOM, this interface isn't specific to Attr, but our implementation is @@ -339,12 +349,14 @@ class Element(Node): self, newChild: _ElementChildrenPlusFragment, refChild: _ElementChildren | None ) -> _ElementChildrenPlusFragment: ... def appendChild(self, node: _ElementChildrenPlusFragment) -> _ElementChildrenPlusFragment: ... # type: ignore[override] + @overload # type: ignore[override] def replaceChild( self, newChild: DocumentFragment, oldChild: _ElementChildrenVar ) -> _ElementChildrenVar | DocumentFragment: ... @overload def replaceChild(self, newChild: _ElementChildren, oldChild: _ElementChildrenVar) -> _ElementChildrenVar | None: ... # type: ignore[override] + def removeChild(self, oldChild: _ElementChildrenVar) -> _ElementChildrenVar: ... # type: ignore[override] class Childless: @@ -661,15 +673,18 @@ class Document(Node, DocumentLS): encoding: str | None = None, standalone: bool | None = None, ) -> None: ... + @overload def renameNode(self, n: Element, namespaceURI: str, name: str) -> Element: ... @overload def renameNode(self, n: Attr, namespaceURI: str, name: str) -> Attr: ... @overload def renameNode(self, n: Element | Attr, namespaceURI: str, name: str) -> Element | Attr: ... + def insertBefore( self, newChild: _DocumentChildrenPlusFragment, refChild: _DocumentChildren | None # type: ignore[override] ) -> _DocumentChildrenPlusFragment: ... + @overload # type: ignore[override] def replaceChild( self, newChild: DocumentFragment, oldChild: _DocumentChildrenVar diff --git a/stdlib/xml/etree/ElementInclude.pyi b/stdlib/xml/etree/ElementInclude.pyi index 10784e7d4021..5db08fb0df05 100644 --- a/stdlib/xml/etree/ElementInclude.pyi +++ b/stdlib/xml/etree/ElementInclude.pyi @@ -22,6 +22,7 @@ class FatalIncludeError(SyntaxError): ... def default_loader(href: FileDescriptorOrPath, parse: Literal["xml"], encoding: str | None = None) -> Element: ... @overload def default_loader(href: FileDescriptorOrPath, parse: Literal["text"], encoding: str | None = None) -> str: ... + def include(elem: Element, loader: _Loader | None = None, base_url: str | None = None, max_depth: int | None = 6) -> None: ... class LimitedRecursiveIncludeError(FatalIncludeError): ... diff --git a/stdlib/xml/etree/ElementPath.pyi b/stdlib/xml/etree/ElementPath.pyi index c971510527d2..1dd6f86cead6 100644 --- a/stdlib/xml/etree/ElementPath.pyi +++ b/stdlib/xml/etree/ElementPath.pyi @@ -32,8 +32,10 @@ def iterfind( # type: ignore[overload-overlap] ) -> None: ... @overload def iterfind(elem: Element[Any], path: str, namespaces: dict[str, str] | None = None) -> Generator[Element]: ... + def find(elem: Element[Any], path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... def findall(elem: Element[Any], path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... + @overload def findtext(elem: Element[Any], path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... @overload diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 7d05fca7bd84..636199215563 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -48,6 +48,7 @@ class ParseError(SyntaxError): # In reality it works based on `.tag` attribute duck typing. def iselement(element: object) -> TypeGuard[Element]: ... + @overload def canonicalize( xml_data: str | ReadableBuffer | None = None, @@ -96,21 +97,26 @@ class Element(Generic[_Tag]): def extend(self, elements: Iterable[Element[Any]], /) -> None: ... def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... + @overload def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... @overload def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... + @overload def get(self, key: str, default: None = None) -> str | None: ... @overload def get(self, key: str, default: _T) -> str | _T: ... + def insert(self, index: int, subelement: Element[Any], /) -> None: ... def items(self) -> ItemsView[str, str]: ... def iter(self, tag: str | None = None) -> Generator[Element]: ... + @overload def iterfind(self, path: Literal[""], namespaces: dict[str, str] | None = None) -> None: ... # type: ignore[overload-overlap] @overload def iterfind(self, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element]: ... + def itertext(self) -> Generator[str]: ... def keys(self) -> dict_keys[str, str]: ... # makeelement returns the type of self in Python impl, but not in C impl @@ -120,13 +126,16 @@ class Element(Generic[_Tag]): def __copy__(self) -> Element[_Tag]: ... # returns the type of self in Python impl, but not in C impl def __deepcopy__(self, memo: Any, /) -> Element: ... # Only exists in C impl def __delitem__(self, key: SupportsIndex | slice, /) -> None: ... + @overload def __getitem__(self, key: SupportsIndex, /) -> Element: ... @overload def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Element]: ... + def __len__(self) -> int: ... # Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__. def __iter__(self) -> Iterator[Element]: ... + @overload def __setitem__(self, key: SupportsIndex, value: Element[Any], /) -> None: ... @overload @@ -161,15 +170,19 @@ class ElementTree(Generic[_Root]): def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element: ... def iter(self, tag: str | None = None) -> Generator[Element]: ... def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... + @overload def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... @overload def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... + def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... + @overload def iterfind(self, path: Literal[""], namespaces: dict[str, str] | None = None) -> None: ... # type: ignore[overload-overlap] @overload def iterfind(self, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element]: ... + def write( self, file_or_filename: _FileWrite, @@ -185,6 +198,7 @@ class ElementTree(Generic[_Root]): HTML_EMPTY: Final[set[str]] def register_namespace(prefix: str, uri: str) -> None: ... + @overload def tostring( element: Element[Any], @@ -215,6 +229,7 @@ def tostring( default_namespace: str | None = None, short_empty_elements: bool = True, ) -> Any: ... + @overload def tostringlist( element: Element[Any], @@ -245,6 +260,7 @@ def tostringlist( default_namespace: str | None = None, short_empty_elements: bool = True, ) -> list[Any]: ... + def dump(elem: Element[Any] | ElementTree[Any]) -> None: ... def indent(tree: Element[Any] | ElementTree[Any], space: str = " ", level: int = 0) -> None: ... def parse(source: _FileRead, parser: XMLParser[Any] | None = None) -> ElementTree[Element]: ... diff --git a/stdlib/xml/sax/expatreader.pyi b/stdlib/xml/sax/expatreader.pyi index dd8762da5137..e29853ebc3fe 100644 --- a/stdlib/xml/sax/expatreader.pyi +++ b/stdlib/xml/sax/expatreader.pyi @@ -28,6 +28,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): def setContentHandler(self, handler: _ContentHandlerProtocol) -> None: ... def getFeature(self, name: str) -> _BoolType: ... def setFeature(self, name: str, state: _BoolType) -> None: ... + @overload def getProperty(self, name: Literal["http://xml.org/sax/properties/lexical-handler"]) -> LexicalHandler | None: ... @overload @@ -36,6 +37,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): def getProperty(self, name: Literal["http://xml.org/sax/properties/xml-string"]) -> bytes | None: ... @overload def getProperty(self, name: str) -> object: ... + @overload def setProperty(self, name: Literal["http://xml.org/sax/properties/lexical-handler"], value: LexicalHandler) -> None: ... @overload @@ -44,6 +46,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): ) -> None: ... @overload def setProperty(self, name: str, value: object) -> None: ... + def feed(self, data: str | ReadableBuffer, isFinal: bool = False) -> None: ... def flush(self) -> None: ... def close(self) -> None: ... diff --git a/stdlib/xml/sax/xmlreader.pyi b/stdlib/xml/sax/xmlreader.pyi index bec292f03282..a7ae5edc55d3 100644 --- a/stdlib/xml/sax/xmlreader.pyi +++ b/stdlib/xml/sax/xmlreader.pyi @@ -64,10 +64,12 @@ class AttributesImpl(Generic[_AttrKey]): def __getitem__(self, name: _AttrKey) -> str: ... def keys(self) -> list[_AttrKey]: ... def __contains__(self, name: _AttrKey) -> bool: ... + @overload def get(self, name: _AttrKey, alternative: None = None) -> str | None: ... @overload def get(self, name: _AttrKey, alternative: str) -> str: ... + def copy(self) -> Self: ... def items(self) -> list[tuple[_AttrKey, str]]: ... def values(self) -> list[str]: ... @@ -83,8 +85,10 @@ class AttributesNSImpl(AttributesImpl[_NSName]): def __getitem__(self, name: _NSName) -> str: ... def keys(self) -> list[_NSName]: ... def __contains__(self, name: _NSName) -> bool: ... + @overload def get(self, name: _NSName, alternative: None = None) -> str | None: ... @overload def get(self, name: _NSName, alternative: str) -> str: ... + def items(self) -> list[tuple[_NSName, str]]: ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 18f8987f78fb..573401f18d08 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -282,12 +282,14 @@ class ServerProxy: context: Any | None = None, ) -> None: ... def __getattr__(self, name: str) -> _Method: ... + @overload def __call__(self, attr: Literal["close"]) -> Callable[[], None]: ... @overload def __call__(self, attr: Literal["transport"]) -> Transport: ... @overload def __call__(self, attr: str) -> Callable[[], None] | Transport: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None diff --git a/stdlib/zipfile/__init__.pyi b/stdlib/zipfile/__init__.pyi index 09aae4e6a713..0039a05b5d6f 100644 --- a/stdlib/zipfile/__init__.pyi +++ b/stdlib/zipfile/__init__.pyi @@ -67,6 +67,7 @@ class ZipExtFile(io.BufferedIOBase): newlines: list[bytes] | None mode: _ReadWriteMode name: str + @overload def __init__( self, fileobj: _ClosableZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, pwd: bytes | None, close_fileobj: Literal[True] @@ -90,6 +91,7 @@ class ZipExtFile(io.BufferedIOBase): pwd: bytes | None = None, close_fileobj: Literal[False] = False, ) -> None: ... + def read(self, n: int | None = -1) -> bytes: ... def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override] def peek(self, n: int = 1) -> bytes: ... @@ -330,6 +332,7 @@ if sys.version_info >= (3, 12): else: class CompleteDirs(ZipFile): def resolve_dir(self, name: str) -> str: ... + @overload @classmethod def make(cls, source: ZipFile) -> CompleteDirs: ... @@ -369,6 +372,7 @@ else: ) -> TextIOWrapper: ... @overload def open(self, mode: Literal["rb", "wb"], *, pwd: bytes | None = None) -> IO[bytes]: ... + def iterdir(self) -> Iterator[Self]: ... def is_dir(self) -> bool: ... def is_file(self) -> bool: ... diff --git a/stdlib/zipfile/_path/__init__.pyi b/stdlib/zipfile/_path/__init__.pyi index c936c4494c7c..e1449dc681ad 100644 --- a/stdlib/zipfile/_path/__init__.pyi +++ b/stdlib/zipfile/_path/__init__.pyi @@ -19,12 +19,14 @@ if sys.version_info >= (3, 12): class CompleteDirs(InitializedState, ZipFile): def resolve_dir(self, name: str) -> str: ... + @overload @classmethod def make(cls, source: ZipFile) -> CompleteDirs: ... @overload @classmethod def make(cls, source: StrPath | IO[bytes]) -> Self: ... + if sys.version_info >= (3, 13): @classmethod def inject(cls, zf: _ZF) -> _ZF: ... @@ -45,6 +47,7 @@ if sys.version_info >= (3, 12): def suffixes(self) -> list[str]: ... @property def stem(self) -> str: ... + @overload def open( self, @@ -59,6 +62,7 @@ if sys.version_info >= (3, 12): ) -> TextIOWrapper: ... @overload def open(self, mode: Literal["rb", "wb"], *, pwd: bytes | None = None) -> IO[bytes]: ... + def iterdir(self) -> Iterator[Self]: ... def is_dir(self) -> bool: ... def is_file(self) -> bool: ... diff --git a/stdlib/zoneinfo/__init__.pyi b/stdlib/zoneinfo/__init__.pyi index b7433f835f83..def31546becb 100644 --- a/stdlib/zoneinfo/__init__.pyi +++ b/stdlib/zoneinfo/__init__.pyi @@ -19,6 +19,7 @@ class ZoneInfo(tzinfo): def __new__(cls, key: str) -> Self: ... @classmethod def no_cache(cls, key: str) -> Self: ... + if sys.version_info >= (3, 12): @classmethod def from_file(cls, file_obj: _IOBytes, /, key: str | None = None) -> Self: ... diff --git a/stubs/Authlib/authlib/common/encoding.pyi b/stubs/Authlib/authlib/common/encoding.pyi index 0cddc1311100..571136fb6db1 100644 --- a/stubs/Authlib/authlib/common/encoding.pyi +++ b/stubs/Authlib/authlib/common/encoding.pyi @@ -10,10 +10,12 @@ def to_bytes( charset: str = "utf-8", errors: str = "strict", ) -> bytes: ... + @overload def to_unicode(x: None, charset: str = "utf-8", errors: str = "strict") -> None: ... @overload def to_unicode(x: object, charset: str = "utf-8", errors: str = "strict") -> str: ... + def to_native(x: str | bytes, encoding: str = "ascii") -> str: ... def json_loads(s: str | bytes | bytearray) -> Any: ... # returns json.loads() def json_dumps(data: Any, ensure_ascii: bool = False) -> str: ... # data pass to json.dumps() diff --git a/stubs/Authlib/authlib/common/urls.pyi b/stubs/Authlib/authlib/common/urls.pyi index 051b51f80b92..2fdea02e0ff4 100644 --- a/stubs/Authlib/authlib/common/urls.pyi +++ b/stubs/Authlib/authlib/common/urls.pyi @@ -14,10 +14,12 @@ def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = F def quote(s: str, safe: bytes = b"/") -> str: ... def unquote(s: str | bytes) -> str: ... def quote_url(s: str) -> str: ... + @overload def extract_params(raw: None) -> None: ... @overload def extract_params(raw: dict[str, str]) -> _ExplodedQueryString: ... @overload def extract_params(raw: _ExplodedQueryString | tuple[tuple[str, str], ...] | str) -> _ExplodedQueryString | None: ... + def is_valid_url(url: str, fragments_allowed: bool = True) -> bool: ... diff --git a/stubs/Authlib/authlib/integrations/flask_client/apps.pyi b/stubs/Authlib/authlib/integrations/flask_client/apps.pyi index b0225ab249aa..43b771e59a39 100644 --- a/stubs/Authlib/authlib/integrations/flask_client/apps.pyi +++ b/stubs/Authlib/authlib/integrations/flask_client/apps.pyi @@ -6,6 +6,7 @@ class FlaskAppMixin: def token(self): ... @token.setter def token(self, token): ... + def save_authorize_data(self, **kwargs) -> None: ... def authorize_redirect(self, redirect_uri=None, **kwargs): ... diff --git a/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi b/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi index 8d4ee3b0d012..b6785ca8f084 100644 --- a/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi +++ b/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi @@ -17,6 +17,7 @@ class JsonWebToken: def __init__(self, algorithms, private_headers=None) -> None: ... def check_sensitive_data(self, payload) -> None: ... def encode(self, header, payload, key, check: bool = True) -> bytes: ... + @overload def decode( self, @@ -50,5 +51,6 @@ def prepare_raw_key(raw: KeySet) -> KeySet: ... def prepare_raw_key(raw: str) -> dict[str, Any] | str: ... # dict is a JSON object @overload def prepare_raw_key(raw: _TL) -> _Keys[_TL]: ... + def find_encode_key(key, header): ... def create_load_key(key: KeySet | _Keys[Incomplete] | Incomplete) -> _LoadKey: ... diff --git a/stubs/Authlib/authlib/oauth1/client.pyi b/stubs/Authlib/authlib/oauth1/client.pyi index 26a40823343c..25a169c46bf5 100644 --- a/stubs/Authlib/authlib/oauth1/client.pyi +++ b/stubs/Authlib/authlib/oauth1/client.pyi @@ -23,14 +23,17 @@ class OAuth1Client: realm=None, **kwargs, ) -> None: ... + @property def redirect_uri(self): ... @redirect_uri.setter def redirect_uri(self, uri) -> None: ... + @property def token(self) -> dict[Incomplete, Incomplete]: ... @token.setter def token(self, token) -> None: ... + def create_authorization_url(self, url, request_token=None, **kwargs) -> str: ... def fetch_request_token(self, url: str, **kwargs) -> dict[str, Any]: ... def fetch_access_token(self, url, verifier=None, **kwargs): ... diff --git a/stubs/Authlib/authlib/oauth2/client.pyi b/stubs/Authlib/authlib/oauth2/client.pyi index 4fcba50b6955..c502a92b5e67 100644 --- a/stubs/Authlib/authlib/oauth2/client.pyi +++ b/stubs/Authlib/authlib/oauth2/client.pyi @@ -48,10 +48,12 @@ class OAuth2Client: ) -> None: ... def register_client_auth_method(self, auth) -> None: ... def client_auth(self, auth_method) -> ClientAuth: ... + @property def token(self): ... @token.setter def token(self, token) -> None: ... + def create_authorization_url(self, url, state=None, code_verifier=None, **kwargs) -> tuple[str, Incomplete]: ... def fetch_token( self, url=None, body: str = "", method: str = "POST", headers=None, auth=None, grant_type=None, state=None, **kwargs diff --git a/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi b/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi index 146fffd4a7e7..af3561c3f6b8 100644 --- a/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi +++ b/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi @@ -42,10 +42,12 @@ class AuthorizationServer(Hookable): def get_consent_grant(self, request=None, end_user=None): ... def get_token_grant(self, request: OAuth2Request) -> BaseGrant: ... def create_endpoint_response(self, name, request=None): ... + @overload @deprecated("The 'grant' parameter will become mandatory.") def create_authorization_response(self, request=None, grant_user=None) -> object: ... @overload def create_authorization_response(self, request=None, grant_user=None, grant=None) -> object: ... + def create_token_response(self, request=None) -> _ServerResponse: ... def handle_error_response(self, request: OAuth2Request, error: OAuth2Error) -> object: ... diff --git a/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi b/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi index 40aa69ce3605..a08553800101 100644 --- a/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi +++ b/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi @@ -41,11 +41,13 @@ class OAuth2Request(OAuth2Payload): authorization_code: Incomplete | None refresh_token: Incomplete | None credential: Incomplete | None + @overload def __init__(self, method: str, uri: str, body: None = None, headers: Mapping[str, str] | None = None) -> None: ... @overload @deprecated("The `body` parameter in OAuth2Request is deprecated. Use the payload system instead.") def __init__(self, method: str, uri: str, body, headers: Mapping[str, str] | None = None) -> None: ... + @property def args(self) -> dict[str, str | None]: ... @property diff --git a/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi b/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi index bd0c0821749e..fb021f8ccb5c 100644 --- a/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi +++ b/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi @@ -31,10 +31,12 @@ class AssertionClient: leeway: int = 60, **kwargs, ) -> None: ... + @property def token(self): ... @token.setter def token(self, token) -> None: ... + def refresh_token(self): ... def parse_response_token(self, resp): ... def __del__(self) -> None: ... diff --git a/stubs/Flask-Cors/flask_cors/core.pyi b/stubs/Flask-Cors/flask_cors/core.pyi index 3fe8b4d2bca7..a0783f797a07 100644 --- a/stubs/Flask-Cors/flask_cors/core.pyi +++ b/stubs/Flask-Cors/flask_cors/core.pyi @@ -49,10 +49,12 @@ def get_cors_origins(options: _Options, request_origin: str | None) -> list[str] def get_allow_headers(options: _Options, acl_request_headers: str | None) -> str | None: ... def get_cors_headers(options: _Options, request_headers: dict[str, Any], request_method: str) -> _MultiDict: ... def set_cors_headers(resp: flask.Response, options: _Options) -> flask.Response: ... + @overload def probably_regex(maybe_regex: Pattern[str]) -> Literal[True]: ... @overload def probably_regex(maybe_regex: str) -> bool: ... + def re_fix(reg: str) -> str: ... def try_match_any_pattern(inst: str, patterns: Iterable[str | Pattern[str]], caseSensitive: bool = True) -> bool: ... def try_match_pattern(value: str, pattern: str | Pattern[str], caseSensitive: bool = True) -> bool | Match[str]: ... @@ -60,11 +62,13 @@ def get_cors_options(appInstance: flask.Flask | None, *dicts: _Options) -> _Opti def get_app_kwarg_dict(appInstance: flask.Flask | None = None) -> _Options: ... def flexible_str(obj: object) -> str | None: ... def serialize_option(options_dict: _Options, key: str, upper: bool = False) -> None: ... + @overload def ensure_iterable(inst: str) -> list[str]: ... # type: ignore[overload-overlap] @overload def ensure_iterable(inst: _IterableT) -> _IterableT: ... # type: ignore[overload-overlap] @overload def ensure_iterable(inst: _T) -> list[_T]: ... + def sanitize_regex_param(param: str | list[str]) -> list[str]: ... def serialize_options(opts: _Options) -> _Options: ... diff --git a/stubs/Flask-SocketIO/flask_socketio/__init__.pyi b/stubs/Flask-SocketIO/flask_socketio/__init__.pyi index 72d942a36f4b..6176a66fabef 100644 --- a/stubs/Flask-SocketIO/flask_socketio/__init__.pyi +++ b/stubs/Flask-SocketIO/flask_socketio/__init__.pyi @@ -84,10 +84,12 @@ class SocketIO: def on_error(self, namespace: str | None = None) -> _ExceptionHandlerDecorator: ... def on_error_default(self, exception_handler: _ExceptionHandler[_R_co]) -> _ExceptionHandler[_R_co]: ... def on_event(self, message: str, handler: _Handler[[Incomplete], object], namespace: str | None = None) -> None: ... + @overload def event(self, event_handler: _Handler[_P, _R_co], /) -> _Handler[_P, _R_co]: ... @overload def event(self, namespace: str | None = None, *args, **kwargs) -> _HandlerDecorator: ... + def on_namespace(self, namespace_handler: Namespace) -> None: ... def emit( self, diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index 963959b0448e..95d6e4857c2c 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -40,10 +40,12 @@ class _CBufferType: def __getitem__(self, key: int) -> str: ... @overload def __getitem__(self, key: slice) -> bytes: ... + @overload def __setitem__(self, key: int, val: str) -> None: ... @overload def __setitem__(self, key: slice, val: bytes) -> None: ... + def __len__(self) -> int: ... def __bytes__(self) -> bytes: ... @@ -90,10 +92,12 @@ class Client: def uuid(self) -> str: ... @property def samplerate(self) -> int: ... + @property def blocksize(self) -> int: ... @blocksize.setter def blocksize(self, blocksize: int) -> None: ... + @property def status(self) -> Status: ... @property @@ -123,10 +127,12 @@ class Client: def transport_stop(self) -> None: ... @property def transport_state(self) -> TransportState: ... + @property def transport_frame(self) -> int: ... @transport_frame.setter def transport_frame(self, frame: int) -> None: ... + def transport_locate(self, frame: int) -> None: ... def transport_query(self) -> tuple[TransportState, dict[str, Any]]: ... # Anyof[int, float, _CDataBase] def transport_query_struct(self) -> tuple[TransportState, _JackPositionT]: ... @@ -183,10 +189,12 @@ class Port: def __ne__(self, other: object) -> bool: ... @property def name(self) -> str: ... + @property def shortname(self) -> str: ... @shortname.setter def shortname(self, shortname: str) -> None: ... + @property def aliases(self) -> list[str]: ... def set_alias(self, alias: str) -> None: ... diff --git a/stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi b/stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi index 5965fc2d2c20..20a8b6121349 100644 --- a/stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi +++ b/stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi @@ -71,6 +71,7 @@ def request_handle(line_offset: int, direction: Literal[0, 1], initial: Literal[ def request_event(line_offset: int, edge: int, consumer: str) -> gpioevent_request: ... def get_value(line_handle: int) -> int: ... def set_value(line_handle: int, value: int) -> None: ... + @dataclass class PadCtlRegister: is_gpio: bool diff --git a/stubs/Markdown/markdown/util.pyi b/stubs/Markdown/markdown/util.pyi index b942839a95f4..82615ec3843f 100644 --- a/stubs/Markdown/markdown/util.pyi +++ b/stubs/Markdown/markdown/util.pyi @@ -21,10 +21,12 @@ RTL_BIDI_RANGES: Final[tuple[tuple[str, str], tuple[str, str]]] def get_installed_extensions() -> metadata.EntryPoints: ... def deprecated(message: str, stacklevel: int = 2): ... + @overload def parseBoolValue(value: str) -> bool: ... @overload def parseBoolValue(value: str | None, fail_on_errors: bool = True, preserve_none: bool = False) -> bool | None: ... + def code_escape(text: str) -> str: ... def nearing_recursion_limit() -> bool: ... @@ -56,10 +58,12 @@ class Registry(Generic[_T]): def __init__(self) -> None: ... def __contains__(self, item: str | _T) -> bool: ... def __iter__(self) -> Iterator[_T]: ... + @overload def __getitem__(self, key: slice) -> Registry[_T]: ... @overload def __getitem__(self, key: str | int) -> _T: ... + def __len__(self) -> int: ... def get_index_for_name(self, name: str) -> int: ... def register(self, item: _T, name: str, priority: float) -> None: ... diff --git a/stubs/PyMeeus/pymeeus/Angle.pyi b/stubs/PyMeeus/pymeeus/Angle.pyi index 63a2451d0a07..5f65ee04f79b 100644 --- a/stubs/PyMeeus/pymeeus/Angle.pyi +++ b/stubs/PyMeeus/pymeeus/Angle.pyi @@ -16,6 +16,7 @@ class Angle: def __init__(self, a1: float, a2: float, a3: float, /, *, ra: bool = False) -> None: ... @overload def __init__(self, a1: float, a2: float, a3: float, a4: float, /, *, ra: bool = False) -> None: ... + @staticmethod def reduce_deg(deg: float | Angle) -> float: ... @staticmethod @@ -27,6 +28,7 @@ class Angle: def get_tolerance(self) -> float: ... def set_tolerance(self, tol: float) -> None: ... def __call__(self) -> float: ... + @overload def set(self, *, ra: bool = False) -> None: ... @overload @@ -41,7 +43,9 @@ class Angle: def set(self, a1: float, a2: float, a3: float, /, *, ra: bool = False) -> None: ... @overload def set(self, a1: float, a2: float, a3: float, a4: float, /, *, ra: bool = False) -> None: ... + def set_radians(self, rads: float) -> None: ... + @overload def set_ra(self) -> None: ... @overload @@ -52,6 +56,7 @@ class Angle: def set_ra(self, a1: float, a2: float, a3: float, /) -> None: ... @overload def set_ra(self, a1: float, a2: float, a3: float, a4: float, /) -> None: ... + def dms_str(self, fancy: bool | None = True, n_dec: int = -1) -> str: ... def get_ra(self) -> float: ... def ra_str(self, fancy: bool | None = True, n_dec: int = -1) -> str: ... diff --git a/stubs/PyMeeus/pymeeus/Coordinates.pyi b/stubs/PyMeeus/pymeeus/Coordinates.pyi index b46989768465..05814b68c48f 100644 --- a/stubs/PyMeeus/pymeeus/Coordinates.pyi +++ b/stubs/PyMeeus/pymeeus/Coordinates.pyi @@ -21,6 +21,7 @@ def mean_obliquity( def mean_obliquity( year: int, month: int, day: int, /, *, leap_seconds: float = 0, local: bool = False, utc: bool = False ) -> Angle: ... + @overload def true_obliquity( a: Epoch | list[float] | tuple[float, ...] | datetime.date, @@ -34,6 +35,7 @@ def true_obliquity( def true_obliquity( year: int, month: int, day: int, /, *, leap_seconds: float = 0, local: bool = False, utc: bool = False ) -> Angle: ... + @overload def nutation_longitude( a: Epoch | list[float] | tuple[float, ...] | datetime.date, @@ -47,6 +49,7 @@ def nutation_longitude( def nutation_longitude( year: int, month: int, day: int, /, *, leap_seconds: float = 0, local: bool = False, utc: bool = False ) -> Angle: ... + @overload def nutation_obliquity( a: Epoch | list[float] | tuple[float, ...] | datetime.date, @@ -60,6 +63,7 @@ def nutation_obliquity( def nutation_obliquity( year: int, month: int, day: int, /, *, leap_seconds: float = 0, local: bool = False, utc: bool = False ) -> Angle: ... + def precession_equatorial( start_epoch: Epoch, final_epoch: Epoch, diff --git a/stubs/PyMeeus/pymeeus/CurveFitting.pyi b/stubs/PyMeeus/pymeeus/CurveFitting.pyi index 9ef7c7c4141e..00ba40a02d7f 100644 --- a/stubs/PyMeeus/pymeeus/CurveFitting.pyi +++ b/stubs/PyMeeus/pymeeus/CurveFitting.pyi @@ -18,6 +18,7 @@ class CurveFitting: def __init__( self, a1: float | Angle, a2: float | Angle, a3: float | Angle, a4: float | Angle, /, *rest: float | Angle ) -> None: ... + @overload def set(self) -> None: ... @overload @@ -32,6 +33,7 @@ class CurveFitting: def set( self, a1: float | Angle, a2: float | Angle, a3: float | Angle, a4: float | Angle, /, *rest: float | Angle ) -> None: ... + def __len__(self) -> int: ... def correlation_coeff(self) -> float: ... def linear_fitting(self) -> tuple[float, float]: ... diff --git a/stubs/PyMeeus/pymeeus/Epoch.pyi b/stubs/PyMeeus/pymeeus/Epoch.pyi index 476839684819..22dce2c398dc 100644 --- a/stubs/PyMeeus/pymeeus/Epoch.pyi +++ b/stubs/PyMeeus/pymeeus/Epoch.pyi @@ -26,7 +26,9 @@ class Epoch: local: bool = False, utc: bool = False, ) -> None: ... + def __hash__(self) -> int: ... + @overload def set(self) -> None: ... @overload @@ -43,6 +45,7 @@ class Epoch: local: bool = False, utc: bool = False, ) -> None: ... + @overload @overload @staticmethod @@ -59,15 +62,18 @@ class Epoch: def check_input_date( year: int, month: int, day: int, /, *, leap_seconds: float = 0, local: bool = False, utc: bool = False ) -> Epoch: ... + @staticmethod def is_julian(year: int, month: int, day: int) -> bool: ... def julian(self) -> bool: ... + @overload @staticmethod def get_month(month: float | str, as_string: Literal[True]) -> str: ... @overload @staticmethod def get_month(month: float | str, as_string: Literal[False] | None = False) -> int: ... + @staticmethod def is_leap(year: float) -> bool: ... def leap(self) -> bool: ... @@ -96,10 +102,12 @@ class Epoch: ) -> tuple[int, int, int, int, int, float]: ... @staticmethod def tt2ut(year: int, month: int) -> float: ... + @overload def dow(self, as_string: Literal[True]) -> str: ... @overload def dow(self, as_string: Literal[False] | None = False) -> int: ... + def mean_sidereal_time(self) -> float: ... def apparent_sidereal_time(self, true_obliquity: float | Angle, nutation_longitude: float | Angle) -> float: ... def mjd(self) -> float: ... @@ -108,10 +116,12 @@ class Epoch: def rise_set(self, latitude: Angle, longitude: Angle, altitude: float = 0.0) -> tuple[Epoch, Epoch]: ... def __call__(self) -> float: ... def __add__(self, b: float) -> Epoch: ... + @overload def __sub__(self, b: float) -> Epoch: ... @overload def __sub__(self, b: Epoch) -> float: ... + def __iadd__(self, b: float) -> Self: ... def __isub__(self, b: float) -> Self: ... # type: ignore[misc] # __sub__ and __isub__ are incompatible def __radd__(self, b: float) -> Epoch: ... diff --git a/stubs/PyMeeus/pymeeus/Interpolation.pyi b/stubs/PyMeeus/pymeeus/Interpolation.pyi index a9219a7a64c8..d3e821633d03 100644 --- a/stubs/PyMeeus/pymeeus/Interpolation.pyi +++ b/stubs/PyMeeus/pymeeus/Interpolation.pyi @@ -17,6 +17,7 @@ class Interpolation: def __init__( self, a1: float | Angle, a2: float | Angle, a3: float | Angle, a4: float | Angle, /, *rest: float | Angle ) -> None: ... + @overload def set(self) -> None: ... @overload @@ -31,6 +32,7 @@ class Interpolation: def set( self, a1: float | Angle, a2: float | Angle, a3: float | Angle, a4: float | Angle, /, *rest: float | Angle ) -> None: ... + def __len__(self) -> int: ... def get_tolerance(self) -> float: ... def set_tolerance(self, tol: float) -> None: ... diff --git a/stubs/PyMeeus/pymeeus/JupiterMoons.pyi b/stubs/PyMeeus/pymeeus/JupiterMoons.pyi index c23baadef122..f86ebf994723 100644 --- a/stubs/PyMeeus/pymeeus/JupiterMoons.pyi +++ b/stubs/PyMeeus/pymeeus/JupiterMoons.pyi @@ -12,6 +12,7 @@ class JupiterMoons: ) -> tuple[ tuple[float, float, float], tuple[float, float, float], tuple[float, float, float], tuple[float, float, float] ]: ... + @overload @staticmethod def apparent_rectangular_coordinates( @@ -42,10 +43,12 @@ class JupiterMoons: D: float = 0, isFictional: Literal[False] | None = False, ) -> tuple[float, float, float]: ... + @staticmethod def calculate_delta( epoch: Epoch, ) -> tuple[float, float, Angle, Angle, float] | tuple[float, float, Literal[0], Literal[0], Literal[0]]: ... + @overload @staticmethod def correct_rectangular_positions( @@ -56,12 +59,14 @@ class JupiterMoons: def correct_rectangular_positions( R: float, i_sat: int, DELTA: float, X_coordinate: float, Y_coordinate: float = 0, Z_coordinate: float = 0 ) -> tuple[float, float, float]: ... + @overload @staticmethod def check_phenomena(epoch: Epoch, check_all: Literal[True] = True, i_sat: int = 0) -> list[list[float]]: ... @overload @staticmethod def check_phenomena(epoch: Epoch, check_all: Literal[False] | None, i_sat: int = 0) -> tuple[float, float]: ... + @staticmethod def is_phenomena(epoch: Epoch) -> list[list[bool]]: ... @staticmethod diff --git a/stubs/PyMySQL/pymysql/connections.pyi b/stubs/PyMySQL/pymysql/connections.pyi index 32abdbf533df..05cf60eaab64 100644 --- a/stubs/PyMySQL/pymysql/connections.pyi +++ b/stubs/PyMySQL/pymysql/connections.pyi @@ -152,6 +152,7 @@ class Connection(Generic[_C]): passwd: str | bytes | None = None, # deprecated db: str | bytes | None = None, # deprecated ) -> None: ... + def close(self) -> None: ... @property def open(self) -> bool: ... @@ -165,10 +166,12 @@ class Connection(Generic[_C]): def escape(self, obj, mapping: Mapping[str, Incomplete] | None = None): ... def literal(self, obj): ... def escape_string(self, s: AnyStr) -> AnyStr: ... + @overload def cursor(self, cursor: None = None) -> _C: ... @overload def cursor(self, cursor: type[_C2]) -> _C2: ... + def query(self, sql, unbuffered: bool = False) -> int: ... def next_result(self, unbuffered: bool = False) -> int: ... def affected_rows(self): ... diff --git a/stubs/PyScreeze/pyscreeze/__init__.pyi b/stubs/PyScreeze/pyscreeze/__init__.pyi index e9701832ba5d..5e1e7c7fb771 100644 --- a/stubs/PyScreeze/pyscreeze/__init__.pyi +++ b/stubs/PyScreeze/pyscreeze/__init__.pyi @@ -146,6 +146,7 @@ def locateCenterOnScreen( step: int = 1, confidence: None = None, ) -> Point | None: ... + def locateOnScreenNear(image: str | Image.Image | _MatLike, x: int, y: int) -> Box: ... def locateCenterOnScreenNear(image: str | Image.Image | _MatLike, x: int, y: int) -> Point | None: ... @@ -172,6 +173,7 @@ def locateOnWindow( step: int = 1, confidence: None = None, ) -> Box | None: ... + def showRegionOnScreen( region: tuple[int, int, int, int], outlineColor: str = "red", filename: str = "_showRegionOnScreen.png" ) -> None: ... diff --git a/stubs/PySocks/socks.pyi b/stubs/PySocks/socks.pyi index c34cfb7b04d8..18ecec651ef6 100644 --- a/stubs/PySocks/socks.pyi +++ b/stubs/PySocks/socks.pyi @@ -122,10 +122,12 @@ class socksocket(_BaseSocket): proxytype: _ProxyType = ..., ) -> None: ... def bind(self, address: socket._Address, /) -> None: ... + @overload def sendto(self, bytes: ReadableBuffer, address: socket._Address) -> int: ... @overload def sendto(self, bytes: ReadableBuffer, flags: int, address: socket._Address) -> int: ... + def send(self, bytes: ReadableBuffer, flags: int = 0) -> int: ... def recvfrom(self, bufsize: int, flags: int = 0) -> tuple[bytes, _Endpoint]: ... def recv(self, bufsize: int, flags: int = 0) -> bytes: ... diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 715d37e4d30e..189ea6812997 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -49,6 +49,7 @@ def emit( allow_unicode: bool | None = None, line_break: str | None = None, ): ... + @overload def serialize_all( nodes, @@ -100,6 +101,7 @@ def serialize_all( version: tuple[int, int] | None = None, tags: Mapping[str, str] | None = None, ) -> bytes: ... + @overload def serialize( node, @@ -151,6 +153,7 @@ def serialize( version: tuple[int, int] | None = None, tags: Mapping[str, str] | None = None, ) -> bytes: ... + @overload def dump_all( documents: Iterable[Any], @@ -211,6 +214,7 @@ def dump_all( tags: Mapping[str, str] | None = None, sort_keys: bool = True, ) -> bytes: ... + @overload def dump( data: Any, @@ -271,6 +275,7 @@ def dump( tags: Mapping[str, str] | None = None, sort_keys: bool = True, ) -> bytes: ... + @overload def safe_dump_all( documents: Iterable[Any], @@ -328,6 +333,7 @@ def safe_dump_all( tags: Mapping[str, str] | None = None, sort_keys: bool = True, ) -> bytes: ... + @overload def safe_dump( data: Any, @@ -385,6 +391,7 @@ def safe_dump( tags: Mapping[str, str] | None = None, sort_keys: bool = True, ) -> bytes: ... + def add_implicit_resolver( tag: str, regexp: Pattern[str], @@ -399,12 +406,14 @@ def add_path_resolver( Loader: type[BaseResolver] | None = None, Dumper: type[BaseResolver] = ..., ) -> None: ... + @overload def add_constructor( tag: str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = None ) -> None: ... @overload def add_constructor(tag: str, constructor: Callable[[_Constructor, Node], Any], Loader: type[_Constructor]) -> None: ... + @overload def add_multi_constructor( tag_prefix: str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, str, Node], Any], Loader: None = None @@ -413,10 +422,12 @@ def add_multi_constructor( def add_multi_constructor( tag_prefix: str, multi_constructor: Callable[[_Constructor, str, Node], Any], Loader: type[_Constructor] ) -> None: ... + @overload def add_representer(data_type: type[_T], representer: Callable[[Dumper, _T], Node]) -> None: ... @overload def add_representer(data_type: type[_T], representer: Callable[[_Representer, _T], Node], Dumper: type[_Representer]) -> None: ... + @overload def add_multi_representer(data_type: type[_T], multi_representer: Callable[[Dumper, _T], Node]) -> None: ... @overload diff --git a/stubs/PyYAML/yaml/_yaml.pyi b/stubs/PyYAML/yaml/_yaml.pyi index 2901bc271310..f7412770b57a 100644 --- a/stubs/PyYAML/yaml/_yaml.pyi +++ b/stubs/PyYAML/yaml/_yaml.pyi @@ -9,6 +9,7 @@ from .tokens import Token def get_version_string() -> str: ... def get_version() -> tuple[int, int, int]: ... + @disjoint_base class Mark: name: Any diff --git a/stubs/Pygments/pygments/__init__.pyi b/stubs/Pygments/pygments/__init__.pyi index ca3371f873b1..d5fab4ab32db 100644 --- a/stubs/Pygments/pygments/__init__.pyi +++ b/stubs/Pygments/pygments/__init__.pyi @@ -13,10 +13,12 @@ __docformat__: Final = "restructuredtext" __all__ = ["lex", "format", "highlight"] def lex(code: str, lexer: Lexer) -> Iterator[tuple[_TokenType, str]]: ... + @overload def format(tokens: Iterable[tuple[_TokenType, str]], formatter: Formatter[_T], outfile: SupportsWrite[_T]) -> None: ... @overload def format(tokens: Iterable[tuple[_TokenType, str]], formatter: Formatter[_T], outfile: None = None) -> _T: ... + @overload def highlight(code: str, lexer: Lexer, formatter: Formatter[_T], outfile: SupportsWrite[_T]) -> None: ... @overload diff --git a/stubs/Pygments/pygments/formatter.pyi b/stubs/Pygments/pygments/formatter.pyi index 32dfdba8ad96..94c4dcdb65f1 100644 --- a/stubs/Pygments/pygments/formatter.pyi +++ b/stubs/Pygments/pygments/formatter.pyi @@ -20,6 +20,7 @@ class Formatter(Generic[_T]): title: str encoding: str | None options: dict[str, Any] # arbitrary values used by subclasses + @overload def __init__( self: Formatter[str], @@ -53,6 +54,7 @@ class Formatter(Generic[_T]): outencoding: str, **options: Any, # arbitrary values used by subclasses ) -> None: ... + def __class_getitem__(cls, name: Any) -> types.GenericAlias: ... def get_style_defs(self, arg: str = "") -> str: ... def format(self, tokensource: Iterable[tuple[_TokenType, str]], outfile: SupportsWrite[_T]) -> None: ... diff --git a/stubs/WTForms/wtforms/fields/numeric.pyi b/stubs/WTForms/wtforms/fields/numeric.pyi index f7390d553f87..e88aad5a7c92 100644 --- a/stubs/WTForms/wtforms/fields/numeric.pyi +++ b/stubs/WTForms/wtforms/fields/numeric.pyi @@ -67,6 +67,7 @@ class DecimalField(LocaleAwareNumberField): default: Decimal | Callable[[], Decimal] | None places: int | None rounding: str | None + @overload def __init__( self, diff --git a/stubs/WTForms/wtforms/i18n.pyi b/stubs/WTForms/wtforms/i18n.pyi index 4ebb609168fc..f8ac4b504556 100644 --- a/stubs/WTForms/wtforms/i18n.pyi +++ b/stubs/WTForms/wtforms/i18n.pyi @@ -11,6 +11,7 @@ class _SupportsUgettextAndUngettext(Protocol): def messages_path() -> str: ... def get_builtin_gnu_translations(languages: Iterable[str] | None = None) -> GNUTranslations: ... + @overload def get_translations( languages: Iterable[str] | None = None, getter: Callable[[Iterable[str]], GNUTranslations] = ... diff --git a/stubs/WTForms/wtforms/meta.pyi b/stubs/WTForms/wtforms/meta.pyi index 1ab9c382f8ea..ee207e7e782d 100644 --- a/stubs/WTForms/wtforms/meta.pyi +++ b/stubs/WTForms/wtforms/meta.pyi @@ -37,10 +37,12 @@ _MultiDictLike: TypeAlias = _MultiDictLikeWithGetall | _MultiDictLikeWithGetlist class DefaultMeta: def bind_field(self, form: BaseForm, unbound_field: UnboundField[_FieldT], options: MutableMapping[str, Any]) -> _FieldT: ... + @overload def wrap_formdata(self, form: BaseForm, formdata: None) -> None: ... @overload def wrap_formdata(self, form: BaseForm, formdata: _MultiDictLike) -> _MultiDictLikeWithGetlist: ... + def render_field(self, field: Field, render_kw: SupportsItems[str, Any]) -> Markup: ... csrf: bool csrf_field_name: str diff --git a/stubs/WTForms/wtforms/validators.pyi b/stubs/WTForms/wtforms/validators.pyi index cbe04b288fc4..0389fcb38779 100644 --- a/stubs/WTForms/wtforms/validators.pyi +++ b/stubs/WTForms/wtforms/validators.pyi @@ -147,6 +147,7 @@ class AnyOf: values: Collection[Any] message: str | None values_formatter: Callable[[Any], str] + @overload def __init__(self, values: Collection[Any], message: str | None = None, values_formatter: None = None) -> None: ... @overload @@ -157,6 +158,7 @@ class AnyOf: def __init__( self, values: _ValuesT_contra, message: str | None = None, *, values_formatter: Callable[[_ValuesT_contra], str] ) -> None: ... + def __call__(self, form: BaseForm, field: Field) -> None: ... @staticmethod def default_values_formatter(values: Iterable[object]) -> str: ... @@ -165,6 +167,7 @@ class NoneOf: values: Collection[Any] message: str | None values_formatter: Callable[[Any], str] + @overload def __init__(self, values: Collection[Any], message: str | None = None, values_formatter: None = None) -> None: ... @overload @@ -175,6 +178,7 @@ class NoneOf: def __init__( self, values: _ValuesT_contra, message: str | None = None, *, values_formatter: Callable[[_ValuesT_contra], str] ) -> None: ... + def __call__(self, form: BaseForm, field: Field) -> None: ... @staticmethod def default_values_formatter(v: Iterable[object]) -> str: ... diff --git a/stubs/WebOb/webob/_types.pyi b/stubs/WebOb/webob/_types.pyi index d0a2b8e1a5df..11c28a5efb9a 100644 --- a/stubs/WebOb/webob/_types.pyi +++ b/stubs/WebOb/webob/_types.pyi @@ -10,6 +10,7 @@ class AsymmetricProperty(Protocol[_GetterReturnType_co, _SetterValueType_contra] def __get__(self, obj: None, type: type[object] | None = ..., /) -> property: ... @overload def __get__(self, obj: object, type: type[object] | None = ..., /) -> _GetterReturnType_co: ... + def __set__(self, obj: object, value: _SetterValueType_contra, /) -> None: ... @type_check_only diff --git a/stubs/WebOb/webob/acceptparse.pyi b/stubs/WebOb/webob/acceptparse.pyi index a7d05aaa8a22..6ccc4c804f26 100644 --- a/stubs/WebOb/webob/acceptparse.pyi +++ b/stubs/WebOb/webob/acceptparse.pyi @@ -114,10 +114,12 @@ class AcceptValidHeader(Accept): @property def accepts_html(self) -> bool: ... def acceptable_offers(self, offers: Sequence[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float | None: ... class _AcceptInvalidOrNoHeader(Accept): @@ -128,10 +130,12 @@ class _AcceptInvalidOrNoHeader(Accept): @property def accepts_html(self) -> bool: ... def acceptable_offers(self, offers: Sequence[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float: ... class AcceptNoHeader(_AcceptInvalidOrNoHeader): @@ -141,6 +145,7 @@ class AcceptNoHeader(_AcceptInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptValidHeader | Literal[""]) -> AcceptValidHeader: ... @overload @@ -157,6 +162,7 @@ class AcceptNoHeader(_AcceptInvalidOrNoHeader): | None ), ) -> Self | AcceptValidHeader: ... + @overload def __radd__(self, other: AcceptValidHeader | Literal[""]) -> AcceptValidHeader: ... @overload @@ -181,6 +187,7 @@ class AcceptInvalidHeader(_AcceptInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self, header_value: str) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptValidHeader | Literal[""]) -> AcceptValidHeader: ... @overload @@ -197,6 +204,7 @@ class AcceptInvalidHeader(_AcceptInvalidOrNoHeader): | None ), ) -> AcceptValidHeader | AcceptNoHeader: ... + @overload def __radd__(self, other: AcceptValidHeader | Literal[""]) -> AcceptValidHeader: ... @overload @@ -224,6 +232,7 @@ def create_accept_header(header_value: None | AcceptNoHeader) -> AcceptNoHeader: def create_accept_header(header_value: str) -> AcceptValidHeader | AcceptInvalidHeader: ... @overload def create_accept_header(header_value: _AnyAcceptHeader | str | None) -> _AnyAcceptHeader: ... + def accept_property() -> _AcceptProperty: ... class AcceptCharset: @@ -263,10 +272,12 @@ class AcceptCharsetValidHeader(AcceptCharset): ), ) -> Self: ... def acceptable_offers(self, offers: Sequence[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float | None: ... class _AcceptCharsetInvalidOrNoHeader(AcceptCharset): @@ -274,10 +285,12 @@ class _AcceptCharsetInvalidOrNoHeader(AcceptCharset): def __contains__(self, offer: str) -> Literal[True]: ... def __iter__(self) -> Iterator[str]: ... def acceptable_offers(self, offers: Iterable[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float | None: ... class AcceptCharsetNoHeader(_AcceptCharsetInvalidOrNoHeader): @@ -287,6 +300,7 @@ class AcceptCharsetNoHeader(_AcceptCharsetInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptCharsetValidHeader) -> AcceptCharsetValidHeader: ... @overload @@ -303,6 +317,7 @@ class AcceptCharsetNoHeader(_AcceptCharsetInvalidOrNoHeader): | None ), ) -> Self | AcceptCharsetValidHeader: ... + @overload def __radd__(self, other: AcceptCharsetValidHeader) -> AcceptCharsetValidHeader: ... @overload @@ -327,6 +342,7 @@ class AcceptCharsetInvalidHeader(_AcceptCharsetInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self, header_value: str) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptCharsetValidHeader) -> AcceptCharsetValidHeader: ... @overload @@ -345,6 +361,7 @@ class AcceptCharsetInvalidHeader(_AcceptCharsetInvalidOrNoHeader): | None ), ) -> AcceptCharsetValidHeader | AcceptCharsetNoHeader: ... + @overload def __radd__(self, other: AcceptCharsetValidHeader) -> AcceptCharsetValidHeader: ... @overload @@ -374,6 +391,7 @@ def create_accept_charset_header(header_value: AcceptCharsetNoHeader | None) -> def create_accept_charset_header(header_value: str) -> AcceptCharsetValidHeader | AcceptCharsetInvalidHeader: ... @overload def create_accept_charset_header(header_value: _AnyAcceptCharsetHeader | str | None) -> _AnyAcceptCharsetHeader: ... + def accept_charset_property() -> _AcceptCharsetProperty: ... class AcceptEncoding: @@ -413,10 +431,12 @@ class AcceptEncodingValidHeader(AcceptEncoding): ), ) -> Self: ... def acceptable_offers(self, offers: Sequence[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float | None: ... class _AcceptEncodingInvalidOrNoHeader(AcceptEncoding): @@ -424,10 +444,12 @@ class _AcceptEncodingInvalidOrNoHeader(AcceptEncoding): def __contains__(self, offer: str) -> Literal[True]: ... def __iter__(self) -> Iterator[str]: ... def acceptable_offers(self, offers: Iterable[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + def quality(self, offer: str) -> float | None: ... class AcceptEncodingNoHeader(_AcceptEncodingInvalidOrNoHeader): @@ -437,6 +459,7 @@ class AcceptEncodingNoHeader(_AcceptEncodingInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptEncodingValidHeader | Literal[""]) -> AcceptEncodingValidHeader: ... @overload @@ -453,6 +476,7 @@ class AcceptEncodingNoHeader(_AcceptEncodingInvalidOrNoHeader): | None ), ) -> Self | AcceptEncodingValidHeader: ... + @overload def __radd__(self, other: AcceptEncodingValidHeader | Literal[""]) -> AcceptEncodingValidHeader: ... @overload @@ -477,6 +501,7 @@ class AcceptEncodingInvalidHeader(_AcceptEncodingInvalidOrNoHeader): def parsed(self) -> None: ... def __init__(self, header_value: str) -> None: ... def copy(self) -> Self: ... + @overload def __add__(self, other: AcceptEncodingValidHeader | Literal[""]) -> AcceptEncodingValidHeader: ... @overload @@ -493,6 +518,7 @@ class AcceptEncodingInvalidHeader(_AcceptEncodingInvalidOrNoHeader): | None ), ) -> AcceptEncodingValidHeader | AcceptEncodingNoHeader: ... + @overload def __radd__(self, other: AcceptEncodingValidHeader | Literal[""]) -> AcceptEncodingValidHeader: ... @overload @@ -520,6 +546,7 @@ def create_accept_encoding_header(header_value: AcceptEncodingNoHeader | None) - def create_accept_encoding_header(header_value: str) -> AcceptEncodingValidHeader | AcceptEncodingInvalidHeader: ... @overload def create_accept_encoding_header(header_value: _AnyAcceptEncodingHeader | str | None) -> _AnyAcceptEncodingHeader: ... + def accept_encoding_property() -> _AcceptEncodingProperty: ... class AcceptLanguage: @@ -559,10 +586,12 @@ class AcceptLanguageValidHeader(AcceptLanguage): ), ) -> Self: ... def basic_filtering(self, language_tags: Sequence[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + @overload def lookup( self, language_tags: Sequence[str], default_range: str | None, default_tag: str, default: None = None @@ -592,6 +621,7 @@ class AcceptLanguageValidHeader(AcceptLanguage): def lookup( self, language_tags: Sequence[str], *, default_range: str | None = None, default_tag: str, default: _T | Callable[[], _T] ) -> _T | str: ... + def quality(self, offer: str) -> float | None: ... class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage): @@ -599,10 +629,12 @@ class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage): def __contains__(self, offer: str) -> Literal[True]: ... def __iter__(self) -> Iterator[str]: ... def basic_filtering(self, language_tags: Iterable[str]) -> list[tuple[str, float]]: ... + @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: None = None) -> str | None: ... @overload def best_match(self, offers: Iterable[str | tuple[str, float] | list[Any]], default_match: str) -> str: ... + @overload def lookup(self, language_tags: object, default_range: object, default_tag: str, default: object = None) -> str: ... @overload @@ -620,6 +652,7 @@ class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage): default_tag: None = None, default: _T | Callable[[], _T], ) -> _T: ... + def quality(self, offer: str) -> float | None: ... class AcceptLanguageNoHeader(_AcceptLanguageInvalidOrNoHeader): @@ -629,6 +662,7 @@ class AcceptLanguageNoHeader(_AcceptLanguageInvalidOrNoHeader): def header_value(self) -> None: ... @property def parsed(self) -> None: ... + @overload def __add__(self, other: AcceptLanguageValidHeader) -> AcceptLanguageValidHeader: ... @overload @@ -645,6 +679,7 @@ class AcceptLanguageNoHeader(_AcceptLanguageInvalidOrNoHeader): | None ), ) -> Self | AcceptLanguageValidHeader: ... + @overload def __radd__(self, other: AcceptLanguageValidHeader) -> AcceptLanguageValidHeader: ... @overload @@ -669,6 +704,7 @@ class AcceptLanguageInvalidHeader(_AcceptLanguageInvalidOrNoHeader): def header_value(self) -> str: ... @property def parsed(self) -> None: ... + @overload def __add__(self, other: AcceptLanguageValidHeader) -> AcceptLanguageValidHeader: ... @overload @@ -687,6 +723,7 @@ class AcceptLanguageInvalidHeader(_AcceptLanguageInvalidOrNoHeader): | None ), ) -> AcceptLanguageValidHeader | AcceptLanguageNoHeader: ... + @overload def __radd__(self, other: AcceptLanguageValidHeader) -> AcceptLanguageValidHeader: ... @overload @@ -716,4 +753,5 @@ def create_accept_language_header(header_value: AcceptLanguageInvalidHeader) -> def create_accept_language_header(header_value: str) -> AcceptLanguageValidHeader | AcceptLanguageInvalidHeader: ... @overload def create_accept_language_header(header_value: _AnyAcceptLanguageHeader | str | None) -> _AnyAcceptLanguageHeader: ... + def accept_language_property() -> _AcceptLanguageProperty: ... diff --git a/stubs/WebOb/webob/byterange.pyi b/stubs/WebOb/webob/byterange.pyi index 6d1d76e19702..6ce07a14c4ae 100644 --- a/stubs/WebOb/webob/byterange.pyi +++ b/stubs/WebOb/webob/byterange.pyi @@ -7,10 +7,12 @@ __all__ = ["Range", "ContentRange"] class Range: start: int | None end: int | None + @overload def __init__(self, start: None, end: None) -> None: ... @overload def __init__(self, start: int, end: int | None) -> None: ... + def range_for_length(self, length: int | None) -> tuple[int, int] | None: ... def content_range(self, length: int | None) -> ContentRange | None: ... def __iter__(self) -> Iterator[int | None]: ... @@ -21,10 +23,12 @@ class ContentRange: start: int | None stop: int | None length: int | None + @overload def __init__(self, start: None, stop: None, length: int | None) -> None: ... @overload def __init__(self, start: int, stop: int, length: int | None) -> None: ... + def __iter__(self) -> Iterator[int | None]: ... @classmethod def parse(cls, value: str | None) -> Self | None: ... diff --git a/stubs/WebOb/webob/cachecontrol.pyi b/stubs/WebOb/webob/cachecontrol.pyi index 47e75e4e4ab8..3a75ee38795b 100644 --- a/stubs/WebOb/webob/cachecontrol.pyi +++ b/stubs/WebOb/webob/cachecontrol.pyi @@ -18,16 +18,19 @@ class exists_property(Generic[_ScopeT]): def __init__(self: exists_property[None], prop: str) -> None: ... @overload def __init__(self, prop: str, type: _ScopeT) -> None: ... + @overload def __get__(self, obj: None, type: type[CacheControl[Any]] | None = None) -> Self: ... @overload def __get__(self: exists_property[None], obj: CacheControl[Any], type: type[CacheControl[Any]] | None = None) -> bool: ... @overload def __get__(self, obj: CacheControl[_ScopeT], type: type[CacheControl[Any]] | None = None) -> bool: ... + @overload def __set__(self: exists_property[None], obj: CacheControl[Any], value: bool | None) -> None: ... @overload def __set__(self, obj: CacheControl[_ScopeT], value: bool | None) -> None: ... + @overload def __delete__(self, obj: CacheControl[Any]) -> None: ... @overload @@ -35,6 +38,7 @@ class exists_property(Generic[_ScopeT]): class value_property(Generic[_T, _DefaultT, _NoneLiteral, _ScopeT]): def __init__(self, prop: str, default: _DefaultT = None, none: _NoneLiteral = None, type: _ScopeT = None) -> None: ... # type: ignore[assignment] + @overload def __get__(self, obj: None, type: type[CacheControl[Any]] | None = None) -> Self: ... @overload @@ -47,6 +51,7 @@ class value_property(Generic[_T, _DefaultT, _NoneLiteral, _ScopeT]): def __get__( self, obj: CacheControl[_ScopeT] | None, type: type[CacheControl[Any]] | None = None ) -> _T | _DefaultT | _NoneLiteral: ... + @overload def __set__( self: value_property[_T, _DefaultT, _NoneLiteral, None], @@ -55,6 +60,7 @@ class value_property(Generic[_T, _DefaultT, _NoneLiteral, _ScopeT]): ) -> None: ... @overload def __set__(self, obj: CacheControl[_ScopeT], value: _T | _DefaultT | Literal[True] | None) -> None: ... + @overload def __delete__(self, obj: CacheControl[Any]) -> None: ... @overload @@ -66,6 +72,7 @@ class CacheControl(Generic[_ScopeT]): properties: dict[str, Any] type: _ScopeT def __init__(self, properties: dict[str, Any], type: _ScopeT) -> None: ... + @overload @classmethod def parse( @@ -79,6 +86,7 @@ class CacheControl(Generic[_ScopeT]): def parse( cls, header: str, updates_to: Callable[[dict[str, Any]], Any] | None = None, *, type: _ScopeT2 ) -> CacheControl[_ScopeT2]: ... + max_stale: value_property[int, None, Literal["*"], Literal["request"]] min_fresh: value_property[int, None, None, Literal["request"]] only_if_cached: exists_property[Literal["request"]] diff --git a/stubs/WebOb/webob/cookies.pyi b/stubs/WebOb/webob/cookies.pyi index 29db78664067..3bda178fc43f 100644 --- a/stubs/WebOb/webob/cookies.pyi +++ b/stubs/WebOb/webob/cookies.pyi @@ -34,12 +34,14 @@ class RequestCookies(MutableMapping[str, str]): def __init__(self, environ: WSGIEnvironment) -> None: ... def __setitem__(self, name: str, value: str) -> None: ... def __getitem__(self, name: str) -> str: ... + @overload def get(self, name: str, default: None = None) -> str | None: ... @overload def get(self, name: str, default: str) -> str: ... @overload def get(self, name: str, default: _T) -> str | _T: ... + def __delitem__(self, name: str) -> None: ... def keys(self) -> KeysView[str]: ... def values(self) -> ValuesView[str]: ... @@ -63,18 +65,22 @@ class Morsel(dict[bytes, bytes | bool | None]): name: bytes value: bytes def __init__(self, name: str | bytes, value: str | bytes) -> None: ... + @property def path(self) -> bytes | None: ... @path.setter def path(self, v: bytes | None) -> None: ... + @property def domain(self) -> bytes | None: ... @domain.setter def domain(self, v: bytes | None) -> None: ... + @property def comment(self) -> bytes | None: ... @comment.setter def comment(self, v: bytes | None) -> None: ... + expires: AsymmetricProperty[bytes | None, datetime | date | timedelta | _TimeTuple | struct_time | int | str | bytes | None] max_age: AsymmetricProperty[bytes | None, timedelta | int | str | bytes | None] httponly: AsymmetricProperty[bool, bool | None] diff --git a/stubs/WebOb/webob/dec.pyi b/stubs/WebOb/webob/dec.pyi index 9fcee2a2ebda..b8f58a6906e7 100644 --- a/stubs/WebOb/webob/dec.pyi +++ b/stubs/WebOb/webob/dec.pyi @@ -30,6 +30,7 @@ class wsgify(Generic[_P, _RequestT_contra]): args: tuple[Any, ...] kwargs: dict[str, Any] middleware_wraps: WSGIApplication | None + # NOTE: We disallow passing args/kwargs using this direct API, because # we can't really make it work as a decorator this way, these # arguments should only really be used indirectly through the @@ -92,10 +93,12 @@ class wsgify(Generic[_P, _RequestT_contra]): kwargs: None = None, middleware_wraps: _AppT_contra, ) -> None: ... + @overload def __get__(self, obj: None, type: type[_S]) -> _unbound_wsgify[_P, _S, _RequestT_contra]: ... @overload def __get__(self, obj: object, type: type | None = None) -> Self: ... + @overload def __call__(self, env: WSGIEnvironment, /, start_response: StartResponse) -> Iterable[bytes]: ... @overload @@ -104,6 +107,7 @@ class wsgify(Generic[_P, _RequestT_contra]): def __call__(self, req: _RequestT_contra) -> _AnyResponse: ... @overload def __call__(self, req: _RequestT_contra, *args: _P.args, **kw: _P.kwargs) -> _AnyResponse: ... + def get(self, url: str, **kw: Any) -> _AnyResponse: ... def post( self, url: str, POST: str | bytes | Mapping[Any, Any] | Mapping[Any, list[Any] | tuple[Any, ...]] | None = None, **kw: Any @@ -114,6 +118,7 @@ class wsgify(Generic[_P, _RequestT_contra]): def clone(self, func: _RequestHandler[_RequestT_contra, _P] | None = None, **kw: Never) -> Self: ... @property def undecorated(self) -> _RequestHandler[_RequestT_contra, _P] | None: ... + @overload @classmethod def middleware( @@ -166,6 +171,7 @@ class _UnboundMiddleware(Generic[_P, _AppT_contra, _RequestT_contra]): app: _AppT_contra | None, kw: dict[str, Any], ) -> None: ... + @overload def __call__(self, func: None, app: _AppT_contra | None = None) -> Self: ... @overload @@ -187,6 +193,7 @@ class _MiddlewareFactory(Generic[_P, _AppT_contra, _RequestT_contra]): middleware: _Middleware[_RequestT_contra, _AppT_contra, _P], kw: dict[str, Any], ) -> None: ... + # NOTE: Technically you are not allowed to pass args, but we give up all kinds # of other safety if we don't use ParamSpec @overload diff --git a/stubs/WebOb/webob/descriptors.pyi b/stubs/WebOb/webob/descriptors.pyi index e79e5d78d35b..0cc3bfc51cff 100644 --- a/stubs/WebOb/webob/descriptors.pyi +++ b/stubs/WebOb/webob/descriptors.pyi @@ -40,6 +40,7 @@ def environ_getter(key: str, default: None, rfc_section: str | None = None) -> S def environ_getter( key: str, default: _DefaultT, rfc_section: str | None = None ) -> AsymmetricPropertyWithDelete[Any | _DefaultT, Any | _DefaultT | None]: ... + @overload def environ_decoder(key: str, *, rfc_section: str | None = None, encattr: str | None = None) -> SymmetricProperty[str]: ... @overload @@ -50,9 +51,11 @@ def environ_decoder( def environ_decoder( key: str, default: None, rfc_section: str | None = None, encattr: str | None = None ) -> SymmetricPropertyWithDelete[str | None]: ... + def upath_property(key: str) -> SymmetricProperty[str]: ... def deprecated_property(attr: _DescriptorT, name: str, text: str, version: str) -> _DescriptorT: ... def header_getter(header: str, rfc_section: str) -> _StringProperty: ... + @overload def converter( prop: AsymmetricPropertyWithDelete[_GetterReturnType, _SetterValueType], @@ -67,6 +70,7 @@ def converter( serialize: Callable[[_ConvertedSetterValueType], _SetterValueType], convert_name: str | None = None, ) -> AsymmetricProperty[_ConvertedGetterReturnType, _ConvertedSetterValueType | None]: ... + def list_header(header: str, rfc_section: str) -> _ListProperty: ... def parse_list(value: str | None) -> tuple[str, ...] | None: ... def serialize_list(value: Iterable[str] | str) -> str: ... diff --git a/stubs/WebOb/webob/headers.pyi b/stubs/WebOb/webob/headers.pyi index 8e14bf642561..5120b86ad866 100644 --- a/stubs/WebOb/webob/headers.pyi +++ b/stubs/WebOb/webob/headers.pyi @@ -18,6 +18,7 @@ class ResponseHeaders(MultiDict[str, str]): def __contains__(self, key: object) -> bool: ... has_key = __contains__ def setdefault(self, key: str, default: str) -> str: ... # type: ignore[override] + @overload def pop(self, key: str) -> str: ... @overload diff --git a/stubs/WebOb/webob/multidict.pyi b/stubs/WebOb/webob/multidict.pyi index bc5cd2c76138..4272d2197564 100644 --- a/stubs/WebOb/webob/multidict.pyi +++ b/stubs/WebOb/webob/multidict.pyi @@ -41,6 +41,7 @@ class MultiDict(MutableMapping[_KT, _VT]): /, **kwargs: _VT, ) -> None: ... + @classmethod def view_list(cls, lst: list[tuple[_KT, _VT]]) -> Self: ... @classmethod @@ -48,12 +49,14 @@ class MultiDict(MutableMapping[_KT, _VT]): def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def add(self, key: _KT, value: _VT) -> None: ... + @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT) -> _VT: ... @overload def get(self, key: _KT, default: _T) -> _VT | _T: ... + def getall(self, key: _KT) -> list[_VT]: ... def getone(self, key: _KT) -> _VT: ... def mixed(self) -> dict[_KT, _VT | list[_VT]]: ... @@ -63,21 +66,26 @@ class MultiDict(MutableMapping[_KT, _VT]): has_key = __contains__ def clear(self) -> None: ... def copy(self) -> Self: ... + @overload def setdefault(self, key: _KT, default: None = None) -> _VT | None: ... @overload def setdefault(self, key: _KT, default: _VT) -> _VT: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + def popitem(self) -> tuple[_KT, _VT]: ... + @overload # type: ignore[override] def update(self: SupportsGetItem[str, _VT], **kwargs: _VT) -> None: ... @overload def update(self, m: Collection[tuple[_KT, _VT]], /) -> None: ... @overload def update(self: SupportsGetItem[str, _VT], m: Collection[tuple[str, _VT]], /, **kwargs: _VT) -> None: ... + @overload def extend(self, other: _SupportsItemsWithIterableResult[_KT, _VT]) -> None: ... @overload @@ -92,6 +100,7 @@ class MultiDict(MutableMapping[_KT, _VT]): def extend(self: MultiDict[str, _VT], other: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ... @overload def extend(self: MultiDict[str, _VT], other: None = None, **kwargs: _VT) -> None: ... + def __len__(self) -> int: ... def keys(self) -> Iterator[_KT]: ... # type: ignore[override] __iter__ = keys @@ -100,25 +109,31 @@ class MultiDict(MutableMapping[_KT, _VT]): class GetDict(MultiDict[str, str]): env: WSGIEnvironment + @overload def __init__(self, data: _SupportsItemsWithIterableResult[str, str], env: WSGIEnvironment) -> None: ... @overload def __init__(self, data: Iterable[tuple[str, str]], env: WSGIEnvironment) -> None: ... + def on_change(self) -> None: ... def __setitem__(self, key: str, value: str) -> None: ... def add(self, key: str, value: str) -> None: ... def __delitem__(self, key: str) -> None: ... def clear(self) -> None: ... def setdefault(self, key: str, default: str) -> str: ... # type: ignore[override] + @overload def pop(self, key: str) -> str: ... @overload def pop(self, key: str, default: _T) -> str | _T: ... + def popitem(self) -> tuple[str, str]: ... + @overload # type: ignore[override] def update(self, **kwargs: str) -> None: ... @overload def update(self, m: Collection[tuple[str, str]], /, **kwargs: str) -> None: ... + @overload def extend(self, other: _SupportsItemsWithIterableResult[str, str], **kwargs: str) -> None: ... @overload @@ -127,6 +142,7 @@ class GetDict(MultiDict[str, str]): def extend(self, other: SupportsKeysAndGetItem[str, str], **kwargs: str) -> None: ... @overload def extend(self, other: None = None, **kwargs: str) -> None: ... + def copy(self) -> MultiDict[str, str]: ... # type: ignore[override] class NestedMultiDict(MultiDict[_KT, _VT]): @@ -161,10 +177,12 @@ class NestedMultiDict(MultiDict[_KT, _VT]): class NoVars: reason: str def __init__(self, reason: str | None = None) -> None: ... + @overload def get(self, key: str, default: None = None) -> None: ... @overload def get(self, key: str, default: _T) -> _T: ... + def getall(self, key: str) -> list[str]: ... def mixed(self) -> dict[str, str | list[str]]: ... def dict_of_lists(self) -> dict[str, list[str]]: ... diff --git a/stubs/WebOb/webob/request.pyi b/stubs/WebOb/webob/request.pyi index 073390122830..a10e3c7a135e 100644 --- a/stubs/WebOb/webob/request.pyi +++ b/stubs/WebOb/webob/request.pyi @@ -50,20 +50,24 @@ class BaseRequest: request_body_tempfile_limit: ClassVar[int] environ: WSGIEnvironment def __init__(self, environ: WSGIEnvironment, **kw: Any) -> None: ... + @overload def encget(self, key: str, default: _T, encattr: str | None = None) -> str | _T: ... @overload def encget(self, key: str, *, encattr: str | None = None) -> str: ... + def encset(self, key: str, val: str, encattr: str | None = None) -> None: ... @property def charset(self) -> str | None: ... def decode(self, charset: str | None = None, errors: str = "strict") -> Self: ... + @property def body_file(self) -> SupportsRead[bytes]: ... @body_file.setter def body_file(self, value: SupportsRead[bytes]) -> None: ... @body_file.deleter def body_file(self) -> None: ... + content_length: SymmetricPropertyWithDelete[int | None] body_file_raw: SymmetricProperty[SupportsRead[bytes]] is_body_seekable: bool @@ -111,12 +115,14 @@ class BaseRequest: host: SymmetricPropertyWithDelete[str] @property def domain(self) -> str: ... + @property def body(self) -> bytes: ... @body.setter def body(self, value: bytes | None) -> None: ... @body.deleter def body(self) -> None: ... + json: SymmetricPropertyWithDelete[Any] json_body: SymmetricPropertyWithDelete[Any] text: SymmetricPropertyWithDelete[str] @@ -129,10 +135,12 @@ class BaseRequest: cookies: AsymmetricProperty[RequestCookies, SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]] def copy(self) -> Self: ... def copy_get(self) -> Self: ... + @property def is_body_readable(self) -> bool: ... @is_body_readable.setter def is_body_readable(self, flag: bool) -> None: ... + def make_body_seekable(self) -> None: ... def copy_body(self) -> None: ... def make_tempfile(self) -> io.BufferedRandom: ... @@ -169,6 +177,7 @@ class BaseRequest: def from_text(cls, s: str) -> Self: ... @classmethod def from_file(cls, fp: _SupportsReadAndNoArgReadline) -> Self: ... + @overload def call_application( self, application: WSGIApplication, catch_exc_info: Literal[False] = False @@ -183,6 +192,7 @@ class BaseRequest: ) -> ( tuple[str, list[tuple[str, str]], Iterable[bytes], OptExcInfo | None] | tuple[str, list[tuple[str, str]], Iterable[bytes]] ): ... + ResponseClass: type[Response] def send(self, application: WSGIApplication | None = None, catch_exc_info: bool = False) -> Response: ... get_response = send @@ -203,10 +213,12 @@ class LegacyRequest(BaseRequest): def uscript_name(self) -> str: ... @uscript_name.setter def uscript_name(self, value: str) -> None: ... + @property # type: ignore[override] def upath_info(self) -> str: ... @upath_info.setter def upath_info(self, value: str) -> None: ... + def encget(self, key: str, default: Any = ..., encattr: str | None = None) -> Any: ... class AdhocAttrMixin: diff --git a/stubs/WebOb/webob/response.pyi b/stubs/WebOb/webob/response.pyi index 13a308fcc9f3..3bfa3ae3d643 100644 --- a/stubs/WebOb/webob/response.pyi +++ b/stubs/WebOb/webob/response.pyi @@ -134,10 +134,12 @@ class Response: ) -> None: ... def delete_cookie(self, name: str | bytes, path: str = "/", domain: str | None = None) -> None: ... def unset_cookie(self, name: str | bytes, strict: bool = True) -> None: ... + @overload def merge_cookies(self, resp: _ResponseT) -> _ResponseT: ... @overload def merge_cookies(self, resp: WSGIApplication) -> WSGIApplication: ... + cache_control: AsymmetricProperty[_ResponseCacheControl, _ResponseCacheControl | _ResponseCacheControlDict | str | None] cache_expires: AsymmetricProperty[_ResponseCacheExpires, timedelta | int | bool | None] def encode_content(self, encoding: Literal["gzip", "identity"] = "gzip", lazy: bool = False) -> None: ... diff --git a/stubs/aiofiles/aiofiles/os.pyi b/stubs/aiofiles/aiofiles/os.pyi index 92c3f38008dc..506a0f2851bd 100644 --- a/stubs/aiofiles/aiofiles/os.pyi +++ b/stubs/aiofiles/aiofiles/os.pyi @@ -113,6 +113,7 @@ async def rmdir( path: StrOrBytesPath, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Executor | None = ... ) -> None: ... async def removedirs(name: StrOrBytesPath, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ...) -> None: ... + @overload async def scandir( path: None = None, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ... @@ -125,6 +126,7 @@ async def scandir( async def scandir( path: GenericPath[AnyStr], *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ... ) -> _ScandirIterator[AnyStr]: ... + @overload async def listdir( path: StrPath | None, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ... @@ -133,6 +135,7 @@ async def listdir( async def listdir(path: BytesPath, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ...) -> list[bytes]: ... @overload async def listdir(path: int, *, loop: AbstractEventLoop | None = ..., executor: Executor | None = ...) -> list[str]: ... + async def access( path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, effective_ids: bool = False, follow_symlinks: bool = True ) -> bool: ... @@ -164,4 +167,5 @@ if sys.platform != "win32": loop: AbstractEventLoop | None = ..., executor: Executor | None = ..., ) -> int: ... # FreeBSD and Mac OS X only + async def statvfs(path: FileDescriptorOrPath) -> statvfs_result: ... # Unix only diff --git a/stubs/aiofiles/aiofiles/tempfile/__init__.pyi b/stubs/aiofiles/aiofiles/tempfile/__init__.pyi index 6535885ff2f4..b9806ecd636e 100644 --- a/stubs/aiofiles/aiofiles/tempfile/__init__.pyi +++ b/stubs/aiofiles/aiofiles/tempfile/__init__.pyi @@ -138,7 +138,6 @@ if sys.version_info >= (3, 12): loop: AbstractEventLoop | None = None, executor: Executor | None = None, ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... - else: # Text mode: always returns AsyncTextIOWrapper @overload @@ -301,6 +300,7 @@ def SpooledTemporaryFile( loop: AbstractEventLoop | None = None, executor: Executor | None = None, ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + @overload def TemporaryDirectory( suffix: str | None = None, diff --git a/stubs/antlr4-python3-runtime/antlr4/Lexer.pyi b/stubs/antlr4-python3-runtime/antlr4/Lexer.pyi index a2690aa7004b..3f46d7abe5d0 100644 --- a/stubs/antlr4-python3-runtime/antlr4/Lexer.pyi +++ b/stubs/antlr4-python3-runtime/antlr4/Lexer.pyi @@ -60,32 +60,40 @@ class Lexer(Recognizer, TokenSource): def mode(self, m: int) -> None: ... def pushMode(self, m: int) -> None: ... def popMode(self) -> int: ... + @property def inputStream(self) -> InputStream: ... @inputStream.setter def inputStream(self, input: InputStream) -> None: ... + @property def sourceName(self) -> str: ... def emitToken(self, token: Token) -> None: ... def emit(self) -> CommonToken: ... def emitEOF(self) -> CommonToken: ... + @property def type(self) -> int: ... @type.setter def type(self, type: int) -> None: ... + @property def line(self) -> int: ... @line.setter def line(self, line: int) -> None: ... + @property def column(self) -> int: ... @column.setter def column(self, column: int) -> None: ... + def getCharIndex(self) -> int: ... + @property def text(self) -> str: ... @text.setter def text(self, txt: str) -> None: ... + def getAllTokens(self) -> list[Token]: ... def notifyListeners(self, e: LexerNoViableAltException) -> None: ... def getErrorDisplay(self, s: str) -> str: ... diff --git a/stubs/antlr4-python3-runtime/antlr4/Recognizer.pyi b/stubs/antlr4-python3-runtime/antlr4/Recognizer.pyi index a13b195f2955..fc0db8acafbc 100644 --- a/stubs/antlr4-python3-runtime/antlr4/Recognizer.pyi +++ b/stubs/antlr4-python3-runtime/antlr4/Recognizer.pyi @@ -31,6 +31,7 @@ class Recognizer: def getErrorListenerDispatch(self) -> ProxyErrorListener: ... def sempred(self, localctx: RuleContext, ruleIndex: int, actionIndex: int) -> bool: ... def precpred(self, localctx: RuleContext, precedence: int) -> bool: ... + @property def state(self) -> int: ... @state.setter diff --git a/stubs/antlr4-python3-runtime/antlr4/Token.pyi b/stubs/antlr4-python3-runtime/antlr4/Token.pyi index acbab1f198b5..dc98e1ace2ce 100644 --- a/stubs/antlr4-python3-runtime/antlr4/Token.pyi +++ b/stubs/antlr4-python3-runtime/antlr4/Token.pyi @@ -18,10 +18,12 @@ class Token: line: int column: int def __init__(self) -> None: ... + @property def text(self) -> str: ... @text.setter def text(self, text: str) -> None: ... + def getTokenSource(self) -> TokenSource | None: ... def getInputStream(self) -> InputStream | None: ... @@ -44,6 +46,7 @@ class CommonToken(Token): stop: int = -1, ) -> None: ... def clone(self) -> CommonToken: ... + @property def text(self) -> str: ... @text.setter diff --git a/stubs/assertpy/assertpy/collection.pyi b/stubs/assertpy/assertpy/collection.pyi index 9f6d22bc98bd..79cc4d5fb369 100644 --- a/stubs/assertpy/assertpy/collection.pyi +++ b/stubs/assertpy/assertpy/collection.pyi @@ -11,6 +11,7 @@ class CollectionMixin(Generic[_V]): def is_iterable(self) -> Self: ... def is_not_iterable(self) -> Self: ... def is_subset_of(self, *supersets: _V) -> Self: ... + @overload def is_sorted(self, key: Callable[[_V], SupportsRichComparison] = ..., reverse: Literal[False] = False) -> Self: ... @overload diff --git a/stubs/atheris/atheris/utils.pyi b/stubs/atheris/atheris/utils.pyi index 090c833ddb1a..481d9880b02b 100644 --- a/stubs/atheris/atheris/utils.pyi +++ b/stubs/atheris/atheris/utils.pyi @@ -1,6 +1,7 @@ from typing import Protocol, type_check_only def path() -> str: ... + @type_check_only class _Writer(Protocol): def isatty(self) -> bool: ... @@ -12,6 +13,7 @@ class ProgressRenderer: def render(self) -> None: ... def erase(self) -> None: ... def drop(self) -> None: ... + @property def count(self) -> int: ... @count.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/context.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/context.pyi index c84574342ab4..cb40f81ce44c 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/context.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/context.pyi @@ -21,6 +21,7 @@ class Context: def set_trace_entity(self, trace_entity: Entity) -> None: ... def clear_trace_entities(self) -> None: ... def handle_context_missing(self) -> None: ... + @property def context_missing(self) -> str: ... @context_missing.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/lambda_launcher.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/lambda_launcher.pyi index 50e94b257de5..42f78df47440 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/lambda_launcher.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/lambda_launcher.pyi @@ -13,6 +13,7 @@ def check_in_lambda() -> LambdaContext | None: ... class LambdaContext(Context): def __init__(self) -> None: ... + @property # type: ignore[override] def context_missing(self) -> None: ... @context_missing.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/entity.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/entity.pyi index 5ea373e689fd..8b4e17c6e4a1 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/entity.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/entity.pyi @@ -27,10 +27,12 @@ class Entity: def close(self, end_time: float | None = None) -> None: ... def add_subsegment(self, subsegment: Subsegment) -> None: ... def remove_subsegment(self, subsegment: Subsegment) -> None: ... + @overload def put_http_meta(self, key: Literal["status", "content_length"], value: int) -> None: ... @overload def put_http_meta(self, key: Literal["url", "method", "user_agent", "client_ip", "x_forwarded_for"], value: str) -> None: ... + def put_annotation(self, key: str, value: float | str | bool) -> None: ... def put_metadata( self, key: str, value: Any, namespace: str = "default" # value is any object that can be serialized into JSON string diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/plugins/ec2_plugin.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/plugins/ec2_plugin.pyi index 84c29f5631cf..b5af18b73702 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/plugins/ec2_plugin.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/plugins/ec2_plugin.pyi @@ -11,6 +11,7 @@ def initialize() -> None: ... def get_token() -> str | None: ... def get_metadata(token: str | None = None) -> dict[str, Any]: ... # result of parse_metadata_json() def parse_metadata_json(json_str: str | bytes | bytearray) -> dict[str, Any]: ... # result of json.loads() + @overload def do_request(url: str, headers: MutableMapping[str, str] | None = None, method: str = "GET") -> str: ... @overload diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi index 8b05f527a5a1..905bcb2e7837 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi @@ -73,46 +73,57 @@ class AWSXRayRecorder: namespace: str, meta_processor: Callable[..., object] | None, ) -> _T: ... + @property def enabled(self) -> bool: ... @enabled.setter def enabled(self, value: bool) -> None: ... + @property def sampling(self) -> bool: ... @sampling.setter def sampling(self, value: bool) -> None: ... + @property def sampler(self) -> LocalSampler | DefaultSampler: ... @sampler.setter def sampler(self, value: LocalSampler | DefaultSampler) -> None: ... + @property def service(self) -> str: ... @service.setter def service(self, value: str) -> None: ... + @property def dynamic_naming(self) -> DefaultDynamicNaming | None: ... @dynamic_naming.setter def dynamic_naming(self, value: DefaultDynamicNaming | str) -> None: ... + @property def context(self) -> Context: ... @context.setter def context(self, cxt: Context) -> None: ... + @property def emitter(self) -> UDPEmitter: ... @emitter.setter def emitter(self, value: UDPEmitter) -> None: ... + @property def streaming(self) -> DefaultStreaming: ... @streaming.setter def streaming(self, value: DefaultStreaming) -> None: ... + @property def streaming_threshold(self) -> int: ... @streaming_threshold.setter def streaming_threshold(self, value: int) -> None: ... + @property def max_trace_back(self) -> int: ... @max_trace_back.setter def max_trace_back(self, value: int) -> None: ... + @property def stream_sql(self) -> bool: ... @stream_sql.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/connector.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/connector.pyi index e496d524da17..4fe3bcedb95d 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/connector.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/connector.pyi @@ -9,6 +9,7 @@ class ServiceConnector: def fetch_sampling_rules(self) -> list[SamplingRule]: ... def fetch_sampling_target(self, rules) -> tuple[Incomplete, int]: ... def setup_xray_client(self, ip: str, port: str | int, client) -> None: ... + @property def context(self) -> Context: ... @context.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/rule_cache.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/rule_cache.pyi index c6e06134ace7..e28044cf0880 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/rule_cache.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/rule_cache.pyi @@ -7,10 +7,12 @@ class RuleCache: def get_matched_rule(self, sampling_req, now: float): ... def load_rules(self, rules) -> None: ... def load_targets(self, targets_dict) -> None: ... + @property def rules(self): ... @rules.setter def rules(self, v) -> None: ... + @property def last_updated(self) -> int | None: ... @last_updated.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampler.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampler.pyi index 0bc379e1cb0b..4f8ea28cd3d5 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampler.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampler.pyi @@ -10,6 +10,7 @@ class DefaultSampler: def should_trace(self, sampling_req=None): ... def load_local_rules(self, rules) -> None: ... def load_settings(self, daemon_config: DaemonConfig, context, origin=None) -> None: ... + @property def xray_client(self): ... @xray_client.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampling_rule.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampling_rule.pyi index f67af0b60997..440fba9c4aeb 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampling_rule.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/sampling/sampling_rule.pyi @@ -21,18 +21,22 @@ class SamplingRule: def increment_request_count(self) -> None: ... def increment_borrow_count(self) -> None: ... def increment_sampled_count(self) -> None: ... + @property def rate(self): ... @rate.setter def rate(self, v) -> None: ... + @property def name(self) -> str: ... @property def priority(self): ... + @property def reservoir(self) -> Reservoir: ... @reservoir.setter def reservoir(self, v: Reservoir) -> None: ... + @property def can_borrow(self) -> bool: ... @property diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/streaming/default_streaming.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/streaming/default_streaming.pyi index 012abdf63fc1..cca12298fe5d 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/streaming/default_streaming.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/streaming/default_streaming.pyi @@ -8,6 +8,7 @@ class DefaultStreaming: def __init__(self, streaming_threshold: int = 30) -> None: ... def is_eligible(self, segment: Segment) -> bool: ... def stream(self, entity: Entity, callback: Callable[..., Unused]) -> None: ... + @property def streaming_threshold(self) -> int: ... @streaming_threshold.setter diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/ext/util.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/ext/util.pyi index d61f173ceb75..466fceaa1323 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/ext/util.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/ext/util.pyi @@ -14,8 +14,10 @@ def calculate_segment_name(host_name, recorder): ... def prepare_response_header(origin_header, segment) -> str: ... def to_snake_case(name: str) -> str: ... def strip_url(url): ... + @overload def get_hostname(url: str | None) -> str: ... @overload def get_hostname(url: bytes | bytearray | None) -> str | bytes: ... + def unwrap(obj: object, attr: str) -> None: ... diff --git a/stubs/boltons/boltons/cacheutils.pyi b/stubs/boltons/boltons/cacheutils.pyi index 8bea29a8b538..978da569d563 100644 --- a/stubs/boltons/boltons/cacheutils.pyi +++ b/stubs/boltons/boltons/cacheutils.pyi @@ -23,24 +23,30 @@ class LRI(dict[_KT, _VT]): def __init__(self, max_size: int = 128, values=None, on_miss: Callable[[_KT], _VT] | None = None) -> None: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... + @overload def get(self, key: _KT, default: None = None) -> _VT | None: ... @overload def get(self, key: _KT, default: _VT) -> _VT: ... @overload def get(self, key: _KT, default: _T) -> _T | _VT: ... + def __delitem__(self, key: _KT) -> None: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _T | _VT: ... + def popitem(self) -> tuple[_KT, _VT]: ... def clear(self) -> None: ... def copy(self) -> Self: ... + @overload def setdefault(self, key: _KT, default: None = None) -> _VT | None: ... @overload def setdefault(self, key: _KT, default: _VT) -> _VT: ... + def update(self, E: SupportsKeysAndGetItem[_KT, _VT] | Iterable[tuple[_KT, _VT]], **F: _VT) -> None: ... # type: ignore[override] class LRU(LRI[_KT, _VT]): @@ -104,6 +110,7 @@ def cachedmethod( class cachedproperty(Generic[_KT, _VT]): func: Callable[[_KT], _VT] def __init__(self, func: Callable[[_KT], _VT]) -> None: ... + @overload def __get__(self, obj: None, objtype: type | None = None) -> Self: ... @overload diff --git a/stubs/boltons/boltons/dictutils.pyi b/stubs/boltons/boltons/dictutils.pyi index a50bc90bd14c..aa438b46076a 100644 --- a/stubs/boltons/boltons/dictutils.pyi +++ b/stubs/boltons/boltons/dictutils.pyi @@ -15,10 +15,12 @@ class OrderedMultiDict(dict[_KT, _VT]): def counts(self) -> Self: ... @classmethod def fromkeys(cls, keys: _KT, default: _VT | None = None) -> Self: ... # type: ignore[override] + @overload # type: ignore[override] def get(self, k: _KT, default: None = None) -> _VT | None: ... @overload def get(self, k: _KT, default: _VT) -> _VT: ... + def getlist(self, k: _KT, default: list[_VT] = ...) -> list[_VT]: ... def inverted(self) -> Self: ... def items(self, multi: bool = False) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] @@ -29,10 +31,12 @@ class OrderedMultiDict(dict[_KT, _VT]): def pop(self, k: _KT, default: _VT = ...) -> _VT: ... # type: ignore[override] def popall(self, k: _KT, default: _VT = ...) -> list[_VT]: ... def poplast(self, k: _KT = ..., default: _VT = ...) -> _VT: ... + @overload # type: ignore[override] def setdefault(self, k: _KT, default: None = None) -> _VT | None: ... @overload def setdefault(self, k: _KT, default: _VT) -> _VT: ... + def sorted(self, key: _KT | None = None, reverse: bool = False) -> Self: ... def sortedvalues(self, key: _KT | None = None, reverse: bool = False) -> Self: ... def todict(self, multi: bool = False) -> dict[_KT, _VT]: ... diff --git a/stubs/boltons/boltons/fileutils.pyi b/stubs/boltons/boltons/fileutils.pyi index 8d3bd1882118..c880b762b361 100644 --- a/stubs/boltons/boltons/fileutils.pyi +++ b/stubs/boltons/boltons/fileutils.pyi @@ -52,6 +52,7 @@ def iter_find_files( include_dirs: bool = False, max_depth: int | None = None, ) -> Generator[str]: ... + @overload def copy_tree( src: _StrPathT, dst: _StrPathT, symlinks: bool = False, ignore: Callable[[_StrPathT, list[str]], Iterable[str]] | None = None diff --git a/stubs/boltons/boltons/mathutils.pyi b/stubs/boltons/boltons/mathutils.pyi index 843e8fcd0412..42920bcf99a4 100644 --- a/stubs/boltons/boltons/mathutils.pyi +++ b/stubs/boltons/boltons/mathutils.pyi @@ -2,10 +2,12 @@ from collections.abc import Iterable from typing import overload def clamp(x: float, lower: float = ..., upper: float = ...) -> float: ... + @overload def ceil(x: float, options: None = None) -> int: ... @overload def ceil(x: float, options: Iterable[float]) -> float: ... + @overload def floor(x: float, options: None = None) -> int: ... @overload diff --git a/stubs/boltons/boltons/setutils.pyi b/stubs/boltons/boltons/setutils.pyi index a72e050a477c..d94de1967fc0 100644 --- a/stubs/boltons/boltons/setutils.pyi +++ b/stubs/boltons/boltons/setutils.pyi @@ -46,10 +46,12 @@ class IndexedSet(MutableSet[Any]): def difference_update(self, *others: Container[Any]) -> None: ... def symmetric_difference_update(self, other: Iterable[Any]) -> None: ... def iter_slice(self, start: int, stop: int, step: int | None = None) -> islice[Iterable[Any]]: ... + @overload def __getitem__(self, index: slice) -> Self: ... @overload def __getitem__(self, index: SupportsIndex) -> Any: ... + def pop(self, index: int | None = None) -> Any: ... def count(self, val: Any) -> Literal[0, 1]: ... def reverse(self) -> None: ... diff --git a/stubs/boltons/boltons/statsutils.pyi b/stubs/boltons/boltons/statsutils.pyi index 544252e03fd2..4165b8a16373 100644 --- a/stubs/boltons/boltons/statsutils.pyi +++ b/stubs/boltons/boltons/statsutils.pyi @@ -9,6 +9,7 @@ class _StatsProperty: internal_name: str __doc__: str | None def __init__(self, name: str, func: Callable[..., Any]) -> None: ... + @overload def __get__(self, obj: None, objtype: object = None) -> Self: ... @overload @@ -17,6 +18,7 @@ class _StatsProperty: class Stats: data: list[float] default: float + @overload def __init__(self, data: list[float], default: float = 0.0, *, use_copy: Literal[False], is_sorted: bool = False) -> None: ... @overload @@ -25,6 +27,7 @@ class Stats: def __init__( self, data: Iterable[float], default: float = 0.0, use_copy: Literal[True] = True, is_sorted: bool = False ) -> None: ... + def __len__(self) -> int: ... def __iter__(self) -> Iterator[float]: ... def clear_cache(self) -> None: ... diff --git a/stubs/boltons/boltons/strutils.pyi b/stubs/boltons/boltons/strutils.pyi index 92aaf63cac68..450937729c74 100644 --- a/stubs/boltons/boltons/strutils.pyi +++ b/stubs/boltons/boltons/strutils.pyi @@ -6,12 +6,14 @@ from typing import Literal, overload def camel2under(camel_string: str) -> str: ... def under2camel(under_string: str) -> str: ... + @overload def slugify(text: str, delim: str = "_", lower: bool = True, *, ascii: Literal[True]) -> bytes: ... @overload def slugify(text: str, delim: str, lower: bool, ascii: Literal[True]) -> bytes: ... @overload def slugify(text: str, delim: str = "_", lower: bool = True, ascii: Literal[False] = False) -> str: ... + def split_punct_ws(text: str) -> list[str]: ... def unit_len(sized_iterable: Sized, unit_noun: str = "item") -> str: ... def ordinalize(number: int | str, ext_only: bool = False) -> str: ... diff --git a/stubs/boltons/boltons/urlutils.pyi b/stubs/boltons/boltons/urlutils.pyi index 3947a0444bda..869001e1504a 100644 --- a/stubs/boltons/boltons/urlutils.pyi +++ b/stubs/boltons/boltons/urlutils.pyi @@ -42,10 +42,12 @@ class URL: ): ... query_params: Incomplete qp: Incomplete + @property def path(self): ... @path.setter def path(self, path_text) -> None: ... + @property def uses_netloc(self): ... @property diff --git a/stubs/braintree/braintree/bank_account_instant_verification_jwt.pyi b/stubs/braintree/braintree/bank_account_instant_verification_jwt.pyi index 4bbed78f9e93..3874739b8bff 100644 --- a/stubs/braintree/braintree/bank_account_instant_verification_jwt.pyi +++ b/stubs/braintree/braintree/bank_account_instant_verification_jwt.pyi @@ -2,6 +2,7 @@ from braintree.attribute_getter import AttributeGetter class BankAccountInstantVerificationJwt(AttributeGetter): def __init__(self, jwt) -> None: ... + @property def jwt(self): ... @jwt.setter diff --git a/stubs/braintree/braintree/graphql/types/customer_recommendations_payload.pyi b/stubs/braintree/braintree/graphql/types/customer_recommendations_payload.pyi index f3d9be7bfc57..488df1d1de61 100644 --- a/stubs/braintree/braintree/graphql/types/customer_recommendations_payload.pyi +++ b/stubs/braintree/braintree/graphql/types/customer_recommendations_payload.pyi @@ -6,6 +6,7 @@ class CustomerRecommendationsPayload: session_id: str is_in_paypal_network: bool recommendations: CustomerRecommendations + @overload def __init__( self, diff --git a/stubs/braintree/braintree/util/crypto.pyi b/stubs/braintree/braintree/util/crypto.pyi index 6a477c8bc480..6d0666648f62 100644 --- a/stubs/braintree/braintree/util/crypto.pyi +++ b/stubs/braintree/braintree/util/crypto.pyi @@ -9,6 +9,7 @@ class Crypto: def sha1_hmac_hash(secret_key: str | ReadableBuffer, content: str | ReadableBuffer | None) -> str: ... @staticmethod def sha256_hmac_hash(secret_key: str | ReadableBuffer, content: str | ReadableBuffer | None) -> str: ... + @overload @staticmethod def secure_compare(left: None, right: Iterable[str | bytes | bytearray]) -> Literal[False]: ... diff --git a/stubs/cachetools/cachetools/__init__.pyi b/stubs/cachetools/cachetools/__init__.pyi index 92a33b591d4b..add55e47a10d 100644 --- a/stubs/cachetools/cachetools/__init__.pyi +++ b/stubs/cachetools/cachetools/__init__.pyi @@ -22,10 +22,12 @@ class Cache(MutableMapping[_KT, _VT]): def __missing__(self, key: _KT) -> _VT: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... + @overload def pop(self, key: _KT) -> _VT: ... @overload def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ... + def setdefault(self, key: _KT, default: _VT | None = None) -> _VT: ... @property def maxsize(self) -> float: ... @@ -74,6 +76,7 @@ class TTLCache(_TimedCache[_KT, _VT, _TT]): timer: Callable[[], _TT], getsizeof: Callable[[_VT], float] | None = None, ) -> None: ... + @property def ttl(self) -> Any: ... def expire(self, time: _TT | None = None) -> list[tuple[_KT, _VT]]: ... @@ -95,6 +98,7 @@ class TLRUCache(_TimedCache[_KT, _VT, _TT]): timer: Callable[[], _TT], getsizeof: Callable[[_VT], float] | None = None, ) -> None: ... + @property def ttu(self) -> Callable[[_KT, _VT, _TT], _TT]: ... def expire(self, time: _TT | None = None) -> list[tuple[_KT, _VT]]: ... @@ -144,6 +148,7 @@ def cached( condition: _AbstractCondition | None = None, info: Literal[False] = ..., ) -> Callable[[Callable[..., _R]], _cached_wrapper[_R]]: ... + @type_check_only class _cachedmethod_wrapper(Generic[_R]): __wrapped__: Callable[..., _R] diff --git a/stubs/cachetools/cachetools/func.pyi b/stubs/cachetools/cachetools/func.pyi index 6e3c9fd2a0fd..974dde3da37d 100644 --- a/stubs/cachetools/cachetools/func.pyi +++ b/stubs/cachetools/cachetools/func.pyi @@ -24,14 +24,17 @@ def fifo_cache( ) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ... @overload def fifo_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ... + @overload def lfu_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ... @overload def lfu_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ... + @overload def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ... @overload def lru_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ... + @overload def rr_cache( maxsize: int | None = 128, choice: Callable[[Sequence[_T]], _T] = ..., typed: bool = False @@ -40,6 +43,7 @@ def rr_cache( def rr_cache( maxsize: Callable[..., _R], choice: Callable[[Sequence[_T]], _T] = ..., typed: bool = False ) -> _cachetools_cache_wrapper[_R]: ... + @overload def ttl_cache( maxsize: int | None = 128, ttl: Any = 600, timer: Callable[[], _T] = ..., typed: bool = False diff --git a/stubs/cffi/_cffi_backend.pyi b/stubs/cffi/_cffi_backend.pyi index ddc03da76a6d..27c2f4d6cf00 100644 --- a/stubs/cffi/_cffi_backend.pyi +++ b/stubs/cffi/_cffi_backend.pyi @@ -141,11 +141,14 @@ class FFI: _typenames: tuple[bytes, ...] = ..., _includes: tuple[FFI, ...] = ..., ) -> None: ... + @overload def addressof(self, cdata: CData, /, *field_or_index: str | int) -> CData: ... @overload def addressof(self, library: Lib, name: str, /) -> CData: ... + def alignof(self, cdecl: str | CType | CData, /) -> int: ... + @overload def callback( self, @@ -162,6 +165,7 @@ class FFI: error: Any = ..., onerror: Callable[[Exception, Any, Any], None] | None = ..., ) -> Callable[..., _T]: ... + def cast(self, cdecl: str | CType, value: CData | int) -> CData: ... def def_extern( self, name: str = ..., error: Any = ..., onerror: Callable[[Exception, Any, types.TracebackType], Any] = ... @@ -180,11 +184,14 @@ class FFI: def from_buffer(self, cdecl: str | CType, python_buffer: ReadableBuffer, require_writable: Literal[False] = ...) -> CData: ... @overload def from_buffer(self, cdecl: str | CType, python_buffer: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + def from_handle(self, x: CData, /) -> Any: ... + @overload def gc(self, cdata: CData, destructor: Callable[[CData], Any], size: int = ...) -> CData: ... @overload def gc(self, cdata: CData, destructor: None, size: int = ...) -> None: ... + def getctype(self, cdecl: str | CType, replace_with: str = ...) -> str: ... if sys.platform == "win32": def getwinerror(self, code: int = ...) -> tuple[int, str]: ... @@ -194,6 +201,7 @@ class FFI: def list_types(self) -> tuple[list[str], list[str], list[str]]: ... def memmove(self, dest: CData | WriteableBuffer, src: CData | ReadableBuffer, n: int) -> None: ... def new(self, cdecl: str | CType, init: Any = ...) -> CData: ... + @overload def new_allocator(self, alloc: None = ..., free: None = ..., should_clear_after_alloc: bool = ...) -> _Allocator: ... @overload @@ -204,6 +212,7 @@ class FFI: def new_allocator( self, alloc: Callable[[int], CData], free: Callable[[CData], Any], should_clear_after_alloc: bool = ... ) -> _Allocator: ... + def new_handle(self, x: Any, /) -> CData: ... def offsetof(self, cdecl: str | CType, field_or_index: str | int, /, *__fields_or_indexes: str | int) -> int: ... def release(self, cdata: CData, /) -> None: ... @@ -231,15 +240,19 @@ def complete_struct_or_union( pack: int, /, ) -> None: ... + @overload def from_buffer(cdecl: CType, python_buffer: ReadableBuffer, /, require_writable: Literal[False] = ...) -> _CDataBase: ... @overload def from_buffer(cdecl: CType, python_buffer: WriteableBuffer, /, require_writable: Literal[True]) -> _CDataBase: ... + def from_handle(x: _CDataBase, /) -> Any: ... + @overload def gcp(cdata: _CDataBase, destructor: Callable[[_CDataBase], Any], size: int = ...) -> _CDataBase: ... @overload def gcp(cdata: _CDataBase, destructor: None, size: int = ...) -> None: ... + def get_errno() -> int: ... def getcname(cdecl: CType, replace_with: str, /) -> str: ... diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi index ad5461c85bc7..05ea2daecbfc 100644 --- a/stubs/cffi/cffi/api.pyi +++ b/stubs/cffi/cffi/api.pyi @@ -48,6 +48,7 @@ class FFI: def cast(self, cdecl: str | CType, source: CData | float) -> CData: ... def string(self, cdata: CData, maxlen: int = -1) -> bytes | str: ... def unpack(self, cdata: CData, length: int) -> bytes | str | list[Any]: ... + @overload def from_buffer(self, cdecl: ReadableBuffer, require_writable: Literal[False] = False) -> CData: ... @overload @@ -58,7 +59,9 @@ class FFI: ) -> CData: ... @overload def from_buffer(self, cdecl: str | CType, python_buffer: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + def memmove(self, dest: CData | WriteableBuffer, src: CData | ReadableBuffer, n: int) -> None: ... + @overload def callback( self, @@ -75,11 +78,14 @@ class FFI: error: Any = None, onerror: Callable[[Exception, Any, Any], None] | None = None, ) -> Callable[..., _T]: ... + def getctype(self, cdecl: str | CType, replace_with: str = "") -> str: ... + @overload def gc(self, cdata: CData, destructor: Callable[[CData], Any], size: int = 0) -> CData: ... @overload def gc(self, cdata: CData, destructor: None, size: int = 0) -> None: ... + def verify(self, source: str = "", tmpdir: str | None = None, **kwargs: Any) -> _cffi_backend.Lib: ... # Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs if sys.platform == "win32": diff --git a/stubs/channels/channels/consumer.pyi b/stubs/channels/channels/consumer.pyi index 0a00a97fec95..9f6f4725c00a 100644 --- a/stubs/channels/channels/consumer.pyi +++ b/stubs/channels/channels/consumer.pyi @@ -39,6 +39,7 @@ class _ChannelScope(WebSocketScope, total=False): # Accepts any ASGI message dict with a required "type" key (str), # but allows additional arbitrary keys for flexibility. def get_handler_name(message: dict[str, Any]) -> str: ... + @type_check_only class _ASGIApplicationProtocol(Protocol): consumer_class: AsyncConsumer diff --git a/stubs/channels/channels/layers.pyi b/stubs/channels/channels/layers.pyi index e709d98398c7..a527e5873b7e 100644 --- a/stubs/channels/channels/layers.pyi +++ b/stubs/channels/channels/layers.pyi @@ -31,22 +31,27 @@ class BaseChannelLayer: def __init__(self, expiry: int = 60, capacity: int = 100, channel_capacity: _ChannelCapacityDict | None = None) -> None: ... def compile_capacities(self, channel_capacity: _ChannelCapacityDict) -> _CompiledChannelCapacity: ... def get_capacity(self, channel: str) -> int: ... + @overload def match_type_and_length(self, name: str) -> bool: ... @overload def match_type_and_length(self, name: object) -> bool: ... + @overload def require_valid_channel_name(self, name: str, receive: bool = False) -> bool: ... @overload def require_valid_channel_name(self, name: object, receive: bool = False) -> bool: ... + @overload def require_valid_group_name(self, name: str) -> bool: ... @overload def require_valid_group_name(self, name: object) -> bool: ... + @overload def valid_channel_names(self, names: list[str], receive: bool = False) -> bool: ... @overload def valid_channel_names(self, names: list[Any], receive: bool = False) -> bool: ... + def non_local_name(self, name: str) -> str: ... async def send(self, channel: str, message: dict[str, Any]) -> None: ... async def receive(self, channel: str) -> dict[str, Any]: ... diff --git a/stubs/channels/channels/testing/websocket.pyi b/stubs/channels/channels/testing/websocket.pyi index db743bed5d55..9b79d7dc10eb 100644 --- a/stubs/channels/channels/testing/websocket.pyi +++ b/stubs/channels/channels/testing/websocket.pyi @@ -50,5 +50,6 @@ class WebsocketCommunicator(ApplicationCommunicator): async def send_json_to(self, data: dict[str, Any]) -> None: ... @overload async def send_json_to(self, data: Any) -> None: ... + async def receive_json_from(self, timeout: float = 1) -> Any: ... async def disconnect(self, code: int = 1000, timeout: float = 1) -> None: ... diff --git a/stubs/click-default-group/click_default_group.pyi b/stubs/click-default-group/click_default_group.pyi index aa521d48b564..28a6ebedce2d 100644 --- a/stubs/click-default-group/click_default_group.pyi +++ b/stubs/click-default-group/click_default_group.pyi @@ -41,6 +41,7 @@ class DefaultGroup(click.Group): def get_command(self, ctx: click.Context, cmd_name: str) -> click.Command | None: ... def resolve_command(self, ctx: click.Context, args: list[str]) -> tuple[str | None, click.Command | None, list[str]]: ... def format_commands(self, ctx: click.Context, formatter: click.HelpFormatter) -> None: ... + @overload def command( self, diff --git a/stubs/colorful/colorful/core.pyi b/stubs/colorful/colorful/core.pyi index 2e79d5015818..f0bfdf8be585 100644 --- a/stubs/colorful/colorful/core.pyi +++ b/stubs/colorful/colorful/core.pyi @@ -64,10 +64,12 @@ class Colorful: no_struckthrough: Final[_str] colormode: _ColorModeType def __init__(self, colormode: _ColorModeType | None = None, colorpalette: _str | _PaletteType | None = None) -> None: ... + @property def colorpalette(self) -> SupportsItems[str, str | tuple[int, int, int]] | None: ... @colorpalette.setter def colorpalette(self, colorpalette: _str | _PaletteType) -> None: ... + def setup( self, colormode: _ColorModeType | None = None, diff --git a/stubs/console-menu/consolemenu/format/menu_margins.pyi b/stubs/console-menu/consolemenu/format/menu_margins.pyi index 210b8e517615..92505a4999e9 100644 --- a/stubs/console-menu/consolemenu/format/menu_margins.pyi +++ b/stubs/console-menu/consolemenu/format/menu_margins.pyi @@ -1,17 +1,21 @@ class MenuMargins: def __init__(self, top: int = 1, left: int = 2, bottom: int = 0, right: int = 2) -> None: ... + @property def left(self) -> int: ... @left.setter def left(self, left: int) -> None: ... + @property def right(self) -> int: ... @right.setter def right(self, right: int) -> None: ... + @property def top(self) -> int: ... @top.setter def top(self, top: int) -> None: ... + @property def bottom(self) -> int: ... @bottom.setter diff --git a/stubs/console-menu/consolemenu/format/menu_padding.pyi b/stubs/console-menu/consolemenu/format/menu_padding.pyi index 21a05db016b0..41791c1efed0 100644 --- a/stubs/console-menu/consolemenu/format/menu_padding.pyi +++ b/stubs/console-menu/consolemenu/format/menu_padding.pyi @@ -1,17 +1,21 @@ class MenuPadding: def __init__(self, top: int = 1, left: int = 2, bottom: int = 1, right: int = 2) -> None: ... + @property def left(self) -> int: ... @left.setter def left(self, left: int) -> None: ... + @property def right(self) -> int: ... @right.setter def right(self, right: int) -> None: ... + @property def top(self) -> int: ... @top.setter def top(self, top: int) -> None: ... + @property def bottom(self) -> int: ... @bottom.setter diff --git a/stubs/console-menu/consolemenu/format/menu_style.pyi b/stubs/console-menu/consolemenu/format/menu_style.pyi index 7ab8bd8b16e2..a0bfc1c42259 100644 --- a/stubs/console-menu/consolemenu/format/menu_style.pyi +++ b/stubs/console-menu/consolemenu/format/menu_style.pyi @@ -11,18 +11,22 @@ class MenuStyle: border_style_type: int | None = None, border_style_factory: MenuBorderStyleFactory | None = None, ) -> None: ... + @property def margins(self) -> MenuMargins: ... @margins.setter def margins(self, margins: MenuMargins) -> None: ... + @property def padding(self) -> MenuPadding: ... @padding.setter def padding(self, padding: MenuPadding) -> None: ... + @property def border_style(self) -> MenuBorderStyle: ... @border_style.setter def border_style(self, border_style: MenuBorderStyle) -> None: ... + @property def border_style_factory(self) -> MenuBorderStyleFactory: ... @border_style_factory.setter diff --git a/stubs/console-menu/consolemenu/menu_component.pyi b/stubs/console-menu/consolemenu/menu_component.pyi index acaf5ccb754e..12cc5c53aae2 100644 --- a/stubs/console-menu/consolemenu/menu_component.pyi +++ b/stubs/console-menu/consolemenu/menu_component.pyi @@ -75,10 +75,12 @@ class MenuItemsSection(MenuComponent): items: list[MenuItem] | None = None, items_align: str = "left", ) -> None: ... + @property def items(self) -> list[MenuItem]: ... @items.setter def items(self, items: list[MenuItem]) -> None: ... + @property def items_with_bottom_border(self) -> list[str]: ... @property @@ -92,8 +94,10 @@ class MenuFooter(MenuComponent): class MenuPrompt(MenuComponent): def __init__(self, menu_style: MenuStyle, max_dimension: Dimension | None = None, prompt_string: str = ">>") -> None: ... + @property def prompt(self) -> str: ... @prompt.setter def prompt(self, prompt: str) -> None: ... + def generate(self) -> Generator[str]: ... diff --git a/stubs/convertdate/convertdate/mayan.pyi b/stubs/convertdate/convertdate/mayan.pyi index 04034c4168a0..fda5faaa18c7 100644 --- a/stubs/convertdate/convertdate/mayan.pyi +++ b/stubs/convertdate/convertdate/mayan.pyi @@ -27,6 +27,7 @@ def next_haab(month: str, jd: float) -> float: ... def next_tzolkin(tzolkin: tuple[int, str], jd: float) -> float: ... def next_tzolkin_haab(tzolkin: tuple[int, str], haab: tuple[int, str], jd: float) -> float: ... def month_length(month: str) -> Literal[5, 20]: ... + @overload def haab_monthcalendar( baktun: int, katun: int, tun: int, uinal: int, kin: int, jdc: None = None @@ -35,6 +36,7 @@ def haab_monthcalendar( def haab_monthcalendar( baktun: Unused = None, katun: Unused = None, tun: Unused = None, uinal: Unused = None, kin: Unused = None, jdc: float = ... ) -> list[list[tuple[int | None, tuple[int, str] | None, tuple[int, int, int, int, int] | None]]]: ... + def haab_monthcalendar_prospective( haabmonth: str, jdc: float ) -> list[list[tuple[int | None, tuple[int, str] | None, tuple[int, int, int, int, int] | None]]]: ... diff --git a/stubs/convertdate/convertdate/utils.pyi b/stubs/convertdate/convertdate/utils.pyi index 430df4aa32b3..3e6f89a2e981 100644 --- a/stubs/convertdate/convertdate/utils.pyi +++ b/stubs/convertdate/convertdate/utils.pyi @@ -6,38 +6,48 @@ TROPICALYEAR: Final[float] def amod(a: float, b: int) -> int: ... @overload def amod(a: float, b: float) -> float: ... + def jwday(j: float) -> int: ... + @overload def weekday_before(weekday: int, jd: int) -> int: ... @overload def weekday_before(weekday: int, jd: float) -> float: ... + @overload def search_weekday(weekday: int, jd: int, direction: Literal[-1, 1], offset: int) -> int: ... @overload def search_weekday(weekday: int, jd: float, direction: Literal[-1, 1], offset: int) -> float: ... + @overload def nearest_weekday(weekday: int, jd: int) -> int: ... @overload def nearest_weekday(weekday: int, jd: float) -> float: ... + @overload def next_weekday(weekday: int, jd: int) -> int: ... @overload def next_weekday(weekday: int, jd: float) -> float: ... + @overload def next_or_current_weekday(weekday: int, jd: int) -> int: ... @overload def next_or_current_weekday(weekday: int, jd: float) -> float: ... + @overload def previous_weekday(weekday: int, jd: int) -> int: ... @overload def previous_weekday(weekday: int, jd: float) -> float: ... + @overload def previous_or_current_weekday(weekday: int, jd: int) -> int: ... @overload def previous_or_current_weekday(weekday: int, jd: float) -> float: ... + @overload def n_weeks(weekday: int, jd: int, nthweek: int) -> int: ... @overload def n_weeks(weekday: int, jd: float, nthweek: int) -> float: ... + def monthcalendarhelper(start_weekday: int, month_length: int) -> list[list[int | None]]: ... def nth_day_of_month(n: int, weekday: int, month: int, year: int) -> tuple[int, int, int]: ... diff --git a/stubs/croniter/croniter/croniter.pyi b/stubs/croniter/croniter/croniter.pyi index 6dbd05035215..b9ba661e3ca9 100644 --- a/stubs/croniter/croniter/croniter.pyi +++ b/stubs/croniter/croniter/croniter.pyi @@ -156,6 +156,7 @@ class croniter(Generic[_R_co]): second_at_beginning: bool = False, expand_from_start_time: bool = False, ) -> croniter[datetime.datetime]: ... + def __init__( self, expr_format: str, @@ -169,6 +170,7 @@ class croniter(Generic[_R_co]): second_at_beginning: bool = False, expand_from_start_time: bool = False, ) -> None: ... + @overload def get_next( self, ret_type: type[_R2_co], start_time: float | datetime.datetime | None = None, update_current: bool = True @@ -177,6 +179,7 @@ class croniter(Generic[_R_co]): def get_next( self, ret_type: None = None, start_time: float | datetime.datetime | None = None, update_current: bool = True ) -> _R_co: ... + @overload def get_prev( self, ret_type: type[_R2_co], start_time: float | datetime.datetime | None = None, update_current: bool = True @@ -185,14 +188,17 @@ class croniter(Generic[_R_co]): def get_prev( self, ret_type: None = None, start_time: float | datetime.datetime | None = None, update_current: bool = True ) -> _R_co: ... + @overload def get_current(self, ret_type: type[_R2_co]) -> _R2_co: ... @overload def get_current(self, ret_type: None = None) -> _R_co: ... + def set_current(self, start_time: float | datetime.datetime | None, force: bool = True) -> float: ... @staticmethod def datetime_to_timestamp(d: datetime.datetime) -> float: ... def timestamp_to_datetime(self, timestamp: float, tzinfo: datetime.tzinfo | None = ...) -> datetime.datetime: ... + @overload def all_next( self, ret_type: type[_R2_co], start_time: float | datetime.datetime | None = None, update_current: bool | None = None @@ -201,6 +207,7 @@ class croniter(Generic[_R_co]): def all_next( self, ret_type: None = None, start_time: float | datetime.datetime | None = None, update_current: bool | None = None ) -> Generator[_R_co]: ... + @overload def all_prev( self, ret_type: type[_R2_co], start_time: float | datetime.datetime | None = None, update_current: bool | None = None @@ -209,8 +216,10 @@ class croniter(Generic[_R_co]): def all_prev( self, ret_type: None = None, start_time: float | datetime.datetime | None = None, update_current: bool | None = None ) -> Generator[_R_co]: ... + def iter(self, *args: Unused, **kwargs: Unused) -> _AllIter[_R_co]: ... def __iter__(self) -> Self: ... + @overload def next( self, @@ -227,6 +236,7 @@ class croniter(Generic[_R_co]): is_prev: bool | None = None, update_current: bool | None = None, ) -> _R_co: ... + __next__ = next @classmethod def value_alias( @@ -316,6 +326,7 @@ def croniter_range( class HashExpander: cron: croniter def __init__(self, cronit: croniter) -> None: ... + @overload def do( self, @@ -333,6 +344,7 @@ class HashExpander: def do( self, idx: int, hash_type: str = "h", *, hash_id: bytes, range_end: int | None = None, range_begin: int | None = None ) -> int: ... + def match(self, efl: Unused, idx: Unused, expr: str, hash_id: bytes | None = None, **kw: Unused) -> Match[str] | None: ... def expand( self, diff --git a/stubs/dateparser/dateparser/date.pyi b/stubs/dateparser/dateparser/date.pyi index c80ef7b46317..0b730c9d6899 100644 --- a/stubs/dateparser/dateparser/date.pyi +++ b/stubs/dateparser/dateparser/date.pyi @@ -99,12 +99,14 @@ class DateData: locale: str | None period: _Period | None def __init__(self, *, date_obj: datetime | None = None, period: _Period | None = None, locale: str | None = None) -> None: ... + @overload def __getitem__(self, k: Literal["date_obj"]) -> datetime | None: ... @overload def __getitem__(self, k: Literal["locale"]) -> str | None: ... @overload def __getitem__(self, k: Literal["period"]) -> _Period | None: ... + @overload def __setitem__(self, k: Literal["date_obj"], v: datetime) -> None: ... @overload diff --git a/stubs/dateparser/dateparser/languages/dictionary.pyi b/stubs/dateparser/dateparser/languages/dictionary.pyi index 183ed097269f..a207c8ed5e7d 100644 --- a/stubs/dateparser/dateparser/languages/dictionary.pyi +++ b/stubs/dateparser/dateparser/languages/dictionary.pyi @@ -22,6 +22,7 @@ class Dictionary: def __getitem__(self, key: str): ... def __iter__(self) -> chain[str]: ... def are_tokens_valid(self, tokens: list[str]) -> bool: ... + @overload def split(self, string: None, keep_formatting: bool = False) -> None: ... @overload diff --git a/stubs/django-import-export/import_export/resources.pyi b/stubs/django-import-export/import_export/resources.pyi index e1fa7ca37924..1baf4cba7ac6 100644 --- a/stubs/django-import-export/import_export/resources.pyi +++ b/stubs/django-import-export/import_export/resources.pyi @@ -102,10 +102,12 @@ class Resource(Generic[_ModelT], metaclass=DeclarativeMetaclass): def before_import_row(self, row: dict[str, Any], **kwargs: Any) -> None: ... def after_import_row(self, row: dict[str, Any], row_result: RowResult, **kwargs: Any) -> None: ... def after_init_instance(self, instance: _ModelT, new: bool, row: dict[str, Any], **kwargs: Any) -> None: ... + @overload def handle_import_error(self, result: Result, error: Exception, raise_errors: Literal[True]) -> NoReturn: ... @overload def handle_import_error(self, result: Result, error: Exception, raise_errors: Literal[False] = False) -> None: ... + def import_row(self, row: dict[str, Any], instance_loader: BaseInstanceLoader, **kwargs: Any) -> RowResult: ... def import_data( self, diff --git a/stubs/django-import-export/import_export/widgets.pyi b/stubs/django-import-export/import_export/widgets.pyi index 3e0260ada9e9..1939cad05f1f 100644 --- a/stubs/django-import-export/import_export/widgets.pyi +++ b/stubs/django-import-export/import_export/widgets.pyi @@ -11,6 +11,7 @@ class Widget: coerce_to_string: bool def __init__(self, coerce_to_string: bool = True) -> None: ... def clean(self, value: Any, row: Mapping[str, Any] | None = None, **kwargs: Any) -> Any: ... + @overload @deprecated("The 'obj' parameter is deprecated and will be removed in a future release.") def render(self, value: Any, obj: Model, **kwargs: Any) -> Any: ... diff --git a/stubs/docker/docker/api/container.pyi b/stubs/docker/docker/api/container.pyi index 07f153efad59..5fb0a48c87bb 100644 --- a/stubs/docker/docker/api/container.pyi +++ b/stubs/docker/docker/api/container.pyi @@ -66,6 +66,7 @@ class ContainerApiMixin: logs: bool = False, demux: Literal[True], ) -> CancellableStream[tuple[bytes | None, bytes | None]]: ... + def attach_socket(self, container: _Container, params=None, ws: bool = False): ... def commit( self, @@ -132,6 +133,7 @@ class ContainerApiMixin: ) -> tuple[Incomplete, Incomplete]: ... def inspect_container(self, container: _Container): ... def kill(self, container: _Container, signal: str | int | None = None) -> None: ... + @overload def logs( self, @@ -172,6 +174,7 @@ class ContainerApiMixin: follow: bool | None = None, until: datetime.datetime | float | None = None, ) -> bytes: ... + def pause(self, container: _Container) -> None: ... def port(self, container: _Container, private_port: int): ... def put_archive(self, container: _Container, path: str, data) -> bool: ... diff --git a/stubs/docker/docker/api/daemon.pyi b/stubs/docker/docker/api/daemon.pyi index 84d38f7add67..d1fccfe7b3c4 100644 --- a/stubs/docker/docker/api/daemon.pyi +++ b/stubs/docker/docker/api/daemon.pyi @@ -5,6 +5,7 @@ from docker.types.daemon import CancellableStream class DaemonApiMixin: def df(self) -> dict[str, Any]: ... + @overload def events( self, @@ -21,6 +22,7 @@ class DaemonApiMixin: filters: dict[str, Any] | None = None, decode: Literal[True] = ..., ) -> CancellableStream[dict[str, Any]]: ... + def info(self) -> dict[str, Any]: ... def login( self, diff --git a/stubs/docker/docker/api/exec_api.pyi b/stubs/docker/docker/api/exec_api.pyi index a4dcd13a716c..4b5c1ca02cd0 100644 --- a/stubs/docker/docker/api/exec_api.pyi +++ b/stubs/docker/docker/api/exec_api.pyi @@ -23,6 +23,7 @@ class ExecApiMixin: ) -> dict[str, Incomplete]: ... def exec_inspect(self, exec_id: str) -> dict[str, Incomplete]: ... def exec_resize(self, exec_id: str, height: int | None = None, width: int | None = None) -> None: ... + @overload def exec_start( self, diff --git a/stubs/docker/docker/client.pyi b/stubs/docker/docker/client.pyi index 05c7235c485a..298755035b6a 100644 --- a/stubs/docker/docker/client.pyi +++ b/stubs/docker/docker/client.pyi @@ -52,10 +52,12 @@ class DockerClient: def swarm(self) -> Swarm: ... @property def volumes(self) -> VolumeCollection: ... + @overload def events(self, *args, decode: Literal[False] | None = None, **kwargs) -> CancellableStream[str]: ... @overload def events(self, *args, decode: Literal[True] = ..., **kwargs) -> CancellableStream[dict[str, Any]]: ... + def df(self) -> dict[str, Any]: ... def info(self, *args, **kwargs) -> dict[str, Any]: ... def login(self, *args, **kwargs) -> dict[str, Any]: ... diff --git a/stubs/docker/docker/models/containers.pyi b/stubs/docker/docker/models/containers.pyi index c0568baeef40..200bbb3baff6 100644 --- a/stubs/docker/docker/models/containers.pyi +++ b/stubs/docker/docker/models/containers.pyi @@ -38,6 +38,7 @@ class Container(Model): def health(self) -> str: ... @property def ports(self) -> dict[str, list[dict[str, str]] | None]: ... + @overload def attach( self, @@ -72,6 +73,7 @@ class Container(Model): def attach( self, *, stdout: bool = True, stderr: bool = True, stream: Literal[True], logs: bool = False, demux: Literal[True] ) -> CancellableStream[tuple[bytes | None, bytes | None]]: ... + def attach_socket(self, **kwargs) -> SocketIO | _BufferedReaderStream | SSHSocket: ... def commit(self, repository: str | None = None, tag: str | None = None, **kwargs) -> Image: ... def diff(self) -> list[dict[str, int | str]]: ... @@ -96,6 +98,7 @@ class Container(Model): self, path: str, chunk_size: int | None = 2097152, encode_stream: bool = False ) -> tuple[Iterator[bytes], dict[str, Any] | None]: ... def kill(self, signal: str | int | None = None) -> None: ... + @overload def logs( self, @@ -122,6 +125,7 @@ class Container(Model): follow: bool | None = None, until: datetime.datetime | float | None = None, ) -> bytes: ... + def pause(self) -> None: ... def put_archive(self, path: str, data) -> bool: ... def remove(self, *, v: bool = False, link: bool = False, force: bool = False) -> None: ... @@ -154,6 +158,7 @@ class Container(Model): class ContainerCollection(Collection[Container]): model: type[Container] + @overload def run( self, @@ -344,6 +349,7 @@ class ContainerCollection(Collection[Container]): volumes_from: list[str] | None = None, working_dir: str | None = None, ) -> Container: ... + def create( # type: ignore[override] self, image: str | Image, diff --git a/stubs/docker/docker/models/images.pyi b/stubs/docker/docker/models/images.pyi index d69e96cf4c0b..8bdd6808583a 100644 --- a/stubs/docker/docker/models/images.pyi +++ b/stubs/docker/docker/models/images.pyi @@ -74,6 +74,7 @@ class ImageCollection(Collection[Image]): def get_registry_data(self, name, auth_config: dict[str, Any] | None = None) -> RegistryData: ... def list(self, name: str | None = None, all: bool = False, filters: dict[str, Any] | None = None) -> _ImageList: ... def load(self, data: bytes | SupportsRead[bytes]) -> _ImageList: ... + @overload def pull( self, @@ -104,6 +105,7 @@ class ImageCollection(Collection[Image]): auth_config: dict[str, Any] | None = None, platform: str | None = None, ) -> _ImageList: ... + def push(self, repository: str, tag: str | None = None, **kwargs): ... def remove(self, *args, **kwargs) -> None: ... def search(self, *args, **kwargs): ... diff --git a/stubs/docker/docker/types/containers.pyi b/stubs/docker/docker/types/containers.pyi index 6e58a0f3515f..b6ce4f4f1c64 100644 --- a/stubs/docker/docker/types/containers.pyi +++ b/stubs/docker/docker/types/containers.pyi @@ -22,10 +22,12 @@ class LogConfig(DictType[Any]): def __init__( self, *, type: str = ..., Type: str = ..., config: dict[str, str] = ..., Config: dict[str, str] = ... ) -> None: ... + @property def type(self) -> str: ... @type.setter def type(self, value: str) -> None: ... + @property def config(self) -> dict[str, str]: ... def set_config_value(self, key: str, value: str) -> None: ... @@ -35,14 +37,17 @@ class Ulimit(DictType[Any]): def __init__( self, *, name: str = ..., Name: str = ..., soft: int = ..., Soft: int = ..., hard: int = ..., Hard: int = ... ) -> None: ... + @property def name(self) -> str: ... @name.setter def name(self, value: str) -> None: ... + @property def soft(self) -> int | None: ... @soft.setter def soft(self, value: int | None) -> None: ... + @property def hard(self) -> int | None: ... @hard.setter @@ -63,22 +68,27 @@ class DeviceRequest(DictType[Any]): options: dict[str, str] = ..., Options: dict[str, str] = ..., ) -> None: ... + @property def driver(self) -> str: ... @driver.setter def driver(self, value: str) -> None: ... + @property def count(self) -> int: ... @count.setter def count(self, value: int) -> None: ... + @property def device_ids(self) -> list[str]: ... @device_ids.setter def device_ids(self, value: list[str]) -> None: ... + @property def capabilities(self) -> list[list[str]]: ... @capabilities.setter def capabilities(self, value: list[list[str]]) -> None: ... + @property def options(self) -> dict[str, str]: ... @options.setter diff --git a/stubs/docker/docker/types/healthcheck.pyi b/stubs/docker/docker/types/healthcheck.pyi index c09ca36ffdcd..25d3a25439ed 100644 --- a/stubs/docker/docker/types/healthcheck.pyi +++ b/stubs/docker/docker/types/healthcheck.pyi @@ -17,22 +17,27 @@ class Healthcheck(DictType[Any]): start_period: int | None = ..., StartPeriod: int | None = ..., ) -> None: ... + @property def test(self) -> list[str] | None: ... @test.setter def test(self, value: str | list[str] | None) -> None: ... + @property def interval(self) -> int | None: ... @interval.setter def interval(self, value: int | None) -> None: ... + @property def timeout(self) -> int | None: ... @timeout.setter def timeout(self, value: int | None) -> None: ... + @property def retries(self) -> int | None: ... @retries.setter def retries(self, value: int | None) -> None: ... + @property def start_period(self) -> int | None: ... @start_period.setter diff --git a/stubs/docker/docker/utils/socket.pyi b/stubs/docker/docker/utils/socket.pyi index 3914c3f6268d..67e4caab2beb 100644 --- a/stubs/docker/docker/utils/socket.pyi +++ b/stubs/docker/docker/utils/socket.pyi @@ -17,12 +17,14 @@ def next_frame_header(socket) -> tuple[Incomplete, int]: ... def frames_iter(socket, tty): ... def frames_iter_no_tty(socket) -> Generator[tuple[str | Incomplete, str | bytes | Incomplete]]: ... def frames_iter_tty(socket) -> Generator[Incomplete]: ... + @overload def consume_socket_output( frames: Iterable[tuple[Incomplete, Incomplete]], demux: Literal[True] ) -> tuple[Incomplete, Incomplete]: ... @overload def consume_socket_output(frames: Iterable[ReadableBuffer], demux: Literal[False] = False) -> bytes: ... + @overload def demux_adaptor(stream_id: Literal[1], data: _T) -> tuple[_T, None]: ... @overload diff --git a/stubs/docker/docker/utils/utils.pyi b/stubs/docker/docker/utils/utils.pyi index 71f2c08baac6..406a48aa8ba5 100644 --- a/stubs/docker/docker/utils/utils.pyi +++ b/stubs/docker/docker/utils/utils.pyi @@ -35,19 +35,24 @@ def version_gte(v1: str, v2: str) -> bool: ... def convert_port_bindings( port_bindings: Mapping[str, int | list[int] | tuple[str, int] | None], ) -> dict[str, list[dict[str, str]]]: ... + @overload def convert_volume_binds(binds: list[_T]) -> list[_T]: ... @overload def convert_volume_binds(binds: Mapping[str | bytes, bytes | str | dict[str, bytes | str]]) -> list[str]: ... + @overload def convert_tmpfs_mounts(tmpfs: dict[_K, _V]) -> dict[_K, _V]: ... @overload def convert_tmpfs_mounts(tmpfs: list[str]) -> dict[str, str]: ... + @overload def convert_service_networks(networks: None) -> None: ... @overload def convert_service_networks(networks: list[str] | list[dict[str, str]] | list[str | dict[str, str]]) -> list[dict[str, str]]: ... + def parse_repository_tag(repo_name: str) -> tuple[str, str | None]: ... + @overload def parse_host(addr: None, is_win32: Literal[True], tls: bool = False) -> Literal["npipe:////./pipe/docker_engine"]: ... @overload @@ -56,6 +61,7 @@ def parse_host( ) -> Literal["http+unix:///var/run/docker.sock"]: ... @overload def parse_host(addr: str | None, is_win32: bool = False, tls: bool = False) -> str | bytes: ... + def parse_devices(devices: Iterable[str | dict[str, str]]) -> list[dict[str, str]]: ... def kwargs_from_env(environment: Mapping[str, str] | None = None) -> _EnvKWArgs: ... def convert_filters(filters) -> str: ... diff --git a/stubs/docutils/docutils/examples.pyi b/stubs/docutils/docutils/examples.pyi index 89912cd84d1f..3973316b9666 100644 --- a/stubs/docutils/docutils/examples.pyi +++ b/stubs/docutils/docutils/examples.pyi @@ -15,6 +15,7 @@ def html_parts( doctitle: bool = True, initial_header_level: _HTMLHeaderLevel = 1, ) -> _WriterParts: ... + @overload def html_body( input_string: str | bytes, @@ -35,6 +36,7 @@ def html_body( doctitle: bool = True, initial_header_level: _HTMLHeaderLevel = 1, ) -> str | bytes: ... + def internals( source: str, source_path: StrPath | None = None, diff --git a/stubs/docutils/docutils/frontend.pyi b/stubs/docutils/docutils/frontend.pyi index 45e7cd44c740..1a457f810419 100644 --- a/stubs/docutils/docutils/frontend.pyi +++ b/stubs/docutils/docutils/frontend.pyi @@ -130,6 +130,7 @@ def make_paths_absolute( @deprecated("The `frontend.make_one_path_absolute` will be removed in Docutils 2.0 or later.") def make_one_path_absolute(base_path: StrPath, path: StrPath) -> str: ... def filter_settings_spec(settings_spec, *exclude, **replace) -> tuple[Any, ...]: ... + @deprecated("The `frontend.Values` class will be removed in Docutils 2.0 or later.") class Values(optparse.Values): record_dependencies: DependencyList @@ -185,11 +186,13 @@ class ConfigParser(RawConfigParser): old_settings: ClassVar[dict[str, tuple[str, str]]] old_warning: ClassVar[str] not_utf8_error: ClassVar[str] + @overload # type: ignore[override] def read(self, filenames: str | Sequence[str]) -> list[str]: ... @overload @deprecated("The `option_parser` parameter is deprecated and will be removed in Docutils 0.24.") def read(self, filenames: str | Sequence[str], option_parser: OptionParser | None) -> list[str]: ... + def handle_old_config(self, filename: str) -> None: ... def validate_settings(self, filename: str, option_parser: OptionParser) -> None: ... def optionxform(self, optionstr: str) -> str: ... diff --git a/stubs/docutils/docutils/nodes.pyi b/stubs/docutils/docutils/nodes.pyi index ef1b43b34b6d..f01429cb3e19 100644 --- a/stubs/docutils/docutils/nodes.pyi +++ b/stubs/docutils/docutils/nodes.pyi @@ -35,10 +35,12 @@ class Node: parent: Element | Any source: str | None line: int | None + @property def document(self) -> document | None: ... @document.setter def document(self, value: document) -> None: ... + def __bool__(self) -> Literal[True]: ... def asdom( self, dom: _DomModule | None = None @@ -58,6 +60,7 @@ class Node: def setup_child(self, child: Node) -> None: ... def walk(self, visitor: NodeVisitor) -> bool: ... def walkabout(self, visitor: NodeVisitor) -> bool: ... + @overload def findall( self, condition: type[_N], include_self: bool = True, descend: bool = True, siblings: bool = False, ascend: bool = False @@ -71,6 +74,7 @@ class Node: siblings: bool = False, ascend: bool = False, ) -> Generator[Node]: ... + @overload @deprecated("The `nodes.Node.traverse()` is deprecated. Use `Node.findall()` instead.") def traverse( @@ -86,6 +90,7 @@ class Node: siblings: bool = False, ascend: bool = False, ) -> list[Node]: ... + @overload def next_node( self, condition: type[_N], include_self: bool = False, descend: bool = True, siblings: bool = False, ascend: bool = False @@ -99,6 +104,7 @@ class Node: siblings: bool = False, ascend: bool = False, ) -> Node | None: ... + def validate(self, recursive: bool = True) -> None: ... def validate_position(self) -> None: ... @@ -143,18 +149,21 @@ class Element(Node): def emptytag(self) -> str: ... def __len__(self) -> int: ... def __contains__(self, key: str | Node) -> bool: ... + @overload def __getitem__(self, key: str) -> Any: ... @overload def __getitem__(self, key: int) -> Node: ... @overload def __getitem__(self, key: slice) -> list[Node]: ... + @overload def __setitem__(self, key: str, item: Any) -> None: ... @overload def __setitem__(self, key: int, item: Node) -> None: ... @overload def __setitem__(self, key: slice, item: Iterable[Node]) -> None: ... + def __delitem__(self, key: str | int | slice) -> None: ... def __add__(self, other: list[Node]) -> list[Node]: ... def __radd__(self, other: list[Node]) -> list[Node]: ... @@ -162,16 +171,20 @@ class Element(Node): def astext(self) -> str: ... def non_default_attributes(self) -> dict[str, Any]: ... def attlist(self) -> list[tuple[str, Any]]: ... + @overload def get(self, key: str) -> Any: ... @overload def get(self, key: str, failobj: _T) -> _T: ... + def hasattr(self, attr: str) -> bool: ... def delattr(self, attr: str) -> None: ... + @overload def setdefault(self, key: str) -> Any: ... @overload def setdefault(self, key: str, failobj: _T) -> Any | _T: ... + has_key = hasattr def get_language_code(self, fallback: str = "") -> str: ... def append(self, item: Node) -> None: ... diff --git a/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi b/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi index c085b367af92..3f12ce9e59f7 100644 --- a/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi +++ b/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi @@ -12,6 +12,7 @@ sphinx: ModuleType @deprecated("The `recommonmark` package is unmaintained and deprecated; will be removed in Docutils 1.0.") def is_literal(node: nodes.Node) -> bool: ... + @deprecated("The `recommonmark` package is unmaintained and deprecated; will be removed in Docutils 1.0.") class _CommonMarkParser: default_config: ClassVar[dict[str, None]] diff --git a/stubs/docutils/docutils/statemachine.pyi b/stubs/docutils/docutils/statemachine.pyi index 80b9439530a3..96b5f38a7461 100644 --- a/stubs/docutils/docutils/statemachine.pyi +++ b/stubs/docutils/docutils/statemachine.pyi @@ -135,14 +135,17 @@ class ViewList(Generic[_T]): def __ge__(self, other: Any) -> bool: ... def __contains__(self, item: _T) -> bool: ... def __len__(self) -> int: ... + @overload def __getitem__(self, i: slice) -> Self: ... @overload def __getitem__(self, i: SupportsIndex) -> _T: ... + @overload def __setitem__(self, i: slice, item: Self) -> None: ... @overload def __setitem__(self, i: SupportsIndex, item: _T) -> None: ... + def __delitem__(self, i: SupportsIndex) -> None: ... def __add__(self, other: Self) -> Self: ... def __radd__(self, other: Self) -> Self: ... diff --git a/stubs/docutils/docutils/transforms/references.pyi b/stubs/docutils/docutils/transforms/references.pyi index a5a0068180f6..3d6d710310ce 100644 --- a/stubs/docutils/docutils/transforms/references.pyi +++ b/stubs/docutils/docutils/transforms/references.pyi @@ -42,6 +42,7 @@ class Footnotes(Transform): def number_footnote_references(self, startnum: int) -> None: ... def symbolize_footnotes(self) -> None: ... def resolve_footnotes_and_citations(self) -> None: ... + @overload def resolve_references(self, note: nodes.footnote, reflist: Iterable[nodes.footnote_reference]) -> None: ... @overload diff --git a/stubs/docutils/docutils/utils/math/mathml_elements.pyi b/stubs/docutils/docutils/utils/math/mathml_elements.pyi index a3aef8ac2cda..d55220a93166 100644 --- a/stubs/docutils/docutils/utils/math/mathml_elements.pyi +++ b/stubs/docutils/docutils/utils/math/mathml_elements.pyi @@ -14,10 +14,12 @@ class MathElement(ET.Element): @staticmethod def a_str(v: object) -> str: ... def set(self, key: str, value: object) -> None: ... # value is passed to self.a_str method + @overload # type: ignore[override] def __setitem__(self, key: SupportsIndex, value: MathElement) -> None: ... @overload # type: ignore[override] def __setitem__(self, key: slice, value: Iterable[MathElement]) -> None: ... + def is_full(self) -> bool: ... def close(self) -> MathElement | None: ... def append(self, element: MathElement) -> Self: ... # type: ignore[override] diff --git a/stubs/docutils/docutils/writers/latex2e/__init__.pyi b/stubs/docutils/docutils/writers/latex2e/__init__.pyi index ed51fd8a58a1..8879d2068d18 100644 --- a/stubs/docutils/docutils/writers/latex2e/__init__.pyi +++ b/stubs/docutils/docutils/writers/latex2e/__init__.pyi @@ -285,11 +285,13 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_description(self, node: nodes.description) -> None: ... def visit_docinfo(self, node: nodes.docinfo) -> None: ... def depart_docinfo(self, node: nodes.docinfo) -> None: ... + @overload def visit_docinfo_item(self, node) -> None: ... @overload @deprecated("The `name` parameter is deprecated and will be removed in Docutils 0.24.") def visit_docinfo_item(self, node, name: str | None) -> None: ... + def depart_docinfo_item(self, node) -> None: ... def visit_doctest_block(self, node: nodes.doctest_block) -> None: ... def depart_doctest_block(self, node: nodes.doctest_block) -> None: ... diff --git a/stubs/ephem/ephem/__init__.pyi b/stubs/ephem/ephem/__init__.pyi index f92fd81c32d5..a62d0f68dd4c 100644 --- a/stubs/ephem/ephem/__init__.pyi +++ b/stubs/ephem/ephem/__init__.pyi @@ -261,6 +261,7 @@ class LonLatCoordinate(Coordinate): def set(self, lon: float | str, lat: float | str) -> None: ... def get(self) -> tuple[Angle, Angle]: ... + @property def long(self) -> Angle: ... @long.setter @@ -284,4 +285,5 @@ LongLatCoordinate = LonLatCoordinate def star(name: str, observer: Observer, /) -> FixedBody: ... @overload def star(name: str, when: _libastro._DateInitType, epoch: _libastro._DateInitType) -> FixedBody: ... + def city(name: str) -> Observer: ... diff --git a/stubs/ephem/ephem/_libastro.pyi b/stubs/ephem/ephem/_libastro.pyi index ad940192fd08..0360fdcf4265 100644 --- a/stubs/ephem/ephem/_libastro.pyi +++ b/stubs/ephem/ephem/_libastro.pyi @@ -22,6 +22,7 @@ class _DateDescriptor: def __get__(self, obj: None, objtype: type | None = None) -> Self: ... @overload def __get__(self, obj: object, objtype: type | None = None) -> Date: ... + def __set__(self, obj: object, value: _DateInitType) -> None: ... @type_check_only @@ -30,6 +31,7 @@ class _AngleDescriptorRadiansHours: def __get__(self, obj: None, objtype: type | None = None) -> Self: ... @overload def __get__(self, obj: object, objtype: type | None = None) -> Angle: ... + def __set__(self, obj: object, value: float | str) -> None: ... @type_check_only @@ -38,6 +40,7 @@ class _AngleDescriptorRadiansDegrees: def __get__(self, obj: None, objtype: type | None = None) -> Self: ... @overload def __get__(self, obj: object, objtype: type | None = None) -> Angle: ... + def __set__(self, obj: object, value: float | str) -> None: ... @type_check_only @@ -46,6 +49,7 @@ class _AngleDescriptorDegreesRadians: def __get__(self, obj: None, objtype: type | None = None) -> Self: ... @overload def __get__(self, obj: object, objtype: type | None = None) -> Angle: ... + @overload @deprecated("Do not pass Angle objects! The radian value will be incorrectly interpreted as degrees.") def __set__(self, obj: object, value: Angle) -> None: ... @@ -72,6 +76,7 @@ class Date(float): def __new__(cls) -> Date: ... @overload def __new__(cls, date: _DateInitType, /) -> Date: ... + def triple(self) -> tuple[int, int, float]: ... def tuple(self) -> tuple[int, int, int, int, int, float]: ... def datetime(self) -> _datetime: ... @@ -144,10 +149,12 @@ class Body: def neverup(self) -> bool: ... def __init__(self, *args: Unused, **kwargs: Unused) -> None: ... def __copy__(self) -> Self: ... + @overload def compute(self, observer: Observer, /) -> None: ... @overload def compute(self, when: _DateInitType = ..., epoch: _DateInitType = ...) -> None: ... + def copy(self) -> Self: ... def writedb(self) -> str: ... def parallactic_angle(self) -> Angle: ... @@ -165,6 +172,7 @@ class Planet(Body): def phase(self) -> float: ... @property def hlong(self) -> Angle: ... + @overload def __init__(self, observer: Observer, /) -> None: ... @overload @@ -229,17 +237,21 @@ class PlanetMoon: def earth_visible(self) -> float: ... @property def sun_visible(self) -> float: ... + @overload def __init__(self, observer: Observer, /) -> None: ... @overload def __init__(self, when: _DateInitType, /, epoch: _DateInitType = ...) -> None: ... @overload def __init__(self, **kwargs: Unused) -> None: ... + def __copy__(self) -> Self: ... + @overload def compute(self, observer: Observer, /) -> None: ... @overload def compute(self, when: _DateInitType = ..., epoch: _DateInitType = ...) -> None: ... + def copy(self) -> Self: ... def writedb(self) -> str: ... def parallactic_angle(self) -> Angle: ... @@ -362,10 +374,12 @@ def unrefract(pressure: float, temperature: float, apparent_alt: float, /) -> An def uranometria(ra: float | str, dec: float | str, /) -> int: ... def uranometria2000(ra: float | str, dec: float | str, /) -> int: ... def millennium_atlas(ra: float | str, dec: float | str, /) -> int: ... + @overload def constellation(position: Body) -> tuple[str, str]: ... @overload def constellation(position: tuple[Angle | float, Angle | float], epoch: Date | float = ...) -> tuple[str, str]: ... + def julian_date(date: _DateInitType | Observer = ..., /) -> float: ... def delta_t(date: _DateInitType | Observer = ..., /) -> float: ... def moon_phases(date: _DateInitType | Observer = ...) -> _MoonPhases: ... diff --git a/stubs/et_xmlfile/et_xmlfile/incremental_tree.pyi b/stubs/et_xmlfile/et_xmlfile/incremental_tree.pyi index 3d7690a66d24..217728dbee3b 100644 --- a/stubs/et_xmlfile/et_xmlfile/incremental_tree.pyi +++ b/stubs/et_xmlfile/et_xmlfile/incremental_tree.pyi @@ -42,6 +42,7 @@ def write_elem_start( new_nsmap: dict[str, str] | None = None, **kwargs: Unused, ) -> tuple[str | None, dict[str, str], str | None, dict[str, str] | None, bool]: ... + @overload def tostring( element: ET.Element[Any], @@ -84,6 +85,7 @@ def tostring( minimal_ns_only: bool = False, tree_cls: type[ET.ElementTree] = ..., ) -> Any: ... + @overload def tostringlist( element: ET.Element[Any], @@ -126,6 +128,7 @@ def tostringlist( minimal_ns_only: bool = False, tree_cls: type[ET.ElementTree] = ..., ) -> list[Any]: ... + @overload def compat_tostring( element: ET.Element[Any], diff --git a/stubs/flake8-bugbear/bugbear.pyi b/stubs/flake8-bugbear/bugbear.pyi index 2e92ede7682b..d3aa8e844186 100644 --- a/stubs/flake8-bugbear/bugbear.pyi +++ b/stubs/flake8-bugbear/bugbear.pyi @@ -164,12 +164,14 @@ class BugBearVisitor(ast.NodeVisitor): self, node: ast.FunctionDef | ast.AsyncFunctionDef ) -> tuple[ast.FunctionDef | ast.AsyncFunctionDef, ast.stmt]: ... def check_for_b901(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: ... + @overload @classmethod def find_decorator_name(cls, d: ast.Name | ast.Attribute | ast.Call) -> str: ... @overload @classmethod def find_decorator_name(cls, d: ast.AST) -> str | None: ... + def check_for_b902(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: ... def check_for_b903(self, node: ast.ClassDef) -> None: ... def check_for_b018(self, node: ast.Expr) -> None: ... diff --git a/stubs/fpdf2/fpdf/drawing.pyi b/stubs/fpdf2/fpdf/drawing.pyi index 2bcb2a1456c5..20ba4daaf838 100644 --- a/stubs/fpdf2/fpdf/drawing.pyi +++ b/stubs/fpdf2/fpdf/drawing.pyi @@ -53,6 +53,7 @@ class GraphicsStateDictRegistry(OrderedDict[Raw, Name]): def number_to_str(number: Number) -> str: ... def render_pdf_primitive(primitive: _Primitive) -> Raw: ... + @type_check_only class _DeviceRGBBase(NamedTuple): r: Number @@ -100,6 +101,7 @@ class DeviceCMYK(_DeviceCMYKBase): def rgb8(r: Number, g: Number, b: Number, a: Number | None = None) -> DeviceRGB: ... def gray8(g: Number, a: Number | None = None) -> DeviceGray: ... + @overload def convert_to_device_color(r: DeviceCMYK) -> DeviceCMYK: ... @overload @@ -112,6 +114,7 @@ def convert_to_device_color(r: str) -> DeviceRGB: ... def convert_to_device_color(r: int, g: Literal[-1] = -1, b: Literal[-1] = -1) -> DeviceGray: ... @overload def convert_to_device_color(r: Sequence[int] | int, g: int, b: int) -> DeviceGray | DeviceRGB: ... + def cmyk8(c, m, y, k, a=None) -> DeviceCMYK: ... def color_from_hex_string(hexstr: str) -> DeviceRGB: ... def color_from_rgb_string(rgbstr: str) -> DeviceRGB: ... @@ -171,66 +174,82 @@ class GraphicsStyle: def merge(cls, parent, child) -> Self: ... def __init__(self) -> None: ... def __deepcopy__(self, memo) -> Self: ... + @property def allow_transparency(self): ... @allow_transparency.setter def allow_transparency(self, new): ... + @property def paint_rule(self) -> PathPaintRule | EllipsisType: ... @paint_rule.setter def paint_rule(self, new: PathPaintRule | str | EllipsisType | None) -> None: ... + @property def auto_close(self) -> bool | EllipsisType: ... @auto_close.setter def auto_close(self, new: bool | EllipsisType) -> None: ... + @property def intersection_rule(self): ... @intersection_rule.setter def intersection_rule(self, new) -> None: ... + @property def fill_color(self): ... @fill_color.setter def fill_color(self, color) -> None: ... + @property def fill_opacity(self): ... @fill_opacity.setter def fill_opacity(self, new) -> None: ... + @property def stroke_color(self): ... @stroke_color.setter def stroke_color(self, color: str | DeviceRGB | DeviceGray | DeviceCMYK | EllipsisType | None) -> None: ... + @property def stroke_opacity(self): ... @stroke_opacity.setter def stroke_opacity(self, new) -> None: ... + @property def blend_mode(self): ... @blend_mode.setter def blend_mode(self, value) -> None: ... + @property def stroke_width(self): ... @stroke_width.setter def stroke_width(self, width: Number | EllipsisType | None) -> None: ... + @property def stroke_cap_style(self): ... @stroke_cap_style.setter def stroke_cap_style(self, value) -> None: ... + @property def stroke_join_style(self): ... @stroke_join_style.setter def stroke_join_style(self, value) -> None: ... + @property def stroke_miter_limit(self): ... @stroke_miter_limit.setter def stroke_miter_limit(self, value: Number | EllipsisType) -> None: ... + @property def stroke_dash_pattern(self): ... @stroke_dash_pattern.setter def stroke_dash_pattern(self, value: Number | Iterable[Number] | EllipsisType | None) -> None: ... + @property def stroke_dash_phase(self): ... @stroke_dash_phase.setter def stroke_dash_phase(self, value: Number | EllipsisType): ... + def serialize(self) -> Raw | None: ... def resolve_paint_rule(self) -> PathPaintRule: ... @@ -397,22 +416,27 @@ class PaintedPath: def __deepcopy__(self, memo) -> Self: ... @property def style(self) -> GraphicsStyle: ... + @property def transform(self): ... @transform.setter def transform(self, tf) -> None: ... + @property def auto_close(self): ... @auto_close.setter def auto_close(self, should) -> None: ... + @property def paint_rule(self): ... @paint_rule.setter def paint_rule(self, style) -> None: ... + @property def clipping_path(self): ... @clipping_path.setter def clipping_path(self, new_clipath) -> None: ... + @contextmanager def transform_group(self, transform) -> Generator[Self]: ... def add_path_element(self, item, _copy: bool = True) -> None: ... @@ -453,14 +477,17 @@ class GraphicsContext: path_items: list[Incomplete] def __init__(self) -> None: ... def __deepcopy__(self, memo) -> Self: ... + @property def transform(self) -> Transform | None: ... @transform.setter def transform(self, tf) -> None: ... + @property def clipping_path(self) -> ClippingPath | None: ... @clipping_path.setter def clipping_path(self, new_clipath) -> None: ... + def add_item(self, item, _copy: bool = True) -> None: ... def remove_last_item(self) -> None: ... def merge(self, other_context) -> None: ... diff --git a/stubs/fpdf2/fpdf/encryption.pyi b/stubs/fpdf2/fpdf/encryption.pyi index 542c931e0de1..6a02f052d0ec 100644 --- a/stubs/fpdf2/fpdf/encryption.pyi +++ b/stubs/fpdf2/fpdf/encryption.pyi @@ -82,10 +82,12 @@ class StandardSecurityHandler: ) -> None: ... def generate_passwords(self, file_id: str) -> None: ... def get_encryption_obj(self) -> EncryptionDictionary: ... + @overload def encrypt(self, text: bytes | bytearray, obj_id: int) -> bytes: ... @overload def encrypt(self, text: str, obj_id: int) -> str: ... + def encrypt_string(self, string: str, obj_id: int) -> str: ... def encrypt_stream(self, stream: bytes | bytearray, obj_id: int) -> bytes: ... def is_aes_algorithm(self) -> bool: ... diff --git a/stubs/fpdf2/fpdf/fpdf.pyi b/stubs/fpdf2/fpdf/fpdf.pyi index 9d4f0d8b1f1f..0ba3b314e0ee 100644 --- a/stubs/fpdf2/fpdf/fpdf.pyi +++ b/stubs/fpdf2/fpdf/fpdf.pyi @@ -207,10 +207,12 @@ class FPDF(GraphicsStateMixin): def emphasis(self) -> TextEmphasis: ... @property def is_ttf_font(self) -> bool: ... + @property def page_mode(self) -> PageMode: ... @page_mode.setter def page_mode(self, page_mode: PageMode) -> None: ... + @property def output_intents(self): ... def add_output_intent( @@ -706,6 +708,7 @@ class FPDF(GraphicsStateMixin): num_heading_rows: int = 1, repeat_headings: TableHeadingsDisplay | int = 1, ) -> _GeneratorContextManager[Table]: ... + @overload def output( # type: ignore[overload-overlap] self, diff --git a/stubs/fpdf2/fpdf/graphics_state.pyi b/stubs/fpdf2/fpdf/graphics_state.pyi index 8fe7e5e1b723..39972466774e 100644 --- a/stubs/fpdf2/fpdf/graphics_state.pyi +++ b/stubs/fpdf2/fpdf/graphics_state.pyi @@ -19,110 +19,137 @@ class GraphicsStateMixin: DEFAULT_FILL_COLOR: ClassVar[DeviceGray] DEFAULT_TEXT_COLOR: ClassVar[DeviceGray] def __init__(self, *args, **kwargs) -> None: ... + @property def draw_color(self) -> DeviceGray | DeviceRGB: ... @draw_color.setter def draw_color(self, v: DeviceGray | DeviceRGB) -> None: ... + @property def fill_color(self) -> DeviceGray | DeviceRGB: ... @fill_color.setter def fill_color(self, v: DeviceGray | DeviceRGB) -> None: ... + @property def text_color(self) -> DeviceGray | DeviceRGB: ... @text_color.setter def text_color(self, v: DeviceGray | DeviceRGB) -> None: ... + @property def underline(self) -> bool: ... @underline.setter def underline(self, v: bool) -> None: ... + @property def strikethrough(self) -> bool: ... @strikethrough.setter def strikethrough(self, v: bool) -> None: ... + @property def font_style(self) -> str: ... @font_style.setter def font_style(self, v: str) -> None: ... + @property def font_stretching(self) -> float: ... @font_stretching.setter def font_stretching(self, v: float) -> None: ... + @property def char_spacing(self) -> float: ... @char_spacing.setter def char_spacing(self, v: float) -> None: ... + @property def font_family(self) -> str: ... @font_family.setter def font_family(self, v: str) -> None: ... + @property def font_size_pt(self) -> float: ... @font_size_pt.setter def font_size_pt(self, v: float) -> None: ... + @property def font_size(self) -> float: ... @font_size.setter def font_size(self, v: float) -> None: ... + @property def current_font(self) -> dict[str, Any]: ... @current_font.setter def current_font(self, v: dict[str, Any]) -> None: ... + @property def current_font_is_set_on_page(self) -> bool: ... @current_font_is_set_on_page.setter def current_font_is_set_on_page(self, v: bool) -> None: ... + @property def dash_pattern(self) -> dict[str, float]: ... @dash_pattern.setter def dash_pattern(self, v: dict[str, float]) -> None: ... + @property def line_width(self) -> float: ... @line_width.setter def line_width(self, v: float) -> None: ... + @property def text_mode(self) -> TextMode: ... @text_mode.setter def text_mode(self, v: int | str) -> None: ... + @property def char_vpos(self): ... @char_vpos.setter def char_vpos(self, v) -> None: ... + @property def sub_scale(self): ... @sub_scale.setter def sub_scale(self, v) -> None: ... + @property def sup_scale(self): ... @sup_scale.setter def sup_scale(self, v) -> None: ... + @property def nom_scale(self): ... @nom_scale.setter def nom_scale(self, v) -> None: ... + @property def denom_scale(self): ... @denom_scale.setter def denom_scale(self, v) -> None: ... + @property def sub_lift(self): ... @sub_lift.setter def sub_lift(self, v) -> None: ... + @property def sup_lift(self): ... @sup_lift.setter def sup_lift(self, v) -> None: ... + @property def nom_lift(self): ... @nom_lift.setter def nom_lift(self, v) -> None: ... + @property def denom_lift(self): ... @denom_lift.setter def denom_lift(self, v) -> None: ... + @property def text_shaping(self) -> _TextShaping | None: ... @text_shaping.setter def text_shaping(self, v: _TextShaping | None) -> None: ... + def font_face(self) -> FontFace: ... __pdoc__: Final[dict[str, bool]] diff --git a/stubs/fpdf2/fpdf/line_break.pyi b/stubs/fpdf2/fpdf/line_break.pyi index 6d48b958b9c5..3ba2ee5a57f9 100644 --- a/stubs/fpdf2/fpdf/line_break.pyi +++ b/stubs/fpdf2/fpdf/line_break.pyi @@ -22,10 +22,12 @@ class Fragment: def __init__( self, characters: list[str] | str, graphics_state: dict[str, Incomplete], k: float, link: str | int | None = None ) -> None: ... + @property def font(self): ... @font.setter def font(self, v) -> None: ... + @property def is_ttf_font(self): ... @property diff --git a/stubs/fpdf2/fpdf/prefs.pyi b/stubs/fpdf2/fpdf/prefs.pyi index d7b1b55f442f..9d9882f837b2 100644 --- a/stubs/fpdf2/fpdf/prefs.pyi +++ b/stubs/fpdf2/fpdf/prefs.pyi @@ -27,48 +27,60 @@ class ViewerPreferences: print_clip: PageBoundaries | None = None, print_scaling=None, ) -> None: ... + @property def non_full_screen_page_mode(self) -> PageMode | None: ... @non_full_screen_page_mode.setter def non_full_screen_page_mode(self, page_mode: PageMode | str | None) -> None: ... + @property def num_copies(self) -> int | None: ... @num_copies.setter def num_copies(self, num_copies: int | None) -> None: ... + @property def print_page_range(self) -> list[int] | None: ... @print_page_range.setter def print_page_range(self, print_page_range: list[int] | None) -> None: ... + @property def direction(self) -> TextDirection | None: ... @direction.setter def direction(self, direction: TextDirection | str | None) -> None: ... + @property def display_doc_title(self) -> bool: ... @display_doc_title.setter def display_doc_title(self, display_doc_title: bool) -> None: ... + @property def duplex(self) -> Duplex | None: ... @duplex.setter def duplex(self, duplex: Duplex | str | None) -> None: ... + @property def view_area(self) -> PageBoundaries | None: ... @view_area.setter def view_area(self, view_area: PageBoundaries | str | None) -> None: ... + @property def view_clip(self) -> PageBoundaries | None: ... @view_clip.setter def view_clip(self, view_area: PageBoundaries | str | None) -> None: ... + @property def print_area(self) -> PageBoundaries | None: ... @print_area.setter def print_area(self, view_area: PageBoundaries | str | None) -> None: ... + @property def print_clip(self) -> PageBoundaries | None: ... @print_clip.setter def print_clip(self, view_area: PageBoundaries | str | None) -> None: ... + @property def print_scaling(self) -> Literal["None", "AppDefault"] | None: ... @print_scaling.setter def print_scaling(self, print_scaling: Literal["None", "AppDefault"] | None) -> None: ... + def serialize(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/svg.pyi b/stubs/fpdf2/fpdf/svg.pyi index 2a2eb78fb606..9a06c8eb04d9 100644 --- a/stubs/fpdf2/fpdf/svg.pyi +++ b/stubs/fpdf2/fpdf/svg.pyi @@ -56,28 +56,33 @@ class ShapeBuilder: @overload @staticmethod def new_path(tag, clipping_path: Literal[False] = False) -> PaintedPath: ... + @overload @classmethod def rect(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... @overload @classmethod def rect(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... + @overload @classmethod def circle(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... @overload @classmethod def circle(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... + @overload @classmethod def ellipse(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... @overload @classmethod def ellipse(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... + @classmethod def line(cls, tag) -> PaintedPath: ... @classmethod def polyline(cls, tag) -> PaintedPath: ... + @overload @classmethod def polygon(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... diff --git a/stubs/fpdf2/fpdf/syntax.pyi b/stubs/fpdf2/fpdf/syntax.pyi index 215db48473d1..ca052a215fbb 100644 --- a/stubs/fpdf2/fpdf/syntax.pyi +++ b/stubs/fpdf2/fpdf/syntax.pyi @@ -34,6 +34,7 @@ class PDFObject: def id(self) -> int: ... @id.setter def id(self, n: int) -> None: ... + @property def ref(self) -> str: ... def serialize(self, obj_dict=None, _security_handler: StandardSecurityHandler | None = None) -> str: ... diff --git a/stubs/fpdf2/fpdf/table.pyi b/stubs/fpdf2/fpdf/table.pyi index 46276c07ddcf..e07d318d5101 100644 --- a/stubs/fpdf2/fpdf/table.pyi +++ b/stubs/fpdf2/fpdf/table.pyi @@ -72,6 +72,7 @@ class Row: @property def max_rowspan(self) -> int: ... def convert_spans(self, active_rowspans: SupportsItems[int, int]) -> tuple[dict[int, int], list[int]]: ... + @overload def cell( self, diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi index a1b62b9f97a1..a8a5d6d79468 100644 --- a/stubs/gdb/gdb/__init__.pyi +++ b/stubs/gdb/gdb/__init__.pyi @@ -37,6 +37,7 @@ def execute(command: str, *, to_string: Literal[True]) -> str: ... def execute(command: str, from_tty: bool, to_string: Literal[True]) -> str: ... @overload def execute(command: str, from_tty: bool = False, to_string: bool = False) -> str | None: ... + def breakpoints() -> Sequence[Breakpoint]: ... def rbreak(regex: str, minsyms: bool = ..., throttle: int = ..., symtabs: Iterator[Symtab] = ...) -> list[Breakpoint]: ... def parameter(parameter: str, /) -> bool | int | str | None: ... @@ -148,6 +149,7 @@ class Value: # Types def lookup_type(name: str, block: Block = ...) -> Type: ... + @final class Type(Mapping[str, Field]): alignof: int @@ -323,10 +325,12 @@ class Inferior: was_attached: bool progspace: Progspace main_name: str | None + @property def arguments(self) -> str | None: ... @arguments.setter def arguments(self, args: str | Sequence[str]) -> None: ... + def is_valid(self) -> bool: ... def threads(self) -> tuple[InferiorThread, ...]: ... def architecture(self) -> Architecture: ... @@ -345,6 +349,7 @@ class Inferior: class Thread(threading.Thread): ... def selected_thread() -> InferiorThread: ... + @final class InferiorThread: name: str | None @@ -482,6 +487,7 @@ class Function: def current_progspace() -> Progspace | None: ... def progspaces() -> Sequence[Progspace]: ... + @final class Progspace: executable_filename: str | None @@ -505,6 +511,7 @@ class Progspace: def current_objfile() -> Objfile | None: ... def objfiles() -> list[Objfile]: ... def lookup_objfile(name: str, by_build_id: bool = ...) -> Objfile | None: ... + @final class Objfile: filename: str | None @@ -570,6 +577,7 @@ class Frame: # Blocks def block_for_pc(pc: int) -> Block | None: ... + @final class Block: start: int @@ -596,6 +604,7 @@ def lookup_symbol(name: str, block: Block | None = ..., domain: int = ...) -> tu def lookup_global_symbol(name: str, domain: int = ...) -> Symbol | None: ... def lookup_static_symbol(name: str, domain: int = ...) -> Symbol | None: ... def lookup_static_symbols(name: str, domain: int = ...) -> list[Symbol]: ... + @final class Symbol: type: Type | None diff --git a/stubs/gdb/gdb/dap/server.pyi b/stubs/gdb/gdb/dap/server.pyi index 2d74c3cbfef7..8d9f49c16193 100644 --- a/stubs/gdb/gdb/dap/server.pyi +++ b/stubs/gdb/gdb/dap/server.pyi @@ -48,6 +48,7 @@ class Server: def shutdown(self) -> None: ... def send_event(event: str, body: _EventBody | None = None) -> None: ... + @type_check_only class _Wrapper: def __call__(self, func: _F) -> _F: ... diff --git a/stubs/gdb/gdb/types.pyi b/stubs/gdb/gdb/types.pyi index e74472a5d10a..ec34ea3e606e 100644 --- a/stubs/gdb/gdb/types.pyi +++ b/stubs/gdb/gdb/types.pyi @@ -10,6 +10,7 @@ def deep_items(type_: gdb.Type) -> Iterator[tuple[str, gdb.Field]]: ... def get_type_recognizers() -> list[_TypeRecognizer]: ... def apply_type_recognizers(recognizers: list[_TypeRecognizer], type_obj: gdb.Type) -> str | None: ... def register_type_printer(locus: gdb.Objfile | gdb.Progspace | None, printer: _TypePrinter) -> None: ... + @type_check_only class _TypePrinter(Protocol): enabled: bool diff --git a/stubs/gdb/gdb/xmethod.pyi b/stubs/gdb/gdb/xmethod.pyi index 9c0a2f34d0d7..31ff16523322 100644 --- a/stubs/gdb/gdb/xmethod.pyi +++ b/stubs/gdb/gdb/xmethod.pyi @@ -7,6 +7,7 @@ import gdb def register_xmethod_matcher( locus: gdb.Objfile | gdb.Progspace | None, matcher: XMethodMatcher, replace: bool = False ) -> None: ... + @type_check_only class _XMethod(Protocol): name: str diff --git a/stubs/geopandas/geopandas/array.pyi b/stubs/geopandas/geopandas/array.pyi index 330174693752..51cf935bd881 100644 --- a/stubs/geopandas/geopandas/array.pyi +++ b/stubs/geopandas/geopandas/array.pyi @@ -41,10 +41,12 @@ def to_shapely(geoms: GeometryArray) -> _Array1D[np.object_]: ... def from_wkb( data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise" ) -> GeometryArray: ... + @overload def to_wkb(geoms: GeometryArray, hex: Literal[False] = False, **kwargs) -> _Array1D[np.bytes_]: ... @overload def to_wkb(geoms: GeometryArray, hex: Literal[True], **kwargs) -> _Array1D[np.str_]: ... + def from_wkt( data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise" ) -> GeometryArray: ... @@ -59,19 +61,23 @@ class GeometryArray(ExtensionArray): def sindex(self) -> SpatialIndex: ... @property def has_sindex(self) -> bool: ... + @property def crs(self) -> CRS | None: ... @crs.setter def crs(self, value: _ConvertibleToCRS | None) -> None: ... + def check_geographic_crs(self, stacklevel: int) -> None: ... @property def dtype(self) -> GeometryDtype: ... def __len__(self) -> int: ... + # np.integer[Any] because precision is not important @overload def __getitem__(self, idx: ScalarIndexer) -> BaseGeometry: ... # Always 1-D, doesn't accept tuple @overload def __getitem__(self, idx: SequenceIndexer) -> GeometryArray: ... + def __setitem__( self, key, value: _ArrayOrGeom | pd.DataFrame | pd.Series[Any] # Cannot use pd.Series[BaseGeometry] ) -> None: ... @@ -225,12 +231,14 @@ class GeometryArray(ExtensionArray): limit: int | None = None, copy: bool = True, ) -> GeometryArray: ... + @overload # type: ignore[override] def astype(self, dtype: GeometryDtype, copy: bool = True) -> GeometryArray: ... @overload def astype(self, dtype: ExtensionDtype | Literal["string"], copy: bool = True) -> ExtensionArray: ... # type: ignore[overload-overlap] @overload def astype(self, dtype: DTypeLike, copy: bool = True) -> _Array1D[Incomplete]: ... + def isna(self) -> _Array1D[np.bool_]: ... def value_counts(self, dropna: bool = True) -> pd.Series[int]: ... def unique(self) -> GeometryArray: ... diff --git a/stubs/geopandas/geopandas/base.pyi b/stubs/geopandas/geopandas/base.pyi index 474ca5e9e3d8..1cb2dc1c8420 100644 --- a/stubs/geopandas/geopandas/base.pyi +++ b/stubs/geopandas/geopandas/base.pyi @@ -51,10 +51,12 @@ def is_geometry_type(data: object) -> bool: ... class GeoPandasBase: @property def area(self) -> pd.Series[float]: ... + @property def crs(self) -> CRS | None: ... @crs.setter def crs(self, value: _ConvertibleToCRS | None) -> None: ... + @property def geom_type(self) -> pd.Series[str]: ... @property @@ -212,6 +214,7 @@ class GeoPandasBase: def hilbert_distance( self, total_bounds: tuple[float, float, float, float] | Iterable[float] | None = None, level: int = 16 ) -> pd.Series[int]: ... + @overload def sample_points( self, @@ -232,7 +235,9 @@ class GeoPandasBase: rng: int | ArrayLike | SeedSequence | BitGenerator | RandomGenerator | None = None, **kwargs, ) -> GeoSeries: ... + def build_area(self, node: bool = True) -> GeoSeries: ... + @overload def polygonize(self, node: bool = True, full: Literal[False] = False) -> GeoSeries: ... @overload diff --git a/stubs/geopandas/geopandas/geodataframe.pyi b/stubs/geopandas/geopandas/geodataframe.pyi index 6f49bce844d4..9e672c5aee32 100644 --- a/stubs/geopandas/geopandas/geodataframe.pyi +++ b/stubs/geopandas/geopandas/geodataframe.pyi @@ -57,6 +57,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] geometry: _GeomCol | None = None, crs: _ConvertibleToCRS | None = None, ) -> Self: ... + def __init__( self, data: _ConvertibleToDataFrame | None = None, @@ -69,10 +70,12 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] crs: _ConvertibleToCRS | None = None, ) -> None: ... def __setattr__(self, attr: str, val: Any) -> None: ... # type: ignore[misc] # Can set arbitrary objects + @property def geometry(self) -> GeoSeries: ... @geometry.setter def geometry(self, col: _GeomSeq) -> None: ... + @overload def set_geometry( self, col: _GeomCol, drop: bool | None = None, inplace: Literal[False] = False, crs: _ConvertibleToCRS | None = None @@ -85,16 +88,20 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] def set_geometry( self, col: _GeomCol, drop: bool | None, inplace: Literal[True], crs: _ConvertibleToCRS | None = None ) -> None: ... + @overload def rename_geometry(self, col: Hashable, inplace: Literal[False] = False) -> Self: ... @overload def rename_geometry(self, col: Hashable, inplace: Literal[True]) -> None: ... + @property def active_geometry_name(self) -> str | None: ... + @property def crs(self) -> CRS | None: ... @crs.setter def crs(self, value: _ConvertibleToCRS | None) -> None: ... + @classmethod def from_dict( # type: ignore[override] # Mapping[Any, Any] because of invariance keys and arbitrary values @@ -130,6 +137,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] crs: _ConvertibleToCRS | None = None, columns: Axes | None = None, ) -> Self: ... + @overload @classmethod def from_postgis( @@ -159,6 +167,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] params: SupportsLenAndGetItem[Scalar] | Mapping[str, Scalar] | None = None, chunksize: None = None, ) -> GeoDataFrame: ... + @classmethod def from_arrow( cls, table, geometry: str | None = None, to_pandas_kwargs: Mapping[str, Incomplete] | None = None @@ -256,6 +265,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] overwrite: bool | None = ..., **kwargs, # engine and driver dependent ) -> None: ... + @overload def set_crs( self, crs: _ConvertibleToCRS, epsg: int | None = None, inplace: bool = False, allow_override: bool = False @@ -266,6 +276,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] ) -> Self: ... @overload def set_crs(self, crs: _ConvertibleToCRS | None, epsg: int, inplace: bool = False, allow_override: bool = False) -> Self: ... + @overload def to_crs(self, crs: _ConvertibleToCRS, epsg: int | None = None, inplace: Literal[False] = False) -> Self: ... @overload @@ -280,6 +291,7 @@ class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] def to_crs(self, crs: _ConvertibleToCRS | None = None, *, epsg: int, inplace: Literal[True]) -> None: ... @overload def to_crs(self, crs: _ConvertibleToCRS | None, epsg: int, inplace: Literal[True]) -> None: ... + def estimate_utm_crs(self, datum_name: str = "WGS 84") -> CRS: ... # def __getitem__(self, key): ... def __delitem__(self, key) -> None: ... # type: ignore[misc] diff --git a/stubs/geopandas/geopandas/geoseries.pyi b/stubs/geopandas/geopandas/geoseries.pyi index 37fcc08aa6ae..8e1a23f17560 100644 --- a/stubs/geopandas/geopandas/geoseries.pyi +++ b/stubs/geopandas/geopandas/geoseries.pyi @@ -162,6 +162,7 @@ class GeoSeries(GeoPandasBase, pd.Series[BaseGeometry]): # type: ignore[type-va @doc(_explore_geoseries) # pyright: ignore[reportUnknownArgumentType] def explore(self, *args, **kwargs): ... # signature of `_explore_geoseries` copied in `@doc` def explode(self, ignore_index: bool = False, index_parts: bool = False) -> GeoSeries: ... + @overload def set_crs( self, crs: _ConvertibleToCRS, epsg: int | None = None, inplace: bool = False, allow_override: bool = False @@ -172,12 +173,14 @@ class GeoSeries(GeoPandasBase, pd.Series[BaseGeometry]): # type: ignore[type-va ) -> Self: ... @overload def set_crs(self, crs: _ConvertibleToCRS | None, epsg: int, inplace: bool = False, allow_override: bool = False) -> Self: ... + @overload def to_crs(self, crs: _ConvertibleToCRS, epsg: int | None = None) -> GeoSeries: ... @overload def to_crs(self, crs: _ConvertibleToCRS | None = None, *, epsg: int) -> GeoSeries: ... @overload def to_crs(self, crs: _ConvertibleToCRS | None, epsg: int) -> GeoSeries: ... + def estimate_utm_crs(self, datum_name: str = "WGS 84") -> CRS: ... def to_json( # type: ignore[override] self, @@ -197,12 +200,14 @@ class GeoSeries(GeoPandasBase, pd.Series[BaseGeometry]): # type: ignore[type-va sort_keys: bool = False, **kwds, ) -> str: ... + @overload def to_wkb(self, hex: Literal[False] = False, **kwargs) -> pd.Series[bytes]: ... @overload def to_wkb(self, hex: Literal[True], **kwargs) -> pd.Series[str]: ... @overload def to_wkb(self, hex: bool = False, **kwargs) -> pd.Series[str] | pd.Series[bytes]: ... + def to_wkt(self, **kwargs) -> pd.Series[str]: ... def to_arrow( self, diff --git a/stubs/geopandas/geopandas/io/file.pyi b/stubs/geopandas/geopandas/io/file.pyi index 75efae95093a..ec2b63b9e198 100644 --- a/stubs/geopandas/geopandas/io/file.pyi +++ b/stubs/geopandas/geopandas/io/file.pyi @@ -38,6 +38,7 @@ def _read_file( encoding: str | None = None, **kwargs, # depend on engine ) -> pd.DataFrame: ... + @type_check_only class _Schema(TypedDict): geometry: str | list[str] diff --git a/stubs/geopandas/geopandas/plotting.pyi b/stubs/geopandas/geopandas/plotting.pyi index 7c511859e3e4..b24d213f7639 100644 --- a/stubs/geopandas/geopandas/plotting.pyi +++ b/stubs/geopandas/geopandas/plotting.pyi @@ -226,6 +226,7 @@ class GeoplotAccessor(PlotAccessor): label: str = "NaN", **style_kwds, ) -> Axes: ... + def geo( self, column: Hashable | pd.Series | pd.Index | NDArray | None = None, diff --git a/stubs/geopandas/geopandas/sindex.pyi b/stubs/geopandas/geopandas/sindex.pyi index 211c04069a9c..1ef9bcb01ad9 100644 --- a/stubs/geopandas/geopandas/sindex.pyi +++ b/stubs/geopandas/geopandas/sindex.pyi @@ -14,6 +14,7 @@ class SpatialIndex: def __init__(self, geometry: NDArray[np.object_]) -> None: ... @property def valid_query_predicates(self) -> set[str | None]: ... + @overload def query( self, @@ -43,6 +44,7 @@ class SpatialIndex: *, output_format: Literal["sparse"], ) -> Any: ... # returns scipy coo_array but we don't depend on scipy + @overload def nearest( self, @@ -71,6 +73,7 @@ class SpatialIndex: return_distance: bool = False, exclusive: bool = False, ) -> _Array2D[np.int64] | tuple[_Array2D[np.int64], _Array1D[np.float64]]: ... + def intersection(self, coordinates: Iterable[float]) -> _Array1D[np.int64]: ... @property def size(self) -> int: ... diff --git a/stubs/gevent/gevent/_config.pyi b/stubs/gevent/gevent/_config.pyi index af42269bffbe..bf5cd4f17c60 100644 --- a/stubs/gevent/gevent/_config.pyi +++ b/stubs/gevent/gevent/_config.pyi @@ -15,6 +15,7 @@ class _SettingDescriptor(Protocol[_T]): def __get__(self, obj: None, owner: type[Config]) -> property: ... @overload def __get__(self, obj: Config, owner: type[Config]) -> _T: ... + def __set__(self, obj: Config, value: str | _T) -> None: ... class SettingType(type): diff --git a/stubs/gevent/gevent/_ffi/watcher.pyi b/stubs/gevent/gevent/_ffi/watcher.pyi index fcf69cd12d9c..9c5c3b181cf9 100644 --- a/stubs/gevent/gevent/_ffi/watcher.pyi +++ b/stubs/gevent/gevent/_ffi/watcher.pyi @@ -24,10 +24,12 @@ class watcher(metaclass=AbstractWatcherType): args: tuple[Any, ...] def start(self, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ... def stop(self) -> None: ... + @property def priority(self) -> int | None: ... @priority.setter def priority(self, value: int | None) -> None: ... + @property def active(self) -> bool: ... @property @@ -36,6 +38,7 @@ class watcher(metaclass=AbstractWatcherType): class IoMixin: EVENT_MASK: int def __init__(self, loop: _Loop, fd: FileDescriptor, events: int, ref: bool = True, priority: int | None = None) -> None: ... + @overload def start(self, callback: Callable[[int, Unpack[_Ts]], Any], *args: Unpack[_Ts], pass_events: Literal[True]) -> None: ... @overload @@ -45,10 +48,12 @@ class TimerMixin: def __init__( self, loop: _Loop, after: float = 0.0, repeat: float = 0.0, ref: bool = True, priority: int | None = None ) -> None: ... + @overload def start(self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], update: bool) -> None: ... @overload def start(self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ... + @overload def again(self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], update: bool) -> None: ... @overload diff --git a/stubs/gevent/gevent/_fileobjectcommon.pyi b/stubs/gevent/gevent/_fileobjectcommon.pyi index d631fd0740f7..3aba7454d1ca 100644 --- a/stubs/gevent/gevent/_fileobjectcommon.pyi +++ b/stubs/gevent/gevent/_fileobjectcommon.pyi @@ -223,6 +223,7 @@ class FileObjectBlock(FileObjectBase[_IOT, AnyStr]): class FileObjectThread(FileObjectBase[_IOT, AnyStr]): threadpool: ThreadPool lock: Semaphore | DummySemaphore + # Text mode: always binds a TextIOWrapper @overload def __init__( diff --git a/stubs/gevent/gevent/_greenlet_primitives.pyi b/stubs/gevent/gevent/_greenlet_primitives.pyi index c1e1b36c2798..39c9dda40a22 100644 --- a/stubs/gevent/gevent/_greenlet_primitives.pyi +++ b/stubs/gevent/gevent/_greenlet_primitives.pyi @@ -14,6 +14,7 @@ class SwitchOutGreenletWithLoop(TrackedRawGreenlet): def loop(self) -> _Loop: ... @loop.setter def loop(self, value: _Loop) -> None: ... + def switch(self) -> Any: ... def switch_out(self) -> NoReturn: ... diff --git a/stubs/gevent/gevent/_hub_primitives.pyi b/stubs/gevent/gevent/_hub_primitives.pyi index 0d9c12228af3..9771e2adf81d 100644 --- a/stubs/gevent/gevent/_hub_primitives.pyi +++ b/stubs/gevent/gevent/_hub_primitives.pyi @@ -47,12 +47,14 @@ def iwait_on_objects(objects: None, timeout: float | None = None, count: int | N def iwait_on_objects( objects: Collection[_WaitableT], timeout: float | None = None, count: int | None = None ) -> _WaitIterator[_WaitableT]: ... + @overload def wait_on_objects(objects: None = None, timeout: float | None = None, count: int | None = None) -> bool: ... @overload def wait_on_objects( objects: Collection[_WaitableT], timeout: float | None = None, count: int | None = None ) -> list[_WaitableT]: ... + def set_default_timeout_error(e: type[BaseException]) -> None: ... def wait_on_socket(socket: socket, watcher: _Watcher, timeout_exc: type[BaseException] | BaseException | None = None) -> None: ... def wait_on_watcher( diff --git a/stubs/gevent/gevent/_types.pyi b/stubs/gevent/gevent/_types.pyi index 0deee509c02b..a5718fb32d7e 100644 --- a/stubs/gevent/gevent/_types.pyi +++ b/stubs/gevent/gevent/_types.pyi @@ -83,6 +83,7 @@ class _TimerWatcher(_Watcher, Protocol): def start(self, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts], update: bool) -> None: ... @overload def start(self, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ... + @overload def again(self, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts], update: bool) -> None: ... @overload @@ -92,6 +93,7 @@ class _TimerWatcher(_Watcher, Protocol): @type_check_only class _IoWatcher(_Watcher, Protocol): EVENT_MASK: int + # pass_events means the first argument of the callback needs to be an integer, but we can't # type check the other passed in args in this case @overload diff --git a/stubs/gevent/gevent/_util.pyi b/stubs/gevent/gevent/_util.pyi index 4d465603c410..d0f6df62d749 100644 --- a/stubs/gevent/gevent/_util.pyi +++ b/stubs/gevent/gevent/_util.pyi @@ -28,6 +28,7 @@ def import_c_accel(globs: MutableMapping[str, Any], cname: str) -> None: ... class Lazy(Generic[_T]): data: _T def __init__(self, func: Callable[[Any], _T]) -> None: ... + @overload def __get__(self, inst: None, class_: type[object]) -> Self: ... @overload @@ -38,6 +39,7 @@ class readproperty(Generic[_T]): def __init__( self: readproperty[_T], func: Callable[[Any], _T] # pyright: ignore[reportInvalidTypeVarUse] #11780 ) -> None: ... + @overload def __get__(self, inst: None, class_: type[object]) -> Self: ... @overload @@ -49,6 +51,7 @@ class LazyOnClass(Generic[_T]): name: str func: Callable[[Any], _T] def __init__(self, func: Callable[[Any], _T], name: str | None = None) -> None: ... + @overload def __get__(self, inst: None, class_: type[object]) -> Self: ... @overload diff --git a/stubs/gevent/gevent/_waiter.pyi b/stubs/gevent/gevent/_waiter.pyi index 44d6f3e9864e..bd1125d84f1e 100644 --- a/stubs/gevent/gevent/_waiter.pyi +++ b/stubs/gevent/gevent/_waiter.pyi @@ -34,10 +34,12 @@ class Waiter(Generic[_T]): @property def exc_info(self) -> _ThrowArgs | None: ... def switch(self, value: _T) -> None: ... + @overload def throw(self, typ: type[BaseException], val: BaseException | object = None, tb: TracebackType | None = None, /) -> None: ... @overload def throw(self, typ: BaseException = ..., val: None = None, tb: TracebackType | None = None, /) -> None: ... + def get(self) -> _T: ... def __call__(self, source: _ValueSource[_T]) -> None: ... diff --git a/stubs/gevent/gevent/backdoor.pyi b/stubs/gevent/gevent/backdoor.pyi index 67740ee35fda..d88cd66710f9 100644 --- a/stubs/gevent/gevent/backdoor.pyi +++ b/stubs/gevent/gevent/backdoor.pyi @@ -9,6 +9,7 @@ from gevent.ssl import SSLContext class BackdoorServer(StreamServer): locals: dict[str, Any] banner: str | None + @overload def __init__( self, @@ -42,6 +43,7 @@ class BackdoorServer(StreamServer): suppress_ragged_eofs: bool = True, ciphers: str = ..., ) -> None: ... + def handle(self, conn: _GeventSocket, _address: _Address) -> None: ... __all__ = ["BackdoorServer"] diff --git a/stubs/gevent/gevent/event.pyi b/stubs/gevent/gevent/event.pyi index fa24fe5159d2..4652810532d2 100644 --- a/stubs/gevent/gevent/event.pyi +++ b/stubs/gevent/gevent/event.pyi @@ -26,6 +26,7 @@ class Event(AbstractLinkable): def ready(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... + @overload def wait(self, timeout: None = None) -> Literal[True]: ... @overload @@ -43,10 +44,12 @@ class AsyncResult(AbstractLinkable, Generic[_T]): def ready(self) -> bool: ... def successful(self) -> bool: ... def set(self, value: _T | None = None) -> None: ... + @overload def set_exception(self, exception: BaseException, exc_info: None = None) -> None: ... @overload def set_exception(self, exception: BaseException | None, exc_info: _OptExcInfo) -> None: ... + # technically get/get_nowait/result should just return _T, but the API is designed in # such a way that it is perfectly legal for a ValueSource to have neither its value nor # its exception set, while still being marked successful, at which point None would be diff --git a/stubs/gevent/gevent/fileobject.pyi b/stubs/gevent/gevent/fileobject.pyi index 86fb43ebfd32..d832e066b7ef 100644 --- a/stubs/gevent/gevent/fileobject.pyi +++ b/stubs/gevent/gevent/fileobject.pyi @@ -24,6 +24,7 @@ if sys.platform != "win32": class FileObjectPosix(FileObjectBase[_IOT, AnyStr]): default_bufsize = io.DEFAULT_BUFFER_SIZE fileio: io.RawIOBase + # Text mode: always binds a TextIOWrapper @overload def __init__( diff --git a/stubs/gevent/gevent/greenlet.pyi b/stubs/gevent/gevent/greenlet.pyi index 03e824be67e3..e6551f06f9de 100644 --- a/stubs/gevent/gevent/greenlet.pyi +++ b/stubs/gevent/gevent/greenlet.pyi @@ -19,6 +19,7 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]): args: tuple[Any, ...] kwargs: dict[str, Any] value: _T | None + @overload def __init__( self: Greenlet[_P, _T], # pyright: ignore[reportInvalidTypeVarUse] #11780 @@ -28,6 +29,7 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]): ) -> None: ... @overload def __init__(self: Greenlet[[], None]) -> None: ... + @readproperty def name(self) -> str: ... @property @@ -60,18 +62,21 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]): def unlink_all(self) -> None: ... def ready(self) -> bool: ... def run(self) -> Any: ... + @overload @classmethod def spawn(cls, run: Callable[_P, _T], /, *args: _P.args, **kwargs: _P.kwargs) -> Self: ... @overload @classmethod def spawn(cls) -> Greenlet[[], None]: ... + @overload @classmethod def spawn_later(cls, seconds: float, run: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Self: ... @overload @classmethod def spawn_later(cls, seconds: float) -> Greenlet[[], None]: ... + def start(self) -> None: ... def start_later(self, seconds: float) -> None: ... def successful(self) -> bool: ... diff --git a/stubs/gevent/gevent/hub.pyi b/stubs/gevent/gevent/hub.pyi index 2e720481dd6e..0daf83413755 100644 --- a/stubs/gevent/gevent/hub.pyi +++ b/stubs/gevent/gevent/hub.pyi @@ -28,6 +28,7 @@ class _DefaultReturnProperty(Protocol[_T]): def __get__(self, obj: None, owner: type[object] | None = None) -> property: ... @overload def __get__(self, obj: object, owner: type[object] | None = None) -> _T: ... + def __set__(self, obj: object, value: _T | None) -> None: ... def __del__(self) -> None: ... @@ -46,10 +47,12 @@ class signal(Generic[_P]): args: tuple[Any, ...] kwargs: dict[str, Any] def __init__(self, signalnum: int, handler: Callable[_P, object], *args: _P.args, **kwargs: _P.kwargs) -> None: ... + @property def ref(self) -> bool: ... @ref.setter def ref(self, value: bool) -> None: ... + def cancel(self) -> None: ... def handle(self) -> None: ... @@ -65,10 +68,12 @@ class Hub(WaitOperationsGreenlet): loop: _Loop format_context: Callable[[object], str] minimal_ident: int + @overload def __init__(self, loop: _Loop, default: None = None) -> None: ... @overload def __init__(self, loop: None = None, default: bool | None = None) -> None: ... + @Lazy def ident_registry(self) -> IdentRegistry: ... @property diff --git a/stubs/gevent/gevent/libev/corecext.pyi b/stubs/gevent/gevent/libev/corecext.pyi index 152339d5348e..fd2f8d80f4dd 100644 --- a/stubs/gevent/gevent/libev/corecext.pyi +++ b/stubs/gevent/gevent/libev/corecext.pyi @@ -20,6 +20,7 @@ if sys.platform != "win32": def recommended_backends() -> list[str | int]: ... def supported_backends() -> list[str | int]: ... def time() -> float: ... + @disjoint_base class loop: starting_timer_may_update_loop_time: bool diff --git a/stubs/gevent/gevent/libev/watcher.pyi b/stubs/gevent/gevent/libev/watcher.pyi index 5f6edadd9fbc..776056872c35 100644 --- a/stubs/gevent/gevent/libev/watcher.pyi +++ b/stubs/gevent/gevent/libev/watcher.pyi @@ -19,23 +19,28 @@ _P = ParamSpec("_P") class watcher(_base.watcher): def __init__(self, _loop: _Loop, ref: bool = True, priority: int | None = None) -> None: ... + @property def ref(self) -> bool: ... @ref.setter def ref(self, value: bool) -> None: ... + # does not accept keyword arguments def feed(self, revents: int, callback: Callable[_P, object], *args: _P.args, **_: _P.kwargs) -> None: ... class io(_base.IoMixin, watcher): EVENT_MASK: int + @property def fd(self) -> FileDescriptor: ... @fd.setter def fd(self, value: FileDescriptor) -> None: ... + @property def events(self) -> int: ... @events.setter def events(self, events: int) -> None: ... + @property def events_str(self) -> str: ... @@ -55,6 +60,7 @@ class child(_base.ChildMixin, watcher): def rpid(self) -> int: ... @rpid.setter def rpid(self, value: int) -> None: ... + @property def rstatus(self) -> int: ... @rstatus.setter diff --git a/stubs/gevent/gevent/libuv/watcher.pyi b/stubs/gevent/gevent/libuv/watcher.pyi index 0f008f490f78..84c9fe212baf 100644 --- a/stubs/gevent/gevent/libuv/watcher.pyi +++ b/stubs/gevent/gevent/libuv/watcher.pyi @@ -9,10 +9,12 @@ class watcher(_base.watcher): class io(_base.IoMixin, watcher): EVENT_MASK: int + @property def events(self) -> int: ... @events.setter def events(self, value: int) -> None: ... + def multiplex(self, events: int) -> _IoWatcher: ... def close_all(self) -> None: ... diff --git a/stubs/gevent/gevent/pool.pyi b/stubs/gevent/gevent/pool.pyi index 291b4f313c4f..74345130b9ed 100644 --- a/stubs/gevent/gevent/pool.pyi +++ b/stubs/gevent/gevent/pool.pyi @@ -46,6 +46,7 @@ class GroupMappingMixin: def map_async( self, func: Callable[[_T], _S], iterable: Iterable[_T], callback: Callable[[list[_S]], object] | None = None ) -> Greenlet[..., list[_S]]: ... + @overload def imap(self, func: Callable[[_T1], _S], iter1: Iterable[_T1], /, *, maxsize: int | None = None) -> IMap[[_T1], _S]: ... @overload @@ -102,6 +103,7 @@ class GroupMappingMixin: *iterables: Iterable[Any], maxsize: int | None = None, ) -> IMap[_P, _S]: ... + @overload def imap_unordered( self, func: Callable[[_T1], _S], iter1: Iterable[_T1], /, *, maxsize: int | None = None @@ -170,10 +172,12 @@ class Group(GroupMappingMixin): greenlet_class: type[Greenlet[..., Any]] greenlets: set[Greenlet[..., Any]] dying: set[Greenlet[..., Any]] + @overload def __init__(self) -> None: ... @overload def __init__(self, grenlets: Collection[Greenlet[..., object]], /) -> None: ... + def __len__(self) -> int: ... def __contains__(self, item: Greenlet[..., object]) -> bool: ... def __iter__(self) -> Iterator[Greenlet[..., object]]: ... diff --git a/stubs/gevent/gevent/pywsgi.pyi b/stubs/gevent/gevent/pywsgi.pyi index 3d9400c6431f..cda7fd112a38 100644 --- a/stubs/gevent/gevent/pywsgi.pyi +++ b/stubs/gevent/gevent/pywsgi.pyi @@ -53,10 +53,12 @@ class Input: class OldMessage(HTTPMessage): status: str def __init__(self) -> None: ... + @overload def getheader(self, name: str, default: None = None) -> str | None: ... @overload def getheader(self, name: str, default: _T) -> str | _T: ... + @property def headers(self) -> Iterator[str]: ... @property @@ -144,6 +146,7 @@ class WSGIServer(StreamServer): secure_environ_class: type[SecureEnviron] base_env: WSGIEnvironment application: WSGIApplication + @overload def __init__( self, @@ -183,6 +186,7 @@ class WSGIServer(StreamServer): suppress_ragged_eofs: bool = True, ciphers: str = ..., ) -> None: ... + environ: WSGIEnvironment def set_environ(self, environ: WSGIEnvironment | None = None) -> None: ... max_accept: int diff --git a/stubs/gevent/gevent/queue.pyi b/stubs/gevent/gevent/queue.pyi index e0a504edba15..afe1ce226dc0 100644 --- a/stubs/gevent/gevent/queue.pyi +++ b/stubs/gevent/gevent/queue.pyi @@ -31,12 +31,14 @@ class SimpleQueue(Generic[_T]): @classmethod def __class_getitem__(cls, item: Any, /) -> types.GenericAlias: ... + @overload def __init__(self, maxsize: int | None = None) -> None: ... @overload def __init__(self, maxsize: int | None, items: Iterable[_T]) -> None: ... @overload def __init__(self, maxsize: int | None = None, *, items: Iterable[_T]) -> None: ... + def copy(self) -> Self: ... def empty(self) -> bool: ... def full(self) -> bool: ... @@ -57,12 +59,14 @@ class Queue(SimpleQueue[_T]): __slots__ = ("_cond", "unfinished_tasks") @property def unfinished_tasks(self) -> int: ... # readonly in Cython + @overload def __init__(self, maxsize: int | None = None, *, unfinished_tasks: int | None = None) -> None: ... @overload def __init__(self, maxsize: int | None, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ... @overload def __init__(self, maxsize: int | None = None, *, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ... + def join(self, timeout: float | None = None) -> bool: ... def task_done(self) -> None: ... def shutdown(self, immediate: bool = False) -> None: ... @@ -72,6 +76,7 @@ JoinableQueue = Queue @final class UnboundQueue(Queue[_T]): __slots__ = () + @overload def __init__(self, maxsize: None = None) -> None: ... @overload diff --git a/stubs/gevent/gevent/server.pyi b/stubs/gevent/gevent/server.pyi index 0ee394c80c6f..8f8306684052 100644 --- a/stubs/gevent/gevent/server.pyi +++ b/stubs/gevent/gevent/server.pyi @@ -28,6 +28,7 @@ class StreamServer(BaseServer[_GeventSocket, _Address]): reuse_addr: ClassVar[int | None] wrap_socket = ssl_wrap_socket ssl_args: _SSLArguments | None + @overload def __init__( self, @@ -59,6 +60,7 @@ class StreamServer(BaseServer[_GeventSocket, _Address]): suppress_ragged_eofs: bool = True, ciphers: str = ..., ) -> None: ... + @property def ssl_enabled(self) -> bool: ... @classmethod @@ -78,6 +80,7 @@ class DatagramServer(BaseServer[_GeventSocket, _Address]): @classmethod def get_listener(cls, address: _StrictAddress, family: int | None = None) -> _GeventSocket: ... def do_read(self) -> tuple[_GeventSocket, _Address]: ... + @overload def sendto(self, data: ReadableBuffer, address: _StrictAddress, /) -> int: ... @overload diff --git a/stubs/gevent/gevent/threadpool.pyi b/stubs/gevent/gevent/threadpool.pyi index 250b4eec239d..22f71e18256b 100644 --- a/stubs/gevent/gevent/threadpool.pyi +++ b/stubs/gevent/gevent/threadpool.pyi @@ -32,14 +32,17 @@ class ThreadPool(GroupMappingMixin): task_queue: Queue[_TaskItem] fork_watcher: _Watcher def __init__(self, maxsize: int, hub: Hub | None = None, idle_task_timeout: int = -1) -> None: ... + @property def maxsize(self) -> int: ... @maxsize.setter def maxsize(self, value: int) -> None: ... + @property def size(self) -> int: ... @size.setter def size(self, value: int) -> None: ... + def __len__(self) -> int: ... def join(self) -> None: ... def kill(self) -> None: ... diff --git a/stubs/gevent/gevent/timeout.pyi b/stubs/gevent/gevent/timeout.pyi index 03c3b0fbbfe0..0278eb2b51dd 100644 --- a/stubs/gevent/gevent/timeout.pyi +++ b/stubs/gevent/gevent/timeout.pyi @@ -28,6 +28,7 @@ class Timeout(BaseException): priority: int = -1, ) -> None: ... def start(self) -> None: ... + @overload @classmethod def start_new( @@ -36,6 +37,7 @@ class Timeout(BaseException): @overload @classmethod def start_new(cls, timeout: _TimeoutT) -> _TimeoutT: ... + @property def pending(self) -> bool: ... def cancel(self) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi index b5234d052a3b..e222fc32eacb 100644 --- a/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi +++ b/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi @@ -6,10 +6,12 @@ from google.cloud.ndb import Key, exceptions as exceptions class _LocalState: def __init__(self) -> None: ... + @property def context(self): ... @context.setter def context(self, value) -> None: ... + @property def toplevel_context(self): ... @toplevel_context.setter diff --git a/stubs/greenlet/greenlet/_greenlet.pyi b/stubs/greenlet/greenlet/_greenlet.pyi index cc3c255e43da..09c4cb22ec8f 100644 --- a/stubs/greenlet/greenlet/_greenlet.pyi +++ b/stubs/greenlet/greenlet/_greenlet.pyi @@ -31,10 +31,12 @@ class error(Exception): ... class greenlet: @property def dead(self) -> bool: ... + @property def gr_context(self) -> Context | None: ... @gr_context.setter def gr_context(self, value: Context | None) -> None: ... + @property def gr_frame(self) -> FrameType | None: ... # the parent attribute is a bit special, since it can't be set to `None` manually, but @@ -42,18 +44,22 @@ class greenlet: # how many greenlets have been spawned explicitly. Since there can only be one such # greenlet per thread, there is no way to create another one manually. parent: _ParentDescriptor + @property def run(self) -> Callable[..., Any]: ... @run.setter def run(self, value: Callable[..., Any]) -> None: ... + def __init__(self, run: Callable[..., Any] | None = None, parent: greenlet | None = None) -> None: ... def switch(self, *args: Any, **kwargs: Any) -> Any: ... + @overload def throw( self, typ: type[BaseException] = ..., val: BaseException | object = None, tb: TracebackType | None = None, / ) -> Any: ... @overload def throw(self, typ: BaseException = ..., val: None = None, tb: TracebackType | None = None, /) -> Any: ... + def __bool__(self) -> bool: ... # aliases for some module attributes/methods diff --git a/stubs/grpcio-health-checking/grpc_health/v1/health.pyi b/stubs/grpcio-health-checking/grpc_health/v1/health.pyi index 1353f3f84ef0..e98ffdbcd980 100644 --- a/stubs/grpcio-health-checking/grpc_health/v1/health.pyi +++ b/stubs/grpcio-health-checking/grpc_health/v1/health.pyi @@ -23,6 +23,7 @@ class HealthServicer(health_pb2_grpc.HealthServicer): self, experimental_non_blocking: bool = True, experimental_thread_pool: futures.ThreadPoolExecutor | None = None ) -> None: ... def Check(self, request: health_pb2.HealthCheckRequest, context: ServicerContext) -> health_pb2.HealthCheckResponse: ... + @overload def Watch( self, request: health_pb2.HealthCheckRequest, context: ServicerContext, send_response_callback: None = None @@ -31,5 +32,6 @@ class HealthServicer(health_pb2_grpc.HealthServicer): def Watch( self, request: health_pb2.HealthCheckRequest, context: ServicerContext, send_response_callback: Callable[..., Incomplete] ) -> None: ... + def set(self, service: str, status: health_pb2.HealthCheckResponse.ServingStatus) -> None: ... def enter_graceful_shutdown(self) -> None: ... diff --git a/stubs/grpcio/grpc/aio/__init__.pyi b/stubs/grpcio/grpc/aio/__init__.pyi index 0704e5dea3d9..82ef20f91bf4 100644 --- a/stubs/grpcio/grpc/aio/__init__.pyi +++ b/stubs/grpcio/grpc/aio/__init__.pyi @@ -456,12 +456,14 @@ class Metadata(Mapping[_MetadataKey, _MetadataValue]): def __delitem__(self, key: _MetadataKey) -> None: ... def delete_all(self, key: _MetadataKey) -> None: ... def __iter__(self) -> Iterator[_MetadataKey]: ... + @overload def get(self, key: _MetadataKey, default: None = None) -> _MetadataValue | None: ... @overload def get(self, key: _MetadataKey, default: _MetadataValue) -> _MetadataValue: ... @overload def get(self, key: _MetadataKey, default: _T) -> _MetadataValue | _T: ... + def get_all(self, key: _MetadataKey) -> list[_MetadataValue]: ... def set_all(self, key: _MetadataKey, values: list[_MetadataValue]) -> None: ... def __contains__(self, key: object) -> bool: ... diff --git a/stubs/gunicorn/gunicorn/config.pyi b/stubs/gunicorn/gunicorn/config.pyi index 129dffb70bbc..8a8640204da6 100644 --- a/stubs/gunicorn/gunicorn/config.pyi +++ b/stubs/gunicorn/gunicorn/config.pyi @@ -175,42 +175,52 @@ def validate_bool(val: bool) -> bool: ... def validate_bool(val: None) -> None: ... @overload def validate_bool(val: Annotated[str, "Case-insensitive boolean string ('true'/'false' in any case)"]) -> bool: ... + def validate_dict(val: dict[str, Any]) -> dict[str, Any]: ... def validate_pos_int(val: ConvertibleToInt) -> int: ... def validate_http2_frame_size(val: ConvertibleToInt) -> int: ... def validate_ssl_version(val: _SSLMethod) -> _SSLMethod: ... + @overload def validate_string(val: str) -> str: ... @overload def validate_string(val: None) -> None: ... + @overload def validate_file_exists(val: str) -> str: ... @overload def validate_file_exists(val: None) -> None: ... + def validate_list_string(val: str | list[str] | None) -> list[str]: ... def validate_list_of_existing_files(val: str | list[str] | None) -> list[str]: ... def validate_string_to_addr_list(val: str | None) -> list[str]: ... def validate_string_to_list(val: str | None) -> list[str]: ... + @overload def validate_class(val: str) -> str: ... @overload def validate_class(val: None) -> None: ... @overload def validate_class(val: object) -> object: ... + def validate_callable(arity: int) -> _CallableValidatorType: ... def validate_user(val: int | str | None) -> int: ... def validate_group(val: int | str | None) -> int: ... def validate_post_request(val: str | _HookType) -> _PostRequestHookType: ... def validate_chdir(val: str) -> str: ... + @overload def validate_statsd_address(val: str) -> _AddressType: ... @overload def validate_statsd_address(val: None) -> None: ... + def validate_reload_engine(val: str) -> str: ... + @overload def validate_header_map_behaviour(val: str) -> str: ... @overload def validate_header_map_behaviour(val: None) -> None: ... + def get_default_config_file() -> str | None: ... class ConfigFile(Setting): diff --git a/stubs/gunicorn/gunicorn/glogging.pyi b/stubs/gunicorn/gunicorn/glogging.pyi index e0ad9216ac40..964c528bd95b 100644 --- a/stubs/gunicorn/gunicorn/glogging.pyi +++ b/stubs/gunicorn/gunicorn/glogging.pyi @@ -59,6 +59,7 @@ _SyslogAddressType: TypeAlias = ( ) def parse_syslog_address(addr: str) -> _SyslogAddressType: ... + @type_check_only class _LogLevels(TypedDict): critical: _CriticalIntType diff --git a/stubs/hdbcli/hdbcli/dbapi.pyi b/stubs/hdbcli/hdbcli/dbapi.pyi index 0f12313590cd..c3e0bc03ce98 100644 --- a/stubs/hdbcli/hdbcli/dbapi.pyi +++ b/stubs/hdbcli/hdbcli/dbapi.pyi @@ -85,10 +85,12 @@ class Cursor: def has_result_set(self) -> bool: ... def nextset(self) -> None: ... def parameter_description(self) -> tuple[str, ...]: ... + @overload def prepare(self, operation: str, newcursor: Literal[True]) -> Cursor: ... @overload def prepare(self, operation: str, newcursor: Literal[False]) -> Any: ... + def print_message(self): ... def parsenamedquery(self, *args, **kwargs): ... def scroll(self, value: int, mode: Literal["absolute", "relative"] = ...) -> None: ... diff --git a/stubs/hdbcli/hdbcli/resultrow.pyi b/stubs/hdbcli/hdbcli/resultrow.pyi index d3942e84a822..d3e9454dbfe1 100644 --- a/stubs/hdbcli/hdbcli/resultrow.pyi +++ b/stubs/hdbcli/hdbcli/resultrow.pyi @@ -9,9 +9,11 @@ class ResultRow: column_values: tuple[Any, ...] def __len__(self) -> int: ... + @overload def __getitem__(self, index: int, /) -> Any: ... @overload def __getitem__(self, index: slice, /) -> Sequence[Any]: ... + def __iter__(self) -> Iterator[Any]: ... # __next__, __delitem__, __setitem__ are technically defined but lead always to an error diff --git a/stubs/hnswlib/hnswlib.pyi b/stubs/hnswlib/hnswlib.pyi index 8123722c7d47..3c2656748fa0 100644 --- a/stubs/hnswlib/hnswlib.pyi +++ b/stubs/hnswlib/hnswlib.pyi @@ -17,11 +17,13 @@ class Index: def __init__(self, index: Index) -> None: ... @overload def __init__(self, space: Literal["l2", "ip", "cosine"], dim: int) -> None: ... + def add_items( self, data: ArrayLike, ids: ArrayLike | None = None, num_threads: int = -1, replace_deleted: bool = False ) -> None: ... def get_current_count(self) -> int: ... def get_ids_list(self) -> list[int]: ... + @overload def get_items(self, ids: ArrayLike | None = ..., return_type: Literal["list"] = ...) -> list[float]: ... @overload @@ -30,6 +32,7 @@ class Index: def get_items( self, ids: ArrayLike | None = None, return_type: Literal["numpy", "list"] = "numpy" ) -> NDArray[np.float32] | list[float]: ... + def get_max_elements(self) -> int: ... def index_file_size(self) -> int: ... def init_index( diff --git a/stubs/html5lib/html5lib/_inputstream.pyi b/stubs/html5lib/html5lib/_inputstream.pyi index f3d92a878716..1a011ee46eb8 100644 --- a/stubs/html5lib/html5lib/_inputstream.pyi +++ b/stubs/html5lib/html5lib/_inputstream.pyi @@ -59,10 +59,12 @@ class HTMLUnicodeInputStream: prevNumLines: int prevNumCols: int def reset(self) -> None: ... + @overload def openStream(self, source: _SupportsReadT) -> _SupportsReadT: ... @overload def openStream(self, source: str | None) -> StringIO: ... + def position(self) -> tuple[int, int]: ... def char(self) -> str | None: ... def readChunk(self, chunkSize: int | None = None) -> bool: ... @@ -93,10 +95,12 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream): ) -> None: ... dataStream: Incomplete def reset(self) -> None: ... + @overload # type: ignore[override] def openStream(self, source: _SupportsReadBytesT) -> _SupportsReadBytesT: ... @overload # type: ignore[override] def openStream(self, source: ReadableBuffer) -> BytesIO: ... + def determineEncoding(self, chardet: bool = True): ... def changeEncoding(self, newEncoding: str | bytes | None) -> None: ... def detectBOM(self) -> Encoding | None: ... @@ -111,10 +115,12 @@ class EncodingBytes(bytes): def previous(self) -> bytes: ... def setPosition(self, position: int) -> None: ... def getPosition(self) -> int | None: ... + @property def position(self) -> int | None: ... @position.setter def position(self, position: int) -> None: ... + def getCurrentByte(self) -> bytes: ... @property def currentByte(self) -> bytes: ... diff --git a/stubs/html5lib/html5lib/_tokenizer.pyi b/stubs/html5lib/html5lib/_tokenizer.pyi index 53c2e1bec605..d2c148b5e21d 100644 --- a/stubs/html5lib/html5lib/_tokenizer.pyi +++ b/stubs/html5lib/html5lib/_tokenizer.pyi @@ -35,6 +35,7 @@ class HTMLTokenizer: state: Callable[[], bool] escape: bool currentToken: _Token | None + @overload def __init__(self, stream: _UnicodeInputStream, parser=None) -> None: ... @overload @@ -50,6 +51,7 @@ class HTMLTokenizer: default_encoding: str = "windows-1252", useChardet: bool = True, ) -> None: ... + tokenQueue: deque[_Token] def __iter__(self) -> Iterator[_Token]: ... def consumeNumberEntity(self, isHex: bool | None) -> str: ... diff --git a/stubs/html5lib/html5lib/_utils.pyi b/stubs/html5lib/html5lib/_utils.pyi index 70abe9494add..3197ccb548e0 100644 --- a/stubs/html5lib/html5lib/_utils.pyi +++ b/stubs/html5lib/html5lib/_utils.pyi @@ -19,10 +19,12 @@ _V = TypeVar("_V") class MethodDispatcher(dict[_K, _V]): default: _V | None + @overload # to solve `reportInvalidTypeVarUse` def __init__(self) -> None: ... @overload def __init__(self, items: Iterable[tuple[_K | Iterable[_K], _V]]) -> None: ... + def __getitem__(self, key: _K) -> _V | None: ... # type: ignore[override] def __get__(self, instance, owner: Unused = None) -> BoundMethodDispatcher: ... diff --git a/stubs/html5lib/html5lib/html5parser.pyi b/stubs/html5lib/html5lib/html5parser.pyi index 114ce03ca233..5f78cf43a2ba 100644 --- a/stubs/html5lib/html5lib/html5parser.pyi +++ b/stubs/html5lib/html5lib/html5parser.pyi @@ -12,6 +12,7 @@ def parse( ) -> Element: ... @overload def parse(doc: _InputStream, treebuilder: str, namespaceHTMLElements: bool = True, **kwargs): ... + def parseFragment( doc: _InputStream, container: str = "div", treebuilder: str = "etree", namespaceHTMLElements: bool = True, **kwargs ): ... diff --git a/stubs/html5lib/html5lib/serializer.pyi b/stubs/html5lib/html5lib/serializer.pyi index e831607ff02d..a4e990c78803 100644 --- a/stubs/html5lib/html5lib/serializer.pyi +++ b/stubs/html5lib/html5lib/serializer.pyi @@ -3,6 +3,7 @@ from collections.abc import Generator from typing import Literal, overload def htmlentityreplace_errors(exc: UnicodeError) -> tuple[str | bytes, int]: ... + @overload def serialize( input, @@ -85,14 +86,17 @@ class HTMLSerializer: def encode(self, string: str) -> str | bytes: ... # result depends on self.encoding def encodeStrict(self, string: str) -> str | bytes: ... # result depends on self.encoding encoding: str | None + @overload def serialize(self, treewalker, encoding: Literal[""] | None = None) -> Generator[str]: ... @overload def serialize(self, treewalker, encoding: str = ...) -> Generator[bytes]: ... + @overload def render(self, treewalker, encoding: Literal[""] | None = None) -> str: ... @overload def render(self, treewalker, encoding: str = ...) -> bytes: ... + def serializeError(self, data="XXX ERROR MESSAGE NEEDED") -> None: ... class SerializeError(Exception): ... diff --git a/stubs/hvac/hvac/api/secrets_engines/kv.pyi b/stubs/hvac/hvac/api/secrets_engines/kv.pyi index 00b60c9c3437..bd7a1c1b2a28 100644 --- a/stubs/hvac/hvac/api/secrets_engines/kv.pyi +++ b/stubs/hvac/hvac/api/secrets_engines/kv.pyi @@ -11,8 +11,10 @@ class Kv(VaultApiBase): def v1(self): ... @property def v2(self): ... + @property def default_kv_version(self): ... @default_kv_version.setter def default_kv_version(self, default_kv_version) -> None: ... + def __getattr__(self, item): ... diff --git a/stubs/hvac/hvac/api/vault_api_category.pyi b/stubs/hvac/hvac/api/vault_api_category.pyi index 2807505a3a92..d0dc0b6827fd 100644 --- a/stubs/hvac/hvac/api/vault_api_category.pyi +++ b/stubs/hvac/hvac/api/vault_api_category.pyi @@ -11,10 +11,12 @@ class VaultApiCategory(VaultApiBase, metaclass=ABCMeta): implemented_class_names: list[str] def __init__(self, adapter: Adapter[Any]) -> None: ... def __getattr__(self, item): ... + @property def adapter(self) -> Adapter[Any]: ... @adapter.setter def adapter(self, adapter: Adapter[Any]) -> None: ... + @property @abstractmethod def implemented_classes(self): ... diff --git a/stubs/hvac/hvac/v1/__init__.pyi b/stubs/hvac/hvac/v1/__init__.pyi index e6d526e4583d..e368210f0a1c 100644 --- a/stubs/hvac/hvac/v1/__init__.pyi +++ b/stubs/hvac/hvac/v1/__init__.pyi @@ -24,26 +24,32 @@ class Client: **kwargs: Any, ) -> None: ... def __getattr__(self, name: str) -> Any: ... + @property def adapter(self) -> Adapter[Any]: ... @adapter.setter def adapter(self, adapter: Adapter[Any]) -> None: ... + @property def url(self) -> str: ... @url.setter def url(self, url: str) -> None: ... + @property def token(self) -> str: ... @token.setter def token(self, token: str) -> None: ... + @property def session(self) -> Session: ... @session.setter def session(self, session: Session) -> None: ... + @property def allow_redirects(self) -> bool: ... @allow_redirects.setter def allow_redirects(self, allow_redirects: bool) -> None: ... + @property def auth(self) -> AuthMethods: ... @property @@ -67,10 +73,12 @@ class Client: self, path: str, *, data: dict[str, Any] | None = None, wrap_ttl: int | str | None = None ) -> dict[str, Any] | Response: ... def delete(self, path: str) -> None: ... + @overload def get_policy(self, name: str, parse: Literal[False] = False) -> str | None: ... @overload def get_policy(self, name: str, parse: Literal[True]) -> dict[str, Any] | None: ... + def lookup_token( self, token: str | None = None, accessor: bool = False, wrap_ttl: int | str | None = None ) -> dict[str, Any] | Response: ... diff --git a/stubs/ibm-db/ibm_db.pyi b/stubs/ibm-db/ibm_db.pyi index d37970bb08c3..016e412d4e23 100644 --- a/stubs/ibm-db/ibm_db.pyi +++ b/stubs/ibm-db/ibm_db.pyi @@ -235,10 +235,12 @@ def bind_param( size: int | None = ..., /, ) -> bool: ... + @overload def callproc(connection: IBM_DBConnection, procname: str, /) -> IBM_DBStatement | None: ... @overload def callproc(connection: IBM_DBConnection, procname: str, parameters: tuple[object, ...], /) -> tuple[object, ...] | None: ... + def check_function_support(connection: IBM_DBConnection, function_id: int, /) -> bool: ... def client_info(connection: IBM_DBConnection, /) -> IBM_DBClientInfo | bool: ... def close(connection: IBM_DBConnection, /) -> bool: ... diff --git a/stubs/icalendar/icalendar/cal.pyi b/stubs/icalendar/icalendar/cal.pyi index 84aef3cffa5a..f78c9f8d7198 100644 --- a/stubs/icalendar/icalendar/cal.pyi +++ b/stubs/icalendar/icalendar/cal.pyi @@ -55,6 +55,7 @@ class Component(CaselessDict[Incomplete]): def __bool__(self) -> bool: ... __nonzero__ = __bool__ def is_empty(self) -> bool: ... + @overload def add(self, name: str, value: Any, *, encode: Literal[False]) -> None: ... @overload @@ -63,37 +64,45 @@ class Component(CaselessDict[Incomplete]): def add( self, name: str, value: Any, parameters: SupportsItems[str, str | None] | None = None, encode: Literal[True] = True ) -> None: ... + def decoded(self, name: str, default: _D = ...) -> Incomplete | _D: ... def get_inline(self, name: str, decode: bool = True) -> list[Incomplete]: ... + @overload def set_inline(self, name: str, values: Iterable[str], encode: Literal[False] = ...) -> None: ... @overload def set_inline(self, name: str, values: Iterable[Incomplete], encode: Literal[True] = True) -> None: ... + def add_component(self, component: Component) -> None: ... 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 @overload @classmethod def from_ical(cls, st: str, multiple: Literal[True]) -> list[Component]: ... # or any of its subclasses + def content_line(self, name: str, value: _vType | ICAL_TYPE, sorted: bool = True) -> Contentline: ... 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: ... @DTSTAMP.deleter def DTSTAMP(self) -> None: ... + @property def LAST_MODIFIED(self) -> datetime.datetime | None: ... @LAST_MODIFIED.setter def LAST_MODIFIED(self, value: datetime.datetime) -> None: ... @LAST_MODIFIED.deleter def LAST_MODIFIED(self) -> None: ... + def is_thunderbird(self) -> bool: ... # type_def is a TypeForm @@ -107,64 +116,76 @@ class Event(Component): def alarms(self) -> Alarms: ... @classmethod def example(cls, name: str = "rfc_9074_example_3") -> Event: ... + @property def DTSTART(self) -> datetime.date | datetime.datetime | None: ... @DTSTART.setter def DTSTART(self, value: datetime.date | datetime.datetime | None) -> None: ... @DTSTART.deleter def DTSTART(self) -> None: ... + @property def DTEND(self) -> datetime.date | datetime.datetime | None: ... @DTEND.setter def DTEND(self, value: datetime.date | datetime.datetime | None) -> None: ... @DTEND.deleter def DTEND(self) -> None: ... + @property def DURATION(self) -> datetime.timedelta | None: ... @DURATION.setter def DURATION(self, value: datetime.timedelta | None) -> None: ... @DURATION.deleter def DURATION(self) -> None: ... + @property def duration(self) -> datetime.timedelta: ... + @property def start(self) -> datetime.date | datetime.datetime: ... @start.setter def start(self, value: datetime.date | datetime.datetime | None) -> None: ... + @property 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: ... @X_MOZ_SNOOZE_TIME.deleter def X_MOZ_SNOOZE_TIME(self) -> None: ... + @property def X_MOZ_LASTACK(self) -> datetime.datetime | None: ... @X_MOZ_LASTACK.setter def X_MOZ_LASTACK(self, value: datetime.datetime) -> None: ... @X_MOZ_LASTACK.deleter def X_MOZ_LASTACK(self) -> None: ... + @property def color(self) -> str: ... @color.setter def color(self, value: str) -> None: ... @color.deleter def color(self) -> None: ... + @property def sequence(self) -> int: ... @sequence.setter def sequence(self, value: int) -> None: ... @sequence.deleter def sequence(self) -> None: ... + @property def categories(self) -> list[str]: ... @categories.setter def categories(self, cats: list[str]) -> None: ... @categories.deleter def categories(self) -> None: ... + @property def rdates( self, @@ -173,6 +194,7 @@ class Event(Component): def exdates(self) -> list[datetime.date | datetime.datetime]: ... @property def rrules(self) -> list[vRecur]: ... + @property def uid(self) -> str: ... @uid.setter @@ -182,66 +204,79 @@ class Event(Component): 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: ... @DTSTART.deleter def DTSTART(self) -> None: ... + @property def DUE(self) -> datetime.datetime | datetime.date | None: ... @DUE.setter def DUE(self, value: datetime.datetime | datetime.date | None) -> None: ... @DUE.deleter def DUE(self) -> None: ... + @property def DURATION(self) -> datetime.timedelta | None: ... @DURATION.setter def DURATION(self, value: datetime.timedelta | None) -> None: ... @DURATION.deleter def DURATION(self) -> 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: ... @X_MOZ_SNOOZE_TIME.deleter def X_MOZ_SNOOZE_TIME(self) -> None: ... + @property def X_MOZ_LASTACK(self) -> datetime.datetime | None: ... @X_MOZ_LASTACK.setter def X_MOZ_LASTACK(self, value: datetime.datetime) -> None: ... @X_MOZ_LASTACK.deleter def X_MOZ_LASTACK(self) -> None: ... + @property def alarms(self) -> Alarms: ... + @property def color(self) -> str: ... @color.setter def color(self, value: str) -> None: ... @color.deleter def color(self) -> None: ... + @property def sequence(self) -> int: ... @sequence.setter def sequence(self, value: int) -> None: ... @sequence.deleter def sequence(self) -> None: ... + @property def categories(self) -> list[str]: ... @categories.setter def categories(self, cats: list[str]) -> None: ... @categories.deleter def categories(self) -> None: ... + @property def rdates( self, @@ -250,6 +285,7 @@ class Todo(Component): def exdates(self) -> list[datetime.date | datetime.datetime]: ... @property def rrules(self) -> list[vRecur]: ... + @property def uid(self) -> str: ... @uid.setter @@ -259,37 +295,44 @@ class Todo(Component): class Journal(Component): name: ClassVar[Literal["VJOURNAL"]] + @property def DTSTART(self) -> datetime.date | datetime.datetime | None: ... @DTSTART.setter def DTSTART(self, value: datetime.date | datetime.datetime | None) -> None: ... @DTSTART.deleter def DTSTART(self) -> None: ... + @property def start(self) -> datetime.date | datetime.datetime: ... @start.setter def start(self, value: datetime.date | datetime.datetime | None) -> None: ... + end = start @property def duration(self) -> datetime.timedelta: ... + @property def color(self) -> str: ... @color.setter def color(self, value: str) -> None: ... @color.deleter def color(self) -> None: ... + @property def sequence(self) -> int: ... @sequence.setter def sequence(self, value: int) -> None: ... @sequence.deleter def sequence(self) -> None: ... + @property def categories(self) -> list[str]: ... @categories.setter def categories(self, cats: list[str]) -> None: ... @categories.deleter def categories(self) -> None: ... + @property def rdates( self, @@ -298,6 +341,7 @@ class Journal(Component): def exdates(self) -> list[datetime.date | datetime.datetime]: ... @property def rrules(self) -> list[vRecur]: ... + @property def uid(self) -> str: ... @uid.setter @@ -307,6 +351,7 @@ class Journal(Component): class FreeBusy(Component): name: ClassVar[Literal["VFREEBUSY"]] + @property def uid(self) -> str: ... @uid.setter @@ -336,24 +381,28 @@ class Timezone(Component): 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: ... @DTSTART.deleter def DTSTART(self) -> None: ... + @property def TZOFFSETTO(self) -> datetime.timedelta | None: ... @TZOFFSETTO.setter def TZOFFSETTO(self, value: datetime.timedelta | None) -> None: ... @TZOFFSETTO.deleter def TZOFFSETTO(self) -> None: ... + @property def TZOFFSETFROM(self) -> datetime.timedelta | None: ... @TZOFFSETFROM.setter def TZOFFSETFROM(self, value: datetime.timedelta | None) -> None: ... @TZOFFSETFROM.deleter def TZOFFSETFROM(self) -> None: ... + @property def rdates( self, @@ -365,24 +414,28 @@ class TimezoneStandard(Component): 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: ... @DTSTART.deleter def DTSTART(self) -> None: ... + @property def TZOFFSETTO(self) -> datetime.timedelta | None: ... @TZOFFSETTO.setter def TZOFFSETTO(self, value: datetime.timedelta | None) -> None: ... @TZOFFSETTO.deleter def TZOFFSETTO(self) -> None: ... + @property def TZOFFSETFROM(self) -> datetime.timedelta | None: ... @TZOFFSETFROM.setter def TZOFFSETFROM(self, value: datetime.timedelta | None) -> None: ... @TZOFFSETFROM.deleter def TZOFFSETFROM(self) -> None: ... + @property def rdates( self, @@ -394,30 +447,35 @@ class TimezoneDaylight(Component): class Alarm(Component): name: ClassVar[Literal["VALARM"]] + @property def REPEAT(self) -> int: ... @REPEAT.setter def REPEAT(self, value: int) -> None: ... @REPEAT.deleter def REPEAT(self) -> None: ... + @property def DURATION(self) -> datetime.timedelta | None: ... @DURATION.setter def DURATION(self, value: datetime.timedelta | None) -> None: ... @DURATION.deleter def DURATION(self) -> None: ... + @property def ACKNOWLEDGED(self) -> datetime.datetime | None: ... @ACKNOWLEDGED.setter def ACKNOWLEDGED(self, value: datetime.datetime | None) -> None: ... @ACKNOWLEDGED.deleter def ACKNOWLEDGED(self) -> None: ... + @property def TRIGGER(self) -> datetime.timedelta | datetime.datetime | None: ... @TRIGGER.setter def TRIGGER(self, value: datetime.timedelta | datetime.datetime | None) -> None: ... @TRIGGER.deleter def TRIGGER(self) -> None: ... + @property def TRIGGER_RELATED(self) -> Literal["START", "END"]: ... @TRIGGER_RELATED.setter @@ -430,6 +488,7 @@ class Alarm(Component): @property def triggers(self) -> Alarm.Triggers: ... + @property def uid(self) -> str: ... @uid.setter @@ -452,30 +511,35 @@ class Calendar(Component): @property def timezones(self) -> list[Timezone]: ... def add_missing_timezones(self, first_date: datetime.date = ..., last_date: datetime.date = ...) -> None: ... + @property def calendar_name(self) -> str | None: ... @calendar_name.setter def calendar_name(self, value: str) -> None: ... @calendar_name.deleter def calendar_name(self) -> None: ... + @property def description(self) -> str | None: ... @description.setter def description(self, value: str) -> None: ... @description.deleter def description(self) -> None: ... + @property def color(self) -> str: ... @color.setter def color(self, value: str) -> None: ... @color.deleter def color(self) -> None: ... + @property def categories(self) -> list[str]: ... @categories.setter def categories(self, cats: list[str]) -> None: ... @categories.deleter def categories(self) -> None: ... + @property def uid(self) -> str: ... @uid.setter diff --git a/stubs/icalendar/icalendar/caselessdict.pyi b/stubs/icalendar/icalendar/caselessdict.pyi index 683033b27c19..aa046445f167 100644 --- a/stubs/icalendar/icalendar/caselessdict.pyi +++ b/stubs/icalendar/icalendar/caselessdict.pyi @@ -18,22 +18,26 @@ class CaselessDict(OrderedDict[str, _VT]): def __setitem__(self, key: str | bytes, value: _VT) -> None: ... def __delitem__(self, key: str | bytes) -> None: ... def __contains__(self, key: str | bytes) -> bool: ... # type: ignore[override] + @overload def get(self, key: str | bytes, default: None = None) -> _VT: ... @overload def get(self, key: str | bytes, default: _VT) -> _VT: ... @overload def get(self, key: str | bytes, default: _T) -> _VT | _T: ... + @overload def setdefault(self: CaselessDict[_T | None], key: str | bytes, value: None = None) -> _T | None: ... @overload def setdefault(self, key: str | bytes, value: _VT) -> _VT: ... + @overload # type: ignore[override] def pop(self, key: str | bytes, default: None = None) -> _VT | None: ... @overload def pop(self, key: str | bytes, default: _VT) -> _VT: ... @overload def pop(self, key: str | bytes, default: _T) -> _VT | _T: ... + def popitem(self) -> tuple[str, _VT]: ... # type: ignore[override] def has_key(self, key: str | bytes) -> bool: ... def update(self, *args: SupportsItems[str, _VT] | Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ... # type: ignore[override] diff --git a/stubs/icalendar/icalendar/parser.pyi b/stubs/icalendar/icalendar/parser.pyi index 1b92de815e51..7c70dc920aeb 100644 --- a/stubs/icalendar/icalendar/parser.pyi +++ b/stubs/icalendar/icalendar/parser.pyi @@ -75,6 +75,7 @@ def rfc_6868_unescape(param_value: str) -> str: ... RFC_6868_ESCAPE_REGEX: Final[Pattern[str]] def rfc_6868_escape(param_value: str) -> str: ... + @overload def unescape_list_or_string(val: list[str]) -> list[str]: ... @overload diff --git a/stubs/icalendar/icalendar/parser_tools.pyi b/stubs/icalendar/icalendar/parser_tools.pyi index 357d5ee6bd00..ac90b121369d 100644 --- a/stubs/icalendar/icalendar/parser_tools.pyi +++ b/stubs/icalendar/icalendar/parser_tools.pyi @@ -10,6 +10,7 @@ ICAL_TYPE: TypeAlias = str | bytes def from_unicode(value: ICAL_TYPE, encoding: str = "utf-8") -> bytes: ... def to_unicode(value: ICAL_TYPE, encoding: str = "utf-8-sig") -> str: ... + @overload def data_encode(data: ICAL_TYPE, encoding: str = "utf-8") -> bytes: ... @overload diff --git a/stubs/icalendar/icalendar/prop.pyi b/stubs/icalendar/icalendar/prop.pyi index 5705c1b8f4b6..d08a2b5b2bf9 100644 --- a/stubs/icalendar/icalendar/prop.pyi +++ b/stubs/icalendar/icalendar/prop.pyi @@ -92,12 +92,14 @@ class vCalAddress(str): def from_ical(cls, ical: ICAL_TYPE) -> Self: ... @property def email(self) -> str: ... + @property def name(self) -> str: ... @name.setter def name(self, value: str) -> None: ... @name.deleter def name(self) -> None: ... + CN: property CUTYPE: property DELEGATED_FROM: property @@ -159,6 +161,7 @@ class vDDDTypes(TimeBase): dt: _AnyTimeType def __init__(self, dt: _AnyTimeType) -> None: ... def to_ical(self) -> bytes: ... + @overload @classmethod def from_ical(cls, ical: Self, timezone: Unused | None = None) -> _AnyTimeType: ... @@ -240,6 +243,7 @@ class vMonth(int): def to_ical(self) -> bytes: ... @classmethod def from_ical(cls, ical: vMonth | str | int) -> Self: ... + @property def leap(self) -> bool: ... @leap.setter @@ -271,6 +275,7 @@ class vRecur(CaselessDict[Iterable[Any] | Any]): class vTime(TimeBase): dt: datetime.time | datetime.datetime params: Parameters + @overload def __init__(self, dt: datetime.time | datetime.datetime, /) -> None: ... # args are passed to the datetime.time() constructor @@ -284,6 +289,7 @@ class vTime(TimeBase): tzinfo: datetime.tzinfo | None = ..., /, ) -> None: ... + def to_ical(self) -> str: ... @staticmethod def from_ical(ical: ICAL_TYPE) -> datetime.time: ... diff --git a/stubs/inifile/inifile.pyi b/stubs/inifile/inifile.pyi index c3ed7c06dbdd..db23bc4e06ce 100644 --- a/stubs/inifile/inifile.pyi +++ b/stubs/inifile/inifile.pyi @@ -67,32 +67,39 @@ class IniData(MutableMapping[str, str]): def rollover(self) -> None: ... def to_dict(self) -> dict[str, str]: ... def __len__(self) -> int: ... + @overload def get(self, name: str, default: None = None) -> str | None: ... @overload def get(self, name: str, default: str) -> str: ... @overload def get(self, name: str, default: _T) -> str | _T: ... + @overload def get_ascii(self, name: str) -> str | None: ... @overload def get_ascii(self, name: str, default: _T) -> str | _T: ... + @overload def get_bool(self, name: str) -> bool: ... @overload def get_bool(self, name: str, default: _T) -> bool | _T: ... + @overload def get_int(self, name: str) -> int | None: ... @overload def get_int(self, name: str, default: _T = ...) -> int | _T: ... + @overload def get_float(self, name: str) -> float | None: ... @overload def get_float(self, name: str, default: _T) -> float | _T: ... + @overload def get_uuid(self, name: str) -> UUID | None: ... @overload def get_uuid(self, name: str, default: _T) -> UUID | _T: ... + def itersections(self) -> Iterator[str]: ... def sections(self) -> Iterator[str]: ... def iteritems(self) -> Iterator[tuple[str, str]]: ... diff --git a/stubs/jsonschema/jsonschema/_utils.pyi b/stubs/jsonschema/jsonschema/_utils.pyi index ebaa71434feb..cc0a4f062227 100644 --- a/stubs/jsonschema/jsonschema/_utils.pyi +++ b/stubs/jsonschema/jsonschema/_utils.pyi @@ -24,10 +24,12 @@ class Unset: ... def format_as_index(container: str, indices: Iterable[Incomplete] | None) -> str: ... def find_additional_properties(instance: Iterable[str], schema: Mapping[str, Iterable[str]]) -> Generator[str]: ... def extras_msg(extras: Iterable[object]) -> tuple[str, Literal["was", "were"]]: ... # elements are passed to the repr() function + @overload def ensure_list(thing: str) -> list[str]: ... @overload def ensure_list(thing: _T) -> _T: ... + def equal(one, two) -> bool: ... def unbool(element, true=..., false=...): ... def uniq(container: Iterable[SupportsRichComparison]) -> bool: ... diff --git a/stubs/jsonschema/jsonschema/validators.pyi b/stubs/jsonschema/jsonschema/validators.pyi index 25882e3b7270..5d5ab49c6333 100644 --- a/stubs/jsonschema/jsonschema/validators.pyi +++ b/stubs/jsonschema/jsonschema/validators.pyi @@ -47,16 +47,19 @@ class _Validator(Validator): ) def resolver(self): ... def evolve(self, **changes) -> _Validator: ... + @overload def iter_errors(self, instance) -> Generator[Incomplete]: ... @overload @deprecated("Passing a schema to Validator.iter_errors is deprecated and will be removed in a future release.") def iter_errors(self, instance, _schema: Schema | None) -> Generator[Incomplete]: ... + def descend( self, instance, schema: Schema, path: Incomplete | None = ..., schema_path: Incomplete | None = ..., resolver=None ) -> Generator[Incomplete]: ... def validate(self, *args, **kwargs) -> None: ... def is_type(self, instance, type) -> bool: ... + @overload def is_valid(self, instance) -> bool: ... @overload diff --git a/stubs/jwcrypto/jwcrypto/jwe.pyi b/stubs/jwcrypto/jwcrypto/jwe.pyi index 8e40942e8914..6c22794cd5e3 100644 --- a/stubs/jwcrypto/jwcrypto/jwe.pyi +++ b/stubs/jwcrypto/jwcrypto/jwe.pyi @@ -45,10 +45,12 @@ class JWE: ) = None, flattened: bool = True, ) -> None: ... + @property def allowed_algs(self) -> list[LiteralString]: ... @allowed_algs.setter def allowed_algs(self, algs: list[LiteralString]) -> None: ... + def add_recipient(self, key: JWK, header: dict[str, Any] | str | None = None) -> None: ... def serialize(self, compact: bool = False) -> str: ... def decrypt(self, key: JWK | JWKSet, max_plaintext: int = 0) -> None: ... diff --git a/stubs/jwcrypto/jwcrypto/jwk.pyi b/stubs/jwcrypto/jwcrypto/jwk.pyi index 5fee679f4264..5cdd0bcc45ba 100644 --- a/stubs/jwcrypto/jwcrypto/jwk.pyi +++ b/stubs/jwcrypto/jwcrypto/jwk.pyi @@ -104,6 +104,7 @@ class InvalidJWKValue(JWException): ... class JWK(dict[str, Any]): unsafe_skip_rsa_key_validation: bool + @overload def __init__( self, @@ -120,6 +121,7 @@ class JWK(dict[str, Any]): def __init__(self, *, generate: Literal["oct", "EC", "OKP"], **kwargs) -> None: ... @overload def __init__(self, **kwargs) -> None: ... + # TODO: __init__ may not be typed adequately because keyword arguments depend on the value of generate @classmethod @overload @@ -137,34 +139,40 @@ class JWK(dict[str, Any]): @classmethod @overload def generate(cls, *, kty: _JWKKeyTypeSupported, **kwargs) -> Self: ... + def generate_key(self, *, kty: _JWKKeyTypeSupported, **kwargs) -> None: ... def import_key(self, **kwargs) -> None: ... @classmethod def from_json(cls, key) -> Self: ... + @overload def export(self, private_key: bool = True, as_dict: Literal[False] = False) -> str: ... @overload def export(self, private_key: bool, as_dict: Literal[True]) -> dict[str, Any]: ... @overload def export(self, *, as_dict: Literal[True]) -> dict[str, Any]: ... + @overload def export_public(self, as_dict: Literal[False] = False) -> str: ... @overload def export_public(self, as_dict: Literal[True]) -> dict[str, Any]: ... @overload def export_public(self, as_dict: bool = False) -> str | dict[str, Any]: ... + @overload def export_private(self, as_dict: Literal[False] = False) -> str: ... @overload def export_private(self, as_dict: Literal[True]) -> dict[str, Any]: ... @overload def export_private(self, as_dict: bool = False) -> str | dict[str, Any]: ... + @overload def export_symmetric(self, as_dict: Literal[False] = False) -> str: ... @overload def export_symmetric(self, as_dict: Literal[True]) -> dict[str, Any]: ... @overload def export_symmetric(self, as_dict: bool = False) -> str | dict[str, Any]: ... + def public(self) -> Self: ... @property def has_public(self) -> bool: ... @@ -216,10 +224,12 @@ class JWK(dict[str, Any]): ), ) -> None: ... def import_from_pem(self, data: bytes, password: bytes | None = None, kid: str | None = None) -> None: ... + @overload def export_to_pem(self, private_key: Literal[False] = False, password: Unused = False) -> bytes: ... @overload def export_to_pem(self, private_key: Literal[True], password: bytes | None) -> bytes: ... + @classmethod def from_pyca( cls, @@ -250,13 +260,16 @@ class JWKSet(dict[Literal["keys"], set[JWK]]): def __setitem__(self, key: Literal["keys"], val: JWK) -> None: ... @overload def __setitem__(self, key: str, val: Any) -> None: ... + def add(self, elem: JWK) -> None: ... + @overload def export(self, private_keys: bool = True, as_dict: Literal[False] = False) -> str: ... @overload def export(self, private_keys: bool, as_dict: Literal[True]) -> dict[str, Any]: ... @overload def export(self, *, as_dict: Literal[True]) -> dict[str, Any]: ... + def import_keyset(self, keyset: str | bytes) -> None: ... @classmethod def from_json(cls, keyset: str | bytes) -> Self: ... diff --git a/stubs/jwcrypto/jwcrypto/jws.pyi b/stubs/jwcrypto/jwcrypto/jws.pyi index fc3da3d62585..b73d3f1fd227 100644 --- a/stubs/jwcrypto/jwcrypto/jws.pyi +++ b/stubs/jwcrypto/jwcrypto/jws.pyi @@ -41,10 +41,12 @@ class JWS: verifylog: list[str] | None header_registry: Incomplete def __init__(self, payload=None, header_registry=None) -> None: ... + @property def allowed_algs(self): ... @allowed_algs.setter def allowed_algs(self, algs) -> None: ... + @property def is_valid(self): ... def verify(self, key, alg=None, detached_payload=None) -> None: ... diff --git a/stubs/jwcrypto/jwcrypto/jwt.pyi b/stubs/jwcrypto/jwcrypto/jwt.pyi index 385482d84cc0..96e94dba35d6 100644 --- a/stubs/jwcrypto/jwcrypto/jwt.pyi +++ b/stubs/jwcrypto/jwcrypto/jwt.pyi @@ -42,30 +42,37 @@ class JWT: check_claims=None, expected_type=None, ) -> None: ... + @property def header(self) -> str: ... @header.setter def header(self, h: dict[str, Any] | str) -> None: ... + @property def claims(self) -> str: ... @claims.setter def claims(self, data: str) -> None: ... + @property def token(self): ... @token.setter def token(self, t) -> None: ... + @property def leeway(self) -> int: ... @leeway.setter def leeway(self, lwy: SupportsInt) -> None: ... + @property def validity(self) -> int: ... @validity.setter def validity(self, v: SupportsInt) -> None: ... + @property def expected_type(self): ... @expected_type.setter def expected_type(self, v) -> None: ... + def norm_typ(self, val): ... def make_signed_token(self, key: JWK) -> None: ... def make_encrypted_token(self, key: JWK) -> None: ... diff --git a/stubs/ldap3/ldap3/abstract/cursor.pyi b/stubs/ldap3/ldap3/abstract/cursor.pyi index 81ad20d99e8b..9a22b44ac9e2 100644 --- a/stubs/ldap3/ldap3/abstract/cursor.pyi +++ b/stubs/ldap3/ldap3/abstract/cursor.pyi @@ -60,14 +60,17 @@ class Reader(Cursor): controls=None, auxiliary_class=None, ) -> None: ... + @property def query(self): ... @query.setter def query(self, value) -> None: ... + @property def components_in_and(self): ... @components_in_and.setter def components_in_and(self, value) -> None: ... + def clear(self) -> None: ... execution_time: Incomplete entries: Incomplete diff --git a/stubs/ldap3/ldap3/core/connection.pyi b/stubs/ldap3/ldap3/core/connection.pyi index 0ee8700e0902..10cb20008e94 100644 --- a/stubs/ldap3/ldap3/core/connection.pyi +++ b/stubs/ldap3/ldap3/core/connection.pyi @@ -110,10 +110,12 @@ class Connection: source_port_list=None, ) -> None: ... def repr_with_sensitive_data_stripped(self): ... + @property def stream(self): ... @stream.setter def stream(self, value) -> None: ... + @property def usage(self): ... def __enter__(self) -> Self: ... diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi index 0455ffd7cf7a..11d682cb54e6 100644 --- a/stubs/ldap3/ldap3/utils/asn1.pyi +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -24,12 +24,14 @@ customTypeMap: dict[int, AbstractItemEncoder] def compute_ber_size(data): ... def decode_message_fast(message): ... + @overload def decode_sequence(message: _B, start: int, stop: int, context_decoders: Mapping[int, Callable[[_B, int, int], _R]]) -> _R: ... @overload def decode_sequence( message: _SupportsGetItemBuffer, start: int, stop: int, context_decoders: None = None ) -> _AllDecodersReturnType: ... + def decode_integer(message, start: int, stop: int, context_decoders: Unused = None): ... def decode_octet_string(message, start: int, stop: int, context_decoders: Unused = None): ... def decode_boolean(message, start: int, stop: int, context_decoders: Unused = None): ... diff --git a/stubs/lunardate/lunardate.pyi b/stubs/lunardate/lunardate.pyi index d1f2f02854c2..fdaaeb6a55af 100644 --- a/stubs/lunardate/lunardate.pyi +++ b/stubs/lunardate/lunardate.pyi @@ -16,10 +16,12 @@ class LunarDate: @staticmethod def fromSolarDate(year: SupportsIndex, month: SupportsIndex, day: SupportsIndex) -> LunarDate: ... def toSolarDate(self) -> datetime.date: ... + @overload def __sub__(self, other: LunarDate | datetime.date) -> datetime.timedelta: ... @overload def __sub__(self, other: datetime.timedelta) -> LunarDate: ... + def __rsub__(self, other: datetime.date) -> datetime.timedelta: ... def __add__(self, other: datetime.timedelta) -> LunarDate: ... def __radd__(self, other: datetime.timedelta) -> LunarDate: ... diff --git a/stubs/m3u8/m3u8/mixins.pyi b/stubs/m3u8/m3u8/mixins.pyi index 884e8b51a247..9e5d89db5772 100644 --- a/stubs/m3u8/m3u8/mixins.pyi +++ b/stubs/m3u8/m3u8/mixins.pyi @@ -8,10 +8,12 @@ class BasePathMixin: uri: str | None @property def absolute_uri(self) -> str: ... + @property def base_path(self) -> str: ... @base_path.setter def base_path(self, newbase_path: str) -> None: ... + def get_path_from_uri(self) -> str: ... class GroupedBasePathMixin(Iterable[_T], metaclass=ABCMeta): @@ -19,6 +21,7 @@ class GroupedBasePathMixin(Iterable[_T], metaclass=ABCMeta): def base_uri(self) -> str: ... @base_uri.setter def base_uri(self, __new_url: str, /) -> None: ... + @property def base_path(self) -> str: ... @base_path.setter diff --git a/stubs/m3u8/m3u8/model.pyi b/stubs/m3u8/m3u8/model.pyi index e59d19cf1f50..f532280b71b2 100644 --- a/stubs/m3u8/m3u8/model.pyi +++ b/stubs/m3u8/m3u8/model.pyi @@ -16,10 +16,12 @@ class _PlaylistProtocol(Protocol): uri: str | None @property def absolute_uri(self) -> str: ... + @property def base_path(self) -> str: ... @base_path.setter def base_path(self, newbase_path: str) -> None: ... + def get_path_from_uri(self) -> str: ... _PlaylistAnyT = TypeVar("_PlaylistAnyT", bound=_PlaylistProtocol) @@ -70,14 +72,17 @@ class M3U8: strict: bool = False, custom_tags_parser: _CustomTagsParser | None = None, ) -> None: ... + @property def base_uri(self) -> str | None: ... @base_uri.setter def base_uri(self, new_base_uri: str) -> None: ... + @property def base_path(self) -> str | None: ... @base_path.setter def base_path(self, newbase_path: str) -> None: ... + def add_playlist(self, playlist: Playlist) -> None: ... def add_iframe_playlist(self, iframe_playlist: IFramePlaylist) -> None: ... def add_image_playlist(self, image_playlist: ImagePlaylist) -> None: ... @@ -144,10 +149,12 @@ class Segment(BasePathMixin): ) -> None: ... def add_part(self, part: PartialSegment) -> None: ... def dumps(self, last_segment: PartialSegment | None, timespec: str = "milliseconds", infspec: str = "auto") -> str: ... + @property def base_path(self) -> str: ... @base_path.setter def base_path(self, newbase_path: str) -> None: ... + @property def base_uri(self) -> str: ... @base_uri.setter @@ -441,6 +448,7 @@ class Tiles(BasePathMixin): # this is unused in runtime, so this is (temporary) def find_key(keydata: None, keylist: Iterable[Key | None]) -> None: ... @overload def find_key(keydata: Mapping[str, Any], keylist: Iterable[Key | None]) -> Key: ... # keydata can contain any values + def denormalize_attribute(attribute: str) -> str: ... def quoted(string: str | None) -> str: ... def number_to_string(number: str | float | Decimal) -> str: ... diff --git a/stubs/m3u8/m3u8/parser.pyi b/stubs/m3u8/m3u8/parser.pyi index aeee2b4d6a6d..5970547659bd 100644 --- a/stubs/m3u8/m3u8/parser.pyi +++ b/stubs/m3u8/m3u8/parser.pyi @@ -9,6 +9,7 @@ _CustomTagsParser: TypeAlias = Callable[[str, int, dict[str, Any], dict[str, Any ATTRIBUTELISTPATTERN: Pattern[str] def cast_date_time(value: str) -> datetime: ... + @overload def format_date_time(value: time, *, timespec: str = ...) -> str: ... @overload diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 84c53ba10cba..8ec149dd76a4 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -215,6 +215,7 @@ class _patch_dict: class _patcher: TEST_PREFIX: str dict: type[_patch_dict] + @overload def __call__( self, @@ -245,6 +246,7 @@ class _patcher: unsafe: bool = ..., **kwargs: Any, ) -> _patch[_T]: ... + @overload def object( self, @@ -274,6 +276,7 @@ class _patcher: unsafe: bool = ..., **kwargs: Any, ) -> _patch[_T]: ... + def multiple( self, target: Any, diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index d7e593b971bc..75721bf1844f 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -27,39 +27,48 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... def __delitem__(self, k: Never) -> None: ... + @overload def __or__(self, value: Self, /) -> Self: ... @overload def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... + @overload def __ror__(self, value: Self, /) -> Self: ... @overload def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... + # supposedly incompatible definitions of `__or__` and `__ior__`: def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc] @deprecated("Use typing.TypedDict or typing_extensions.TypedDict instead") def TypedDict(typename: str, fields: dict[str, type[Any]], total: bool = ...) -> type[dict[str, Any]]: ... + @overload def Arg(type: _T, name: str | None = ...) -> _T: ... @overload def Arg(*, name: str | None = ...) -> Any: ... + @overload def DefaultArg(type: _T, name: str | None = ...) -> _T: ... @overload def DefaultArg(*, name: str | None = ...) -> Any: ... + @overload def NamedArg(type: _T, name: str | None = ...) -> _T: ... @overload def NamedArg(*, name: str | None = ...) -> Any: ... + @overload def DefaultNamedArg(type: _T, name: str | None = ...) -> _T: ... @overload def DefaultNamedArg(*, name: str | None = ...) -> Any: ... + @overload def VarArg(type: _T) -> _T: ... @overload def VarArg() -> Any: ... + @overload def KwArg(type: _T) -> _T: ... @overload diff --git a/stubs/netaddr/netaddr/eui/__init__.pyi b/stubs/netaddr/netaddr/eui/__init__.pyi index c73a5b6e34d8..4ff92b883f43 100644 --- a/stubs/netaddr/netaddr/eui/__init__.pyi +++ b/stubs/netaddr/netaddr/eui/__init__.pyi @@ -39,14 +39,17 @@ class EUI(BaseIdentifier): def __init__( self, addr: EUI | int | str, version: int | None = None, dialect: type[mac_eui48 | eui64_base] | None = None ) -> None: ... + @property def value(self) -> int: ... @value.setter def value(self, value: ConvertibleToInt) -> None: ... + @property def dialect(self) -> type[mac_eui48 | eui64_base]: ... @dialect.setter def dialect(self, value: type[mac_eui48 | eui64_base] | None) -> None: ... + @property def oui(self) -> OUI: ... @property @@ -56,12 +59,14 @@ class EUI(BaseIdentifier): def iab(self) -> IAB | None: ... @property def version(self) -> Literal[48, 64]: ... + @overload def __getitem__(self, idx: int) -> int: ... @overload def __getitem__(self, idx: slice) -> list[int]: ... @overload def __getitem__(self, idx: int | slice) -> int | list[int]: ... + def __setitem__(self, idx: int, value: int) -> None: ... def __hash__(self) -> int: ... def __eq__(self, other: object) -> bool: ... diff --git a/stubs/netaddr/netaddr/ip/__init__.pyi b/stubs/netaddr/netaddr/ip/__init__.pyi index 6c61ff4cc056..0f748120ca95 100644 --- a/stubs/netaddr/netaddr/ip/__init__.pyi +++ b/stubs/netaddr/netaddr/ip/__init__.pyi @@ -11,10 +11,12 @@ from netaddr.strategy.ipv6 import ipv6_verbose class BaseIP: __slots__ = ("_value", "_module", "__weakref__") def __init__(self) -> None: ... + @property def value(self) -> int | None: ... @value.setter def value(self, value: int) -> None: ... + @abstractmethod def key(self) -> tuple[int, ...]: ... @abstractmethod @@ -87,12 +89,14 @@ class IPListMixin: @property def size(self) -> int: ... def __len__(self) -> int: ... + @overload def __getitem__(self, index: SupportsIndex) -> IPAddress: ... @overload def __getitem__(self, index: slice) -> Iterator[IPAddress]: ... @overload def __getitem__(self, index: SupportsIndex | slice) -> IPAddress | Iterator[IPAddress]: ... + def __contains__(self, other: BaseIP | _IPAddressAddr) -> bool: ... def __bool__(self) -> Literal[True]: ... @@ -105,10 +109,12 @@ class IPNetwork(BaseIP, IPListMixin): def __init__( self, addr: _IPNetworkAddr, version: Literal[4, 6] | None = None, flags: int = 0, *, expand_partial: bool = False ) -> None: ... + @property def prefixlen(self) -> int: ... @prefixlen.setter def prefixlen(self, value: int) -> None: ... + @property def ip(self) -> IPAddress: ... @property @@ -119,10 +125,12 @@ class IPNetwork(BaseIP, IPListMixin): def first(self) -> int: ... @property def last(self) -> int: ... + @property def netmask(self) -> IPAddress: ... @netmask.setter def netmask(self, value: _IPAddressAddr) -> None: ... + @property def hostmask(self) -> IPAddress: ... @property diff --git a/stubs/netaddr/netaddr/ip/glob.pyi b/stubs/netaddr/netaddr/ip/glob.pyi index 42f5c8f3e802..c2865d085e7b 100644 --- a/stubs/netaddr/netaddr/ip/glob.pyi +++ b/stubs/netaddr/netaddr/ip/glob.pyi @@ -12,6 +12,7 @@ def cidr_to_glob(cidr: _IPNetworkAddr) -> str: ... class IPGlob(IPRange): __slots__ = ("_glob",) def __init__(self, ipglob: str) -> None: ... + @property def glob(self) -> str: ... @glob.setter diff --git a/stubs/networkx/networkx/algorithms/boundary.pyi b/stubs/networkx/networkx/algorithms/boundary.pyi index b7a57b02820c..358ed74eb197 100644 --- a/stubs/networkx/networkx/algorithms/boundary.pyi +++ b/stubs/networkx/networkx/algorithms/boundary.pyi @@ -107,5 +107,6 @@ def edge_boundary( keys: bool = False, default: _U | None = None, ) -> Generator[tuple[_Node, _Node, int, dict[str, _U]]]: ... + @_dispatchable def node_boundary(G: Graph[_Node], nbunch1: Iterable[Incomplete], nbunch2: Iterable[Incomplete] | None = None) -> set[_Node]: ... diff --git a/stubs/networkx/networkx/algorithms/bridges.pyi b/stubs/networkx/networkx/algorithms/bridges.pyi index f76eb0276b41..104a682bc24c 100644 --- a/stubs/networkx/networkx/algorithms/bridges.pyi +++ b/stubs/networkx/networkx/algorithms/bridges.pyi @@ -10,6 +10,7 @@ __all__ = ["bridges", "has_bridges", "local_bridges"] def bridges(G: Graph[_Node], root: _Node | None = None) -> Generator[_Node]: ... @_dispatchable def has_bridges(G: Graph[_Node], root: _Node | None = None) -> bool: ... + @overload def local_bridges(G: Graph[_Node], with_span: bool = True, weight: str | None = None) -> Generator[tuple[_Node, _Node]]: ... @overload diff --git a/stubs/networkx/networkx/algorithms/clique.pyi b/stubs/networkx/networkx/algorithms/clique.pyi index 23ffbb7355f8..c9ad22af6625 100644 --- a/stubs/networkx/networkx/algorithms/clique.pyi +++ b/stubs/networkx/networkx/algorithms/clique.pyi @@ -33,12 +33,14 @@ def make_clique_bipartite( create_using: Graph[_Node, _NodeData, _EdgeData] | None = None, name=None, ) -> Graph[_Node]: ... + @overload def node_clique_number( G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False ) -> dict[_Node, int]: ... @overload def node_clique_number(G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False) -> int: ... + def number_of_cliques(G: Graph[_Node], nodes=None, cliques=None) -> int | dict[Incomplete, Incomplete]: ... @_dispatchable def max_weight_clique(G: Graph[_Node], weight="weight") -> tuple[list[Incomplete], int]: ... diff --git a/stubs/networkx/networkx/algorithms/flow/utils.pyi b/stubs/networkx/networkx/algorithms/flow/utils.pyi index 04102aff11d4..456660c90f0d 100644 --- a/stubs/networkx/networkx/algorithms/flow/utils.pyi +++ b/stubs/networkx/networkx/algorithms/flow/utils.pyi @@ -32,6 +32,7 @@ class GlobalRelabelThreshold: def build_residual_network(G: MultiGraph[_Node], capacity, *, backend: str | None = None, **backend_kwargs) -> NoReturn: ... @overload def build_residual_network(G: Graph[_Node], capacity, *, backend: str | None = None, **backend_kwargs): ... + @_dispatchable def detect_unboundedness(R, s, t) -> None: ... @_dispatchable diff --git a/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi b/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi index a768381fb942..abaf6a0f50f4 100644 --- a/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +++ b/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi @@ -17,6 +17,7 @@ __all__ = [ @_dispatchable def has_path(G: Graph[_Node], source: _Node, target: _Node) -> bool: ... + @overload # both source and target are specified => (s -> t) def shortest_path( G: Graph[_Node], @@ -72,6 +73,7 @@ def shortest_path( # source and target are not specified => generator of (t, {s backend: str | None = None, **backend_kwargs, ) -> Generator[tuple[_Node, dict[str, list[_Node]]]]: ... + @overload # both source and target are specified => len(s -> t) def shortest_path_length( G: Graph[_Node], @@ -127,6 +129,7 @@ def shortest_path_length( # source and target are not specified => generator of backend: str | None = None, **backend_kwargs, ) -> Generator[tuple[_Node, dict[_Node, float]]]: ... + @_dispatchable def average_shortest_path_length( G: Graph[_Node], weight: str | _WeightFunc[_Node] | None = None, method: str | None = None diff --git a/stubs/networkx/networkx/classes/function.pyi b/stubs/networkx/networkx/classes/function.pyi index 0c6422005e53..c9759528af9a 100644 --- a/stubs/networkx/networkx/classes/function.pyi +++ b/stubs/networkx/networkx/classes/function.pyi @@ -61,12 +61,14 @@ def number_of_nodes(G: Graph[_Node]): ... def number_of_edges(G: Graph[_Node]): ... def density(G: Graph[_Node]): ... def degree_histogram(G: Graph[_Node]) -> list[int]: ... + @overload def is_directed(G: PlanarEmbedding[Hashable]) -> Literal[False]: ... # type: ignore[misc] # Incompatible return types @overload def is_directed(G: DiGraph[Hashable]) -> Literal[True]: ... # type: ignore[misc] # Incompatible return types @overload def is_directed(G: Graph[Hashable]) -> Literal[False]: ... + def freeze(G: Graph[_Node]): ... def is_frozen(G: Graph[Incomplete]) -> bool: ... def add_star(G_to_add_to, nodes_for_star, **attr) -> None: ... @@ -99,10 +101,12 @@ def set_node_attributes( backend=None, **backend_kwargs, ) -> None: ... + @_dispatchable def get_node_attributes(G: Graph[_Node], name: str, default=None) -> dict[_Node, Incomplete]: ... @_dispatchable def remove_node_attributes(G: Graph[_Node], *attr_names, nbunch=None) -> None: ... + @overload def set_edge_attributes( G: Graph[_Node], @@ -125,6 +129,7 @@ def set_edge_attributes( def set_edge_attributes( G: Graph[Hashable], values, name: None = None, *, backend: str | None = None, **backend_kwargs ) -> None: ... + @_dispatchable def get_edge_attributes(G: Graph[_Node], name: str, default=None) -> dict[tuple[_Node, _Node], Incomplete]: ... @_dispatchable @@ -140,6 +145,7 @@ def is_negatively_weighted(G: Graph[_Node], edge: tuple[_Node, _Node] | None = N @_dispatchable def is_empty(G: Graph[Hashable]) -> bool: ... def nodes_with_selfloops(G: Graph[_Node]) -> Generator[_Node]: ... + @overload def selfloop_edges( G: Graph[_Node], data: Literal[False] = False, keys: Literal[False] = False, default=None @@ -168,6 +174,7 @@ def selfloop_edges( def selfloop_edges( G: Graph[_Node], data: str, keys: Literal[True], default: _U | None = None ) -> Generator[tuple[_Node, _Node, int, _U]]: ... + @_dispatchable def number_of_selfloops(G: Graph[Hashable]) -> int: ... def is_path(G: Graph[_Node], path: Iterable[Incomplete]) -> bool: ... diff --git a/stubs/networkx/networkx/classes/graph.pyi b/stubs/networkx/networkx/classes/graph.pyi index 155c47a4a4a6..a942816e731b 100644 --- a/stubs/networkx/networkx/classes/graph.pyi +++ b/stubs/networkx/networkx/classes/graph.pyi @@ -55,11 +55,13 @@ class Graph(Collection[_Node], Generic[_Node, _NodeData, _EdgeData]): ) -> None: ... # attr: key=value pairs @cached_property def adj(self) -> AdjacencyView[_Node, _Node, _EdgeData]: ... + # This object is a read-only dict-like structure @property def name(self) -> str: ... @name.setter def name(self, s: str) -> None: ... + def __iter__(self) -> Iterator[_Node]: ... def __contains__(self, n: object) -> bool: ... def __len__(self) -> int: ... @@ -86,6 +88,7 @@ class Graph(Collection[_Node], Generic[_Node, _NodeData, _EdgeData]): # attr: Edge attributes to add/update for all edges. def remove_edge(self, u: _Node, v: _Node) -> None: ... def remove_edges_from(self, ebunch: Iterable[_EdgePlus[_Node, _EdgeData]]) -> None: ... + @overload def update(self, edges: Graph[_Node, _NodeData, _EdgeData], nodes: None = None) -> None: ... @overload @@ -94,6 +97,7 @@ class Graph(Collection[_Node], Generic[_Node, _NodeData, _EdgeData]): edges: Graph[_Node, _NodeData, _EdgeData] | Iterable[_EdgePlus[_Node, _EdgeData]] | None = None, nodes: Iterable[_Node] | None = None, ) -> None: ... + def has_edge(self, u: _Node, v: _Node) -> bool: ... def neighbors(self, n: _Node) -> Iterator[_Node]: ... @cached_property @@ -114,9 +118,11 @@ class Graph(Collection[_Node], Generic[_Node, _NodeData, _EdgeData]): def to_undirected(self, as_view: bool = False) -> Graph[_Node, _NodeData, _EdgeData]: ... def subgraph(self, nodes: _NBunch[_Node]) -> Self: ... def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Self: ... + @overload def size(self, weight: None = None) -> int: ... @overload def size(self, weight: str) -> float: ... + def number_of_edges(self, u: _Node | None = None, v: _Node | None = None) -> int: ... def nbunch_iter(self, nbunch: _NBunch[_Node] = None) -> Iterator[_Node]: ... diff --git a/stubs/networkx/networkx/classes/graphviews.pyi b/stubs/networkx/networkx/classes/graphviews.pyi index a1b228711d9e..29c42a5191af 100644 --- a/stubs/networkx/networkx/classes/graphviews.pyi +++ b/stubs/networkx/networkx/classes/graphviews.pyi @@ -29,6 +29,7 @@ def generic_graph_view( def generic_graph_view( G: Graph[_Node, _NodeData, _EdgeData], create_using: type[Graph[_Node, _NodeData, _EdgeData]] ) -> Graph[_Node, _NodeData, _EdgeData]: ... + @overload def subgraph_view( G: MultiDiGraph[_Node, _NodeData, _EdgeData], @@ -57,4 +58,5 @@ def subgraph_view( filter_node: Callable[[_Node], bool] = ..., filter_edge: Callable[[_Node, _Node], bool] = ..., ) -> Graph[_Node, _NodeData, _EdgeData]: ... + def reverse_view(G: _D) -> _D: ... diff --git a/stubs/networkx/networkx/classes/multigraph.pyi b/stubs/networkx/networkx/classes/multigraph.pyi index d0c23fc18969..6d3fcdc56bc3 100644 --- a/stubs/networkx/networkx/classes/multigraph.pyi +++ b/stubs/networkx/networkx/classes/multigraph.pyi @@ -29,16 +29,19 @@ class MultiGraph(Graph[_Node, _NodeData, _EdgeData]): @cached_property def adj(self) -> MultiAdjacencyView[_Node, _Node, _EdgeData]: ... # data can be any type def new_edge_key(self, u: _Node, v: _Node) -> int: ... + # key : hashable identifier, optional (default=lowest unused integer) @overload # type: ignore[override] # More complex overload def add_edge(self, u_for_edge: _Node, v_for_edge: _Node, key: int | None = None, **attr: Any) -> int: ... @overload def add_edge(self, u_for_edge: _Node, v_for_edge: _Node, key: _KeyT, **attr: Any) -> _KeyT: ... + def remove_edge(self, u: _Node, v: _Node, key: Hashable | None = None) -> None: ... def has_edge(self, u: _Node, v: _Node, key: Hashable | None = None) -> bool: ... @cached_property # Including subtypes' possible return types for LSP def edges(self) -> MultiEdgeView[_Node, _NodeData, _EdgeData] | OutMultiEdgeView[_Node, _NodeData, _EdgeData]: ... + # key : hashable identifier, optional (default=None). # default : any Python object (default=None). Value to return if the specific edge (u, v, key) is not found. # Returns: The edge attribute dictionary. @@ -50,6 +53,7 @@ class MultiGraph(Graph[_Node, _NodeData, _EdgeData]): def get_edge_data( self, u: _Node, v: _Node, key: None = None, default: _DefaultT | None = None ) -> dict[Hashable, _EdgeData | _DefaultT]: ... + def copy(self, as_view: bool = False) -> Self: ... @cached_property # Including subtypes' possible return types for LSP diff --git a/stubs/networkx/networkx/classes/reportviews.pyi b/stubs/networkx/networkx/classes/reportviews.pyi index dba4d056ffd2..a133389f2420 100644 --- a/stubs/networkx/networkx/classes/reportviews.pyi +++ b/stubs/networkx/networkx/classes/reportviews.pyi @@ -41,10 +41,12 @@ class NodeView(Mapping[_Node, _NodeData], AbstractSet[_Node], Generic[_Node, _No def __iter__(self) -> Iterator[_Node]: ... def __getitem__(self, n: _Node) -> _NodeData: ... def __contains__(self, n: object) -> bool: ... + @overload def __call__(self, data: Literal[False] = False, default=None) -> Self: ... @overload def __call__(self, data: Literal[True] | str, default=None) -> NodeDataView[_Node, _NodeData, _EdgeData]: ... + @overload def data(self, data: Literal[False], default=None) -> Self: ... @overload @@ -62,10 +64,12 @@ class DiDegreeView(Generic[_Node, _NodeData, _EdgeData]): def __init__( self, G: Graph[_Node, _NodeData, _EdgeData], nbunch: _NBunch[_Node] = None, weight: None | bool | str = None ) -> None: ... + @overload # Use this overload first in case _Node=str, since `str` matches `Iterable[str]` def __call__(self, nbunch: _Node, weight: None | bool | str = None) -> int: ... # type: ignore[overload-overlap] @overload def __call__(self, nbunch: Iterable[_Node] | None = None, weight: None | bool | str = None) -> Self: ... + def __getitem__(self, n: _Node) -> int: ... def __iter__(self) -> Iterator[tuple[_Node, int]]: ... def __len__(self) -> int: ... @@ -113,6 +117,7 @@ class OutEdgeView(AbstractSet[Incomplete], Mapping[Incomplete, Incomplete], Edge def __contains__(self, e: _Edge[_Node]) -> bool: ... # type: ignore[override] def __getitem__(self, e: _Edge[_Node]) -> _EdgeData: ... dataview = OutEdgeDataView + @overload def __call__(self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None) -> Self: ... # type: ignore[overload-overlap] @overload @@ -135,6 +140,7 @@ class OutEdgeView(AbstractSet[Incomplete], Mapping[Incomplete, Incomplete], Edge def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None ) -> OutEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload def data(self, data: Literal[False], default: Unused = None, nbunch: None = None) -> Self: ... @overload @@ -149,6 +155,7 @@ class OutEdgeView(AbstractSet[Incomplete], Mapping[Incomplete, Incomplete], Edge class EdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): __slots__ = () dataview = EdgeDataView + # Have to override parent's overloads with the proper return type based on dataview @overload def __call__(self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None) -> Self: ... # type: ignore[overload-overlap] @@ -172,6 +179,7 @@ class EdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None ) -> EdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload def data(self, data: Literal[False], default: Unused = None, nbunch: None = None) -> Self: ... @overload @@ -186,6 +194,7 @@ class EdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): class InEdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): __slots__ = () dataview = InEdgeDataView + # Have to override parent's overloads with the proper return type based on dataview @overload def __call__(self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None) -> Self: ... # type: ignore[overload-overlap] @@ -209,6 +218,7 @@ class InEdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None ) -> InEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload def data(self, data: Literal[False], default: Unused = None, nbunch: None = None) -> Self: ... @overload @@ -225,6 +235,7 @@ class OutMultiEdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): def __iter__(self) -> Iterator[tuple[_Node, _Node, Incomplete]]: ... # type: ignore[override] def __getitem__(self, e: tuple[_Node, _Node, Incomplete]) -> _EdgeData: ... # type: ignore[override] dataview = OutMultiEdgeDataView + @overload # type: ignore[override] # Has an additional `keys` keyword argument def __call__( # type: ignore[overload-overlap] self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None, keys: Literal[True] @@ -261,6 +272,7 @@ class OutMultiEdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: Literal[False] = False ) -> OutMultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload # type: ignore[override] def data(self, data: Literal[False], default: Unused = None, nbunch: None = None, *, keys: Literal[True]) -> Self: ... @overload @@ -287,6 +299,7 @@ class OutMultiEdgeView(OutEdgeView[_Node, _NodeData, _EdgeData]): class MultiEdgeView(OutMultiEdgeView[_Node, _NodeData, _EdgeData]): __slots__ = () dataview = MultiEdgeDataView # type: ignore[assignment] + # Have to override parent's overloads with the proper return type based on dataview @overload # type: ignore[override] # Has an additional `keys` keyword argument def __call__( # type: ignore[overload-overlap] @@ -324,6 +337,7 @@ class MultiEdgeView(OutMultiEdgeView[_Node, _NodeData, _EdgeData]): def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: Literal[False] = False ) -> MultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload # type: ignore[override] def data(self, data: Literal[False], default: Unused = None, nbunch: None = None, *, keys: Literal[True]) -> Self: ... @overload @@ -350,6 +364,7 @@ class MultiEdgeView(OutMultiEdgeView[_Node, _NodeData, _EdgeData]): class InMultiEdgeView(OutMultiEdgeView[_Node, _NodeData, _EdgeData]): __slots__ = () dataview = InMultiEdgeDataView # type: ignore[assignment] + # Have to override parent's overloads with the proper return type based on dataview @overload # type: ignore[override] def __call__( # type: ignore[overload-overlap] @@ -387,6 +402,7 @@ class InMultiEdgeView(OutMultiEdgeView[_Node, _NodeData, _EdgeData]): def __call__( self, nbunch: _NBunch[_Node] = None, *, data: str, default: _U | None = None, keys: Literal[False] = False ) -> InMultiEdgeDataView[_Node, tuple[_Node, _Node, _U]]: ... + @overload # type: ignore[override] def data(self, data: Literal[False], default: Unused = None, nbunch: None = None, *, keys: Literal[True]) -> Self: ... @overload diff --git a/stubs/networkx/networkx/convert_matrix.pyi b/stubs/networkx/networkx/convert_matrix.pyi index 52f5b16f3e31..2fbee5b51ffc 100644 --- a/stubs/networkx/networkx/convert_matrix.pyi +++ b/stubs/networkx/networkx/convert_matrix.pyi @@ -37,10 +37,12 @@ def to_pandas_adjacency( weight: str = "weight", nonedge: float = 0.0, ) -> _DataFrame: ... + @overload def from_pandas_adjacency(df: _DataFrame, create_using: type[_G]) -> _G: ... @overload def from_pandas_adjacency(df: _DataFrame, create_using: None = None) -> Graph[Incomplete]: ... + @_dispatchable def to_pandas_edgelist( G: Graph[_Node], @@ -50,6 +52,7 @@ def to_pandas_edgelist( dtype: _ExtensionDtype | None = None, edge_key: str | int | None = None, ) -> _DataFrame: ... + @overload def from_pandas_edgelist( df: _DataFrame, @@ -78,6 +81,7 @@ def from_pandas_edgelist( create_using: None = None, edge_key: str | None = None, ) -> Graph[Incomplete]: ... + @_dispatchable def to_scipy_sparse_array(G: Graph[_Node], nodelist=None, dtype=None, weight="weight", format="csr"): ... @_dispatchable @@ -92,6 +96,7 @@ def to_numpy_array( weight: str = "weight", nonedge: float = 0.0, ) -> numpy.ndarray[Incomplete, numpy.dtype[Incomplete]]: ... + @overload def from_numpy_array( A: numpy.ndarray[Incomplete, Incomplete], parallel_edges: bool = False, create_using: None = None diff --git a/stubs/networkx/networkx/drawing/nx_pylab.pyi b/stubs/networkx/networkx/drawing/nx_pylab.pyi index ee4002b32ed5..34c40c5f5f67 100644 --- a/stubs/networkx/networkx/drawing/nx_pylab.pyi +++ b/stubs/networkx/networkx/drawing/nx_pylab.pyi @@ -191,6 +191,7 @@ def draw_networkx_nodes( # keep in sync with _DrawNetworkxKwds above margins: float | tuple[float, float] | None = None, hide_ticks: bool = True, ) -> PathCollection: ... + @overload # arrows=None -> LineCollection if G is undirected, list[FancyArrowPatch] if G is directed def draw_networkx_edges( # keep in sync with _DrawNetworkxKwds above G: Graph[_Node], @@ -288,6 +289,7 @@ def draw_networkx_edges( node_shape: str = "o", hide_ticks: bool = True, ) -> LineCollection: ... + def draw_networkx_labels( # keep in sync with _DrawNetworkxKwds above G: Graph[_Node], pos: Mapping[_Node, Collection[float]], diff --git a/stubs/networkx/networkx/relabel.pyi b/stubs/networkx/networkx/relabel.pyi index 71e03625f022..432bea7608b3 100644 --- a/stubs/networkx/networkx/relabel.pyi +++ b/stubs/networkx/networkx/relabel.pyi @@ -20,6 +20,7 @@ def relabel_nodes(G: DiGraph[_X], mapping: Mapping[_X, _Y], copy: bool = True) - def relabel_nodes(G: MultiGraph[_X], mapping: Mapping[_X, _Y], copy: bool = True) -> MultiGraph[_X | _Y]: ... @overload def relabel_nodes(G: Graph[_X], mapping: Mapping[_X, _Y], copy: bool = True) -> Graph[_X | _Y]: ... + @_dispatchable def convert_node_labels_to_integers( G: Graph[Hashable], diff --git a/stubs/networkx/networkx/utils/backends.pyi b/stubs/networkx/networkx/utils/backends.pyi index 0681537c2365..0935d701d8e3 100644 --- a/stubs/networkx/networkx/utils/backends.pyi +++ b/stubs/networkx/networkx/utils/backends.pyi @@ -44,12 +44,15 @@ class _dispatchable(Generic[_P, _R]): returns_graph: bool = False, implemented_by_nx: bool = True, ) -> Self: ... + @property def __doc__(self): ... @__doc__.setter def __doc__(self, val) -> None: ... + @property def __signature__(self): ... + # Type system limitations doesn't allow us to define this as it truly should. # But specifying backend with backend_kwargs isn't a common usecase anyway # and specifying backend as explicitly None is possible but not intended. @@ -58,6 +61,7 @@ class _dispatchable(Generic[_P, _R]): def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ... @overload def __call__(self, *args: Any, backend: str, **backend_kwargs: Any) -> _R: ... + # @overload # def __call__(self, *args: _P.args, backend: None = None, **kwargs: _P.kwargs) -> _R: ... # @overload diff --git a/stubs/oauthlib/oauthlib/common.pyi b/stubs/oauthlib/oauthlib/common.pyi index dc2199bfb034..281303f83078 100644 --- a/stubs/oauthlib/oauthlib/common.pyi +++ b/stubs/oauthlib/oauthlib/common.pyi @@ -35,6 +35,7 @@ def generate_client_id(length: int = 30, chars: SupportsLenAndGetItem[str] = ... def add_params_to_qs(query: str, params: dict[str, str] | Iterable[tuple[str, str]]) -> str: ... def add_params_to_uri(uri: str, params: dict[str, str] | Iterable[tuple[str, str]], fragment: bool = False) -> str: ... def safe_string_equals(a: str, b: str) -> bool: ... + @overload def to_unicode(data: str | bytes, encoding: str = "UTF-8") -> str: ... @overload @@ -45,16 +46,20 @@ def to_unicode(data: _T, encoding: str = "UTF-8") -> _T: ... class CaseInsensitiveDict(dict[str, Incomplete]): proxy: dict[str, str] def __init__(self, data: dict[str, Incomplete]) -> None: ... + @overload def __contains__(self, k: str) -> bool: ... @overload def __contains__(self, k: object) -> bool: ... + def __delitem__(self, k: str) -> None: ... def __getitem__(self, k: str): ... + @overload def get(self, k: str, default: None = None) -> Incomplete | None: ... @overload def get(self, k: str, default): ... + def __setitem__(self, k: str, v) -> None: ... def update(self, *args, **kwargs) -> None: ... diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/endpoints/base.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/endpoints/base.pyi index 7a5be82caa62..d4aade1edbd3 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/endpoints/base.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/endpoints/base.pyi @@ -6,14 +6,17 @@ log: Logger class BaseEndpoint: def __init__(self) -> None: ... + @property def valid_request_methods(self) -> Sequence[str] | None: ... @valid_request_methods.setter def valid_request_methods(self, valid_request_methods: Sequence[str] | None) -> None: ... + @property def available(self) -> bool: ... @available.setter def available(self, available: bool) -> None: ... + @property def catch_errors(self) -> bool: ... @catch_errors.setter diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/utils.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/utils.pyi index be3fff47be18..97f51aa733ac 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/utils.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/utils.pyi @@ -5,10 +5,12 @@ from typing import overload def list_to_scope(scope: None) -> None: ... @overload def list_to_scope(scope: str | set[object] | tuple[object] | list[object]) -> str: ... + @overload def scope_to_list(scope: None) -> None: ... @overload def scope_to_list(scope: str | set[object] | tuple[object] | list[object]) -> list[str]: ... + def params_from_uri(uri: str) -> dict[str, str | list[str]]: ... def host_from_uri(uri: str) -> tuple[str, str | None]: ... def escape(u: str) -> str: ... diff --git a/stubs/openpyxl/openpyxl/cell/cell.pyi b/stubs/openpyxl/openpyxl/cell/cell.pyi index 2b75f5a281fa..b16d008d9f4e 100644 --- a/stubs/openpyxl/openpyxl/cell/cell.pyi +++ b/stubs/openpyxl/openpyxl/cell/cell.pyi @@ -59,24 +59,31 @@ class Cell(StyleableObject): def encoding(self) -> str: ... @property def base_date(self) -> datetime: ... + @overload def check_string(self, value: None) -> None: ... @overload def check_string(self, value: str | ReadableBuffer) -> str: ... + def check_error(self, value: object) -> str: ... + @property def value(self) -> _CellGetValue: ... @value.setter def value(self, value: _CellSetValue) -> None: ... + @property def internal_value(self) -> _CellGetValue: ... + @property def hyperlink(self) -> Hyperlink | None: ... @hyperlink.setter def hyperlink(self, val: Hyperlink | str | None) -> None: ... + @property def is_date(self) -> bool: ... def offset(self, row: int = 0, column: int = 0) -> _CellOrMergedCell: ... + @property def comment(self) -> Comment | None: ... @comment.setter diff --git a/stubs/openpyxl/openpyxl/cell/read_only.pyi b/stubs/openpyxl/openpyxl/cell/read_only.pyi index 5635de13ee80..21fe3097e518 100644 --- a/stubs/openpyxl/openpyxl/cell/read_only.pyi +++ b/stubs/openpyxl/openpyxl/cell/read_only.pyi @@ -53,6 +53,7 @@ class ReadOnlyCell: def is_date(self) -> bool: ... @property def internal_value(self) -> _CellGetValue: ... + @property def value(self) -> _CellGetValue: ... @value.setter diff --git a/stubs/openpyxl/openpyxl/cell/rich_text.pyi b/stubs/openpyxl/openpyxl/cell/rich_text.pyi index 7f098a1b81d9..68a4e4c0d71f 100644 --- a/stubs/openpyxl/openpyxl/cell/rich_text.pyi +++ b/stubs/openpyxl/openpyxl/cell/rich_text.pyi @@ -20,6 +20,7 @@ class CellRichText(list[str | TextBlock]): def __init__(self, args: list[str] | list[TextBlock] | list[str | TextBlock] | tuple[str | TextBlock, ...], /) -> None: ... @overload def __init__(self, *args: str | TextBlock) -> None: ... + @classmethod def from_tree(cls, node: _ChildSerialisableTreeElement) -> Self: ... def __add__(self, arg: Iterable[str | TextBlock]) -> CellRichText: ... # type: ignore[override] diff --git a/stubs/openpyxl/openpyxl/chart/axis.pyi b/stubs/openpyxl/openpyxl/chart/axis.pyi index 45292f690c93..b98f29d87c35 100644 --- a/stubs/openpyxl/openpyxl/chart/axis.pyi +++ b/stubs/openpyxl/openpyxl/chart/axis.pyi @@ -85,6 +85,7 @@ class _BaseAxis(Serialisable): crosses: NestedNoneSet[_BaseAxisCrosses] crossesAt: NestedFloat[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/chart/chartspace.pyi b/stubs/openpyxl/openpyxl/chart/chartspace.pyi index 6effdd86a89f..5e21bb8397a7 100644 --- a/stubs/openpyxl/openpyxl/chart/chartspace.pyi +++ b/stubs/openpyxl/openpyxl/chart/chartspace.pyi @@ -78,6 +78,7 @@ class ExternalData(Serialisable): tagname: ClassVar[str] autoUpdate: NestedBool[Literal[True]] id: String[Literal[False]] + @overload def __init__( self, autoUpdate: _HasTagAndGet[_ConvertibleToBool | None] | _ConvertibleToBool | None = None, *, id: str @@ -104,6 +105,7 @@ class ChartSpace(Serialisable): userShapes: Incomplete extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -141,4 +143,5 @@ class ChartSpace(Serialisable): userShapes=None, extLst: Unused = None, ) -> None: ... + def to_tree(self, tagname: Unused = None, idx: Unused = None, namespace: Unused = None) -> Element: ... diff --git a/stubs/openpyxl/openpyxl/chart/data_source.pyi b/stubs/openpyxl/openpyxl/chart/data_source.pyi index 0d7237cd1c10..78e269889e5a 100644 --- a/stubs/openpyxl/openpyxl/chart/data_source.pyi +++ b/stubs/openpyxl/openpyxl/chart/data_source.pyi @@ -105,6 +105,7 @@ class AxDataSource(Serialisable): strRef: Typed[StrRef, Literal[True]] strLit: Typed[StrData, Literal[True]] multiLvlStrRef: Typed[MultiLevelStrRef, Literal[True]] + @overload def __init__( self, numRef: None = None, numLit: None = None, strRef: None = None, strLit: None = None, multiLvlStrRef: None = None diff --git a/stubs/openpyxl/openpyxl/chart/pivot.pyi b/stubs/openpyxl/openpyxl/chart/pivot.pyi index e0df463d6b13..2546e921560c 100644 --- a/stubs/openpyxl/openpyxl/chart/pivot.pyi +++ b/stubs/openpyxl/openpyxl/chart/pivot.pyi @@ -18,6 +18,7 @@ class PivotSource(Serialisable): fmtId: NestedInteger[Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, name: object, fmtId: _HasTagAndGet[ConvertibleToInt] | ConvertibleToInt, extLst: Unused = None diff --git a/stubs/openpyxl/openpyxl/chart/reference.pyi b/stubs/openpyxl/openpyxl/chart/reference.pyi index 6eb1f7e98198..be2cff94b357 100644 --- a/stubs/openpyxl/openpyxl/chart/reference.pyi +++ b/stubs/openpyxl/openpyxl/chart/reference.pyi @@ -18,6 +18,7 @@ class Reference(Strict): max_col: MinMax[int, Literal[False]] range_string: String[Literal[True]] worksheet: _WorkbookChild | ReadOnlyWorksheet | DummyWorksheet + @overload def __init__( self, @@ -39,6 +40,7 @@ class Reference(Strict): max_row: ConvertibleToInt | None = None, range_string: str | None = None, ) -> None: ... + def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... @property diff --git a/stubs/openpyxl/openpyxl/chartsheet/custom.pyi b/stubs/openpyxl/openpyxl/chartsheet/custom.pyi index 2f1066bd2db5..be243e9f8fb2 100644 --- a/stubs/openpyxl/openpyxl/chartsheet/custom.pyi +++ b/stubs/openpyxl/openpyxl/chartsheet/custom.pyi @@ -17,6 +17,7 @@ class CustomChartsheetView(Serialisable): pageSetup: Typed[PrintPageSetup, Literal[True]] headerFooter: Typed[HeaderFooter, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/chartsheet/publish.pyi b/stubs/openpyxl/openpyxl/chartsheet/publish.pyi index 94a0fba4d4b7..e18f600c6991 100644 --- a/stubs/openpyxl/openpyxl/chartsheet/publish.pyi +++ b/stubs/openpyxl/openpyxl/chartsheet/publish.pyi @@ -18,6 +18,7 @@ class WebPublishItem(Serialisable): destinationFile: String[Literal[False]] title: String[Literal[True]] autoRepublish: Bool[Literal[True]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi b/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi index c316373ef895..f7ea59046e8a 100644 --- a/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi +++ b/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi @@ -33,6 +33,7 @@ class Properties(Serialisable): colHidden: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] anchor: ObjectAnchor | None + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/comments/comments.pyi b/stubs/openpyxl/openpyxl/comments/comments.pyi index 8d76e3309a9f..a4966493d9ed 100644 --- a/stubs/openpyxl/openpyxl/comments/comments.pyi +++ b/stubs/openpyxl/openpyxl/comments/comments.pyi @@ -13,6 +13,7 @@ class Comment: def __copy__(self): ... def bind(self, cell) -> None: ... def unbind(self) -> None: ... + @property def text(self) -> str: ... @text.setter diff --git a/stubs/openpyxl/openpyxl/compat/singleton.pyi b/stubs/openpyxl/openpyxl/compat/singleton.pyi index 28bb0fce854e..65749ec98e3a 100644 --- a/stubs/openpyxl/openpyxl/compat/singleton.pyi +++ b/stubs/openpyxl/openpyxl/compat/singleton.pyi @@ -5,6 +5,7 @@ class Singleton(type): def __init__(self, o: object, /) -> None: ... @overload def __init__(self, name: str, bases: tuple[type, ...], dict: dict[str, Any], /, **kwds: Any) -> None: ... + def __call__(self, *args: Any, **kwds: Any) -> Any: ... class Cached(type): @@ -12,4 +13,5 @@ class Cached(type): def __init__(self, o: object, /) -> None: ... @overload def __init__(self, name: str, bases: tuple[type, ...], dict: dict[str, Any], /, **kwds: Any) -> None: ... + def __call__(self, *args: Any) -> Any: ... diff --git a/stubs/openpyxl/openpyxl/descriptors/base.pyi b/stubs/openpyxl/openpyxl/descriptors/base.pyi index e85095f8f2a7..5636a3b25226 100644 --- a/stubs/openpyxl/openpyxl/descriptors/base.pyi +++ b/stubs/openpyxl/openpyxl/descriptors/base.pyi @@ -51,10 +51,12 @@ class Typed(Descriptor[_T], Generic[_T, _N]): allow_none: Literal[False] = False, nested: bool = False, ) -> None: ... + @overload def __get__(self: Typed[_T, Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> _T | None: ... @overload def __get__(self: Typed[_T, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _T: ... + @overload def __set__(self: Typed[_T, Literal[True]], instance: Serialisable | Strict, value: _T | None) -> None: ... @overload @@ -77,6 +79,7 @@ class Convertible(Typed[_T, _N]): expected_type: _ExpectedTypeParam[_T], allow_none: Literal[False] = False, ) -> None: ... + # NOTE: It is currently impossible to make a generic based on the parameter type of another generic # So we implement explicitly the types used internally # MultiCellRange @@ -122,6 +125,7 @@ class Max(Convertible[_M, _N]): expected_type: type[_M] allow_none: _N max: float + @overload def __init__( self: Max[int, Literal[True]], *, expected_type: _ExpectedTypeParam[int], allow_none: Literal[True], max: float @@ -143,6 +147,7 @@ class Max(Convertible[_M, _N]): allow_none: Literal[False] = False, max: float, ) -> None: ... + @overload # type: ignore[override] # Different restrictions def __set__(self: Max[int, Literal[True]], instance: Serialisable | Strict, value: ConvertibleToInt | None) -> None: ... @overload @@ -156,6 +161,7 @@ class Min(Convertible[_M, _N]): expected_type: type[_M] allow_none: _N min: float + @overload def __init__( self: Min[int, Literal[True]], *, expected_type: _ExpectedTypeParam[int], allow_none: Literal[True], min: float @@ -177,6 +183,7 @@ class Min(Convertible[_M, _N]): allow_none: Literal[False] = False, min: float, ) -> None: ... + @overload # type: ignore[override] # Different restrictions def __set__(self: Min[int, Literal[True]], instance: Serialisable | Strict, value: ConvertibleToInt | None) -> None: ... @overload @@ -189,6 +196,7 @@ class Min(Convertible[_M, _N]): class MinMax(Min[_M, _N], Max[_M, _N]): expected_type: type[_M] allow_none: _N + @overload def __init__( self: MinMax[int, Literal[True]], @@ -240,6 +248,7 @@ class NoneSet(Set[_T | None]): class Integer(Convertible[int, _N]): allow_none: _N expected_type: type[int] + @overload def __init__(self: Integer[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload @@ -248,6 +257,7 @@ class Integer(Convertible[int, _N]): class Float(Convertible[float, _N]): allow_none: _N expected_type: type[float] + @overload def __init__(self: Float[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload @@ -256,15 +266,18 @@ class Float(Convertible[float, _N]): class Bool(Convertible[bool, _N]): expected_type: type[bool] allow_none: _N + @overload def __init__(self: Bool[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__(self: Bool[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ... + def __set__(self, instance: Serialisable | Strict, value: _ConvertibleToBool) -> None: ... class String(Typed[str, _N]): allow_none: _N expected_type: type[str] + @overload def __init__(self: String[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload @@ -331,10 +344,12 @@ class MatchPattern(Descriptor[_P], Generic[_P, _N]): pattern: bytes | Pattern[bytes], allow_none: Literal[False] = False, ) -> None: ... + @overload def __get__(self: MatchPattern[_P, Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> _P | None: ... @overload def __get__(self: MatchPattern[_P, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _P: ... + @overload def __set__(self: MatchPattern[_P, Literal[True]], instance: Serialisable | Strict, value: _P | None) -> None: ... @overload @@ -343,10 +358,12 @@ class MatchPattern(Descriptor[_P], Generic[_P, _N]): class DateTime(Typed[datetime, _N]): allow_none: _N expected_type: type[datetime] + @overload def __init__(self: DateTime[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__(self: DateTime[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ... + @overload def __set__(self: DateTime[Literal[True]], instance: Serialisable | Strict, value: datetime | str | None) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/descriptors/nested.pyi b/stubs/openpyxl/openpyxl/descriptors/nested.pyi index e10e546383dc..44d98a3ebd2c 100644 --- a/stubs/openpyxl/openpyxl/descriptors/nested.pyi +++ b/stubs/openpyxl/openpyxl/descriptors/nested.pyi @@ -35,6 +35,7 @@ class Nested(Descriptor[_T]): def __get__(self, instance: Serialisable | Strict, cls: type | None) -> _T: ... def __set__(self, instance: Serialisable | Strict, value: _HasTagAndGet[_T] | _T) -> None: ... def from_tree(self, node: _HasGet[_T]) -> _T: ... + @overload def to_tree(self, tagname: Unused = None, value: None = None, namespace: Unused = None) -> None: ... @overload @@ -57,10 +58,12 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc] expected_type: _ExpectedTypeParam[_T], allow_none: Literal[False] = False, ) -> None: ... + @overload def __get__(self: NestedValue[_T, Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> _T | None: ... @overload def __get__(self: NestedValue[_T, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _T: ... + # NOTE: It is currently impossible to make a generic based on the parameter type of another generic # So we implement explicitly the types used internally # str | Blip @@ -128,10 +131,12 @@ class NestedText(NestedValue[_T, _N]): expected_type: _ExpectedTypeParam[_T], allow_none: Literal[False] = False, ) -> None: ... + @overload def __get__(self: NestedText[_T, Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> _T | None: ... @overload def __get__(self: NestedText[_T, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _T: ... + # NOTE: It is currently impossible to make a generic based on the parameter type of another generic # So we implement explicitly the types used internally # str @@ -152,7 +157,9 @@ class NestedText(NestedValue[_T, _N]): # Anything else @overload def __set__(self: NestedText[_T, Literal[True]], instance: Serialisable | Strict, value: _T | int | Any | None) -> None: ... + def from_tree(self, node: _HasText) -> str: ... # type: ignore[override] + @overload def to_tree(self, tagname: Unused = None, value: None = None, namespace: Unused = None) -> None: ... @overload @@ -181,6 +188,7 @@ class NestedBool(NestedValue[bool, _N], Bool[_N]): # type: ignore[misc] def __init__(self: NestedBool[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__(self: NestedBool[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ... + def __set__(self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool) -> None: ... def from_tree(self, node: _HasGet[bool]) -> bool: ... @@ -229,10 +237,12 @@ class NestedMinMax(Nested[_M], MinMax[_M, _N]): # type: ignore[misc] min: float, max: float, ) -> None: ... + @overload def __get__(self: NestedMinMax[_M, Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> _M | None: ... @overload def __get__(self: NestedMinMax[_M, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _M: ... + @overload # type: ignore[override] # Different restrictions def __set__( self: NestedMinMax[int, Literal[True]], @@ -263,12 +273,15 @@ class EmptyTag(Nested[bool], Bool[_N]): # type: ignore[misc] def __init__(self: EmptyTag[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__(self: EmptyTag[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ... + @overload def __get__(self: EmptyTag[Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> bool | None: ... @overload def __get__(self: EmptyTag[Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> bool: ... + def __set__(self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool) -> None: ... def from_tree(self, node: Unused) -> Literal[True]: ... + @overload def to_tree(self, tagname: Unused = None, value: None = None, namespace: Unused = None) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/drawing/colors.pyi b/stubs/openpyxl/openpyxl/drawing/colors.pyi index c73200009afd..872589fbb8dc 100644 --- a/stubs/openpyxl/openpyxl/drawing/colors.pyi +++ b/stubs/openpyxl/openpyxl/drawing/colors.pyi @@ -378,6 +378,7 @@ class SchemeColor(Serialisable): invGamma: EmptyTag[Literal[True]] val: Set[_SchemeColors] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/drawing/connector.pyi b/stubs/openpyxl/openpyxl/drawing/connector.pyi index 0bf756647eac..2308021cdfc6 100644 --- a/stubs/openpyxl/openpyxl/drawing/connector.pyi +++ b/stubs/openpyxl/openpyxl/drawing/connector.pyi @@ -71,6 +71,7 @@ class Shape(Serialisable): graphicalProperties: Alias style: Typed[ShapeStyle, Literal[True]] txBody: Typed[RichText, Literal[True]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/drawing/drawing.pyi b/stubs/openpyxl/openpyxl/drawing/drawing.pyi index 2dddc130021e..069370e5e02c 100644 --- a/stubs/openpyxl/openpyxl/drawing/drawing.pyi +++ b/stubs/openpyxl/openpyxl/drawing/drawing.pyi @@ -15,14 +15,17 @@ class Drawing: anchorcol: int anchorrow: int def __init__(self) -> None: ... + @property def width(self) -> int: ... @width.setter def width(self, w: int) -> None: ... + @property def height(self) -> int: ... @height.setter def height(self, h: int) -> None: ... + def set_dimension(self, w: int = 0, h: int = 0) -> None: ... @property def anchor(self) -> AbsoluteAnchor | OneCellAnchor: ... diff --git a/stubs/openpyxl/openpyxl/drawing/effect.pyi b/stubs/openpyxl/openpyxl/drawing/effect.pyi index 550ef04cf892..d0678bfbc406 100644 --- a/stubs/openpyxl/openpyxl/drawing/effect.pyi +++ b/stubs/openpyxl/openpyxl/drawing/effect.pyi @@ -65,6 +65,7 @@ class ColorChangeEffect(Serialisable): useA: Bool[Literal[True]] clrFrom: Typed[Color, Literal[False]] clrTo: Typed[Color, Literal[False]] + @overload def __init__(self, useA: _ConvertibleToBool | None = None, *, clrFrom: Color, clrTo: Color) -> None: ... @overload @@ -149,6 +150,7 @@ class OuterShadow(ColorChoice): # schemeClr = ColorChoice.schemeClr # prstClr = ColorChoice.prstClr __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/drawing/geometry.pyi b/stubs/openpyxl/openpyxl/drawing/geometry.pyi index adf70df8d996..a15293e0c663 100644 --- a/stubs/openpyxl/openpyxl/drawing/geometry.pyi +++ b/stubs/openpyxl/openpyxl/drawing/geometry.pyi @@ -530,6 +530,7 @@ class CustomGeometry2D(Serialisable): cxnLst: Typed[ConnectionSiteList, Literal[True]] pathLst: Typed[Path2DList, Literal[False]] rect: GeomRect | None + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/drawing/properties.pyi b/stubs/openpyxl/openpyxl/drawing/properties.pyi index f95685c72325..48aae4d92053 100644 --- a/stubs/openpyxl/openpyxl/drawing/properties.pyi +++ b/stubs/openpyxl/openpyxl/drawing/properties.pyi @@ -85,6 +85,7 @@ class NonVisualDrawingProps(Serialisable): extLst: Typed[ExtensionList, Literal[True]] # Source incorrectly uses a list here instead of a tuple __elements__: ClassVar[list[str]] # type: ignore[assignment] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/formatting/rule.pyi b/stubs/openpyxl/openpyxl/formatting/rule.pyi index f74d9536a760..35ab566356c6 100644 --- a/stubs/openpyxl/openpyxl/formatting/rule.pyi +++ b/stubs/openpyxl/openpyxl/formatting/rule.pyi @@ -109,6 +109,7 @@ class DataBar(RuleType): color: ColorDescriptor[Literal[False]] __elements__: ClassVar[tuple[str, ...]] cfvo: Incomplete + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/packaging/core.pyi b/stubs/openpyxl/openpyxl/packaging/core.pyi index 9111e2bb6387..d42e5a6adc5f 100644 --- a/stubs/openpyxl/openpyxl/packaging/core.pyi +++ b/stubs/openpyxl/openpyxl/packaging/core.pyi @@ -11,6 +11,7 @@ from openpyxl.xml.functions import Element # Does not reimplement the relevant methods, so runtime also has incompatible supertypes class NestedDateTime(DateTime[Incomplete], NestedText[Incomplete, Incomplete]): # type: ignore[misc] expected_type: type[Incomplete] + @overload # type: ignore[override] def to_tree(self, tagname: str | None = None, value: None = None, namespace: str | None = None) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/packaging/relationship.pyi b/stubs/openpyxl/openpyxl/packaging/relationship.pyi index 219fe46da085..ca6bbb0b97f5 100644 --- a/stubs/openpyxl/openpyxl/packaging/relationship.pyi +++ b/stubs/openpyxl/openpyxl/packaging/relationship.pyi @@ -21,6 +21,7 @@ class Relationship(Serialisable): TargetMode: String[Literal[True]] Id: String[Literal[True]] id: Alias + @overload def __init__( self, Id: str, Type: Unused = None, *, type: str, Target: str | None = None, TargetMode: str | None = None diff --git a/stubs/openpyxl/openpyxl/pivot/cache.pyi b/stubs/openpyxl/openpyxl/pivot/cache.pyi index 47a0578ab695..e2fc7b3f73dc 100644 --- a/stubs/openpyxl/openpyxl/pivot/cache.pyi +++ b/stubs/openpyxl/openpyxl/pivot/cache.pyi @@ -34,6 +34,7 @@ class PivotDimension(Serialisable): name: String[Literal[False]] uniqueName: String[Literal[False]] caption: String[Literal[False]] + @overload def __init__(self, measure: _ConvertibleToBool = None, *, name: str, uniqueName: str, caption: str) -> None: ... @overload @@ -69,6 +70,7 @@ class CalculatedItem(Serialisable): pivotArea: Typed[PivotArea, Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__(self, field: ConvertibleToInt | None = None, *, formula: str, pivotArea: PivotArea, extLst=None) -> None: ... @overload @@ -240,6 +242,7 @@ class CacheHierarchy(Serialisable): groupLevels: NestedSequence[list[GroupLevel]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -416,6 +419,7 @@ class CacheField(Serialisable): mappingCount: Integer[Literal[True]] memberPropertyField: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -469,6 +473,7 @@ class RangeSet(Serialisable): ref: String[Literal[False]] name: String[Literal[True]] sheet: String[Literal[True]] + @overload def __init__( self, @@ -570,6 +575,7 @@ class CacheDefinition(Serialisable): extLst: Typed[ExtensionList, Literal[True]] id: Incomplete __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -637,6 +643,7 @@ class CacheDefinition(Serialisable): extLst: ExtensionList | None = None, id=None, ) -> None: ... + def to_tree(self) -> Element: ... # type: ignore[override] @property def path(self) -> str: ... diff --git a/stubs/openpyxl/openpyxl/pivot/fields.pyi b/stubs/openpyxl/openpyxl/pivot/fields.pyi index 15b8be17efbd..e2892e328bac 100644 --- a/stubs/openpyxl/openpyxl/pivot/fields.pyi +++ b/stubs/openpyxl/openpyxl/pivot/fields.pyi @@ -20,6 +20,7 @@ class TupleList(Serialisable): c: Integer[Literal[True]] tpl: Typed[Tuple, Literal[False]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__(self, c: ConvertibleToInt | None = None, *, tpl: Tuple) -> None: ... @overload @@ -75,6 +76,7 @@ class Number(Serialisable): st: Bool[Literal[True]] b: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -130,6 +132,7 @@ class Error(Serialisable): st: Bool[Literal[True]] b: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/pivot/table.pyi b/stubs/openpyxl/openpyxl/pivot/table.pyi index 8082827be382..ec1f0dd3fd45 100644 --- a/stubs/openpyxl/openpyxl/pivot/table.pyi +++ b/stubs/openpyxl/openpyxl/pivot/table.pyi @@ -144,6 +144,7 @@ class PivotFilter(Serialisable): autoFilter: Typed[AutoFilter, Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -224,6 +225,7 @@ class MemberProperty(Serialisable): pLen: Integer[Literal[True]] level: Integer[Literal[True]] field: Integer[Literal[False]] + @overload def __init__( self, @@ -375,6 +377,7 @@ class ChartFormat(Serialisable): series: Bool[Literal[False]] pivotArea: Typed[PivotArea, Literal[False]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, chart: ConvertibleToInt, format: ConvertibleToInt, series: _ConvertibleToBool = None, *, pivotArea: PivotArea @@ -392,6 +395,7 @@ class ConditionalFormat(Serialisable): pivotAreas: Incomplete extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -429,6 +433,7 @@ class Format(Serialisable): pivotArea: Typed[PivotArea, Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -458,6 +463,7 @@ class DataField(Serialisable): numFmtId: Integer[Literal[True]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -769,6 +775,7 @@ class TableDefinition(Serialisable): extLst: Typed[ExtensionList, Literal[True]] id: Incomplete __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -950,6 +957,7 @@ class TableDefinition(Serialisable): extLst: ExtensionList | None = None, id=None, ) -> None: ... + def to_tree(self) -> Element: ... # type: ignore[override] @property def path(self) -> str: ... diff --git a/stubs/openpyxl/openpyxl/styles/colors.pyi b/stubs/openpyxl/openpyxl/styles/colors.pyi index 69975c0787e5..be92324686c0 100644 --- a/stubs/openpyxl/openpyxl/styles/colors.pyi +++ b/stubs/openpyxl/openpyxl/styles/colors.pyi @@ -18,10 +18,12 @@ aRGB_REGEX: Final[Pattern[str]] class RGB(Typed[str, _N]): expected_type: type[str] + @overload def __init__(self: RGB[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__(self: RGB[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ... + @overload def __set__(self: RGB[Literal[True]], instance: Serialisable | Strict, value: str | None) -> None: ... @overload @@ -45,13 +47,16 @@ class Color(Serialisable): index: ConvertibleToInt | None = None, type: Unused = "rgb", ) -> None: ... + @property def value(self) -> str | int | bool: ... @value.setter def value(self, value: str | ConvertibleToInt | _ConvertibleToBool) -> None: ... + def __iter__(self) -> Iterator[tuple[str, str]]: ... @property def index(self) -> str | int | bool: ... + @overload def __add__(self, other: Color) -> Self: ... @overload @@ -59,12 +64,14 @@ class Color(Serialisable): class ColorDescriptor(Typed[Color, _N]): expected_type: type[Color] + @overload def __init__(self: ColorDescriptor[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload def __init__( self: ColorDescriptor[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False ) -> None: ... + @overload def __set__(self: ColorDescriptor[Literal[True]], instance: Serialisable | Strict, value: str | Color | None) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/styles/numbers.pyi b/stubs/openpyxl/openpyxl/styles/numbers.pyi index 92a6ee263689..abadbf89e764 100644 --- a/stubs/openpyxl/openpyxl/styles/numbers.pyi +++ b/stubs/openpyxl/openpyxl/styles/numbers.pyi @@ -52,12 +52,15 @@ TIMEDELTA_RE: Final[Pattern[str]] def is_date_format(fmt: str | None) -> TypeGuard[str]: ... def is_timedelta_format(fmt: str | None) -> TypeGuard[str]: ... + @overload def is_datetime(fmt: None) -> None: ... @overload def is_datetime(fmt: str) -> Literal["datetime", "date", "time"] | None: ... + def is_builtin(fmt: str | None) -> TypeGuard[str]: ... def builtin_format_code(index: int) -> str | None: ... + @overload def builtin_format_id(fmt: None) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/workbook/child.pyi b/stubs/openpyxl/openpyxl/workbook/child.pyi index b6b041e596e3..7e9df7c885a1 100644 --- a/stubs/openpyxl/openpyxl/workbook/child.pyi +++ b/stubs/openpyxl/openpyxl/workbook/child.pyi @@ -17,33 +17,41 @@ class _WorkbookChild: def parent(self) -> Workbook | None: ... @property def encoding(self) -> str: ... # Will error without a parent. + @property def title(self) -> str: ... @title.setter def title(self, value: str | _Decodable) -> None: ... + @property def oddHeader(self) -> HeaderFooterItem | None: ... @oddHeader.setter def oddHeader(self, value: HeaderFooterItem | None) -> None: ... + @property def oddFooter(self) -> HeaderFooterItem | None: ... @oddFooter.setter def oddFooter(self, value: HeaderFooterItem | None) -> None: ... + @property def evenHeader(self) -> HeaderFooterItem | None: ... @evenHeader.setter def evenHeader(self, value: HeaderFooterItem | None) -> None: ... + @property def evenFooter(self) -> HeaderFooterItem | None: ... @evenFooter.setter def evenFooter(self, value: HeaderFooterItem | None) -> None: ... + @property def firstHeader(self) -> HeaderFooterItem | None: ... @firstHeader.setter def firstHeader(self, value: HeaderFooterItem | None) -> None: ... + @property def firstFooter(self) -> HeaderFooterItem | None: ... @firstFooter.setter def firstFooter(self, value: HeaderFooterItem | None) -> None: ... + @property def path(self) -> str: ... diff --git a/stubs/openpyxl/openpyxl/workbook/protection.pyi b/stubs/openpyxl/openpyxl/workbook/protection.pyi index f89cdbe8e645..ddedb7960f7b 100644 --- a/stubs/openpyxl/openpyxl/workbook/protection.pyi +++ b/stubs/openpyxl/openpyxl/workbook/protection.pyi @@ -46,26 +46,31 @@ class WorkbookProtection(Serialisable): workbookSaltValue=None, workbookSpinCount: ConvertibleToInt | None = None, ) -> None: ... + @overload def set_workbook_password(self, value: str = "", already_hashed: Literal[False] = False) -> None: ... @overload def set_workbook_password(self, value: str | None, already_hashed: Literal[True]) -> None: ... @overload def set_workbook_password(self, value: str | None = "", *, already_hashed: Literal[True]) -> None: ... + @property def workbookPassword(self) -> str | None: ... @workbookPassword.setter def workbookPassword(self, value: str) -> None: ... + @overload def set_revisions_password(self, value: str = "", already_hashed: Literal[False] = False) -> None: ... @overload def set_revisions_password(self, value: str | None, already_hashed: Literal[True]) -> None: ... @overload def set_revisions_password(self, value: str | None = "", *, already_hashed: Literal[True]) -> None: ... + @property def revisionsPassword(self) -> str | None: ... @revisionsPassword.setter def revisionsPassword(self, value: str) -> None: ... + @classmethod def from_tree(cls, node: _SupportsIterAndAttribAndTextAndGet) -> Self: ... diff --git a/stubs/openpyxl/openpyxl/workbook/views.pyi b/stubs/openpyxl/openpyxl/workbook/views.pyi index cd876c04952e..f32087949c1c 100644 --- a/stubs/openpyxl/openpyxl/workbook/views.pyi +++ b/stubs/openpyxl/openpyxl/workbook/views.pyi @@ -72,6 +72,7 @@ class CustomWorkbookView(Serialisable): showObjects: NoneSet[_CustomWorkbookViewShowObjects] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/workbook/web.pyi b/stubs/openpyxl/openpyxl/workbook/web.pyi index 21fcb87987c9..fbd5bc0b3cd6 100644 --- a/stubs/openpyxl/openpyxl/workbook/web.pyi +++ b/stubs/openpyxl/openpyxl/workbook/web.pyi @@ -26,6 +26,7 @@ class WebPublishObject(Serialisable): destinationFile: String[Literal[False]] title: String[Literal[True]] autoRepublish: Bool[Literal[True]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/workbook/workbook.pyi b/stubs/openpyxl/openpyxl/workbook/workbook.pyi index 402b82f4d0ed..dc56df61beb4 100644 --- a/stubs/openpyxl/openpyxl/workbook/workbook.pyi +++ b/stubs/openpyxl/openpyxl/workbook/workbook.pyi @@ -56,10 +56,12 @@ class Workbook: # ExcelReader can add ReadOnlyWorksheet in read_only mode. # _sheets: list[_WorksheetOrChartsheetLike] def __init__(self, write_only: bool = False, iso_dates: bool = False) -> None: ... + @property def epoch(self) -> datetime: ... @epoch.setter def epoch(self, value: datetime) -> None: ... + @property def read_only(self) -> bool: ... @property @@ -68,10 +70,12 @@ class Workbook: def write_only(self) -> bool: ... @property def excel_base_date(self) -> datetime: ... + @property def active(self) -> _WorksheetOrChartsheetLike | None: ... @active.setter def active(self, value: Worksheet | Chartsheet | int) -> None: ... + # read_only workbook cannot call this method # Could be generic based on write_only def create_sheet( diff --git a/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi b/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi index eb1f6e6fdc09..c73e6d964898 100644 --- a/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi @@ -20,22 +20,27 @@ class WriteOnlyWorksheet(_WorkbookChild): def tables(self) -> TableList: ... @property def print_titles(self) -> str: ... + @property def print_title_cols(self) -> str | None: ... @print_title_cols.setter def print_title_cols(self, cols: str | None) -> None: ... + @property def print_title_rows(self) -> str | None: ... @print_title_rows.setter def print_title_rows(self, rows: str | None) -> None: ... + @property def freeze_panes(self) -> str | None: ... @freeze_panes.setter def freeze_panes(self, topLeftCell: str | Cell | None = ...) -> None: ... + @property def print_area(self) -> str: ... @print_area.setter def print_area(self, value: str | Iterable[str] | None) -> None: ... + @property def sheet_view(self) -> SheetView: ... def __init__(self, parent: Workbook | None, title: str | _Decodable | None) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi b/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi index 5d5094755fb6..9047a877351e 100644 --- a/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi @@ -48,6 +48,7 @@ class CellRange(Serialisable): max_row: ConvertibleToInt, title: str | None = None, ) -> None: ... + @property def bounds(self) -> tuple[int, int, int, int]: ... @property diff --git a/stubs/openpyxl/openpyxl/worksheet/controls.pyi b/stubs/openpyxl/openpyxl/worksheet/controls.pyi index 247969cdbb43..2e42831a592c 100644 --- a/stubs/openpyxl/openpyxl/worksheet/controls.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/controls.pyi @@ -50,6 +50,7 @@ class Control(Serialisable): shapeId: Integer[Literal[False]] name: String[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, controlPr: ControlProperty | None = None, *, shapeId: ConvertibleToInt, name: str | None = None diff --git a/stubs/openpyxl/openpyxl/worksheet/filters.pyi b/stubs/openpyxl/openpyxl/worksheet/filters.pyi index 120a8b4f6a3a..932b53b604d7 100644 --- a/stubs/openpyxl/openpyxl/worksheet/filters.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/filters.pyi @@ -206,6 +206,7 @@ class Top10(Serialisable): percent: Bool[Literal[True]] val: Float[Literal[False]] filterVal: Float[Literal[True]] + @overload def __init__( self, @@ -233,6 +234,7 @@ class DateGroupItem(Serialisable): minute: MinMax[float, Literal[True]] second: Integer[Literal[True]] dateTimeGrouping: Set[_DateGroupItemDateTimeGrouping] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/worksheet/ole.pyi b/stubs/openpyxl/openpyxl/worksheet/ole.pyi index 08749e9e3435..fedb4beaf3ef 100644 --- a/stubs/openpyxl/openpyxl/worksheet/ole.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/ole.pyi @@ -39,6 +39,7 @@ class ObjectPr(Serialisable): altText: String[Literal[True]] dde: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -83,6 +84,7 @@ class OleObject(Serialisable): autoLoad: Bool[Literal[True]] shapeId: Integer[Literal[False]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/worksheet/page.pyi b/stubs/openpyxl/openpyxl/worksheet/page.pyi index 843caa742464..d86b80dd759f 100644 --- a/stubs/openpyxl/openpyxl/worksheet/page.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/page.pyi @@ -58,14 +58,17 @@ class PrintPageSetup(Serialisable): def __bool__(self) -> bool: ... @property def sheet_properties(self) -> PageSetupProperties | None: ... + @property def fitToPage(self) -> bool | None: ... @fitToPage.setter def fitToPage(self, value: _ConvertibleToBool | None) -> None: ... + @property def autoPageBreaks(self) -> bool | None: ... @autoPageBreaks.setter def autoPageBreaks(self, value: _ConvertibleToBool | None) -> None: ... + @classmethod def from_tree(cls, node: _ChildSerialisableTreeElement) -> Self: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/print_settings.pyi b/stubs/openpyxl/openpyxl/worksheet/print_settings.pyi index e50118de7532..f2d0f4c44155 100644 --- a/stubs/openpyxl/openpyxl/worksheet/print_settings.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/print_settings.pyi @@ -19,19 +19,23 @@ PRINT_AREA_RE: Final[Pattern[str]] class ColRange(Strict): min_col: String[Literal[False]] max_col: String[Literal[False]] + @overload def __init__(self, range_string: None = None, *, min_col: str, max_col: str) -> None: ... @overload def __init__(self, range_string, min_col: Unused = None, max_col: Unused = None) -> None: ... + def __eq__(self, other: object) -> bool: ... class RowRange(Strict): min_row: Integer[Literal[False]] max_row: Integer[Literal[False]] + @overload def __init__(self, range_string: None, min_row: ConvertibleToInt, max_row: ConvertibleToInt) -> None: ... @overload def __init__(self, range_string, min_row: Unused = None, max_row: Unused = None) -> None: ... + def __eq__(self, other: object) -> bool: ... class PrintTitles(Strict): diff --git a/stubs/openpyxl/openpyxl/worksheet/protection.pyi b/stubs/openpyxl/openpyxl/worksheet/protection.pyi index 141af543cb29..02bf4dd923af 100644 --- a/stubs/openpyxl/openpyxl/worksheet/protection.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/protection.pyi @@ -11,6 +11,7 @@ class _Protected: def set_password(self, value: str | None, already_hashed: Literal[True]) -> None: ... @overload def set_password(self, value: str | None = "", *, already_hashed: Literal[True]) -> None: ... + @property def password(self) -> str | None: ... @password.setter @@ -65,12 +66,14 @@ class SheetProtection(Serialisable, _Protected): spinCount: ConvertibleToInt | None = None, hashValue=None, ) -> None: ... + @overload def set_password(self, value: str = "", already_hashed: Literal[False] = False) -> None: ... @overload def set_password(self, value: str | None, already_hashed: Literal[True]) -> None: ... @overload def set_password(self, value: str | None = "", *, already_hashed: Literal[True]) -> None: ... + def enable(self) -> None: ... def disable(self) -> None: ... def __bool__(self) -> bool: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/scenario.pyi b/stubs/openpyxl/openpyxl/worksheet/scenario.pyi index 976054fe1b44..8ae7f0dca07e 100644 --- a/stubs/openpyxl/openpyxl/worksheet/scenario.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/scenario.pyi @@ -43,6 +43,7 @@ class Scenario(Serialisable): comment: String[Literal[True]] __elements__: ClassVar[tuple[str, ...]] __attrs__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -66,6 +67,7 @@ class Scenario(Serialisable): user: str | None = None, comment: str | None = None, ) -> None: ... + @property def count(self) -> int: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi b/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi index bcea5f9dfe3c..9e45422c2ec0 100644 --- a/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi @@ -17,6 +17,7 @@ class CellSmartTag(Serialisable): deleted: Bool[Literal[True]] xmlBased: Bool[Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, diff --git a/stubs/openpyxl/openpyxl/worksheet/table.pyi b/stubs/openpyxl/openpyxl/worksheet/table.pyi index 0ab3d5052796..f8abd7b02a54 100644 --- a/stubs/openpyxl/openpyxl/worksheet/table.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/table.pyi @@ -42,6 +42,7 @@ class XMLColumnProps(Serialisable): xmlDataType: String[Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -88,6 +89,7 @@ class TableColumn(Serialisable): xmlColumnPr: Typed[XMLColumnProps, Literal[True]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] + @overload def __init__( self, @@ -129,6 +131,7 @@ class TableColumn(Serialisable): xmlColumnPr: XMLColumnProps | None = None, extLst: ExtensionList | None = None, ) -> None: ... + def __iter__(self) -> Iterator[tuple[str, str]]: ... @classmethod def from_tree(cls, node: _ChildSerialisableTreeElement) -> Self: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi b/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi index 36a98ebc827c..82244ad9daf1 100644 --- a/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +++ b/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi @@ -82,15 +82,18 @@ class Worksheet(_WorkbookChild): def array_formulae(self) -> dict[str, str]: ... @property def show_gridlines(self) -> bool | None: ... + @property def freeze_panes(self) -> str | None: ... @freeze_panes.setter def freeze_panes(self, topLeftCell: str | Cell | None = None) -> None: ... + # A MergedCell value should be kept to None @overload def cell(self, row: int, column: int, value: None = None) -> _CellOrMergedCell: ... @overload def cell(self, row: int, column: int, value: _CellSetValue = None) -> Cell: ... + # An int is necessarily a row selection @overload def __getitem__(self, key: int) -> tuple[_CellOrMergedCell, ...]: ... @@ -102,6 +105,7 @@ class Worksheet(_WorkbookChild): def __getitem__( self, key: str ) -> Any: ... # AnyOf[_CellOrMergedCell, tuple[_CellOrMergedCell, ...], tuple[tuple[_CellOrMergedCell, ...], ...]] + def __setitem__(self, key: str, value: _CellSetValue) -> None: ... def __iter__(self) -> Iterator[tuple[_CellOrMergedCell, ...]]: ... def __delitem__(self, key: str) -> None: ... @@ -116,6 +120,7 @@ class Worksheet(_WorkbookChild): def calculate_dimension(self) -> str: ... @property def dimensions(self) -> str: ... + @overload def iter_rows( self, min_row: int | None, max_row: int | None, min_col: int | None, max_col: int | None, values_only: Literal[True] @@ -153,10 +158,12 @@ class Worksheet(_WorkbookChild): *, values_only: bool, ) -> Generator[tuple[_CellOrMergedCell, ...]] | Generator[tuple[_CellGetValue, ...]]: ... + @property def rows(self) -> Generator[tuple[_CellOrMergedCell, ...]]: ... @property def values(self) -> Generator[tuple[_CellGetValue, ...]]: ... + @overload def iter_cols( self, min_col: int | None, max_col: int | None, min_row: int | None, max_row: int | None, values_only: Literal[True] @@ -194,6 +201,7 @@ class Worksheet(_WorkbookChild): *, values_only: bool, ) -> Generator[tuple[_CellOrMergedCell, ...]] | Generator[tuple[_CellGetValue, ...]]: ... + @property def columns(self) -> Generator[tuple[_CellOrMergedCell, ...]]: ... @property @@ -208,6 +216,7 @@ class Worksheet(_WorkbookChild): @property def tables(self) -> TableList: ... def add_pivot(self, pivot) -> None: ... + # Same overload as CellRange.__init__ @overload def merge_cells( @@ -232,6 +241,7 @@ class Worksheet(_WorkbookChild): end_row: ConvertibleToInt, end_column: ConvertibleToInt, ) -> None: ... + # Will always raise: TypeError: 'set' object is not subscriptable @property @deprecated("Use ws.merged_cells.ranges") @@ -259,16 +269,20 @@ class Worksheet(_WorkbookChild): def delete_rows(self, idx: int, amount: int = 1) -> None: ... def delete_cols(self, idx: int, amount: int = 1) -> None: ... def move_range(self, cell_range: CellRange | str, rows: int = 0, cols: int = 0, translate: bool = False) -> None: ... + @property def print_title_rows(self) -> str | None: ... @print_title_rows.setter def print_title_rows(self, rows: str | None) -> None: ... + @property def print_title_cols(self) -> str | None: ... @print_title_cols.setter def print_title_cols(self, cols: str | None) -> None: ... + @property def print_titles(self) -> str: ... + @property def print_area(self) -> str: ... @print_area.setter diff --git a/stubs/paramiko/paramiko/_winapi.pyi b/stubs/paramiko/paramiko/_winapi.pyi index bbc62bb52075..0e3fc8a81869 100644 --- a/stubs/paramiko/paramiko/_winapi.pyi +++ b/stubs/paramiko/paramiko/_winapi.pyi @@ -93,6 +93,7 @@ if sys.platform == "win32": lpSecurityDescriptor: int bInheritHandle: bool def __init__(self, *args, **kwargs) -> None: ... + @property def descriptor(self): ... @descriptor.setter diff --git a/stubs/paramiko/paramiko/transport.pyi b/stubs/paramiko/paramiko/transport.pyi index 1cb5214789db..be63269bfd3f 100644 --- a/stubs/paramiko/paramiko/transport.pyi +++ b/stubs/paramiko/paramiko/transport.pyi @@ -176,22 +176,27 @@ class Transport(Thread, ClosingContextManager): class SecurityOptions: __slots__ = "_transport" def __init__(self, transport: Transport) -> None: ... + @property def ciphers(self) -> Sequence[str]: ... @ciphers.setter def ciphers(self, x: Sequence[str]) -> None: ... + @property def digests(self) -> Sequence[str]: ... @digests.setter def digests(self, x: Sequence[str]) -> None: ... + @property def key_types(self) -> Sequence[str]: ... @key_types.setter def key_types(self, x: Sequence[str]) -> None: ... + @property def kex(self) -> Sequence[str]: ... @kex.setter def kex(self, x: Sequence[str]) -> None: ... + @property def compression(self) -> Sequence[str]: ... @compression.setter diff --git a/stubs/peewee/peewee.pyi b/stubs/peewee/peewee.pyi index 0fb7364a0fff..816b7a7e8d0c 100644 --- a/stubs/peewee/peewee.pyi +++ b/stubs/peewee/peewee.pyi @@ -322,10 +322,12 @@ class Alias(WrappedNode): c: Incomplete def __init__(self, node, alias) -> None: ... def __hash__(self) -> int: ... + @property def name(self): ... @name.setter def name(self, value) -> None: ... + def alias(self, alias=None): ... def unalias(self): ... def is_alias(self) -> bool: ... @@ -606,10 +608,12 @@ class Select(SelectBase): def columns(self, *columns, **kwargs) -> Self: ... select = columns def select_extend(self, *columns) -> Self: ... + @property def selected_columns(self): ... @selected_columns.setter def selected_columns(self, value) -> None: ... + def from_(self, *sources) -> Self: ... def join(self, dest, join_type="INNER JOIN", on=None) -> Self: ... # type: ignore[override] def left_outer_join(self, dest, on=None) -> Self: ... # type: ignore[override] @@ -870,10 +874,12 @@ class SqliteDatabase(Database): application_id: Incomplete user_version: Incomplete data_version: Incomplete + @property def timeout(self): ... @timeout.setter def timeout(self, seconds) -> None: ... + def register_aggregate(self, klass, name=None, num_params: int = -1) -> None: ... def aggregate(self, name=None, num_params: int = -1): ... def register_collation(self, fn, name=None) -> None: ... @@ -911,10 +917,12 @@ class _BasePsycopgAdapter: isolation_levels: dict[int, str] isolation_levels_inv: dict[str, int] def __init__(self) -> None: ... + @overload def isolation_level_int(self, isolation_level: str) -> int: ... @overload def isolation_level_int(self, isolation_level: _T) -> _T: ... + @overload def isolation_level_str(self, isolation_level: int) -> str: ... @overload @@ -1460,10 +1468,12 @@ class ManyToManyField(MetaField): ) -> None: ... def bind(self, model, name, set_attribute: bool = True) -> None: ... def get_models(self) -> list[Incomplete]: ... + @property def through_model(self): ... @through_model.setter def through_model(self, value) -> None: ... + def get_through_model(self): ... class VirtualField(MetaField): @@ -1506,10 +1516,12 @@ class SchemaManager: model: Incomplete context_options: Incomplete def __init__(self, model, database=None, **context_options) -> None: ... + @property def database(self): ... @database.setter def database(self, value) -> None: ... + def create_table(self, safe: bool = True, **options) -> None: ... def create_table_as(self, table_name, query, safe: bool = True, **meta) -> None: ... def drop_table(self, safe: bool = True, **options) -> None: ... @@ -1583,14 +1595,17 @@ class Metadata: def remove_ref(self, field) -> None: ... def add_manytomany(self, field) -> None: ... def remove_manytomany(self, field) -> None: ... + @property def table(self) -> Table: ... @table.deleter def table(self) -> None: ... + @property def schema(self): ... @schema.setter def schema(self, value) -> None: ... + @property def entity(self) -> Entity: ... def get_rel_for_model(self, model) -> tuple[list[Incomplete], list[Incomplete]]: ... diff --git a/stubs/pexpect/pexpect/pty_spawn.pyi b/stubs/pexpect/pexpect/pty_spawn.pyi index cecc298c0376..879915556e35 100644 --- a/stubs/pexpect/pexpect/pty_spawn.pyi +++ b/stubs/pexpect/pexpect/pty_spawn.pyi @@ -53,10 +53,12 @@ class spawn(SpawnBase[AnyStr]): def sendcontrol(self, char: str) -> int: ... def sendeof(self) -> None: ... def sendintr(self) -> None: ... + @property def flag_eof(self) -> bool: ... @flag_eof.setter def flag_eof(self, value: bool) -> None: ... + def eof(self) -> bool: ... def terminate(self, force: bool = False) -> bool: ... status: int | None diff --git a/stubs/pexpect/pexpect/spawnbase.pyi b/stubs/pexpect/pexpect/spawnbase.pyi index fc29f065d504..d839fddd57f9 100644 --- a/stubs/pexpect/pexpect/spawnbase.pyi +++ b/stubs/pexpect/pexpect/spawnbase.pyi @@ -77,12 +77,15 @@ class SpawnBase(Generic[AnyStr]): encoding: str | None = None, codec_errors: str = "strict", ) -> None: ... + @property def buffer(self) -> AnyStr: ... @buffer.setter def buffer(self, value: AnyStr) -> None: ... + def read_nonblocking(self, size: int = 1, timeout: float | None = None) -> AnyStr: ... def compile_pattern_list(self, patterns: _InputRePattern | list[_InputRePattern]) -> list[_CompiledRePattern[AnyStr]]: ... + @overload def expect( self, @@ -100,6 +103,7 @@ class SpawnBase(Generic[AnyStr]): *, async_: Literal[True], ) -> Awaitable[int]: ... + @overload def expect_list( self, @@ -117,6 +121,7 @@ class SpawnBase(Generic[AnyStr]): *, async_: Literal[True], ) -> Awaitable[int]: ... + @overload def expect_exact( self, @@ -134,6 +139,7 @@ class SpawnBase(Generic[AnyStr]): *, async_: Literal[True], ) -> Awaitable[int]: ... + def expect_loop(self, searcher: _Searcher[AnyStr], timeout: float | None = -1, searchwindowsize: int | None = -1) -> int: ... def read(self, size: int = -1) -> AnyStr: ... def readline(self, size: int = -1) -> AnyStr: ... diff --git a/stubs/pika/pika/connection.pyi b/stubs/pika/pika/connection.pyi index 551bed550798..99eace9f7218 100644 --- a/stubs/pika/pika/connection.pyi +++ b/stubs/pika/pika/connection.pyi @@ -58,66 +58,82 @@ class Parameters: def __init__(self) -> None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... + @property def blocked_connection_timeout(self) -> float | None: ... @blocked_connection_timeout.setter def blocked_connection_timeout(self, value: float | None) -> None: ... + @property def channel_max(self) -> int: ... @channel_max.setter def channel_max(self, value: int) -> None: ... + @property def client_properties(self) -> dict[Incomplete, Incomplete] | None: ... @client_properties.setter def client_properties(self, value: dict[Incomplete, Incomplete] | None) -> None: ... + @property def connection_attempts(self) -> int: ... @connection_attempts.setter def connection_attempts(self, value: int) -> None: ... + @property def credentials(self) -> _Credentials: ... @credentials.setter def credentials(self, value: _Credentials) -> None: ... + @property def frame_max(self) -> int: ... @frame_max.setter def frame_max(self, value: int) -> None: ... + @property def heartbeat(self) -> int | Callable[[Connection, int], int] | None: ... @heartbeat.setter def heartbeat(self, value: int | Callable[[Connection, int], int] | None) -> None: ... + @property def host(self) -> str: ... @host.setter def host(self, value: str) -> None: ... + @property def locale(self) -> str: ... @locale.setter def locale(self, value: str) -> None: ... + @property def port(self) -> int: ... @port.setter def port(self, value: int | str) -> None: ... + @property def retry_delay(self) -> int | float: ... @retry_delay.setter def retry_delay(self, value: float) -> None: ... + @property def socket_timeout(self) -> float | None: ... @socket_timeout.setter def socket_timeout(self, value: float | None) -> None: ... + @property def stack_timeout(self) -> float | None: ... @stack_timeout.setter def stack_timeout(self, value: float | None) -> None: ... + @property def ssl_options(self) -> SSLOptions | None: ... @ssl_options.setter def ssl_options(self, value: SSLOptions | None) -> None: ... + @property def virtual_host(self) -> str: ... @virtual_host.setter def virtual_host(self, value: str) -> None: ... + @property def tcp_options(self) -> dict[Incomplete, Incomplete] | None: ... @tcp_options.setter diff --git a/stubs/pika/pika/validators.pyi b/stubs/pika/pika/validators.pyi index b9540bd66179..8fea4a8e7343 100644 --- a/stubs/pika/pika/validators.pyi +++ b/stubs/pika/pika/validators.pyi @@ -5,8 +5,10 @@ def require_string(value: object, value_name: str) -> None: ... # raise TypeErr def require_callback( callback: object, callback_name: str = "callback" ) -> None: ... # raise TypeError if callback is not callable + @overload def rpc_completion_callback(callback: None) -> Literal[True]: ... @overload def rpc_completion_callback(callback: Callable[..., object]) -> Literal[False]: ... + def zero_or_greater(name: str, value: str | float) -> None: ... diff --git a/stubs/polib/polib.pyi b/stubs/polib/polib.pyi index 2bc1171fb9c2..a41fe1dea93a 100644 --- a/stubs/polib/polib.pyi +++ b/stubs/polib/polib.pyi @@ -15,10 +15,12 @@ default_encoding: str def pofile(pofile: str | Path, *, klass: type[_TP], **kwargs: Any) -> _TP: ... @overload def pofile(pofile: str | Path, **kwargs: Any) -> POFile: ... + @overload def mofile(mofile: str, *, klass: type[_TM], **kwargs: Any) -> _TM: ... @overload def mofile(mofile: str, **kwargs: Any) -> MOFile: ... + def detect_encoding(file: bytes | str, binary_mode: bool = ...) -> str: ... def escape(st: str) -> str: ... def unescape(st: str) -> str: ... diff --git a/stubs/pony/pony/orm/dbproviders/sqlite.pyi b/stubs/pony/pony/orm/dbproviders/sqlite.pyi index 89f8baa53f73..d7b984d30c5d 100644 --- a/stubs/pony/pony/orm/dbproviders/sqlite.pyi +++ b/stubs/pony/pony/orm/dbproviders/sqlite.pyi @@ -176,6 +176,7 @@ def py_array_subset(array, items): ... def py_array_length(array): ... def py_array_slice(array, start, stop): ... def py_make_array(*items): ... + @overload def py_string_slice(s: None, start: str | int | None, end: str | int | None) -> None: ... @overload diff --git a/stubs/pony/pony/utils/utils.pyi b/stubs/pony/pony/utils/utils.pyi index 79f9e6cb83b0..4817e48c40ab 100644 --- a/stubs/pony/pony/utils/utils.pyi +++ b/stubs/pony/pony/utils/utils.pyi @@ -23,6 +23,7 @@ cut_traceback_depth: int def reraise(exc_type: Unused, exc: None, tb: TracebackType | None) -> None: ... @overload def reraise(exc_type: Unused, exc: BaseException, tb: TracebackType | None) -> NoReturn: ... + def throw(exc_type: Exception | Callable[..., Exception], *args, **kwargs) -> NoReturn: ... def truncate_repr(s: object, max_len: int = 100) -> str: ... @@ -58,10 +59,12 @@ def strjoin( ) -> str | bytes: ... def count(*args, **kwargs): ... def avg(iter: Iterable[float | None]) -> float | None: ... + @overload def group_concat(items: None, sep: str = ",") -> None: ... @overload def group_concat(items: Iterable[object], sep: str = ",") -> str: ... + def coalesce(*args: Any) -> Any: ... def distinct(iter): ... def concat(*args) -> str: ... diff --git a/stubs/protobuf/google/protobuf/internal/containers.pyi b/stubs/protobuf/google/protobuf/internal/containers.pyi index 37f681eb2d2f..bb48c5bb6ddd 100644 --- a/stubs/protobuf/google/protobuf/internal/containers.pyi +++ b/stubs/protobuf/google/protobuf/internal/containers.pyi @@ -19,10 +19,12 @@ class _ValueChecker(Protocol[_T]): class BaseContainer(Sequence[_T]): __slots__ = ["_message_listener", "_values"] def __init__(self, message_listener: MessageListener) -> None: ... + @overload def __getitem__(self, key: SupportsIndex) -> _T: ... @overload def __getitem__(self, key: slice) -> list[_T]: ... + def __len__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __hash__(self) -> int: ... @@ -41,10 +43,12 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV], MutableSequence[_Sca def MergeFrom(self, other: RepeatedScalarFieldContainer[_ScalarV] | Iterable[_ScalarV]) -> None: ... def remove(self, elem: _ScalarV) -> None: ... def pop(self, key: int = -1) -> _ScalarV: ... + @overload def __setitem__(self, key: int, value: _ScalarV) -> None: ... @overload def __setitem__(self, key: slice, value: Iterable[_ScalarV]) -> None: ... + def __delitem__(self, key: int | slice) -> None: ... def __eq__(self, other: object) -> bool: ... def __deepcopy__(self, unused_memo: Any = None) -> RepeatedScalarFieldContainer[_ScalarV]: ... @@ -60,10 +64,12 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV], MutableSequence[ def MergeFrom(self, other: RepeatedCompositeFieldContainer[_MessageV] | Iterable[_MessageV]) -> None: ... def remove(self, elem: _MessageV) -> None: ... def pop(self, key: int = -1) -> _MessageV: ... + @overload def __setitem__(self, key: int, value: _MessageV) -> None: ... @overload def __setitem__(self, key: slice, value: Iterable[_MessageV]) -> None: ... + def __delitem__(self, key: int | slice) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -77,12 +83,14 @@ class ScalarMap(MutableMapping[_K, _ScalarV]): entry_descriptor: Descriptor, ) -> None: ... def __getitem__(self, key: _K) -> _ScalarV: ... + @overload def get(self, key: _K, default: None = None) -> _ScalarV | None: ... @overload def get(self, key: _K, default: _ScalarV) -> _ScalarV: ... @overload def get(self, key: _K, default: _T) -> _ScalarV | _T: ... + def __setitem__(self, key: _K, value: _ScalarV) -> None: ... def __delitem__(self, key: _K) -> None: ... def __len__(self) -> int: ... @@ -105,12 +113,14 @@ class MessageMap(MutableMapping[_K, _MessageV]): ) -> None: ... def __getitem__(self, key: _K) -> _MessageV: ... def get_or_create(self, key: _K) -> _MessageV: ... + @overload def get(self, key: _K, default: None = None) -> _MessageV | None: ... @overload def get(self, key: _K, default: _MessageV) -> _MessageV: ... @overload def get(self, key: _K, default: _T) -> _MessageV | _T: ... + def __setitem__(self, key: _K, value: _MessageV) -> None: ... def __delitem__(self, key: _K) -> None: ... def __len__(self) -> int: ... diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index c54581f8d668..b49b1a1fb3d4 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -171,10 +171,12 @@ class Process: if sys.platform != "darwin": def io_counters(self) -> _ntp.pio: ... def ionice(self, ioclass: int | None = None, value: int | None = None) -> _ntp.pionice: ... + @overload def cpu_affinity(self, cpus: None = None) -> list[int]: ... @overload def cpu_affinity(self, cpus: list[int]) -> None: ... + def memory_maps(self, grouped: bool = True) -> list[Incomplete]: ... if sys.platform == "linux": def rlimit(self, resource: int, limits: tuple[int, int] | None = None) -> tuple[int, int]: ... @@ -291,26 +293,31 @@ def wait_procs( procs: Iterable[Process], timeout: float | None = None, callback: Callable[[Process], object] | None = None ) -> tuple[list[Process], list[Process]]: ... def cpu_count(logical: bool = True) -> int | None: ... + @overload def cpu_freq(percpu: Literal[False] = False) -> _ntp.scpufreq: ... @overload def cpu_freq(percpu: Literal[True]) -> list[_ntp.scpufreq]: ... + @overload def cpu_times(percpu: Literal[False] = False) -> _ntp.scputimes: ... @overload def cpu_times(percpu: Literal[True]) -> list[_ntp.scputimes]: ... + @overload def cpu_percent(interval: float | None = None, percpu: Literal[False] = False) -> float: ... @overload def cpu_percent(interval: float | None, percpu: Literal[True]) -> list[float]: ... @overload def cpu_percent(*, percpu: Literal[True]) -> list[float]: ... + @overload def cpu_times_percent(interval: float | None = None, percpu: Literal[False] = False) -> _ntp.scputimes: ... @overload def cpu_times_percent(interval: float | None, percpu: Literal[True]) -> list[_ntp.scputimes]: ... @overload def cpu_times_percent(*, percpu: Literal[True]) -> list[_ntp.scputimes]: ... + def cpu_stats() -> _ntp.scpustats: ... def getloadavg() -> tuple[float, float, float]: ... def virtual_memory() -> _ntp.svmem: ... @@ -323,10 +330,12 @@ def disk_partitions(all: bool = False) -> list[_ntp.sdiskpart]: ... def disk_io_counters(perdisk: Literal[False] = False, nowrap: bool = True) -> _ntp.sdiskio | None: ... @overload def disk_io_counters(perdisk: Literal[True], nowrap: bool = True) -> dict[str, _ntp.sdiskio]: ... + @overload def net_io_counters(pernic: Literal[False] = False, nowrap: bool = True) -> _ntp.snetio: ... @overload def net_io_counters(pernic: Literal[True], nowrap: bool = True) -> dict[str, _ntp.snetio]: ... + def net_connections(kind: str = "inet") -> list[_ntp.sconn]: ... def net_if_addrs() -> dict[str, list[_ntp.snicaddr]]: ... def net_if_stats() -> dict[str, _ntp.snicstats]: ... diff --git a/stubs/psutil/psutil/_common.pyi b/stubs/psutil/psutil/_common.pyi index cf2899c3e897..e7a974bc77cc 100644 --- a/stubs/psutil/psutil/_common.pyi +++ b/stubs/psutil/psutil/_common.pyi @@ -113,6 +113,7 @@ def supports_ipv6() -> bool: ... def parse_environ_block(data: str) -> dict[str, str]: ... def sockfam_to_enum(num: int) -> AddressFamily: ... def socktype_to_enum(num: int) -> SocketKind: ... + @overload def conn_to_ntuple( fd: int, @@ -135,6 +136,7 @@ def conn_to_ntuple( status_map: dict[int, str] | dict[str, str], pid: None = None, ) -> ntp.pconn: ... + def deprecated_method(replacement: str) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... class _WrapNumbers: @@ -156,16 +158,19 @@ class _WrapNumbers: def wrap_numbers(input_dict: dict[str, tuple[int, ...]], name: str) -> dict[str, tuple[int, ...]]: ... def open_binary(fname: FileDescriptorOrPath) -> BinaryIO: ... def open_text(fname: FileDescriptorOrPath) -> io.TextIOWrapper: ... + @overload def cat(fname: FileDescriptorOrPath, _open: Callable[[FileDescriptorOrPath], io.TextIOWrapper] = ...) -> str: ... @overload def cat( fname: FileDescriptorOrPath, fallback: _T = ..., _open: Callable[[FileDescriptorOrPath], io.TextIOWrapper] = ... ) -> str | _T: ... + @overload def bcat(fname: FileDescriptorOrPath) -> str: ... @overload def bcat(fname: FileDescriptorOrPath, fallback: _T = ...) -> str | _T: ... + def bytes2human(n: int, format: str = "%(value).1f%(symbol)s") -> str: ... def get_procfs_path() -> str: ... def decode(s: bytes) -> str: ... diff --git a/stubs/psutil/psutil/_psaix.pyi b/stubs/psutil/psutil/_psaix.pyi index ab19f874f660..195fd25591e2 100644 --- a/stubs/psutil/psutil/_psaix.pyi +++ b/stubs/psutil/psutil/_psaix.pyi @@ -72,6 +72,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw def net_connections(kind: str, _pid: Literal[-1] = -1) -> list[ntp.sconn]: ... @overload def net_connections(kind: str, _pid: int = -1) -> list[ntp.pconn]: ... + def net_if_stats() -> dict[str, ntp.snicstats]: ... def boot_time() -> float: ... def users() -> list[ntp.suser]: ... diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index 64397342e8cb..7b7a18140705 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -206,6 +206,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw def cpu_affinity_get(self) -> list[int]: ... # only FreeBSD def cpu_affinity_set(self, cpus: list[int]) -> None: ... # only FreeBSD def memory_maps(self) -> list[tuple[str, str, str, int, int, int, int]]: ... # only FreeBSD + @overload def rlimit(self, resource: int, limits: tuple[int, int]) -> None: ... # only FreeBSD @overload diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index a6bfbe6103f9..34bb16456b44 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -104,6 +104,7 @@ if sys.platform == "linux": def process_unix( file: FileDescriptorOrPath, family: int, inodes: dict[str, list[tuple[int, int]]], filter_pid: int | None = None ) -> Generator[tuple[int, int, int, str, str, str, int | None]]: ... + @overload def retrieve(self, kind: str, pid: int) -> list[ntp.pconn]: ... @overload @@ -167,10 +168,12 @@ if sys.platform == "linux": def cpu_affinity_set(self, cpus: Sequence[int]) -> None: ... def ionice_get(self) -> ntp.pionice: ... def ionice_set(self, ioclass: int, value: int | None) -> None: ... + @overload def rlimit(self, resource_: int, limits: tuple[int, int]) -> None: ... @overload def rlimit(self, resource_: int, limits: None = None) -> tuple[int, int]: ... + def status(self) -> str: ... def open_files(self) -> list[ntp.popenfile]: ... def net_connections(self, kind: str = "inet") -> list[ntp.pconn]: ... diff --git a/stubs/psutil/psutil/_pssunos.pyi b/stubs/psutil/psutil/_pssunos.pyi index 62e154832d0c..d1e3b6dba4aa 100644 --- a/stubs/psutil/psutil/_pssunos.pyi +++ b/stubs/psutil/psutil/_pssunos.pyi @@ -95,6 +95,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw def net_connections(kind: str, _pid: Literal[-1] = -1) -> list[ntp.sconn]: ... @overload def net_connections(kind: str, _pid: int = -1) -> list[ntp.pconn]: ... + def net_if_stats() -> dict[str, ntp.snicstats]: ... def boot_time() -> float: ... def users() -> list[ntp.suser]: ... diff --git a/stubs/psutil/psutil/_psutil_bsd.pyi b/stubs/psutil/psutil/_psutil_bsd.pyi index 2d876cd2cf9f..9aabf5116d03 100644 --- a/stubs/psutil/psutil/_psutil_bsd.pyi +++ b/stubs/psutil/psutil/_psutil_bsd.pyi @@ -108,6 +108,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw def cpu_times() -> tuple[float, float, float, float, float]: ... def disk_io_counters() -> dict[str, tuple[int, ...]]: ... # tuple's length depends on OS def disk_partitions() -> list[tuple[str, str, str, str]]: ... + @overload # for FreeBSD def net_connections( af_filter: Sequence[AddressFamily | int | None], type_filter: Sequence[SocketKind | int | None], / @@ -122,6 +123,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw ]: ... @overload # for NetBSD def net_connections(pid: int, kind: str, /) -> list[tuple[int, int, int, str, str, int, int]]: ... + def net_io_counters() -> dict[str, tuple[int, int, int, int, int, int, int, int]]: ... def per_cpu_times() -> list[tuple[float, float, float, float, float]]: ... def pids() -> list[int]: ... @@ -130,10 +132,12 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw def heap_trim() -> None: ... # only FreeBSD and NetBSD def users() -> list[tuple[str, str, str, float, int | None]]: ... # returns None only in OpenBSD def virtual_mem() -> tuple[int, ...]: ... # tuple's length depends on OS + @overload def cpu_freq() -> int: ... # only OpenBSD @overload def cpu_freq(core: int, /) -> tuple[int, str]: ... # only FreeBSD + def cpu_topology() -> str | None: ... # only FreeBSD def sensors_battery() -> tuple[int, int, int]: ... # only FreeBSD def sensors_cpu_temperature(core: int, /) -> tuple[int, int]: ... # only FreeBSD diff --git a/stubs/psutil/psutil/_pswindows.pyi b/stubs/psutil/psutil/_pswindows.pyi index 951ad6467fcc..8d9d89e1d783 100644 --- a/stubs/psutil/psutil/_pswindows.pyi +++ b/stubs/psutil/psutil/_pswindows.pyi @@ -86,10 +86,12 @@ if sys.platform == "win32": def cpu_stats() -> ntp.scpustats: ... def cpu_freq() -> list[ntp.scpufreq]: ... def getloadavg() -> tuple[float, float, float]: ... + @overload def net_connections(kind: str, _pid: Literal[-1] = -1) -> list[ntp.sconn]: ... @overload def net_connections(kind: str, _pid: int = -1) -> list[ntp.pconn]: ... + def net_if_stats() -> dict[str, ntp.snicstats]: ... def net_io_counters() -> dict[str, tuple[int, int, int, int, int, int, int, int]]: ... def net_if_addrs() -> list[tuple[str, int, str, str | None, None, None]]: ... @@ -98,6 +100,7 @@ if sys.platform == "win32": def users() -> list[ntp.suser]: ... def win_service_iter() -> Iterator[WindowsService]: ... def win_service_get(name: str) -> WindowsService: ... + @type_check_only class _WindowsServiceAttrs(TypedDict): name: str @@ -128,10 +131,12 @@ if sys.platform == "win32": ppid_map = _psutil_windows.ppid_map def is_permission_err(exc: OSError) -> bool: ... + @overload def convert_oserror(exc: PermissionError, pid: int | None = None, name: str | None = None) -> AccessDenied: ... @overload def convert_oserror(exc: OSError, pid: int | None = None, name: str | None = None) -> AccessDenied | NoSuchProcess: ... + def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ... def retry_error_partial_copy(fun: Callable[_P, _R]) -> Callable[_P, _R]: ... diff --git a/stubs/psycopg2/psycopg2/_psycopg.pyi b/stubs/psycopg2/psycopg2/_psycopg.pyi index aabab424befc..1461bbc002e5 100644 --- a/stubs/psycopg2/psycopg2/_psycopg.pyi +++ b/stubs/psycopg2/psycopg2/_psycopg.pyi @@ -451,24 +451,29 @@ class connection: def encoding(self) -> str: ... @property def info(self) -> ConnectionInfo: ... + @property def isolation_level(self) -> int | None: ... @isolation_level.setter def isolation_level(self, value: str | bytes | int | None, /) -> None: ... + notices: list[str] notifies: list[Notify] @property def pgconn_ptr(self) -> int | None: ... @property def protocol_version(self) -> int: ... + @property def deferrable(self) -> bool | None: ... @deferrable.setter def deferrable(self, value: Literal["default"] | bool | None, /) -> None: ... + @property def readonly(self) -> bool | None: ... @readonly.setter def readonly(self, value: Literal["default"] | bool | None, /) -> None: ... + @property def server_version(self) -> int: ... @property @@ -481,6 +486,7 @@ class connection: def cancel(self) -> None: ... def close(self) -> None: ... def commit(self) -> None: ... + @overload def cursor( self, name: str | bytes | None = None, cursor_factory: None = None, withhold: bool = False, scrollable: bool | None = None @@ -502,6 +508,7 @@ class connection: withhold: bool = False, scrollable: bool | None = None, ) -> _T_cur: ... + def fileno(self) -> int: ... def get_backend_pid(self) -> int: ... def get_dsn_parameters(self) -> dict[str, str]: ... @@ -549,6 +556,7 @@ class ReplicationConnection(connection): set_isolation_level: Any set_session: Any def __init__(self, *args, **kwargs) -> None: ... + # https://github.com/python/typeshed/issues/11282 # The return type should be exactly extras.ReplicationCursor (not _psycopg.ReplicationCursor) # See the C code: replicationConnection_init(), psyco_conn_cursor() diff --git a/stubs/psycopg2/psycopg2/_range.pyi b/stubs/psycopg2/psycopg2/_range.pyi index cc777c4774b9..254aadd5516e 100644 --- a/stubs/psycopg2/psycopg2/_range.pyi +++ b/stubs/psycopg2/psycopg2/_range.pyi @@ -62,6 +62,7 @@ class RangeCaster: subtype_oid: int, array_oid: int | None = None, ) -> None: ... + @overload def parse(self, s: None, cur: cursor | None = None) -> None: ... @overload diff --git a/stubs/punq/punq/__init__.pyi b/stubs/punq/punq/__init__.pyi index 544eff046ff4..c6b2d50fac73 100644 --- a/stubs/punq/punq/__init__.pyi +++ b/stubs/punq/punq/__init__.pyi @@ -71,6 +71,7 @@ class _ResolutionContext: class Container: registrations: _Registry def __init__(self) -> None: ... + # all kwargs are forwarded to _Registration.builder @overload def register(self, service: type[_T] | str, *, instance: _T, **kwargs: Any) -> Container: ... @@ -87,6 +88,7 @@ class Container: scope: Scope = Scope.transient, **kwargs: Any, ) -> Container: ... + def resolve_all(self, service: type[_T] | str, **kwargs: Any) -> list[_T]: ... def resolve(self, service_key: type[_T] | str, **kwargs: Any) -> _T: ... def instantiate(self, service_key: type[_T] | str, **kwargs: Any) -> _T: ... diff --git a/stubs/pycocotools/pycocotools/coco.pyi b/stubs/pycocotools/pycocotools/coco.pyi index ff0741ae0dfc..6e5af237bddb 100644 --- a/stubs/pycocotools/pycocotools/coco.pyi +++ b/stubs/pycocotools/pycocotools/coco.pyi @@ -85,10 +85,12 @@ class COCO: def loadRes(self, resFile: str) -> COCO: ... def download(self, tarDir: str | None = None, imgIds: Collection[int] = []) -> Literal[-1] | None: ... def loadNumpyAnnotations(self, data: npt.NDArray[np.float64]) -> list[_Annotation]: ... + @overload def annToRLE(self, ann: _AnnotationG[_RLE]) -> _RLE: ... @overload def annToRLE(self, ann: _AnnotationG[_EncodedRLE]) -> _EncodedRLE: ... @overload def annToRLE(self, ann: _AnnotationG[_TPolygonSegmentation]) -> _EncodedRLE: ... + def annToMask(self, ann: _Annotation) -> npt.NDArray[np.uint8]: ... diff --git a/stubs/pycocotools/pycocotools/mask.pyi b/stubs/pycocotools/pycocotools/mask.pyi index dffff2e673db..84e85c3bf215 100644 --- a/stubs/pycocotools/pycocotools/mask.pyi +++ b/stubs/pycocotools/pycocotools/mask.pyi @@ -22,6 +22,7 @@ def merge(rleObjs: list[_EncodedRLE], intersect: int = 0) -> _EncodedRLE: ... def frPyObjects(pyobj: _NDArrayUInt32 | list[list[int]] | list[_EncodedRLE], h: int, w: int) -> list[_EncodedRLE]: ... @overload def frPyObjects(pyobj: list[int] | _EncodedRLE, h: int, w: int) -> _EncodedRLE: ... + def encode(bimask: _NDArrayUInt8) -> _EncodedRLE: ... def decode(rleObjs: _EncodedRLE) -> _NDArrayUInt8: ... def area(rleObjs: _EncodedRLE) -> _NPUInt32: ... diff --git a/stubs/pyflakes/pyflakes/checker.pyi b/stubs/pyflakes/pyflakes/checker.pyi index bb3f8c09e658..4e7bc16642cb 100644 --- a/stubs/pyflakes/pyflakes/checker.pyi +++ b/stubs/pyflakes/pyflakes/checker.pyi @@ -39,6 +39,7 @@ class _FieldsOrder(dict[type[ast.AST], tuple[str, ...]]): _OmitType: TypeAlias = str | tuple[str, ...] | None def iter_child_nodes(node: ast.AST, omit: _OmitType = None, _fields_order: _FieldsOrder = ...) -> Iterator[ast.AST]: ... + @overload def convert_to_value(item: ast.Constant) -> Any: ... # type: ignore[overload-overlap] # See ast.Constant.value for possible return types @overload @@ -47,6 +48,7 @@ def convert_to_value(item: ast.Tuple) -> tuple[Any, ...]: ... # type: ignore[ov def convert_to_value(item: ast.Name) -> VariableKey: ... # type: ignore[overload-overlap] @overload def convert_to_value(item: ast.AST) -> UnhandledKeyType: ... + def is_notimplemented_name_node(node: ast.AST) -> bool: ... class Binding: @@ -185,14 +187,17 @@ class Checker: file_tokens: Unused = (), ) -> None: ... def deferFunction(self, callable: Callable[..., Any]) -> None: ... + @property def futuresAllowed(self) -> bool: ... @futuresAllowed.setter def futuresAllowed(self, value: Literal[False]) -> None: ... + @property def annotationsFutureEnabled(self) -> bool: ... @annotationsFutureEnabled.setter def annotationsFutureEnabled(self, value: Literal[True]) -> None: ... + @property def scope(self) -> Scope: ... @contextmanager diff --git a/stubs/pyinstaller/PyInstaller/compat.pyi b/stubs/pyinstaller/PyInstaller/compat.pyi index 2bd29fe23688..24b2864d2b64 100644 --- a/stubs/pyinstaller/PyInstaller/compat.pyi +++ b/stubs/pyinstaller/PyInstaller/compat.pyi @@ -54,10 +54,12 @@ machine: Final[ ] def is_wine_dll(filename: FileDescriptorOrPath) -> bool: ... + @overload def getenv(name: str, default: str) -> str: ... @overload def getenv(name: str, default: None = None) -> str | None: ... + def setenv(name: str, value: str) -> None: ... def unsetenv(name: str) -> None: ... def exec_command( diff --git a/stubs/pyjks/jks/jks.pyi b/stubs/pyjks/jks/jks.pyi index fb1e814864a1..7d3bb7d7e0d4 100644 --- a/stubs/pyjks/jks/jks.pyi +++ b/stubs/pyjks/jks/jks.pyi @@ -44,6 +44,7 @@ class PrivateKeyEntry(AbstractKeystoreEntry): def pkey_pkcs8(self) -> bytes: ... @property def algorithm_oid(self) -> tuple[int, ...]: ... + # NB! For most use cases, use PrivateKeyEntry.new() classmethod. # Overloaded: must provide `encrypted` OR `pkey`, `pkey_pkcs8`, `algorithm_oid` @overload @@ -70,6 +71,7 @@ class PrivateKeyEntry(AbstractKeystoreEntry): timestamp: int, **kwargs: Unused, ) -> None: ... + @classmethod def new( # type: ignore[override] cls, alias: str, certs: Iterable[bytes], key: bytes, key_format: _KeyFormat = "pkcs8" @@ -84,6 +86,7 @@ class SecretKeyEntry(AbstractKeystoreEntry): def key(self) -> bytes: ... @property def key_size(self) -> int: ... + # Overloaded: must provide `sealed_obj` OR `algorithm`, `key`, `key_size` @overload def __init__( @@ -101,6 +104,7 @@ class SecretKeyEntry(AbstractKeystoreEntry): timestamp: int, **kwargs: Unused, ) -> None: ... + # Not implemented by pyjks @classmethod def new( # type: ignore[override] diff --git a/stubs/pyluach/pyluach/dates.pyi b/stubs/pyluach/pyluach/dates.pyi index f4d1f8d78608..479c4b53be35 100644 --- a/stubs/pyluach/pyluach/dates.pyi +++ b/stubs/pyluach/pyluach/dates.pyi @@ -24,10 +24,12 @@ class BaseDate(abc.ABC, metaclass=abc.ABCMeta): def to_heb(self) -> HebrewDate: ... def __hash__(self) -> int: ... def __add__(self, other: float) -> BaseDate: ... + @overload def __sub__(self, other: float) -> BaseDate: ... @overload def __sub__(self, other: BaseDate) -> int: ... + def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... def __lt__(self, other: object) -> bool: ... diff --git a/stubs/pyluach/pyluach/hebrewcal.pyi b/stubs/pyluach/pyluach/hebrewcal.pyi index 4eed2968f558..925354719149 100644 --- a/stubs/pyluach/pyluach/hebrewcal.pyi +++ b/stubs/pyluach/pyluach/hebrewcal.pyi @@ -34,10 +34,12 @@ class Year: def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __add__(self, other: int) -> Year: ... + @overload def __sub__(self, other: int) -> Year: ... @overload def __sub__(self, other: Year) -> int: ... + def __gt__(self, other: Year) -> bool: ... def __ge__(self, other: Year) -> bool: ... def __lt__(self, other: Year) -> bool: ... @@ -61,10 +63,12 @@ class Month: def __iter__(self) -> Generator[int]: ... def __eq__(self, other: object) -> bool: ... def __add__(self, other: int) -> Month: ... + @overload def __sub__(self, other: int) -> Month: ... @overload def __sub__(self, other: Month) -> int: ... + def __gt__(self, other: Month) -> bool: ... def __ge__(self, other: Month) -> bool: ... def __lt__(self, other: Month) -> bool: ... @@ -95,10 +99,12 @@ class HebrewCalendar(calendar.Calendar): hebrewmonths: bool = False, hebrewyear: bool = False, ) -> None: ... + @property def firstweekday(self) -> int: ... @firstweekday.setter def firstweekday(self, thefirstweekday: int) -> None: ... + def iterweekdays(self) -> Generator[int]: ... def itermonthdates(self, year: int, month: int) -> Generator[HebrewDate]: ... # type: ignore[override] def itermonthdays(self, year: int, month: int) -> Generator[int]: ... diff --git a/stubs/pynput/pynput/mouse/_base.pyi b/stubs/pynput/pynput/mouse/_base.pyi index 4874e3be814f..9ae82dd422df 100644 --- a/stubs/pynput/pynput/mouse/_base.pyi +++ b/stubs/pynput/pynput/mouse/_base.pyi @@ -46,10 +46,12 @@ class Button(enum.Enum): class Controller: def __init__(self) -> None: ... + @property def position(self) -> tuple[int, int]: ... @position.setter def position(self, position: tuple[int, int]) -> None: ... + def scroll(self, dx: int, dy: int) -> None: ... def press(self, button: Button) -> None: ... def release(self, button: Button) -> None: ... diff --git a/stubs/pyserial/serial/serialutil.pyi b/stubs/pyserial/serial/serialutil.pyi index 3b6f84adee50..9e956eacbff0 100644 --- a/stubs/pyserial/serial/serialutil.pyi +++ b/stubs/pyserial/serial/serialutil.pyi @@ -79,70 +79,87 @@ class SerialBase(io.RawIOBase): def read(self, size: int = -1, /) -> bytes: ... @abstractmethod def write(self, b: ReadableBuffer, /) -> int | None: ... + @property def port(self) -> str | None: ... @port.setter def port(self, port: str | None) -> None: ... + @property def baudrate(self) -> int: ... @baudrate.setter def baudrate(self, baudrate: int) -> None: ... + @property def bytesize(self) -> int: ... @bytesize.setter def bytesize(self, bytesize: int) -> None: ... + @property def exclusive(self) -> bool | None: ... @exclusive.setter def exclusive(self, exclusive: bool | None) -> None: ... + @property def parity(self) -> str: ... @parity.setter def parity(self, parity: str) -> None: ... + @property def stopbits(self) -> float: ... @stopbits.setter def stopbits(self, stopbits: float) -> None: ... + @property def timeout(self) -> float | None: ... @timeout.setter def timeout(self, timeout: float | None) -> None: ... + @property def write_timeout(self) -> float | None: ... @write_timeout.setter def write_timeout(self, timeout: float | None) -> None: ... + @property def inter_byte_timeout(self) -> float | None: ... @inter_byte_timeout.setter def inter_byte_timeout(self, ic_timeout: float | None) -> None: ... + @property def xonxoff(self) -> bool: ... @xonxoff.setter def xonxoff(self, xonxoff: bool) -> None: ... + @property def rtscts(self) -> bool: ... @rtscts.setter def rtscts(self, rtscts: bool) -> None: ... + @property def dsrdtr(self) -> bool: ... @dsrdtr.setter def dsrdtr(self, dsrdtr: bool | None = ...) -> None: ... + @property def rts(self) -> bool: ... @rts.setter def rts(self, value: bool) -> None: ... + @property def dtr(self) -> bool: ... @dtr.setter def dtr(self, value: bool) -> None: ... + @property def break_condition(self) -> bool: ... @break_condition.setter def break_condition(self, value: bool) -> None: ... + @property def rs485_mode(self) -> RS485Settings | None: ... @rs485_mode.setter def rs485_mode(self, rs485_settings: RS485Settings | None) -> None: ... + def get_settings(self) -> dict[str, Any]: ... def apply_settings(self, d: dict[str, Any]) -> None: ... def readinto(self, buffer: WriteableBuffer, /) -> int: ... # returns int unlike `io.RawIOBase` diff --git a/stubs/pyserial/serial/urlhandler/protocol_spy.pyi b/stubs/pyserial/serial/urlhandler/protocol_spy.pyi index 9020d7e07690..29b45167dc76 100644 --- a/stubs/pyserial/serial/urlhandler/protocol_spy.pyi +++ b/stubs/pyserial/serial/urlhandler/protocol_spy.pyi @@ -5,6 +5,7 @@ import serial def sixteen(data: bytes) -> Generator[tuple[str, str] | tuple[None, None]]: ... def hexdump(data: bytes) -> Generator[tuple[int, str]]: ... + @type_check_only class _Formatter: def rx(self, data: bytes) -> None: ... diff --git a/stubs/pysftp/pysftp/__init__.pyi b/stubs/pysftp/pysftp/__init__.pyi index 775a72e6ae0f..18ce302951c9 100644 --- a/stubs/pysftp/pysftp/__init__.pyi +++ b/stubs/pysftp/pysftp/__init__.pyi @@ -120,10 +120,12 @@ class Connection: def security_options(self) -> paramiko.SecurityOptions: ... @property def logfile(self) -> str | Literal[False]: ... + @property def timeout(self) -> float | None: ... @timeout.setter def timeout(self, val: float | None) -> None: ... + @property def remote_server_key(self) -> paramiko.PKey: ... def __del__(self) -> None: ... diff --git a/stubs/pysftp/pysftp/helpers.pyi b/stubs/pysftp/pysftp/helpers.pyi index 7967be313ae2..1d400d7bfebe 100644 --- a/stubs/pysftp/pysftp/helpers.pyi +++ b/stubs/pysftp/pysftp/helpers.pyi @@ -10,14 +10,17 @@ class WTCallbacks: def file_cb(self, pathname: str) -> None: ... def dir_cb(self, pathname: str) -> None: ... def unk_cb(self, pathname: str) -> None: ... + @property def flist(self) -> list[str]: ... @flist.setter def flist(self, val: list[str]) -> None: ... + @property def dlist(self) -> list[str]: ... @dlist.setter def dlist(self, val: list[str]) -> None: ... + @property def ulist(self) -> list[str]: ... @ulist.setter diff --git a/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi b/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi index bf57b15813f4..3f9f07febe87 100644 --- a/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +++ b/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi @@ -11,4 +11,5 @@ class LazyFixture: def lazy_fixture(names: str) -> LazyFixture: ... @overload def lazy_fixture(names: Iterable[str]) -> list[LazyFixture] | Any: ... + def is_lazy_fixture(val: object) -> TypeIs[LazyFixture]: ... diff --git a/stubs/python-crontab/crontab.pyi b/stubs/python-crontab/crontab.pyi index c7ca54a2f581..9d215a2abfcb 100644 --- a/stubs/python-crontab/crontab.pyi +++ b/stubs/python-crontab/crontab.pyi @@ -159,18 +159,22 @@ class CronItem: def frequency_per_day(self) -> int: ... def frequency_per_hour(self) -> int: ... def frequency_at_year(self, year: int | None = None) -> int: ... + @overload def frequency_at_month(self, year: int, month: int) -> int: ... @overload def frequency_at_month(self, year: None = None, month: None = None) -> int: ... + @overload def frequency_at_day(self, year: int, month: int, day: int) -> int: ... @overload def frequency_at_day(self, year: None = None, month: None = None, day: None = None) -> int: ... + @overload def frequency_at_hour(self, year: int, month: int, day: int, hour: int) -> int: ... @overload def frequency_at_hour(self, year: None = None, month: None = None, day: None = None, hour: None = None) -> int: ... + def run_pending(self, now: datetime | None = ...) -> int | str: ... def run(self) -> str: ... def schedule(self, date_from: datetime | None = ...) -> croniter: ... @@ -233,18 +237,22 @@ class CronSlices(list[CronSlice]): def frequency_per_day(self) -> int: ... def frequency_per_hour(self) -> int: ... def frequency_at_year(self, year: int | None = None) -> int: ... + @overload def frequency_at_month(self, year: int, month: int) -> int: ... @overload def frequency_at_month(self, year: None = None, month: None = None) -> int: ... + @overload def frequency_at_day(self, year: int, month: int, day: int) -> int: ... @overload def frequency_at_day(self, year: None = None, month: None = None, day: None = None) -> int: ... + @overload def frequency_at_hour(self, year: int, month: int, day: int, hour: int) -> int: ... @overload def frequency_at_hour(self, year: None = None, month: None = None, day: None = None, hour: None = None) -> int: ... + def __eq__(self, arg: object) -> bool: ... class SundayError(KeyError): ... diff --git a/stubs/python-dateutil/dateutil/parser/_parser.pyi b/stubs/python-dateutil/dateutil/parser/_parser.pyi index facc5ea1e5b6..e25d466f2e2c 100644 --- a/stubs/python-dateutil/dateutil/parser/_parser.pyi +++ b/stubs/python-dateutil/dateutil/parser/_parser.pyi @@ -77,6 +77,7 @@ class _ymd(list[int]): class parser: info: parserinfo def __init__(self, info: parserinfo | None = None) -> None: ... + @overload def parse( self, diff --git a/stubs/python-dateutil/dateutil/relativedelta.pyi b/stubs/python-dateutil/dateutil/relativedelta.pyi index 7214673c2da1..e8f2528a9ac6 100644 --- a/stubs/python-dateutil/dateutil/relativedelta.pyi +++ b/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -60,23 +60,29 @@ class relativedelta: second: int | None = None, microsecond: int | None = None, ) -> None: ... + @property def weeks(self) -> int: ... @weeks.setter def weeks(self, value: int) -> None: ... + def normalized(self) -> Self: ... + @overload def __add__(self, other: timedelta | relativedelta) -> Self: ... @overload def __add__(self, other: _DateT) -> _DateT: ... + @overload def __radd__(self, other: timedelta | relativedelta) -> Self: ... @overload def __radd__(self, other: _DateT) -> _DateT: ... + @overload def __rsub__(self, other: timedelta | relativedelta) -> Self: ... @overload def __rsub__(self, other: _DateT) -> _DateT: ... + def __sub__(self, other: relativedelta) -> Self: ... def __neg__(self) -> Self: ... def __bool__(self) -> bool: ... diff --git a/stubs/python-dateutil/dateutil/zoneinfo/__init__.pyi b/stubs/python-dateutil/dateutil/zoneinfo/__init__.pyi index 687e3f563a89..adee85032da2 100644 --- a/stubs/python-dateutil/dateutil/zoneinfo/__init__.pyi +++ b/stubs/python-dateutil/dateutil/zoneinfo/__init__.pyi @@ -25,6 +25,7 @@ class ZoneInfoFile: zones: dict[str, _tzfile] metadata: _MetadataType | None def __init__(self, zonefile_stream: _Fileobj | None = None) -> None: ... + @overload def get(self, name: str, default: None = None) -> _tzfile | None: ... @overload diff --git a/stubs/python-http-client/python_http_client/exceptions.pyi b/stubs/python-http-client/python_http_client/exceptions.pyi index d896698698c1..6fc504b17b57 100644 --- a/stubs/python-http-client/python_http_client/exceptions.pyi +++ b/stubs/python-http-client/python_http_client/exceptions.pyi @@ -7,10 +7,12 @@ class HTTPError(Exception): reason: str body: bytes headers: Message + @overload def __init__(self, status_code: int, reason: str, body: bytes, headers: Message, /) -> None: ... @overload def __init__(self, http_error: _HTTPError, /) -> None: ... + def __reduce__(self) -> tuple[type[HTTPError], tuple[int, str, bytes, Message]]: ... @property def to_dict(self) -> dict[str, Any]: ... # dict of response error from the API diff --git a/stubs/python-jenkins/jenkins/__init__.pyi b/stubs/python-jenkins/jenkins/__init__.pyi index 67182d33b61b..7c5b4663e8a6 100644 --- a/stubs/python-jenkins/jenkins/__init__.pyi +++ b/stubs/python-jenkins/jenkins/__init__.pyi @@ -154,6 +154,7 @@ class Jenkins: def create_job(self, name: str, config_xml: str) -> None: ... def get_job_config(self, name: str) -> str: ... def reconfig_job(self, name: str, config_xml: str) -> None: ... + @overload def build_job_url( self, @@ -169,6 +170,7 @@ class Jenkins: def build_job_url( self, name: str, parameters: dict[str, Incomplete] | list[tuple[str, Incomplete]] | None = None, *, token: str ) -> str: ... + @overload def build_job( self, @@ -184,6 +186,7 @@ class Jenkins: def build_job( self, name: str, parameters: dict[str, Incomplete] | list[tuple[str, Incomplete]] | None = None, *, token: str ) -> int: ... + def run_script(self, script: str, node: str | None = None) -> str: ... def install_plugin(self, name: str, include_dependencies: bool = True) -> bool: ... def stop_build(self, name: str, number: int) -> None: ... diff --git a/stubs/python-xlib/Xlib/display.pyi b/stubs/python-xlib/Xlib/display.pyi index 8ee8b6df0c36..c1cda16e88bf 100644 --- a/stubs/python-xlib/Xlib/display.pyi +++ b/stubs/python-xlib/Xlib/display.pyi @@ -54,6 +54,7 @@ class Display: def next_event(self) -> rq.Event: ... def pending_events(self) -> int: ... def has_extension(self, extension: str) -> bool: ... + @overload def create_resource_object(self, type: Literal["resource"], id: int) -> resource.Resource: ... @overload @@ -74,6 +75,7 @@ class Display: def create_resource_object(self, type: Literal["cursor"], id: int) -> cursor.Cursor: ... @overload def create_resource_object(self, type: str, id: int) -> resource.Resource: ... + def __getattr__(self, attr: str) -> MethodType: ... def screen(self, sno: int | None = None) -> rq.Struct: ... def screen_count(self) -> int: ... diff --git a/stubs/python-xlib/Xlib/protocol/display.pyi b/stubs/python-xlib/Xlib/protocol/display.pyi index 04f7be30313c..b099d6463f0a 100644 --- a/stubs/python-xlib/Xlib/protocol/display.pyi +++ b/stubs/python-xlib/Xlib/protocol/display.pyi @@ -13,14 +13,17 @@ _T = TypeVar("_T") class bytesview: view: memoryview + @overload def __init__(self, data: bytes | bytesview, offset: int, size: int) -> None: ... @overload def __init__(self, data: SizedBuffer, offset: int = 0, size: int | None = None) -> None: ... + @overload def __getitem__(self, key: slice) -> bytes: ... @overload def __getitem__(self, key: int) -> int: ... + def __len__(self) -> int: ... class Display: @@ -69,6 +72,7 @@ class Display: def set_error_handler(self, handler: ErrorHandler[object] | None) -> None: ... def allocate_resource_id(self) -> int: ... def free_resource_id(self, rid: int) -> None: ... + @overload def get_resource_class(self, class_name: Literal["resource"], default: object = None) -> type[resource.Resource]: ... @overload @@ -91,6 +95,7 @@ class Display: def get_resource_class(self, class_name: str, default: _T) -> type[_ResourceBaseClass] | _T: ... @overload def get_resource_class(self, class_name: str, default: None = None) -> type[_ResourceBaseClass] | None: ... + def set_extension_major(self, extname: str, major: int) -> None: ... def get_extension_major(self, extname: str) -> int: ... def add_extension_event(self, code: int, evt: type[rq.Event], subcode: int | None = None) -> None: ... diff --git a/stubs/python-xlib/Xlib/protocol/rq.pyi b/stubs/python-xlib/Xlib/protocol/rq.pyi index 689e7cd5dfd7..af22cf3d0b34 100644 --- a/stubs/python-xlib/Xlib/protocol/rq.pyi +++ b/stubs/python-xlib/Xlib/protocol/rq.pyi @@ -107,10 +107,12 @@ class Resource(Card32): class_name: str codes: tuple[int, ...] def __init__(self, name: str, codes: tuple[int, ...] = (), default: int | None = None) -> None: ... + @overload # type: ignore[override] def check_value(self, value: Callable[[], _T]) -> _T: ... @overload def check_value(self, value: _T) -> _T: ... + def parse_value(self, value: int, display: _BaseDisplay) -> int: ... # type: ignore[override] # display: None will error. See: https://github.com/python-xlib/python-xlib/pull/248 class Window(Resource): @@ -169,6 +171,7 @@ class Binary(ValueField): def pack_value( # type: ignore[override] # Override Callable self, val: bytes | bytearray ) -> tuple[bytes | bytearray, int, None]: ... + @overload # type: ignore[override] # Overload for specific values def parse_binary_value(self, data: _T, display: Unused, length: None, format: Unused) -> tuple[_T, Literal[b""]]: ... @overload @@ -181,6 +184,7 @@ class String8(ValueField): pad: int def __init__(self, name: str, pad: int = 1) -> None: ... def pack_value(self, val: bytes | str) -> tuple[bytes, int, None]: ... # type: ignore[override] # Override Callable + @overload # type: ignore[override] # Overload for specific values def parse_binary_value( self, data: bytes | bytearray, display: Unused, length: None, format: Unused @@ -330,12 +334,14 @@ class Struct: def __init__(self, *fields: Field) -> None: ... def to_binary(self, *varargs: object, **keys: object) -> bytes: ... def pack_value(self, value: tuple[object, ...] | dict[str, Any] | DictWrapper) -> bytes: ... + @overload def parse_value(self, val: SliceableBuffer, display: display.Display | None, rawdict: Literal[True]) -> dict[str, Any]: ... @overload def parse_value( self, val: SliceableBuffer, display: display.Display | None, rawdict: Literal[False] = False ) -> DictWrapper: ... + @overload def parse_binary( self, data: SliceableBuffer, display: display.Display | None, rawdict: Literal[True] @@ -344,6 +350,7 @@ class Struct: def parse_binary( self, data: SliceableBuffer, display: display.Display | None, rawdict: Literal[False] = False ) -> tuple[DictWrapper, SliceableBuffer]: ... + # Structs generate their attributes # TODO: Create a specific type-only class for all instances of `Struct` @type_check_only diff --git a/stubs/python-xlib/Xlib/rdb.pyi b/stubs/python-xlib/Xlib/rdb.pyi index f0ec57c5b656..4c0ed9cdaab0 100644 --- a/stubs/python-xlib/Xlib/rdb.pyi +++ b/stubs/python-xlib/Xlib/rdb.pyi @@ -42,10 +42,12 @@ class ResourceDB: def insert_resources(self, resources: Iterable[tuple[str, object]]) -> None: ... def insert(self, resource: str, value: object) -> None: ... def __getitem__(self, keys_tuple: tuple[str, str]) -> Any: ... + @overload def get(self, res: str, cls: str, default: None = None) -> Any: ... @overload def get(self, res: str, cls: str, default: _T) -> _T: ... + def update(self, db: ResourceDB) -> None: ... def output(self) -> str: ... def getopt(self, name: str, argv: Sequence[str], opts: Mapping[str, Option]) -> Sequence[str]: ... diff --git a/stubs/pytz/pytz/tzinfo.pyi b/stubs/pytz/pytz/tzinfo.pyi index 66c707950f45..115dbc76a032 100644 --- a/stubs/pytz/pytz/tzinfo.pyi +++ b/stubs/pytz/pytz/tzinfo.pyi @@ -33,11 +33,13 @@ class DstTzInfo(BaseTzInfo): def localize(self, dt: datetime.datetime, is_dst: bool | None = False) -> datetime.datetime: ... def normalize(self, dt: datetime.datetime) -> datetime.datetime: ... def tzname(self, dt: datetime.datetime | None, is_dst: bool | None = None) -> str: ... + # https://github.com/python/mypy/issues/12379 @overload # type: ignore[override] def utcoffset(self, dt: None, is_dst: bool | None = None) -> None: ... @overload def utcoffset(self, dt: datetime.datetime, is_dst: bool | None = None) -> datetime.timedelta: ... + def dst(self, dt: datetime.datetime | None, is_dst: bool | None = None) -> datetime.timedelta | None: ... __all__: list[str] = [] diff --git a/stubs/pywin32/_win32typing.pyi b/stubs/pywin32/_win32typing.pyi index bdcc4cd282ec..936f1e810a90 100644 --- a/stubs/pywin32/_win32typing.pyi +++ b/stubs/pywin32/_win32typing.pyi @@ -81,19 +81,23 @@ class PyDSCCAPSType: class PyNCB: @property def Bufflen(self): ... + @property def Callname(self) -> str: ... @Callname.setter def Callname(self, value: str | bytes) -> None: ... + Cmd_cplt: int Command: int Event: int Lana_num: int Lsn: int + @property def Name(self) -> str: ... @Name.setter def Name(self, value: str | bytes) -> None: ... + Num: int Post: int def Reset(self) -> None: ... @@ -173,6 +177,7 @@ class PRINTER_DEFAULTS: class PyACL: def Initialize(self) -> None: ... def IsValid(self) -> bool: ... + @overload @deprecated("""\ Early versions of this function supported only two arguments. \ @@ -181,10 +186,12 @@ which reflects the win32 API and the new functions in this module.""") def AddAccessAllowedAce(self, access: int, sid: PySID, /) -> None: ... @overload def AddAccessAllowedAce(self, revision: int, access: int, sid: PySID, /) -> None: ... + def AddAccessAllowedAceEx(self, revision: int, aceflags: int, access: int, sid: PySID, /) -> None: ... def AddAccessAllowedObjectAce( self, AceRevision, AceFlags, AccessMask, ObjectTypeGuid: PyIID, InheritedObjectTypeGuid: PyIID, sid: PySID, / ) -> None: ... + @overload @deprecated("""\ Early versions of this function supported only two arguments. \ @@ -193,6 +200,7 @@ which reflects the win32 API and the new functions in this module.""") def AddAccessDeniedAce(self, access: int, sid: PySID, /) -> None: ... @overload def AddAccessDeniedAce(self, revision: int, access: int, sid: PySID, /) -> None: ... + def AddAccessDeniedAceEx(self, revision: int, aceflags: int, access: int, sid: PySID, /) -> None: ... def AddMandatoryAce(self, AceRevision, AceFlags, MandatoryPolicy, LabelSid: PySID, /) -> None: ... def AddAuditAccessAce(self, dwAceRevision, dwAccessMask, sid: PySID, bAuditSuccess, bAuditFailure, /) -> None: ... @@ -237,6 +245,7 @@ class PyCEHANDLE: ... class PyCERTSTORE: @property def HCERTSTORE(self): ... + @overload def CertCloseStore(self) -> None: ... @overload @@ -246,6 +255,7 @@ class PyCERTSTORE: always called with `CERT_CLOSE_STORE_CHECK_FLAG`, and support for this \ param will be dropped at some point in the future.""") def CertCloseStore(self, Flags: int) -> None: ... + def CertControlStore(self, Flags, CtrlType, CtrlPara: int) -> None: ... def CertEnumCertificatesInStore(self) -> list[PyCERT_CONTEXT]: ... def CertEnumCTLsInStore(self) -> list[PyCTL_CONTEXT]: ... @@ -808,6 +818,7 @@ class PyDEVMODEW: PanningHeight: int DeviceName: str FormName: str + @property def DriverData(self) -> bytes | None: ... @DriverData.setter @@ -3709,11 +3720,13 @@ class PyIInternetPriority: class PyIInternetProtocol: def Read(self, cb, /) -> None: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def Seek(self, dlibMove: tuple[int, int], dwOrigin, /) -> None: ... @overload def Seek(self, dlibMove: int, dwOrigin, /) -> None: ... + def LockRequest(self, dwOptions, /) -> None: ... def UnlockRequest(self) -> None: ... @@ -3777,22 +3790,27 @@ class PyILockBytes: def ReadAt(self, ulOffset: tuple[int, int], cb, /) -> str: ... @overload def ReadAt(self, ulOffset: int, cb, /) -> str: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def WriteAt(self, ulOffset: tuple[int, int], data: str, /): ... @overload def WriteAt(self, ulOffset: int, data: str, /): ... + def Flush(self) -> None: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def SetSize(self, cb: tuple[int, int], /) -> None: ... @overload def SetSize(self, cb: int, /) -> None: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def LockRegion(self, libOffset: tuple[int, int], cb: tuple[int, int], dwLockType, /) -> None: ... @overload def LockRegion(self, libOffset: int, cb: int, dwLockType, /) -> None: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def UnlockRegion(self, libOffset: tuple[int, int], cb: tuple[int, int], dwLockType, /) -> None: ... @@ -4591,33 +4609,40 @@ class PyIStream: def read(self, numBytes, /) -> str: ... def Write(self, data: str, /) -> None: ... def write(self, data: str, /) -> None: ... + @overload def Seek(self, offset: int, origin: int, /) -> int: ... @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def Seek(self, offset: tuple[int, int], origin: int, /) -> int: ... + @overload def SetSize(self, newSize: int, /) -> None: ... @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def SetSize(self, newSize: tuple[int, int], /) -> None: ... + @overload def CopyTo(self, stream: PyIStream, cb: int, /) -> int: ... @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def CopyTo(self, stream: PyIStream, cb: tuple[int, int], /) -> int: ... + def Commit(self, flags, /) -> None: ... def Revert(self) -> None: ... + @overload def LockRegion(self, offset: int, cb: int, lockType, /) -> None: ... @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def LockRegion(self, offset: tuple[int, int], cb: tuple[int, int], lockType, /) -> None: ... + @overload def UnLockRegion(self, offset: int, cb: int, lockType, /) -> None: ... @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def UnLockRegion(self, offset: tuple[int, int], cb: tuple[int, int], lockType, /) -> None: ... + def Clone(self) -> PyIStream: ... def Stat(self, grfStatFlag: int = ..., /) -> STATSTG: ... @@ -4759,6 +4784,7 @@ class PyPROPVARIANT: def __new__(self, Value: tuple[int, int], Type=...) -> Self: ... @overload def __new__(self, Value, Type=...) -> Self: ... + @property def vt(self): ... def GetValue(self): ... @@ -4878,12 +4904,14 @@ class PyCBitmap: /, ) -> None: ... def GetInfo(self): ... + @overload def GetBitmapBits(self, asString: Literal[False] = False, /) -> tuple[int, ...]: ... @overload def GetBitmapBits(self, asString: Literal[True], /) -> bytes: ... @overload def GetBitmapBits(self, asString: bool, /) -> tuple[int, ...] | bytes: ... + def SaveBitmapFile(self, dcObject: PyCDC, Filename: str, /): ... class PyCBrush: @@ -5999,12 +6027,14 @@ class PyCWnd: def SetWindowPos( self, hWndInsertAfter, position: tuple[Incomplete, Incomplete, Incomplete, Incomplete], flags, / ) -> None: ... + @overload def ScreenToClient(self, rect: tuple[int, int], /) -> tuple[int, int]: ... @overload def ScreenToClient(self, rect: tuple[int, int, int, int], /) -> tuple[int, int, int, int]: ... @overload def ScreenToClient(self, rect: _TwoIntSequence | _FourIntSequence, /) -> tuple[int, int] | tuple[int, int, int, int]: ... + def SetCapture(self) -> None: ... def SetDlgItemText(self, idControl, text: str, /) -> None: ... def SetFocus(self) -> None: ... diff --git a/stubs/pywin32/pythoncom.pyi b/stubs/pywin32/pythoncom.pyi index da6d35197cea..3ab9e851e98f 100644 --- a/stubs/pywin32/pythoncom.pyi +++ b/stubs/pywin32/pythoncom.pyi @@ -132,6 +132,7 @@ def StgOpenStorageOnILockBytes( ) -> _win32typing.PyIStorage: ... def StgIsStorageFile(name: str, /): ... def STGMEDIUM() -> _win32typing.PySTGMEDIUM: ... + @overload def StgOpenStorage( name: str | None, other: _win32typing.PyIStorage, mode: int, snbExclude: Unused = ..., reserved: int = ..., / @@ -140,6 +141,7 @@ def StgOpenStorage( def StgOpenStorage( name: str, other: _win32typing.PyIStorage | None, mode: int, snbExclude: Unused = ..., reserved: int = ..., / ) -> _win32typing.PyIStorage: ... + def StgOpenStorageEx( Name: str, Mode: int, stgfmt: int, Attrs: int, riid: _win32typing.PyIID, StgOptions: Incomplete | None = ... ) -> _win32typing.PyIStorage: ... diff --git a/stubs/pywin32/win32/lib/pywintypes.pyi b/stubs/pywin32/win32/lib/pywintypes.pyi index 726f7b48ab31..30be519023f1 100644 --- a/stubs/pywin32/win32/lib/pywintypes.pyi +++ b/stubs/pywin32/win32/lib/pywintypes.pyi @@ -46,6 +46,7 @@ def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... def HANDLE() -> HANDLEType: ... def HKEY() -> _win32typing.PyHKEY: ... def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def TimeStamp(timestamp: tuple[int, int], /) -> TimeType: ... diff --git a/stubs/pywin32/win32/lib/win32gui_struct.pyi b/stubs/pywin32/win32/lib/win32gui_struct.pyi index 0bce3711549e..fd8708e0f738 100644 --- a/stubs/pywin32/win32/lib/win32gui_struct.pyi +++ b/stubs/pywin32/win32/lib/win32gui_struct.pyi @@ -11,6 +11,7 @@ class _WMNOTIFY(NamedTuple): code: Incomplete def UnpackWMNOTIFY(lparam: int) -> _WMNOTIFY: ... + @type_check_only class _NMITEMACTIVATE(NamedTuple): hwndFrom: Incomplete @@ -38,6 +39,7 @@ def PackMENUITEMINFO( hbmpItem: Incomplete | None = ..., dwTypeData: Incomplete | None = ..., ) -> tuple[array[int], list[Incomplete]]: ... + @type_check_only class _MENUITEMINFO(NamedTuple): fType: int | None @@ -60,6 +62,7 @@ def PackMENUINFO( dwMenuData: Incomplete | None = ..., fMask: int = ..., ) -> array[int]: ... + @type_check_only class _MENUINFO(NamedTuple): dwStyle: Incomplete | None @@ -73,6 +76,7 @@ def EmptyMENUINFO(mask: Incomplete | None = ...) -> array[int]: ... def PackTVINSERTSTRUCT(parent, insertAfter, tvitem) -> tuple[bytes, list[Incomplete]]: ... def PackTVITEM(hitem, state, stateMask, text, image, selimage, citems, param) -> tuple[array[int], list[Incomplete]]: ... def EmptyTVITEM(hitem, mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ... + @type_check_only class _TVITEM(NamedTuple): item_hItem: Incomplete @@ -85,6 +89,7 @@ class _TVITEM(NamedTuple): item_param: Incomplete | None def UnpackTVITEM(buffer: ReadableBuffer) -> _TVITEM: ... + @type_check_only class _TVNOTIFY(NamedTuple): hwndFrom: Incomplete @@ -95,6 +100,7 @@ class _TVNOTIFY(NamedTuple): item_new: _TVITEM def UnpackTVNOTIFY(lparam: int) -> _TVNOTIFY: ... + @type_check_only class _TVDISPINFO(NamedTuple): hwndFrom: Incomplete @@ -113,6 +119,7 @@ def PackLVITEM( param: Incomplete | None = ..., indent: Incomplete | None = ..., ) -> tuple[array[int], list[Incomplete]]: ... + @type_check_only class _LVITEM(NamedTuple): item_item: Incomplete @@ -125,6 +132,7 @@ class _LVITEM(NamedTuple): item_indent: Incomplete | None def UnpackLVITEM(buffer: ReadableBuffer) -> _LVITEM: ... + @type_check_only class _LVDISPINFO(NamedTuple): hwndFrom: Incomplete @@ -133,6 +141,7 @@ class _LVDISPINFO(NamedTuple): item: _LVITEM def UnpackLVDISPINFO(lparam: int) -> _LVDISPINFO: ... + @type_check_only class _UnpackLVNOTIFY(NamedTuple): hwndFrom: Incomplete @@ -158,6 +167,7 @@ def PackLVCOLUMN( image: Incomplete | None = ..., order: Incomplete | None = ..., ) -> tuple[array[int], list[Incomplete]]: ... + @type_check_only class _LVCOLUMN(NamedTuple): fmt: Incomplete | None @@ -170,6 +180,7 @@ class _LVCOLUMN(NamedTuple): def UnpackLVCOLUMN(lparam: ReadableBuffer) -> _LVCOLUMN: ... def EmptyLVCOLUMN(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ... def PackLVHITTEST(pt) -> tuple[array[int], None]: ... + @type_check_only class _LVHITTEST(NamedTuple): pt: tuple[Incomplete, Incomplete] diff --git a/stubs/pywin32/win32/lib/win32timezone.pyi b/stubs/pywin32/win32/lib/win32timezone.pyi index 2d254c0ce43f..15508cc26158 100644 --- a/stubs/pywin32/win32/lib/win32timezone.pyi +++ b/stubs/pywin32/win32/lib/win32timezone.pyi @@ -46,19 +46,24 @@ class TimeZoneInfo(datetime.tzinfo): timeZoneName: str fixedStandardTime: bool def __init__(self, param: str | TimeZoneDefinition, fix_standard_time: bool = False) -> None: ... + @overload # type: ignore[override] # Split definition into overrides def tzname(self, dt: datetime.datetime) -> str: ... @overload def tzname(self, dt: None) -> None: ... + def getWinInfo(self, targetYear: int) -> TimeZoneDefinition: ... + @overload # type: ignore[override] # False-positive, our overload covers all base types def utcoffset(self, dt: None) -> None: ... @overload def utcoffset(self, dt: datetime.datetime) -> datetime.timedelta: ... + @overload # type: ignore[override] # False-positive, our overload covers all base types def dst(self, dt: None) -> None: ... @overload def dst(self, dt: datetime.datetime) -> datetime.timedelta: ... + def GetDSTStartTime(self, year: int) -> datetime.datetime: ... def GetDSTEndTime(self, year: int) -> datetime.datetime: ... def __eq__(self, other: object) -> bool: ... @@ -97,11 +102,14 @@ class RangeMap(dict[_RangeMapKT, _VT]): @classmethod def left(cls, source: SupportsKeysAndGetItem[_RangeMapKT, _VT] | Iterable[tuple[_RangeMapKT, _VT]]) -> Self: ... def __getitem__(self, item: _RangeMapKT) -> _VT: ... + @overload # type: ignore[override] # Signature simplified over dict and Mapping def get(self, key: _RangeMapKT, default: _T) -> _VT | _T: ... @overload def get(self, key: _RangeMapKT, default: None = None) -> _VT | None: ... + def bounds(self) -> tuple[_RangeMapKT, _RangeMapKT]: ... + @type_check_only class RangeValueUndefined: ... diff --git a/stubs/pywin32/win32/win32api.pyi b/stubs/pywin32/win32/win32api.pyi index e06fea623e44..182890bcc55c 100644 --- a/stubs/pywin32/win32/win32api.pyi +++ b/stubs/pywin32/win32/win32api.pyi @@ -174,6 +174,7 @@ def GetTempPath() -> str: ... def GetThreadLocale() -> int: ... def GetTickCount() -> int: ... def GetTimeFormat(locale: int, flags: int, time: TimeType | None, _format: str, /) -> str: ... + @overload def GetTimeZoneInformation( times_as_tuples: Literal[True] = True, / @@ -183,6 +184,7 @@ def GetTimeZoneInformation( ]: ... @overload def GetTimeZoneInformation(times_as_tuples: Literal[False], /): ... + def GetVersion() -> int: ... def GetVersionEx(_format: int = ..., /) -> tuple[int, int, int, int, str]: ... def GetVolumeInformation(path: str, /) -> tuple[str, int, int, int, str]: ... diff --git a/stubs/pywin32/win32/win32console.pyi b/stubs/pywin32/win32/win32console.pyi index f59d23db73da..ca6c0661ba0c 100644 --- a/stubs/pywin32/win32/win32console.pyi +++ b/stubs/pywin32/win32/win32console.pyi @@ -23,10 +23,12 @@ def GetConsoleWindow(): ... def GetNumberOfConsoleFonts(): ... def SetConsoleTitle(ConsoleTitle: str) -> None: ... def GetConsoleTitle(): ... + @overload def GenerateConsoleCtrlEvent(CtrlEvent: Literal[1], ProcessGroupId: Literal[0] = 0) -> NoReturn: ... @overload def GenerateConsoleCtrlEvent(CtrlEvent: Literal[0, 1], ProcessGroupId: int) -> None: ... + def GetStdHandle(StdHandle: int) -> _win32typing.PyConsoleScreenBuffer: ... ATTACH_PARENT_PROCESS: int diff --git a/stubs/pywin32/win32/win32file.pyi b/stubs/pywin32/win32/win32file.pyi index f2b1ff59a390..34443c808ade 100644 --- a/stubs/pywin32/win32/win32file.pyi +++ b/stubs/pywin32/win32/win32file.pyi @@ -57,12 +57,14 @@ def GetFileInformationByHandle(handle: int, /): ... def GetCompressedFileSize(): ... def GetFileSize(): ... def AllocateReadBuffer(bufSize: int, /) -> _win32typing.PyOVERLAPPEDReadBuffer: ... + @overload def ReadFile(hFile: int, bufSize: int, /) -> tuple[int, str]: ... @overload def ReadFile( hFile: int, buffer: _win32typing.PyOVERLAPPEDReadBuffer, overlapped: _win32typing.PyOVERLAPPED | None, / ) -> tuple[int, str]: ... + def WriteFile( hFile: int, data: str | bytes | _win32typing.PyOVERLAPPEDReadBuffer, ol: _win32typing.PyOVERLAPPED | None = ..., / ) -> tuple[int, int]: ... @@ -91,11 +93,13 @@ def SetEndOfFile(hFile: int, /) -> None: ... def SetFileApisToANSI() -> None: ... def SetFileApisToOEM() -> None: ... def SetFileAttributes(filename: str, newAttributes: int, /) -> None: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def SetFilePointer(handle: int, offset: tuple[int, int], moveMethod, /) -> None: ... @overload def SetFilePointer(handle: int, offset: int, moveMethod, /) -> None: ... + def SetVolumeLabel(rootPathName: str, volumeName: str, /) -> None: ... def UnlockFile(hFile: int, offsetLow, offsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, /) -> None: ... def TransmitFile( @@ -167,11 +171,13 @@ def DuplicateEncryptionInfoFile( def BackupRead( hFile: int, NumberOfBytesToRead, Buffer, bAbort, bProcessSecurity, lpContext, / ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def BackupSeek(hFile: int, NumberOfBytesToSeek: tuple[int, int], lpContext, /): ... @overload def BackupSeek(hFile: int, NumberOfBytesToSeek: int, lpContext, /): ... + def BackupWrite( hFile: int, NumberOfBytesToWrite, Buffer: str, bAbort, bProcessSecurity, lpContext, / ) -> tuple[Incomplete, Incomplete]: ... @@ -242,12 +248,15 @@ def GetFullPathName(FileName, Transaction: int | None = ...): ... def Wow64DisableWow64FsRedirection(): ... def Wow64RevertWow64FsRedirection(OldValue, /) -> None: ... def GetFileInformationByHandleEx(File: int, FileInformationClass): ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def SetFileInformationByHandle(File: int, FileInformationClass, Information: tuple[int, int]) -> None: ... @overload def SetFileInformationByHandle(File: int, FileInformationClass, Information) -> None: ... + def ReOpenFile(OriginalFile: int, DesiredAccess, ShareMode, Flags) -> int: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def OpenFileById( @@ -267,6 +276,7 @@ def OpenFileById( Flags, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., ) -> int: ... + def DCB() -> _win32typing.PyDCB: ... def GetFileAttributesExW(FileName: str, InfoLevelId: int = ..., Transaction: int | None = None): ... def OVERLAPPED() -> _win32typing.PyOVERLAPPED: ... diff --git a/stubs/pywin32/win32/win32security.pyi b/stubs/pywin32/win32/win32security.pyi index 4f25c80e7c57..477a5d2f63d1 100644 --- a/stubs/pywin32/win32/win32security.pyi +++ b/stubs/pywin32/win32/win32security.pyi @@ -67,11 +67,13 @@ def SetNamedSecurityInfo( def GetNamedSecurityInfo(ObjectName: str, ObjectType: int, SecurityInfo: int, /) -> _win32typing.PySECURITY_DESCRIPTOR: ... def OpenProcessToken(processHandle, desiredAccess, /) -> int: ... def LookupPrivilegeValue(systemName: str, privilegeName: str, /) -> int: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def LookupPrivilegeName(SystemName: str, luid: tuple[int, int], /) -> str: ... @overload def LookupPrivilegeName(SystemName: str, luid: int, /) -> str: ... + def LookupPrivilegeDisplayName(SystemName: str, Name: str, /) -> str: ... def AdjustTokenPrivileges( TokenHandle: int, bDisableAllPrivileges, NewState: _win32typing.PyTOKEN_PRIVILEGES @@ -138,11 +140,13 @@ def LsaConnectUntrusted() -> _win32typing.PyLsaLogon_HANDLE: ... def LsaDeregisterLogonProcess(LsaHandle: _win32typing.PyLsaLogon_HANDLE, /) -> None: ... def LsaLookupAuthenticationPackage(LsaHandle: _win32typing.PyLsaLogon_HANDLE, PackageName: str, /): ... def LsaEnumerateLogonSessions() -> tuple[Incomplete, ...]: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def LsaGetLogonSessionData(LogonId: tuple[int, int], /) -> tuple[Incomplete, ...]: ... @overload def LsaGetLogonSessionData(LogonId: int, /) -> tuple[Incomplete, ...]: ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def AcquireCredentialsHandle( @@ -152,6 +156,7 @@ def AcquireCredentialsHandle( def AcquireCredentialsHandle( Principal, Package, CredentialUse, LogonID: int | None, AuthData, / ) -> tuple[_win32typing.PyCredHandle, TimeType]: ... + def InitializeSecurityContext( Credential: _win32typing.PyCredHandle, Context: _win32typing.PyCtxtHandle, @@ -174,6 +179,7 @@ def AcceptSecurityContext( /, ) -> tuple[Incomplete, Incomplete, Incomplete]: ... def QuerySecurityPackageInfo(PackageName, /): ... + @overload @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") def LsaCallAuthenticationPackage( @@ -183,6 +189,7 @@ def LsaCallAuthenticationPackage( def LsaCallAuthenticationPackage( LsaHandle: _win32typing.PyLsaLogon_HANDLE, AuthenticationPackage, MessageType, ProtocolSubmitBuffer, / ) -> None: ... + def TranslateName(accountName: str, accountNameFormat, accountNameFormat1, numChars=..., /) -> str: ... def CreateWellKnownSid(WellKnownSidType, DomainSid: _win32typing.PySID | None = ..., /) -> _win32typing.PySID: ... def MapGenericMask(AccessMask, GenericMapping: tuple[Incomplete, Incomplete, Incomplete, Incomplete], /): ... diff --git a/stubs/pywin32/win32com/client/__init__.pyi b/stubs/pywin32/win32com/client/__init__.pyi index 112947b877fb..930c9586f3ab 100644 --- a/stubs/pywin32/win32com/client/__init__.pyi +++ b/stubs/pywin32/win32com/client/__init__.pyi @@ -66,6 +66,7 @@ class CoClassBaseClass: class VARIANT: varianttype: Incomplete def __init__(self, vt, value) -> None: ... + @property def value(self): ... @value.setter diff --git a/stubs/pywin32/win32com/client/dynamic.pyi b/stubs/pywin32/win32com/client/dynamic.pyi index 7d910d2b40fa..100ca291d7cc 100644 --- a/stubs/pywin32/win32com/client/dynamic.pyi +++ b/stubs/pywin32/win32com/client/dynamic.pyi @@ -46,6 +46,7 @@ def Dispatch( typeinfo: _win32typing.PyITypeInfo | None = None, clsctx: int = ..., ) -> CDispatch: ... + def MakeOleRepr(IDispatch, typeinfo, typecomp) -> build.DispatchItem | build.LazyDispatchItem: ... def DumbDispatch(IDispatch, userName=None, createClass=None, clsctx=...): ... diff --git a/stubs/pyxdg/xdg/IniFile.pyi b/stubs/pyxdg/xdg/IniFile.pyi index f4488d1c7d41..2fa7cb47aebd 100644 --- a/stubs/pyxdg/xdg/IniFile.pyi +++ b/stubs/pyxdg/xdg/IniFile.pyi @@ -15,6 +15,7 @@ class IniFile: def __init__(self, filename: str | None = None) -> None: ... def __cmp__(self, other: IniFile) -> bool: ... def parse(self, filename: str, headers: Iterable[str] | None = None) -> None: ... + @overload def get( self, @@ -225,6 +226,7 @@ class IniFile: locale: bool = False, strict: bool = False, ) -> list[tuple[int, int]]: ... + def getList(self, string: str) -> list[str]: ... def validate(self, report: Literal["All", "Warnings", "Errors"] = "All") -> None: ... def checkGroup(self, group: str) -> None: ... diff --git a/stubs/pyxdg/xdg/Menu.pyi b/stubs/pyxdg/xdg/Menu.pyi index e2c288e85326..bd0b7af99651 100644 --- a/stubs/pyxdg/xdg/Menu.pyi +++ b/stubs/pyxdg/xdg/Menu.pyi @@ -73,6 +73,7 @@ class Layout: inline_header: bool = True, inline_alias: bool = False, ) -> None: ... + @property def order(self) -> list[list[str]]: ... @order.setter diff --git a/stubs/pyxdg/xdg/MenuEditor.pyi b/stubs/pyxdg/xdg/MenuEditor.pyi index 48626276a760..a3dad5e2b8d8 100644 --- a/stubs/pyxdg/xdg/MenuEditor.pyi +++ b/stubs/pyxdg/xdg/MenuEditor.pyi @@ -43,6 +43,7 @@ class MenuEditor: after: None = None, before: _MenuItem | None = None, ) -> MenuEntry: ... + @overload def createMenu( self, @@ -65,10 +66,12 @@ class MenuEditor: after: None = None, before: _MenuItem | None = None, ) -> Menu: ... + @overload def createSeparator(self, parent: Menu, after: _MenuItem | None = None, before: None = None) -> Separator: ... @overload def createSeparator(self, parent: Menu, after: None = None, before: _MenuItem | None = None) -> Separator: ... + @overload def moveMenuEntry( self, @@ -87,6 +90,7 @@ class MenuEditor: after: None = None, before: _MenuItem | None = None, ) -> MenuEntry: ... + @overload def moveMenu( self, menu: Menu, oldparent: Menu, newparent: Menu, after: _MenuItem | None = None, before: None = None @@ -95,6 +99,7 @@ class MenuEditor: def moveMenu( self, menu: Menu, oldparent: Menu, newparent: Menu, after: None = None, before: _MenuItem | None = None ) -> Menu: ... + @overload def moveSeparator( self, separator: Separator, parent: Menu, after: _MenuItem | None = None, before: None = None @@ -103,6 +108,7 @@ class MenuEditor: def moveSeparator( self, separator: Separator, parent: Menu, after: None = None, before: _MenuItem | None = None ) -> Separator: ... + @overload def copyMenuEntry( self, menuentry: MenuEntry, oldparent: Unused, newparent: Menu, after: _MenuItem | None = None, before: None = None @@ -111,6 +117,7 @@ class MenuEditor: def copyMenuEntry( self, menuentry: MenuEntry, oldparent: Unused, newparent: Menu, after: None = None, before: _MenuItem | None = None ) -> MenuEntry: ... + def editMenuEntry( self, menuentry: MenuEntry, diff --git a/stubs/qrbill/qrbill/bill.pyi b/stubs/qrbill/qrbill/bill.pyi index 2cabe1fd1af8..b89b902c45be 100644 --- a/stubs/qrbill/qrbill/bill.pyi +++ b/stubs/qrbill/qrbill/bill.pyi @@ -49,6 +49,7 @@ class Address: city: str, country: str | None = None, ) -> StructuredAddress: ... + @staticmethod def parse_country(country: str | None) -> str: ... @@ -102,6 +103,7 @@ class QRBill: currency: Literal["CHF", "EUR"] additional_information: str billing_information: str + @overload def __init__( self, @@ -166,6 +168,7 @@ class QRBill: payment_line: bool = True, font_factor: int = 1, ) -> None: ... + @property def title_font_info(self) -> dict[str, Any]: ... @property diff --git a/stubs/qrcode/qrcode/image/svg.pyi b/stubs/qrcode/qrcode/image/svg.pyi index a1f95c6984f2..b5f662dbf869 100644 --- a/stubs/qrcode/qrcode/image/svg.pyi +++ b/stubs/qrcode/qrcode/image/svg.pyi @@ -11,10 +11,12 @@ class SvgFragmentImage(base.BaseImageWithDrawer, metaclass=abc.ABCMeta): allowed_kinds: tuple[Literal["SVG"]] default_drawer_class: type[QRModuleDrawer] unit_size: Decimal | str + @overload def units(self, pixels: int | Decimal, text: Literal[False]) -> Decimal: ... @overload def units(self, pixels: int | Decimal, text: Literal[True] = True) -> str: ... + # to_string is delegated to ET.Element.tostring, which dictates the overload # options here. @overload @@ -47,6 +49,7 @@ class SvgFragmentImage(base.BaseImageWithDrawer, metaclass=abc.ABCMeta): default_namespace: str | None = None, short_empty_elements: bool = True, ) -> Any: ... + # the new_image method accepts arbitrary keyword arguments to accommodate # subclasses with additional arguments. def new_image(self, **kwargs: Any) -> Element: ... diff --git a/stubs/qrcode/qrcode/main.pyi b/stubs/qrcode/qrcode/main.pyi index f7b35f39219f..2c2fb05b2f72 100644 --- a/stubs/qrcode/qrcode/main.pyi +++ b/stubs/qrcode/qrcode/main.pyi @@ -36,6 +36,7 @@ def make( image_factory: type[GenericImage], mask_pattern: MaskPattern | None = None, ) -> GenericImage: ... + def copy_2d_array(x: Sequence[_AnySeq]) -> list[_AnySeq]: ... class ActiveWithNeighbors(NamedTuple): @@ -65,6 +66,7 @@ class QRCode(Generic[GenericImage]): box_size: int border: int image_factory: type[GenericImage] | None + @overload def __init__( self, @@ -96,14 +98,17 @@ class QRCode(Generic[GenericImage]): image_factory: None = None, mask_pattern: MaskPattern | None = None, ) -> None: ... + @property def version(self) -> int: ... @version.setter def version(self, value: ConvertibleToInt | None) -> None: ... + @property def mask_pattern(self) -> MaskPattern | None: ... @mask_pattern.setter def mask_pattern(self, pattern: MaskPattern | None) -> None: ... + modules_count: int data_cache: list[int] data_list: list[QRData] @@ -116,12 +121,14 @@ class QRCode(Generic[GenericImage]): def best_mask_pattern(self) -> int: ... def print_tty(self, out: _TTYWriter | None = None) -> None: ... def print_ascii(self, out: _TTYWriter | None = None, tty: bool = False, invert: bool = False) -> None: ... + # kwargs are passed on to the specific image factory used, and in turn passed through to # their make_image method. @overload def make_image(self, image_factory: None = None, **kwargs: Any) -> GenericImage: ... @overload def make_image(self, image_factory: type[GenericImageLocal], **kwargs: Any) -> GenericImageLocal: ... + def is_constrained(self, row: int, col: int) -> bool: ... def setup_timing_pattern(self) -> None: ... def setup_position_adjust_pattern(self) -> None: ... diff --git a/stubs/qrcode/qrcode/util.pyi b/stubs/qrcode/qrcode/util.pyi index 44c4e4bbfefc..0144c7951ecf 100644 --- a/stubs/qrcode/qrcode/util.pyi +++ b/stubs/qrcode/qrcode/util.pyi @@ -46,12 +46,14 @@ def optimal_mode(data: bytes) -> _SupportedMode: ... class QRData: mode: _SupportedMode data: bytes + @overload def __init__(self, data: bytes | str, mode: _SupportedMode | None = None, check_data: Literal[True] = True) -> None: ... @overload def __init__(self, data: bytes, mode: _SupportedMode | None = None, *, check_data: Literal[False]) -> None: ... @overload def __init__(self, data: bytes, mode: _SupportedMode | None, check_data: Literal[False]) -> None: ... + def __len__(self) -> int: ... def write(self, buffer: BitBuffer) -> None: ... diff --git a/stubs/regex/regex/_main.pyi b/stubs/regex/regex/_main.pyi index 49c66bb0248c..2a77bafd9fa0 100644 --- a/stubs/regex/regex/_main.pyi +++ b/stubs/regex/regex/_main.pyi @@ -82,6 +82,7 @@ def compile( cache_pattern: bool | None = None, **kwargs: Any, ) -> Pattern[AnyStr]: ... + @overload def search( pattern: str | Pattern[str], @@ -108,6 +109,7 @@ def search( ignore_unused: bool = False, **kwargs: Any, ) -> Match[bytes] | None: ... + @overload def match( pattern: str | Pattern[str], @@ -163,6 +165,7 @@ def fullmatch( ignore_unused: bool = False, **kwargs: Any, ) -> Match[bytes] | None: ... + @overload def split( pattern: str | Pattern[str], @@ -185,6 +188,7 @@ def split( ignore_unused: bool = False, **kwargs: Any, ) -> list[bytes | Any]: ... + @overload def splititer( pattern: str | Pattern[str], @@ -207,6 +211,7 @@ def splititer( ignore_unused: bool = False, **kwargs: Any, ) -> _regex.Splitter[bytes]: ... + @overload def findall( pattern: str | Pattern[str], @@ -233,6 +238,7 @@ def findall( ignore_unused: bool = False, **kwargs: Any, ) -> list[Any]: ... + @overload def finditer( pattern: str | Pattern[str], @@ -261,6 +267,7 @@ def finditer( ignore_unused: bool = False, **kwargs: Any, ) -> _regex.Scanner[bytes]: ... + @overload def sub( pattern: str | Pattern[str], @@ -289,6 +296,7 @@ def sub( ignore_unused: bool = False, **kwargs: Any, ) -> bytes: ... + @overload def subf( pattern: str | Pattern[str], @@ -317,6 +325,7 @@ def subf( ignore_unused: bool = False, **kwargs: Any, ) -> bytes: ... + @overload def subn( pattern: str | Pattern[str], @@ -345,6 +354,7 @@ def subn( ignore_unused: bool = False, **kwargs: Any, ) -> tuple[bytes, int]: ... + @overload def subfn( pattern: str | Pattern[str], @@ -373,11 +383,14 @@ def subfn( ignore_unused: bool = False, **kwargs: Any, ) -> tuple[bytes, int]: ... + def purge() -> None: ... + @overload def cache_all(value: bool = True) -> None: ... @overload def cache_all(value: None) -> bool: ... + def escape(pattern: AnyStr, special_only: bool = True, literal_spaces: bool = False) -> AnyStr: ... DEFAULT_VERSION = RegexFlag.VERSION0 @@ -398,6 +411,7 @@ class Pattern(Generic[AnyStr]): def pattern(self) -> AnyStr: ... @property def named_lists(self) -> Mapping[str, frozenset[AnyStr]]: ... + @overload def search( self: Pattern[str], @@ -418,6 +432,7 @@ class Pattern(Generic[AnyStr]): partial: bool = False, timeout: float | None = None, ) -> Match[bytes] | None: ... + @overload def match( self: Pattern[str], @@ -438,7 +453,9 @@ class Pattern(Generic[AnyStr]): partial: bool = False, timeout: float | None = None, ) -> Match[bytes] | None: ... + prefixmatch = match + @overload def fullmatch( self: Pattern[str], @@ -459,6 +476,7 @@ class Pattern(Generic[AnyStr]): partial: bool = False, timeout: float | None = None, ) -> Match[bytes] | None: ... + @overload def split( self: Pattern[str], string: str, maxsplit: int = 0, concurrent: bool | None = None, timeout: float | None = None @@ -471,6 +489,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> list[bytes | Any]: ... + @overload def splititer( self: Pattern[str], string: str, maxsplit: int = 0, concurrent: bool | None = None, timeout: float | None = None @@ -483,6 +502,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> _regex.Splitter[bytes]: ... + @overload def findall( self: Pattern[str], @@ -503,6 +523,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> list[Any]: ... + @overload def finditer( self: Pattern[str], @@ -525,6 +546,7 @@ class Pattern(Generic[AnyStr]): partial: bool = False, timeout: float | None = None, ) -> _regex.Scanner[bytes]: ... + @overload def sub( self: Pattern[str], @@ -547,6 +569,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> bytes: ... + @overload def subf( self: Pattern[str], @@ -569,6 +592,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> bytes: ... + @overload def subn( self: Pattern[str], @@ -591,6 +615,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> tuple[bytes, int]: ... + @overload def subfn( self: Pattern[str], @@ -613,6 +638,7 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = None, timeout: float | None = None, ) -> tuple[bytes, int]: ... + @overload def scanner( self: Pattern[str], @@ -635,6 +661,7 @@ class Pattern(Generic[AnyStr]): partial: bool = False, timeout: float | None = None, ) -> _regex.Scanner[bytes]: ... + def __copy__(self) -> Self: ... def __deepcopy__(self, memo: Unused, /) -> Self: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -661,58 +688,72 @@ class Match(Generic[AnyStr]): def fuzzy_counts(self) -> tuple[int, int, int]: ... @property def fuzzy_changes(self) -> tuple[list[int], list[int], list[int]]: ... + @overload def group(self, group: Literal[0] = 0, /) -> AnyStr: ... @overload def group(self, group: int | str = ..., /) -> AnyStr | Any: ... @overload def group(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[AnyStr | Any, ...]: ... + @overload def groups(self, default: None = None) -> tuple[AnyStr | Any, ...]: ... @overload def groups(self, default: _T) -> tuple[AnyStr | _T, ...]: ... + @overload def groupdict(self, default: None = None) -> dict[str, AnyStr | Any]: ... @overload def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ... + @overload def span(self, group: int | str = ..., /) -> tuple[int, int]: ... @overload def span(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[tuple[int, int], ...]: ... + @overload def spans(self, group: int | str = ..., /) -> list[tuple[int, int]]: ... @overload def spans(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[list[tuple[int, int]], ...]: ... + @overload def start(self, group: int | str = ..., /) -> int: ... @overload def start(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[int, ...]: ... + @overload def starts(self, group: int | str = ..., /) -> list[int]: ... @overload def starts(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[list[int], ...]: ... + @overload def end(self, group: int | str = ..., /) -> int: ... @overload def end(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[int, ...]: ... + @overload def ends(self, group: int | str = ..., /) -> list[int]: ... @overload def ends(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[list[int], ...]: ... + def expand(self, template: AnyStr, /) -> AnyStr: ... def expandf(self, format: AnyStr, /) -> AnyStr: ... + @overload def captures(self, group: int | str = ..., /) -> list[AnyStr]: ... @overload def captures(self, group1: int | str, group2: int | str, /, *groups: int | str) -> tuple[list[AnyStr], ...]: ... + def capturesdict(self) -> dict[str, list[AnyStr]]: ... def detach_string(self) -> None: ... def allcaptures(self) -> tuple[list[AnyStr]]: ... def allspans(self) -> tuple[list[tuple[int, int]]]: ... + @overload def __getitem__(self, key: Literal[0], /) -> AnyStr: ... @overload def __getitem__(self, key: int | str, /) -> AnyStr | Any: ... + def __copy__(self) -> Self: ... def __deepcopy__(self, memo: Unused, /) -> Self: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/stubs/reportlab/reportlab/graphics/barcode/common.pyi b/stubs/reportlab/reportlab/graphics/barcode/common.pyi index 6dea353f856f..513fb79debf7 100644 --- a/stubs/reportlab/reportlab/graphics/barcode/common.pyi +++ b/stubs/reportlab/reportlab/graphics/barcode/common.pyi @@ -18,14 +18,17 @@ class Barcode(Flowable): def decompose(self) -> None: ... barHeight: Incomplete def computeSize(self, *args) -> None: ... + @property def width(self): ... @width.setter def width(self, v) -> None: ... + @property def height(self): ... @height.setter def height(self, v) -> None: ... + def draw(self) -> None: ... def drawHumanReadable(self) -> None: ... def rect(self, x, y, w, h) -> None: ... diff --git a/stubs/reportlab/reportlab/graphics/barcode/dmtx.pyi b/stubs/reportlab/reportlab/graphics/barcode/dmtx.pyi index f4798830790e..480095e85683 100644 --- a/stubs/reportlab/reportlab/graphics/barcode/dmtx.pyi +++ b/stubs/reportlab/reportlab/graphics/barcode/dmtx.pyi @@ -11,38 +11,47 @@ class DataMatrix(Barcode, _DMTXCheck): color: Incomplete bgColor: Incomplete def __init__(self, value: str = "", **kwds) -> None: ... + @property def value(self): ... @value.setter def value(self, v) -> None: ... + @property def size(self): ... @size.setter def size(self, v) -> None: ... + @property def border(self): ... @border.setter def border(self, v) -> None: ... + @property def x(self): ... @x.setter def x(self, v) -> None: ... + @property def y(self): ... @y.setter def y(self, v) -> None: ... + @property def cellSize(self): ... @cellSize.setter def cellSize(self, v) -> None: ... + @property def encoding(self): ... @encoding.setter def encoding(self, v) -> None: ... + @property def anchor(self): ... @anchor.setter def anchor(self, v) -> None: ... + def recalc(self) -> None: ... @property def matrix(self): ... diff --git a/stubs/reportlab/reportlab/graphics/barcode/usps4s.pyi b/stubs/reportlab/reportlab/graphics/barcode/usps4s.pyi index aeb4a5dfc3da..069b94a2f30c 100644 --- a/stubs/reportlab/reportlab/graphics/barcode/usps4s.pyi +++ b/stubs/reportlab/reportlab/graphics/barcode/usps4s.pyi @@ -9,30 +9,37 @@ class USPS_4State(Barcode): def __init__(self, value: str = "01234567094987654321", routing: str = "", **kwd) -> None: ... @staticmethod def scale(kind, D, s): ... + @property def tracking(self): ... @tracking.setter def tracking(self, tracking) -> None: ... + @property def routing(self): ... @routing.setter def routing(self, routing) -> None: ... + @property def widthSize(self): ... @widthSize.setter def widthSize(self, value) -> None: ... + @property def heightSize(self): ... @heightSize.setter def heightSize(self, value) -> None: ... + @property def fontSize(self): ... @fontSize.setter def fontSize(self, value) -> None: ... + @property def humanReadable(self): ... @humanReadable.setter def humanReadable(self, value) -> None: ... + @property def binary(self): ... @property @@ -50,37 +57,46 @@ class USPS_4State(Barcode): def horizontalClearZone(self): ... @property def verticalClearZone(self): ... + @property def barWidth(self): ... @barWidth.setter def barWidth(self, value) -> None: ... + @property def pitch(self): ... @pitch.setter def pitch(self, value) -> None: ... + @property def barHeight(self): ... @barHeight.setter def barHeight(self, value) -> None: ... + @property def widthScale(self): ... @property def heightScale(self): ... + @property def width(self): ... @width.setter def width(self, v) -> None: ... + @property def height(self): ... @height.setter def height(self, v) -> None: ... + def computeSize(self) -> None: ... def wrap(self, aW, aH): ... def draw(self) -> None: ... + @property def value(self): ... @value.setter def value(self, value) -> None: ... + def drawHumanReadable(self) -> None: ... def annotate(self, x, y, text, fontName, fontSize, anchor: str = "middle") -> None: ... diff --git a/stubs/reportlab/reportlab/graphics/charts/lineplots.pyi b/stubs/reportlab/reportlab/graphics/charts/lineplots.pyi index 9c7a0009bf8e..77c6ad29d27d 100644 --- a/stubs/reportlab/reportlab/graphics/charts/lineplots.pyi +++ b/stubs/reportlab/reportlab/graphics/charts/lineplots.pyi @@ -45,10 +45,12 @@ class LinePlot(AbstractLineChart): behindAxes: int gridFirst: int def __init__(self) -> None: ... + @property def joinedLines(self): ... @joinedLines.setter def joinedLines(self, v) -> None: ... + def demo(self): ... def calcPositions(self) -> None: ... def drawLabel(self, G, rowNo, colNo, x, y) -> None: ... diff --git a/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi b/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi index 1c6d32a18292..c7b4fa1bc0d5 100644 --- a/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi +++ b/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi @@ -13,10 +13,12 @@ class Label(Widget): x: Incomplete y: Incomplete def __init__(self, **kw) -> None: ... + @property def padding(self): ... @padding.setter def padding(self, p) -> None: ... + def setText(self, text) -> None: ... def setOrigin(self, x, y) -> None: ... def demo(self) -> Drawing: ... diff --git a/stubs/reportlab/reportlab/lib/boxstuff.pyi b/stubs/reportlab/reportlab/lib/boxstuff.pyi index 24343fe30f39..61578c5e15c1 100644 --- a/stubs/reportlab/reportlab/lib/boxstuff.pyi +++ b/stubs/reportlab/reportlab/lib/boxstuff.pyi @@ -9,6 +9,7 @@ def rectCorner( ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... @overload def rectCorner(x, y, width, height, anchor: str = "sw", dims: Literal[False] | None = False) -> tuple[Incomplete, Incomplete]: ... + def aspectRatioFix( preserve, anchor, x, y, width, height, imWidth, imHeight, anchorAtXY: bool = False ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... diff --git a/stubs/reportlab/reportlab/lib/colors.pyi b/stubs/reportlab/reportlab/lib/colors.pyi index 99d7e2e0174b..de0de9789c00 100644 --- a/stubs/reportlab/reportlab/lib/colors.pyi +++ b/stubs/reportlab/reportlab/lib/colors.pyi @@ -109,6 +109,7 @@ def rgb2cmyk(r: float, g: float, b: float) -> tuple[float, float, float, float]: def color2bw(colorRGB: Color) -> Color: ... def HexColor(val: str | int, htmlOnly: bool = False, hasAlpha: bool = False) -> Color: ... def linearlyInterpolatedColor(c0: _ColorT, c1: _ColorT, x0: float, x1: float, x: float) -> _ColorT: ... + @overload def obj_R_G_B( c: Color | list[float] | tuple[float, float, float, float] | tuple[float, float, float], @@ -280,14 +281,17 @@ ColorType: type[Color] def colorDistance(col1: Color, col2: Color) -> float: ... def cmykDistance(col1: Color, col2: Color) -> float: ... def getAllNamedColors() -> dict[str, Color]: ... + @overload def describe(aColor: Color, mode: Literal[0] = 0) -> None: ... @overload def describe(aColor: Color, mode: Literal[1]) -> str: ... @overload def describe(aColor: Color, mode: Literal[2]) -> tuple[str, float]: ... + def hue2rgb(m1: float, m2: float, h: float) -> float: ... def hsl2rgb(h: float, s: float, l: float) -> tuple[float, float, float]: ... + @type_check_only class _cssParse: def pcVal(self, v: str, n: str = "argument") -> float: ... @@ -314,6 +318,7 @@ toColor: _toColor def toColorOrNone(arg: None, default: Color | None) -> None: ... @overload def toColorOrNone(arg: _ConvertibleToColor, default: Color | None = None) -> Color: ... + def setColors(**kw: _ConvertibleToColor) -> None: ... def Whiter(c: _ColorT, f: float) -> _ColorT: ... def Blacker(c: _ColorT, f: float) -> _ColorT: ... diff --git a/stubs/reportlab/reportlab/lib/sequencer.pyi b/stubs/reportlab/reportlab/lib/sequencer.pyi index ce2461bd9848..f7fd2029ba72 100644 --- a/stubs/reportlab/reportlab/lib/sequencer.pyi +++ b/stubs/reportlab/reportlab/lib/sequencer.pyi @@ -32,6 +32,7 @@ class Sequencer: def dump(self) -> None: ... def getSequencer() -> Sequencer: ... + @overload def setSequencer(seq: Sequencer) -> Sequencer: ... @overload diff --git a/stubs/reportlab/reportlab/lib/styles.pyi b/stubs/reportlab/reportlab/lib/styles.pyi index 096d8d031a3a..6e550700e5eb 100644 --- a/stubs/reportlab/reportlab/lib/styles.pyi +++ b/stubs/reportlab/reportlab/lib/styles.pyi @@ -169,10 +169,12 @@ class StyleSheet1: byAlias: dict[str, PropertySet] def __init__(self) -> None: ... def __getitem__(self, key: str) -> PropertySet: ... + @overload def get(self, key: str) -> PropertySet: ... @overload def get(self, key: str, default: _T) -> PropertySet | _T: ... + def __contains__(self, key: str) -> bool: ... def has_key(self, key: str) -> bool: ... def add(self, style: PropertySet, alias: str | None = None) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/utils.pyi b/stubs/reportlab/reportlab/lib/utils.pyi index 9a2371b931e5..90d166451ad3 100644 --- a/stubs/reportlab/reportlab/lib/utils.pyi +++ b/stubs/reportlab/reportlab/lib/utils.pyi @@ -156,10 +156,12 @@ class _FmtSelfDict: class FmtSelfDict: ... def simpleSplit(text: str | bytes, fontName: str | None, fontSize: float, maxWidth: float | None): ... + @overload def escapeTextOnce(text: None) -> None: ... @overload def escapeTextOnce(text: str | bytes) -> str: ... + def fileName2FSEnc(fn): ... def prev_this_next(items): ... def commasplit(s: str | bytes) -> list[str]: ... diff --git a/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi b/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi index 963d0b447457..aab282f6c48b 100644 --- a/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi +++ b/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi @@ -162,10 +162,12 @@ class TTFont: @property def hbFace(self) -> Incomplete | None: ... def hbFont(self, fontSize: float = 10): ... + @property def shapable(self) -> bool: ... @shapable.setter def shapable(self, v) -> None: ... + def pdfScale(self, v): ... def unregister(self) -> None: ... diff --git a/stubs/reportlab/reportlab/platypus/para.pyi b/stubs/reportlab/reportlab/platypus/para.pyi index 59ff594b0db7..f2205c40992b 100644 --- a/stubs/reportlab/reportlab/platypus/para.pyi +++ b/stubs/reportlab/reportlab/platypus/para.pyi @@ -85,10 +85,12 @@ def simpleJustifyAlign(line: list[_Op], currentLength: float, maxLength: float) def readBool(text: str) -> _BoolInt: ... def readAlignment(text: str) -> Literal[0, 1, 2, 4] | None: ... def readLength(text: str) -> float: ... + @overload def lengthSequence(s: str, converter: Callable[[str], float] = ...) -> list[float]: ... @overload def lengthSequence(s: str, converter: Callable[[str], _T]) -> list[_T]: ... + def readColor(text: str | None) -> Color | None: ... class StyleAttributeConverters: diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index c8208372970f..2bcee72979e2 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -49,10 +49,12 @@ class CellStyle(PropertySet): class TableStyle: # TODO: Add TypedDict for Table properties that can be set through the style def __init__(self, cmds: Iterable[_TableCommand] | None = None, parent: TableStyle | None = None, **kw) -> None: ... + @overload def add(self, *cmd: Unpack[_TableSectionCommand]) -> None: ... @overload def add(self, *cmd: Unpack[_RoundedCornersTableCommand]) -> None: ... + def getCommands(self) -> list[_TableCommand]: ... class ShadowStyle(NamedTuple): diff --git a/stubs/requests-oauthlib/requests_oauthlib/oauth1_session.pyi b/stubs/requests-oauthlib/requests_oauthlib/oauth1_session.pyi index b9f9b11962b5..fcbfdb73cfb3 100644 --- a/stubs/requests-oauthlib/requests_oauthlib/oauth1_session.pyi +++ b/stubs/requests-oauthlib/requests_oauthlib/oauth1_session.pyi @@ -52,10 +52,12 @@ class OAuth1Session(requests.Session): nonce=None, timestamp=None, ) -> None: ... + @property def token(self) -> _TokenDict: ... @token.setter def token(self, value: _TokenDict) -> None: ... + @property def authorized(self) -> bool: ... def authorization_url(self, url: str, request_token=None, **kwargs) -> str: ... diff --git a/stubs/requests-oauthlib/requests_oauthlib/oauth2_session.pyi b/stubs/requests-oauthlib/requests_oauthlib/oauth2_session.pyi index 27a21c3e8f48..bdd4b2aa0e0e 100644 --- a/stubs/requests-oauthlib/requests_oauthlib/oauth2_session.pyi +++ b/stubs/requests-oauthlib/requests_oauthlib/oauth2_session.pyi @@ -53,27 +53,33 @@ class OAuth2Session(requests.Session): pkce=None, **kwargs, ) -> None: ... + @property def scope(self) -> Incomplete | None: ... # oauthlib.oauth2.Client.scope @scope.setter def scope(self, value: Incomplete | None) -> None: ... + def new_state(self): ... + @property def client_id(self) -> Incomplete | None: ... # oauthlib.oauth2.Client.client_id @client_id.setter def client_id(self, value: Incomplete | None) -> None: ... @client_id.deleter def client_id(self) -> None: ... + @property def token(self): ... # oauthlib.oauth2.Client.token @token.setter def token(self, value) -> None: ... + @property def access_token(self): ... # oauthlib.oauth2.Client.access_token @access_token.setter def access_token(self, value) -> None: ... @access_token.deleter def access_token(self) -> None: ... + @property def authorized(self) -> bool: ... def authorization_url(self, url: str, state=None, **kwargs) -> tuple[str, str]: ... @@ -133,6 +139,7 @@ class OAuth2Session(requests.Session): cert: requests.sessions._Cert | None = None, json=None, ) -> requests.Response: ... + @overload def register_compliance_hook(self, hook_type: Literal["access_token_response"], hook: _AccessTokenResponseHook) -> None: ... @overload diff --git a/stubs/requests/requests/structures.pyi b/stubs/requests/requests/structures.pyi index 53dd5f565154..fbfffefce04b 100644 --- a/stubs/requests/requests/structures.pyi +++ b/stubs/requests/requests/structures.pyi @@ -19,6 +19,7 @@ class LookupDict(dict[str, _VT]): def __init__(self, name: Any = None) -> None: ... def __getitem__(self, key: str) -> _VT | None: ... # type: ignore[override] def __setattr__(self, attr: str, value: _VT, /) -> None: ... + @overload def get(self, key: str, default: None = None) -> _VT | None: ... @overload diff --git a/stubs/seaborn/seaborn/_core/data.pyi b/stubs/seaborn/seaborn/_core/data.pyi index 35769b27bfe7..7686ead8de08 100644 --- a/stubs/seaborn/seaborn/_core/data.pyi +++ b/stubs/seaborn/seaborn/_core/data.pyi @@ -22,4 +22,5 @@ class PlotData: def handle_data_source(data: _T) -> _T: ... @overload def handle_data_source(data: SupportsDataFrame) -> DataFrame: ... + def convert_dataframe_to_pandas(data: object) -> DataFrame: ... diff --git a/stubs/seaborn/seaborn/external/docscrape.pyi b/stubs/seaborn/seaborn/external/docscrape.pyi index b769253eb59e..5d3e5e1b5807 100644 --- a/stubs/seaborn/seaborn/external/docscrape.pyi +++ b/stubs/seaborn/seaborn/external/docscrape.pyi @@ -8,10 +8,12 @@ def strip_blank_lines(l: _S) -> _S: ... class Reader: def __init__(self, data: str | list[str]) -> None: ... + @overload def __getitem__(self, n: slice) -> list[str]: ... @overload def __getitem__(self, n: SupportsIndex) -> str: ... + def reset(self) -> None: ... def read(self) -> str: ... def seek_next_non_empty_line(self) -> None: ... @@ -49,6 +51,7 @@ class FunctionDoc(NumpyDocString): class ClassDoc(NumpyDocString): extra_public_methods: list[str] show_inherited_members: bool + @overload def __init__( self, cls: None, doc: str, modulename: str = "", func_doc: type[FunctionDoc] = ..., config: Mapping[str, Any] = {} @@ -62,6 +65,7 @@ class ClassDoc(NumpyDocString): func_doc: type[FunctionDoc] = ..., config: Mapping[str, Any] = {}, ) -> None: ... + @property def methods(self) -> list[str]: ... @property diff --git a/stubs/seaborn/seaborn/matrix.pyi b/stubs/seaborn/seaborn/matrix.pyi index 6aae408d9808..50214ffaaae3 100644 --- a/stubs/seaborn/seaborn/matrix.pyi +++ b/stubs/seaborn/seaborn/matrix.pyi @@ -62,6 +62,7 @@ def heatmap( antialiased: bool = False, **kwargs, ) -> Axes: ... + @type_check_only class _Dendogram(TypedDict): icoord: list[list[float]] diff --git a/stubs/seaborn/seaborn/palettes.pyi b/stubs/seaborn/seaborn/palettes.pyi index 133ead3504cf..c64d4d1234fe 100644 --- a/stubs/seaborn/seaborn/palettes.pyi +++ b/stubs/seaborn/seaborn/palettes.pyi @@ -52,6 +52,7 @@ def color_palette( desat: float | None = None, as_cmap: Literal[False] = False, ) -> _RGBColorPalette: ... + @overload def hls_palette( n_colors: int = 6, h: float = 0.01, l: float = 0.6, s: float = 0.65, *, as_cmap: Literal[True] @@ -60,6 +61,7 @@ def hls_palette( def hls_palette( n_colors: int = 6, h: float = 0.01, l: float = 0.6, s: float = 0.65, as_cmap: Literal[False] = False ) -> _RGBColorPalette: ... + @overload def husl_palette( n_colors: int = 6, h: float = 0.01, s: float = 0.9, l: float = 0.65, *, as_cmap: Literal[True] @@ -68,10 +70,12 @@ def husl_palette( def husl_palette( n_colors: int = 6, h: float = 0.01, s: float = 0.9, l: float = 0.65, as_cmap: Literal[False] = False ) -> _RGBColorPalette: ... + @overload def mpl_palette(name: str, n_colors: int = 6, *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ... @overload def mpl_palette(name: str, n_colors: int = 6, as_cmap: Literal[False] = False) -> _RGBColorPalette: ... + @overload def dark_palette( color: ColorType, n_colors: int = 6, reverse: bool = False, *, as_cmap: Literal[True], input: str = "rgb" @@ -80,6 +84,7 @@ def dark_palette( def dark_palette( color: ColorType, n_colors: int = 6, reverse: bool = False, as_cmap: Literal[False] = False, input: str = "rgb" ) -> _RGBColorPalette: ... + @overload def light_palette( color: ColorType, n_colors: int = 6, reverse: bool = False, *, as_cmap: Literal[True], input: str = "rgb" @@ -88,6 +93,7 @@ def light_palette( def light_palette( color: ColorType, n_colors: int = 6, reverse: bool = False, as_cmap: Literal[False] = False, input: str = "rgb" ) -> _RGBColorPalette: ... + @overload def diverging_palette( h_neg: float, @@ -111,6 +117,7 @@ def diverging_palette( center: Literal["light", "dark"] = "light", as_cmap: Literal[False] = False, ) -> _RGBColorPalette: ... + @overload def blend_palette( colors: Iterable[ColorType], n_colors: int = 6, *, as_cmap: Literal[True], input: str = "rgb" @@ -119,8 +126,10 @@ def blend_palette( def blend_palette( colors: Iterable[ColorType], n_colors: int = 6, as_cmap: Literal[False] = False, input: str = "rgb" ) -> _RGBColorPalette: ... + def xkcd_palette(colors: Iterable[str]) -> _RGBColorPalette: ... def crayon_palette(colors: Iterable[str]) -> _RGBColorPalette: ... + @overload def cubehelix_palette( n_colors: int = 6, @@ -146,4 +155,5 @@ def cubehelix_palette( reverse: bool = False, as_cmap: Literal[False] = False, ) -> _RGBColorPalette: ... + def set_color_codes(palette: str = "deep") -> None: ... diff --git a/stubs/seaborn/seaborn/regression.pyi b/stubs/seaborn/seaborn/regression.pyi index eb4bd4412ad6..615035fa1206 100644 --- a/stubs/seaborn/seaborn/regression.pyi +++ b/stubs/seaborn/seaborn/regression.pyi @@ -57,6 +57,7 @@ def lmplot( line_kws: dict[str, Any] | None = None, facet_kws: dict[str, Any] | None = None, ) -> FacetGrid: ... + @overload def regplot( data: None = None, @@ -123,6 +124,7 @@ def regplot( line_kws: dict[str, Any] | None = None, ax: Axes | None = None, ) -> Axes: ... + @overload def residplot( data: None = None, diff --git a/stubs/seaborn/seaborn/utils.pyi b/stubs/seaborn/seaborn/utils.pyi index aa57881400d5..bd8cdecc9b8c 100644 --- a/stubs/seaborn/seaborn/utils.pyi +++ b/stubs/seaborn/seaborn/utils.pyi @@ -103,11 +103,13 @@ def load_dataset(name: str, cache: bool = True, data_home: str | None = None, ** def axis_ticklabels_overlap(labels: Iterable[Text]) -> bool: ... def axes_ticklabels_overlap(ax: Axes) -> tuple[bool, bool]: ... def locator_to_legend_entries(locator: Locator, limits: Iterable[float], dtype) -> tuple[list[Incomplete], list[str]]: ... + @overload def relative_luminance(color: ColorType) -> float: ... # type: ignore[overload-overlap] @overload def relative_luminance(color: Sequence[ColorType]) -> NDArray[np.float64]: ... @overload def relative_luminance(color: ColorType | Sequence[ColorType] | ArrayLike) -> float | NDArray[np.float64]: ... + def to_utf8(obj: object) -> str: ... def adjust_legend_subtitles(legend: Legend) -> None: ... # not public API diff --git a/stubs/seaborn/seaborn/widgets.pyi b/stubs/seaborn/seaborn/widgets.pyi index dd2f9702fff1..64fd59ff27ab 100644 --- a/stubs/seaborn/seaborn/widgets.pyi +++ b/stubs/seaborn/seaborn/widgets.pyi @@ -18,18 +18,22 @@ def choose_colorbrewer_palette( def choose_colorbrewer_palette( data_type: Literal["sequential", "diverging", "qualitative"], as_cmap: Literal[False] = False ) -> list[tuple[float, float, float]]: ... + @overload def choose_dark_palette(input: str = "husl", *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ... @overload def choose_dark_palette(input: str = "husl", as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ... + @overload def choose_light_palette(input: str = "husl", *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ... @overload def choose_light_palette(input: str = "husl", as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ... + @overload def choose_diverging_palette(as_cmap: Literal[True]) -> LinearSegmentedColormap: ... @overload def choose_diverging_palette(as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ... + @overload def choose_cubehelix_palette(as_cmap: Literal[True]) -> LinearSegmentedColormap: ... @overload diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index 6404f0e1aad3..5b2c77ab99f2 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -166,6 +166,7 @@ class Command(_Command): dry_run: bool # Any: Dynamic command subclass attributes def __init__(self, dist: Distribution, **kw: Any) -> None: ... + # Note: Commands that setuptools doesn't re-expose are considered deprecated (they must be imported from distutils directly) # So we're not listing them here. This list comes directly from the setuptools/command folder. Minus the test command. @overload # type: ignore[override] @@ -214,6 +215,7 @@ class Command(_Command): def get_finalized_command(self, command: Literal["setopt"], create: bool | Literal[0, 1] = 1) -> setopt: ... @overload def get_finalized_command(self, command: str, create: bool | Literal[0, 1] = 1) -> Command: ... + @overload # type: ignore[override] # Extra **kw param def reinitialize_command(self, command: Literal["alias"], reinit_subcommands: bool = False, **kw) -> alias: ... @overload @@ -266,6 +268,7 @@ class Command(_Command): def reinitialize_command(self, command: str, reinit_subcommands: bool = False, **kw) -> Command: ... @overload def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False, **kw) -> _CommandT: ... + @abstractmethod def initialize_options(self) -> None: ... @abstractmethod diff --git a/stubs/setuptools/setuptools/_distutils/archive_util.pyi b/stubs/setuptools/setuptools/_distutils/archive_util.pyi index a77f6fa09ad8..2c6dae867a6b 100644 --- a/stubs/setuptools/setuptools/_distutils/archive_util.pyi +++ b/stubs/setuptools/setuptools/_distutils/archive_util.pyi @@ -21,6 +21,7 @@ def make_archive( owner: str | None = None, group: str | None = None, ) -> str: ... + def make_tarball( base_name: str, base_dir: StrPath, diff --git a/stubs/setuptools/setuptools/_distutils/cmd.pyi b/stubs/setuptools/setuptools/_distutils/cmd.pyi index 77ceb4b90581..879a0858d97d 100644 --- a/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -39,10 +39,12 @@ class Command: # NOTE: Because this is private setuptools implementation and we don't re-expose all commands here, # we're not overloading each and every command possibility. def get_finalized_command(self, command: str, create: bool = True) -> Command: ... + @overload def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ... @overload def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ... + def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... @@ -50,6 +52,7 @@ class Command: self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... + @overload def copy_file( self, @@ -70,6 +73,7 @@ class Command: link: str | None = None, level: Unused = 1, ) -> tuple[_BytesPathT | bytes, bool]: ... + def copy_tree( self, infile: StrPath, @@ -79,14 +83,17 @@ class Command: preserve_symlinks: bool = False, level: Unused = 1, ) -> list[str]: ... + @overload 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: ... + @overload def spawn(self, cmd: Sequence[StrOrBytesPath], search_path: Literal[False], level: Unused = 1) -> None: ... @overload def spawn(self, cmd: MutableSequence[bytes | StrPath], search_path: Literal[True] = True, level: Unused = 1) -> None: ... + @overload def make_archive( self, @@ -107,6 +114,7 @@ class Command: owner: str | None = None, group: str | None = None, ) -> str: ... + def make_file( self, infiles: str | list[str] | tuple[str, ...], diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi index 36672ced9ca2..b4256775c4c2 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -53,6 +53,7 @@ class Compiler: def set_link_objects(self, objects: list[str]) -> None: ... def detect_language(self, sources: str | list[str]) -> str | None: ... def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ... + @overload def has_function( self, funcname: str, libraries: list[str] | None = None, library_dirs: list[str] | tuple[str, ...] | None = None @@ -67,6 +68,7 @@ class Compiler: libraries: list[str] | None = None, library_dirs: list[str] | tuple[str, ...] | None = None, ) -> bool: ... + def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... def runtime_library_dir_option(self, dir: str) -> str: ... @@ -159,10 +161,12 @@ class Compiler: extra_preargs: list[str] | None = None, extra_postargs: Iterable[str] | None = None, ) -> None: ... + @overload def executable_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ... @overload def executable_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ... + def library_filename( self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = "" ) -> str: ... @@ -171,24 +175,30 @@ class Compiler: def object_filenames( self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = "" ) -> list[str]: ... + @overload def shared_object_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ... @overload def shared_object_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ... + def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... + @overload def spawn(self, cmd: Sequence[StrOrBytesPath], *, search_path: Literal[False], env: _ENV | None = None) -> None: ... @overload def spawn( self, cmd: MutableSequence[bytes | StrPath], *, search_path: Literal[True] = True, env: _ENV | None = None ) -> None: ... + def mkpath(self, name: str, mode: int = 0o777) -> None: ... + @overload def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... @overload def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ... + def announce(self, msg: str, level: int = 1) -> None: ... def warn(self, msg: str) -> None: ... def debug_print(self, msg: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/dist.pyi b/stubs/setuptools/setuptools/_distutils/dist.pyi index a4085c7ecdf4..4affefed4df1 100644 --- a/stubs/setuptools/setuptools/_distutils/dist.pyi +++ b/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -104,17 +104,21 @@ class Distribution: def print_commands(self) -> None: ... def get_command_list(self): ... def get_command_packages(self): ... + # NOTE: Because this is private setuptools implementation and we don't re-expose all commands here, # we're not overloading each and every command possibility. @overload def get_command_obj(self, command: str, create: Literal[True] = True) -> Command: ... @overload def get_command_obj(self, command: str, create: Literal[False]) -> Command | None: ... + def get_command_class(self, command: str) -> type[Command]: ... + @overload def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ... @overload def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ... + def announce(self, msg, level: int = 20) -> None: ... def run_commands(self) -> None: ... def run_command(self, command: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/filelist.pyi b/stubs/setuptools/setuptools/_distutils/filelist.pyi index 3e58a792fdff..39c3e77d79fc 100644 --- a/stubs/setuptools/setuptools/_distutils/filelist.pyi +++ b/stubs/setuptools/setuptools/_distutils/filelist.pyi @@ -16,6 +16,7 @@ class FileList: def sort(self) -> None: ... def remove_duplicates(self) -> None: ... def process_template_line(self, line: str) -> None: ... + @overload def include_pattern( self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False @@ -26,6 +27,7 @@ class FileList: ) -> bool: ... @overload def include_pattern(self, pattern: str | Pattern[str], anchor: bool, prefix: str | None, is_regex: Literal[True]) -> bool: ... + @overload def exclude_pattern( self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False diff --git a/stubs/setuptools/setuptools/_distutils/spawn.pyi b/stubs/setuptools/setuptools/_distutils/spawn.pyi index 958490c4966c..c76535e0bf5e 100644 --- a/stubs/setuptools/setuptools/_distutils/spawn.pyi +++ b/stubs/setuptools/setuptools/_distutils/spawn.pyi @@ -11,4 +11,5 @@ def spawn( def spawn( cmd: MutableSequence[bytes | StrPath], search_path: Literal[True] = True, verbose: Unused = False, env: _ENV | None = None ) -> None: ... + def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/stubs/setuptools/setuptools/_distutils/sysconfig.pyi b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi index b75ae74fcab8..e3b0292ef39b 100644 --- a/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +++ b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi @@ -11,10 +11,12 @@ EXEC_PREFIX: Final[str] def get_config_var(name: Literal["SO"]) -> int | str | None: ... @overload def get_config_var(name: str) -> int | str | None: ... + @overload def get_config_vars() -> dict[str, str | int]: ... @overload def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ... + def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... def get_python_inc(plat_specific: bool = False, prefix: str | None = None) -> str: ... diff --git a/stubs/setuptools/setuptools/command/egg_info.pyi b/stubs/setuptools/setuptools/command/egg_info.pyi index db57845ec268..10069f414f16 100644 --- a/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/stubs/setuptools/setuptools/command/egg_info.pyi @@ -29,10 +29,12 @@ class egg_info(InfoCommon, Command): egg_info: Incomplete egg_version: Incomplete def initialize_options(self) -> None: ... + @property 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: ... def finalize_options(self) -> None: ... def write_or_delete_file(self, what, filename, data, force: bool = False) -> None: ... diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index fb04a7b41ce9..a17b46c69fe9 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -43,6 +43,7 @@ class Distribution(_Distribution): def fetch_build_eggs(self, requires: str | Iterable[str]) -> list[metadata.Distribution]: ... def get_egg_cache_dir(self) -> str: ... def fetch_build_egg(self, req): ... + # NOTE: Commands that setuptools doesn't re-expose are considered deprecated (they must be imported from distutils directly) # So we're not listing them here. This list comes directly from the setuptools/command folder. Minus the test command. @overload # type: ignore[override] @@ -92,6 +93,7 @@ class Distribution(_Distribution): # Not replicating the overloads for "Command | None", user may use "isinstance" @overload def get_command_obj(self, command: str, create: Literal[0, False]) -> Command | None: ... + @overload def get_command_class(self, command: Literal["alias"]) -> type[alias]: ... @overload @@ -136,6 +138,7 @@ class Distribution(_Distribution): def get_command_class(self, command: Literal["setopt"]) -> type[setopt]: ... @overload def get_command_class(self, command: str) -> type[Command]: ... + @overload # type: ignore[override] def reinitialize_command(self, command: Literal["alias"], reinit_subcommands: bool = False) -> alias: ... @overload @@ -184,6 +187,7 @@ class Distribution(_Distribution): def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ... @overload 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: ... diff --git a/stubs/setuptools/setuptools/monkey.pyi b/stubs/setuptools/setuptools/monkey.pyi index ba3f50fe98da..c69326ab1fd5 100644 --- a/stubs/setuptools/setuptools/monkey.pyi +++ b/stubs/setuptools/setuptools/monkey.pyi @@ -9,6 +9,7 @@ __all__: list[str] = [] def get_unpatched(item: _UnpatchT) -> _UnpatchT: ... # type: ignore[overload-overlap] @overload def get_unpatched(item: object) -> None: ... + def get_unpatched_class(cls: type[_T]) -> type[_T]: ... def patch_all() -> None: ... def patch_func(replacement, target_mod, func_name) -> None: ... diff --git a/stubs/setuptools/setuptools/msvc.pyi b/stubs/setuptools/setuptools/msvc.pyi index af55d1c21720..433b0b161fd2 100644 --- a/stubs/setuptools/setuptools/msvc.pyi +++ b/stubs/setuptools/setuptools/msvc.pyi @@ -55,10 +55,12 @@ class RegistryInfo: def netfx_sdk(self) -> LiteralString: ... @property def windows_kits_roots(self) -> LiteralString: ... + @overload 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 | None: ... class SystemInfo: diff --git a/stubs/shapely/shapely/_coverage.pyi b/stubs/shapely/shapely/_coverage.pyi index 4d5b7b7d57ed..fefc40e02d48 100644 --- a/stubs/shapely/shapely/_coverage.pyi +++ b/stubs/shapely/shapely/_coverage.pyi @@ -9,6 +9,7 @@ __all__ = ["coverage_invalid_edges", "coverage_is_valid", "coverage_simplify"] def coverage_is_valid(geometry: OptGeoArrayLike, gap_width: float = 0.0, **kwargs) -> np.bool_: ... def coverage_invalid_edges(geometry: OptGeoArrayLike, gap_width: float = 0.0, **kwargs) -> GeoArray: ... + @overload def coverage_simplify(geometry: Polygon, tolerance: ArrayLike[float], *, simplify_boundary: bool = True) -> Polygon: ... @overload diff --git a/stubs/shapely/shapely/_geometry.pyi b/stubs/shapely/shapely/_geometry.pyi index 381f306867d9..7e9b64f1a71d 100644 --- a/stubs/shapely/shapely/_geometry.pyi +++ b/stubs/shapely/shapely/_geometry.pyi @@ -54,44 +54,54 @@ class GeometryType(IntEnum): def get_type_id(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_type_id(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_dimensions(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_dimensions(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_coordinate_dimension(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_coordinate_dimension(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_num_coordinates(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_num_coordinates(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_srid(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_srid(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def set_srid(geometry: OptGeoT, srid: SupportsIndex, **kwargs) -> OptGeoT: ... @overload def set_srid(geometry: OptGeoArrayLikeSeq, srid: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... @overload def set_srid(geometry: OptGeoArrayLike, srid: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... + @overload def get_x(point: Geometry | None, **kwargs) -> np.float64: ... @overload def get_x(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def get_y(point: Geometry | None, **kwargs) -> np.float64: ... @overload def get_y(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def get_z(point: Geometry | None, **kwargs) -> np.float64: ... @overload def get_z(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def get_m(point: Geometry | None, **kwargs) -> np.float64: ... @overload def get_m(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def get_point(geometry: LineString, index: SupportsIndex, **kwargs) -> Point | Any: ... @overload @@ -102,10 +112,12 @@ def get_point(geometry: Geometry, index: SupportsIndex, **kwargs) -> Point | Non def get_point(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... @overload def get_point(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... + @overload def get_num_points(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_num_points(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_exterior_ring(geometry: Polygon, **kwargs) -> LinearRing: ... @overload @@ -114,6 +126,7 @@ def get_exterior_ring(geometry: Point | LineString | BaseMultipartGeometry | Non def get_exterior_ring(geometry: Geometry, **kwargs) -> LinearRing | None: ... @overload def get_exterior_ring(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def get_interior_ring(geometry: Polygon, index: SupportsIndex, **kwargs) -> LinearRing | Any: ... @overload @@ -124,10 +137,12 @@ def get_interior_ring(geometry: Geometry, index: SupportsIndex, **kwargs) -> Lin def get_interior_ring(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... @overload def get_interior_ring(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... + @overload def get_num_interior_rings(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_num_interior_rings(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_geometry(geometry: MultiPoint, index: SupportsIndex, **kwargs) -> Point | Any: ... @overload @@ -144,22 +159,26 @@ def get_geometry(geometry: Geometry | None, index: SupportsIndex, **kwargs) -> B def get_geometry(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... @overload def get_geometry(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... + @overload def get_parts(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ... @overload def get_parts(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ... @overload def get_parts(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ... + @overload def get_rings(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ... @overload def get_rings(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ... @overload def get_rings(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ... + @overload def get_num_geometries(geometry: Geometry | None, **kwargs) -> np.int32: ... @overload def get_num_geometries(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int32]: ... + @overload def get_precision(geometry: Geometry | None, **kwargs) -> np.float64: ... @overload @@ -176,10 +195,12 @@ def set_precision(geometry: OptGeoT, grid_size: float, mode: _PrecisionMode = "v def set_precision( geometry: OptGeoArrayLikeSeq, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs ) -> GeoArray: ... + @overload def force_2d(geometry: OptGeoT, **kwargs) -> OptGeoT: ... @overload def force_2d(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def force_3d(geometry: OptGeoT, z: float = 0.0, **kwargs) -> OptGeoT: ... @overload diff --git a/stubs/shapely/shapely/affinity.pyi b/stubs/shapely/shapely/affinity.pyi index fbca24462789..d5e230db085f 100644 --- a/stubs/shapely/shapely/affinity.pyi +++ b/stubs/shapely/shapely/affinity.pyi @@ -10,12 +10,14 @@ __all__ = ["affine_transform", "rotate", "scale", "skew", "translate"] _Origin: TypeAlias = Literal["center", "centroid"] | Point | tuple[float, float] | tuple[float, float, float] def affine_transform(geom: GeoT, matrix: Collection[float]) -> GeoT: ... + @overload def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[2]) -> tuple[float, float]: ... @overload def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[3]) -> tuple[float, float, float]: ... @overload def interpret_origin(geom: Geometry, origin: _Origin, ndim: int) -> tuple[float, float] | tuple[float, float, float]: ... + def rotate(geom: GeoT, angle: float, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ... def scale(geom: GeoT, xfact: float = 1.0, yfact: float = 1.0, zfact: float = 1.0, origin: _Origin = "center") -> GeoT: ... def skew(geom: GeoT, xs: float = 0.0, ys: float = 0.0, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ... diff --git a/stubs/shapely/shapely/constructive.pyi b/stubs/shapely/shapely/constructive.pyi index ba1ba4e6ea59..80ff27d36add 100644 --- a/stubs/shapely/shapely/constructive.pyi +++ b/stubs/shapely/shapely/constructive.pyi @@ -64,6 +64,7 @@ def boundary(geometry: GeometryCollection | None, **kwargs) -> None: ... def boundary(geometry: Geometry, **kwargs) -> BaseMultipartGeometry | Any: ... @overload def boundary(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def buffer( geometry: Geometry, @@ -119,6 +120,7 @@ def buffer( single_sided: bool = False, **kwargs, ) -> GeoArray: ... + @overload def offset_curve( geometry: Geometry, @@ -164,6 +166,7 @@ def offset_curve( mitre_limit: float = 5.0, **kwargs, ) -> GeoArray: ... + @overload def centroid(geometry: Geometry, **kwargs) -> Point: ... @overload @@ -172,6 +175,7 @@ def centroid(geometry: None, **kwargs) -> None: ... def centroid(geometry: Geometry | None, **kwargs) -> Point | None: ... @overload def centroid(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def clip_by_rect(geometry: Geometry, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs) -> BaseGeometry: ... @overload @@ -182,6 +186,7 @@ def clip_by_rect( ) -> BaseGeometry | None: ... @overload def clip_by_rect(geometry: OptGeoArrayLikeSeq, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs) -> GeoArray: ... + @overload def concave_hull(geometry: Geometry, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> BaseGeometry: ... @overload @@ -190,6 +195,7 @@ def concave_hull(geometry: None, ratio: float = 0.0, allow_holes: bool = False, def concave_hull(geometry: Geometry | None, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> BaseGeometry | None: ... @overload def concave_hull(geometry: OptGeoArrayLikeSeq, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> GeoArray: ... + @overload def convex_hull(geometry: Geometry, **kwargs) -> BaseGeometry: ... @overload @@ -198,6 +204,7 @@ def convex_hull(geometry: None, **kwargs) -> None: ... def convex_hull(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... @overload def convex_hull(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def delaunay_triangles( geometry: Geometry, tolerance: float = 0.0, only_edges: Literal[False] = False, **kwargs @@ -232,6 +239,7 @@ def delaunay_triangles( def delaunay_triangles( geometry: OptGeoArrayLikeSeq, tolerance: ArrayLike[float] = 0.0, only_edges: ArrayLike[bool] = False, **kwargs ) -> GeoArray: ... + @overload def constrained_delaunay_triangles(geometry: Geometry, **kwargs) -> GeometryCollection: ... @overload @@ -240,6 +248,7 @@ def constrained_delaunay_triangles(geometry: None, **kwargs) -> None: ... def constrained_delaunay_triangles(geometry: Geometry | None, **kwargs) -> GeometryCollection | None: ... @overload def constrained_delaunay_triangles(geometry: OptGeoArrayLikeSeq | OptGeoArrayLike, **kwargs) -> GeoArray: ... + @overload def envelope(geometry: Point, **kwargs) -> Point: ... @overload @@ -250,6 +259,7 @@ def envelope(geometry: None, **kwargs) -> None: ... def envelope(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... @overload def envelope(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def extract_unique_points(geometry: Geometry, **kwargs) -> MultiPoint: ... @overload @@ -258,6 +268,7 @@ def extract_unique_points(geometry: None, **kwargs) -> None: ... def extract_unique_points(geometry: Geometry | None, **kwargs) -> MultiPoint | None: ... @overload def extract_unique_points(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def build_area(geometry: Geometry, **kwargs) -> BaseGeometry: ... @overload @@ -296,6 +307,7 @@ def make_valid( def make_valid( geometry: OptGeoArrayLikeSeq, *, method: Literal["structure"], keep_collapsed: bool = True, **kwargs ) -> GeoArray: ... + @overload def minimum_clearance_line(geometry: Point, **kwargs) -> Point: ... @overload @@ -308,10 +320,12 @@ def minimum_clearance_line(geometry: None, **kwargs) -> None: ... def minimum_clearance_line(geometry: Geometry | None, **kwargs) -> Polygon | Point | None: ... @overload def minimum_clearance_line(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def normalize(geometry: OptGeoT, **kwargs) -> OptGeoT: ... @overload def normalize(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def point_on_surface(geometry: Geometry, **kwargs) -> Point: ... @overload @@ -320,6 +334,7 @@ def point_on_surface(geometry: None, **kwargs) -> None: ... def point_on_surface(geometry: Geometry | None, **kwargs) -> Point | None: ... @overload def point_on_surface(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def node(geometry: Geometry, **kwargs) -> MultiLineString: ... @overload @@ -328,12 +343,14 @@ def node(geometry: None, **kwargs) -> None: ... def node(geometry: Geometry | None, **kwargs) -> MultiLineString | None: ... @overload def node(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def polygonize(geometries: Sequence[Geometry | None], **kwargs) -> GeometryCollection: ... @overload def polygonize(geometries: Sequence[Sequence[Geometry | None]], **kwargs) -> GeoArray: ... @overload def polygonize(geometries: OptGeoArrayLikeSeq, **kwargs) -> GeometryCollection | GeoArray: ... + @overload def polygonize_full( geometries: Sequence[Geometry | None], **kwargs @@ -349,26 +366,31 @@ def polygonize_full( tuple[GeometryCollection, GeometryCollection, GeometryCollection, GeometryCollection] | tuple[GeoArray, GeoArray, GeoArray, GeoArray] ): ... + @overload def remove_repeated_points(geometry: OptGeoT, tolerance: float = 0.0, **kwargs) -> OptGeoT: ... @overload def remove_repeated_points(geometry: OptGeoArrayLikeSeq, tolerance: float = 0.0, **kwargs) -> GeoArray: ... + @overload def reverse(geometry: OptGeoT, **kwargs) -> OptGeoT: ... @overload def reverse(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def segmentize(geometry: OptGeoT, max_segment_length: float, **kwargs) -> OptGeoT: ... @overload def segmentize(geometry: OptGeoArrayLike, max_segment_length: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... @overload def segmentize(geometry: OptGeoArrayLikeSeq, max_segment_length: ArrayLike[float], **kwargs) -> GeoArray: ... + @overload def simplify(geometry: OptGeoT, tolerance: float, preserve_topology: bool = True, **kwargs) -> OptGeoT: ... @overload def simplify(geometry: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], preserve_topology: bool = True, **kwargs) -> GeoArray: ... @overload def simplify(geometry: OptGeoArrayLikeSeq, tolerance: ArrayLike[float], preserve_topology: bool = True, **kwargs) -> GeoArray: ... + @overload def snap(geometry: OptGeoT, reference: Geometry, tolerance: float, **kwargs) -> OptGeoT: ... @overload @@ -379,6 +401,7 @@ def snap(geometry: OptGeoArrayLikeSeq, reference: OptGeoArrayLike, tolerance: Ar def snap(geometry: OptGeoArrayLike, reference: OptGeoArrayLikeSeq, tolerance: ArrayLike[float], **kwargs) -> GeoArray: ... @overload def snap(geometry: OptGeoArrayLike, reference: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... + @overload def voronoi_polygons( geometry: Geometry, @@ -504,6 +527,7 @@ def voronoi_polygons( ordered: ArrayLikeSeq[bool], **kwargs, ) -> GeoArray: ... + @overload def oriented_envelope(geometry: Point, **kwargs) -> Point: ... @overload @@ -529,6 +553,7 @@ def minimum_bounding_circle(geometry: None, **kwargs) -> None: ... def minimum_bounding_circle(geometry: Geometry | None, **kwargs) -> Polygon | Point | None: ... @overload def minimum_bounding_circle(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... + @overload def maximum_inscribed_circle(geometry: Polygon | MultiPolygon, tolerance: float | None = None, **kwargs) -> LineString: ... @overload @@ -541,6 +566,7 @@ def maximum_inscribed_circle( def maximum_inscribed_circle(geometry: OptGeoArrayLikeSeq, tolerance: ArrayLike[float] | None = None, **kwargs) -> GeoArray: ... @overload def maximum_inscribed_circle(geometry: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... + @overload def orient_polygons(geometry: OptGeoT, *, exterior_cw: bool = False, **kwargs) -> OptGeoT: ... @overload diff --git a/stubs/shapely/shapely/coordinates.pyi b/stubs/shapely/shapely/coordinates.pyi index bb8026c9d0c1..fd3d1284c10f 100644 --- a/stubs/shapely/shapely/coordinates.pyi +++ b/stubs/shapely/shapely/coordinates.pyi @@ -24,7 +24,9 @@ def transform( *, interleaved: bool = True, ) -> GeoArray: ... + def count_coordinates(geometry: OptGeoArrayLike) -> int: ... + @overload def get_coordinates( geometry: OptGeoArrayLike, include_z: bool = False, return_index: Literal[False] = False, *, include_m: bool = False @@ -45,6 +47,7 @@ def get_coordinates( def get_coordinates( geometry: OptGeoArrayLike, include_z: bool, return_index: bool, *, include_m: bool = False ) -> NDArray[np.float64] | tuple[NDArray[np.float64], NDArray[np.int64]]: ... + @overload def set_coordinates(geometry: GeoT, coordinates: ArrayLikeSeq[float]) -> GeoT: ... @overload diff --git a/stubs/shapely/shapely/coords.pyi b/stubs/shapely/shapely/coords.pyi index 407b32af0c44..7ea73aa8404a 100644 --- a/stubs/shapely/shapely/coords.pyi +++ b/stubs/shapely/shapely/coords.pyi @@ -9,10 +9,12 @@ class CoordinateSequence: def __init__(self, coords: NDArray[np.float64]) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[tuple[float, ...]]: ... + @overload def __getitem__(self, key: int) -> tuple[float, ...]: ... @overload def __getitem__(self, key: slice) -> list[tuple[float, ...]]: ... + def __array__(self, dtype: DTypeLike | None = None, copy: Literal[True] | None = None) -> NDArray[np.float64]: ... @property def xy(self) -> tuple[array[float], array[float]]: ... diff --git a/stubs/shapely/shapely/creation.pyi b/stubs/shapely/shapely/creation.pyi index d009e3a06a63..d9631df85d80 100644 --- a/stubs/shapely/shapely/creation.pyi +++ b/stubs/shapely/shapely/creation.pyi @@ -98,6 +98,7 @@ def points( out: NDArray[np.object_] | None = None, **kwargs, ) -> Point | GeoArray: ... + @overload def linestrings( coords: Sequence[float], # acts as (x1, x2, ...) @@ -142,6 +143,7 @@ def linestrings( out: NDArray[np.object_] | None = None, **kwargs, ) -> LineString | GeoArray: ... + @overload def linearrings( coords: Sequence[float], # acts as (x1, x2, ...) @@ -186,6 +188,7 @@ def linearrings( out: NDArray[np.object_] | None = None, **kwargs, ) -> LinearRing | GeoArray: ... + @overload def polygons( geometries: LinearRing | Sequence[Sequence[float]] | None, @@ -213,6 +216,7 @@ def polygons( out: NDArray[np.object_] | None = None, **kwargs, ) -> Polygon | GeoArray: ... + @overload def box(xmin: float, ymin: float, xmax: float, ymax: float, ccw: bool = True, **kwargs) -> Polygon: ... @overload @@ -224,6 +228,7 @@ def box( ccw: bool = True, **kwargs, ) -> GeoArray: ... + @overload def multipoints( geometries: Sequence[Point | Sequence[float] | None], indices: None = None, *, out: None = None, **kwargs @@ -240,6 +245,7 @@ def multipoints( def multipoints( geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, *, out: NDArray[np.object_] | None = None, **kwargs ) -> MultiPoint | GeoArray: ... + @overload def multilinestrings( geometries: Sequence[LineString | Sequence[Sequence[float]] | None], indices: None = None, *, out: None = None, **kwargs @@ -256,6 +262,7 @@ def multilinestrings( def multilinestrings( geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, *, out: NDArray[np.object_] | None = None, **kwargs ) -> MultiLineString | GeoArray: ... + @overload def multipolygons( geometries: Sequence[Polygon | Sequence[Sequence[float]] | None], indices: None = None, *, out: None = None, **kwargs @@ -272,6 +279,7 @@ def multipolygons( def multipolygons( geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, *, out: NDArray[np.object_] | None = None, **kwargs ) -> MultiPolygon | GeoArray: ... + @overload def geometrycollections( geometries: Sequence[Geometry | None], indices: None = None, out: None = None, **kwargs @@ -287,6 +295,7 @@ def geometrycollections( def geometrycollections( geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, out: NDArray[np.object_] | None = None, **kwargs ) -> GeometryCollection | GeoArray: ... + def prepare(geometry: OptGeoArrayLike, **kwargs) -> None: ... def destroy_prepared(geometry: OptGeoArrayLike, **kwargs) -> None: ... def empty( diff --git a/stubs/shapely/shapely/geometry/base.pyi b/stubs/shapely/shapely/geometry/base.pyi index b641a608375e..a39ed80b3b89 100644 --- a/stubs/shapely/shapely/geometry/base.pyi +++ b/stubs/shapely/shapely/geometry/base.pyi @@ -40,30 +40,35 @@ class BaseGeometry(Geometry): def __bool__(self) -> bool: ... def __nonzero__(self) -> bool: ... def __format__(self, format_spec: str) -> str: ... + @overload def __and__(self, other: Geometry) -> BaseGeometry: ... @overload def __and__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... @overload def __and__(self, other: None) -> None: ... + @overload def __or__(self, other: Geometry) -> BaseGeometry: ... @overload def __or__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... @overload def __or__(self, other: None) -> None: ... + @overload def __sub__(self, other: Geometry) -> BaseGeometry: ... @overload def __sub__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... @overload def __sub__(self, other: None) -> None: ... + @overload def __xor__(self, other: Geometry) -> BaseGeometry: ... @overload def __xor__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... @overload def __xor__(self, other: None) -> None: ... + def __eq__(self, other: object, /) -> bool: ... def __ne__(self, other: object, /) -> bool: ... def __hash__(self) -> int: ... @@ -90,14 +95,17 @@ class BaseGeometry(Geometry): def geom_type(self) -> str: ... @property def area(self) -> float: ... + @overload def distance(self, other: Geometry | None) -> float: ... @overload def distance(self, other: OptGeoArrayLikeSeq) -> NDArray[np.float64]: ... + @overload def hausdorff_distance(self, other: Geometry | None) -> float: ... @overload def hausdorff_distance(self, other: OptGeoArrayLikeSeq) -> NDArray[np.float64]: ... + @property def length(self) -> float: ... @property @@ -132,30 +140,35 @@ class BaseGeometry(Geometry): ) -> Polygon: ... def simplify(self, tolerance: float, preserve_topology: bool = True) -> BaseGeometry: ... def normalize(self) -> BaseGeometry: ... + @overload def difference(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... @overload def difference(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... @overload def difference(self, other: None, grid_size: float | None = None) -> None: ... + @overload def intersection(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... @overload def intersection(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... @overload def intersection(self, other: None, grid_size: float | None = None) -> None: ... + @overload def symmetric_difference(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... @overload def symmetric_difference(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... @overload def symmetric_difference(self, other: None, grid_size: float | None = None) -> None: ... + @overload def union(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... @overload def union(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... @overload def union(self, other: None, grid_size: float | None = None) -> None: ... + @property def has_z(self) -> bool: ... @property @@ -170,62 +183,76 @@ class BaseGeometry(Geometry): def is_simple(self) -> bool: ... @property def is_valid(self) -> bool: ... + @overload def relate(self, other: Geometry) -> str: ... @overload def relate(self, other: OptGeoArrayLikeSeq) -> NDArray[np.str_]: ... @overload def relate(self, other: None) -> None: ... + @overload def covers(self, other: Geometry | None) -> bool: ... @overload def covers(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def covered_by(self, other: Geometry | None) -> bool: ... @overload def covered_by(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def contains(self, other: Geometry | None) -> bool: ... @overload def contains(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def contains_properly(self, other: Geometry | None) -> bool: ... @overload def contains_properly(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def crosses(self, other: Geometry | None) -> bool: ... @overload def crosses(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def disjoint(self, other: Geometry | None) -> bool: ... @overload def disjoint(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def equals(self, other: Geometry | None) -> bool: ... @overload def equals(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def intersects(self, other: Geometry | None) -> bool: ... @overload def intersects(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def overlaps(self, other: Geometry | None) -> bool: ... @overload def overlaps(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def touches(self, other: Geometry | None) -> bool: ... @overload def touches(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def within(self, other: Geometry | None) -> bool: ... @overload def within(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... + @overload def dwithin(self, other: Geometry | None, distance: float) -> bool: ... @overload def dwithin(self, other: OptGeoArrayLikeSeq, distance: float) -> NDArray[np.bool_]: ... @overload def dwithin(self, other: OptGeoArrayLike, distance: ArrayLikeSeq[float]) -> NDArray[np.bool_]: ... + @overload def equals_exact(self, other: Geometry | None, tolerance: float = 0.0, *, normalize: bool = False) -> bool: ... @overload @@ -236,30 +263,37 @@ class BaseGeometry(Geometry): def equals_exact( self, other: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], *, normalize: bool = False ) -> NDArray[np.bool_]: ... + @overload def relate_pattern(self, other: Geometry | None, pattern: str) -> bool: ... @overload def relate_pattern(self, other: OptGeoArrayLikeSeq, pattern: str) -> NDArray[np.bool_]: ... + @overload def line_locate_point(self, other: Point | None, normalized: bool = False) -> float: ... @overload def line_locate_point(self, other: OptGeoArrayLikeSeq, normalized: bool = False) -> NDArray[np.float64]: ... + @overload def project(self, other: Point | None, normalized: bool = False) -> float: ... @overload def project(self, other: OptGeoArrayLikeSeq, normalized: bool = False) -> NDArray[np.float64]: ... + @overload def line_interpolate_point(self, distance: float, normalized: bool = False) -> Point: ... @overload def line_interpolate_point(self, distance: ArrayLikeSeq[float], normalized: bool = False) -> GeoArray: ... + @overload def interpolate(self, distance: float, normalized: bool = False) -> Point: ... @overload def interpolate(self, distance: ArrayLikeSeq[float], normalized: bool = False) -> GeoArray: ... + @overload def segmentize(self, max_segment_length: float) -> Self: ... @overload def segmentize(self, max_segment_length: ArrayLikeSeq[float]) -> GeoArray: ... + def reverse(self) -> Self: ... _GeoT_co = TypeVar("_GeoT_co", bound=Geometry, default=BaseGeometry, covariant=True) @@ -278,6 +312,7 @@ class GeometrySequence(Generic[_P_co]): def __init__(self, parent: _P_co) -> None: ... def __iter__(self: GeometrySequence[BaseMultipartGeometry[GeoT]]) -> Iterator[GeoT]: ... def __len__(self) -> int: ... + @overload def __getitem__(self: GeometrySequence[BaseMultipartGeometry[GeoT]], key: int | np.integer[Any]) -> GeoT: ... @overload diff --git a/stubs/shapely/shapely/geometry/collection.pyi b/stubs/shapely/shapely/geometry/collection.pyi index adfe1cc648f6..bbac18efee0e 100644 --- a/stubs/shapely/shapely/geometry/collection.pyi +++ b/stubs/shapely/shapely/geometry/collection.pyi @@ -8,12 +8,14 @@ from .base import BaseMultipartGeometry, GeometrySequence, _GeoT_co class GeometryCollection(BaseMultipartGeometry[_GeoT_co]): # Overloads of __new__ are used because mypy is unable to narrow the typevar otherwise __slots__: list[str] = [] + @overload def __new__( self, geoms: BaseMultipartGeometry[_GeoT_co] | GeometrySequence[BaseMultipartGeometry[_GeoT_co]] | Collection[_GeoT_co] ) -> Self: ... @overload def __new__(self, geoms: OptGeoArrayLike = None) -> Self: ... + # more precise base overrides @property def boundary(self) -> None: ... diff --git a/stubs/shapely/shapely/geometry/point.pyi b/stubs/shapely/shapely/geometry/point.pyi index 41b429fc652c..1622185fff4a 100644 --- a/stubs/shapely/shapely/geometry/point.pyi +++ b/stubs/shapely/shapely/geometry/point.pyi @@ -12,6 +12,7 @@ _PointLike: TypeAlias = Point | Iterable[float] | ArrayLikeSeq[float] class Point(BaseGeometry): __slots__: list[str] = [] + @overload # no args: empty point def __new__(self) -> Self: ... @overload # one arg: (x, y[, z]) tuple or a Point instance @@ -20,6 +21,7 @@ class Point(BaseGeometry): def __new__(self, x: float, y: float, /) -> Self: ... @overload # three args: (x, y, z) tuple def __new__(self, x: float, y: float, z: float, /) -> Self: ... + @property def x(self) -> float: ... @property diff --git a/stubs/shapely/shapely/geometry/polygon.pyi b/stubs/shapely/shapely/geometry/polygon.pyi index ee8feb530ea0..240674200a0f 100644 --- a/stubs/shapely/shapely/geometry/polygon.pyi +++ b/stubs/shapely/shapely/geometry/polygon.pyi @@ -23,6 +23,7 @@ class InteriorRingSequence: def __iter__(self) -> Self: ... def __next__(self) -> LinearRing: ... def __len__(self) -> int: ... + @overload def __getitem__(self, key: int) -> LinearRing: ... @overload diff --git a/stubs/shapely/shapely/io.pyi b/stubs/shapely/shapely/io.pyi index fba4035f3328..871967fa8fc0 100644 --- a/stubs/shapely/shapely/io.pyi +++ b/stubs/shapely/shapely/io.pyi @@ -50,6 +50,7 @@ def to_wkt( old_3d: bool = False, **kwargs, ) -> NDArray[np.str_]: ... + @overload def to_wkb( geometry: None, @@ -120,12 +121,14 @@ def to_wkb( flavor: Literal["iso", "extended"] = "extended", **kwargs, ) -> NDArray[np.bytes_] | NDArray[np.str_]: ... + @overload def to_geojson(geometry: None, indent: int | None = None, **kwargs) -> None: ... @overload def to_geojson(geometry: Geometry, indent: int | None = None, **kwargs) -> str: ... @overload def to_geojson(geometry: OptGeoArrayLikeSeq, indent: int | None = None, **kwargs) -> NDArray[np.str_]: ... + @overload def from_wkt(geometry: None, on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", **kwargs) -> None: ... @overload @@ -134,6 +137,7 @@ def from_wkt(geometry: str, on_invalid: Literal["raise", "warn", "ignore", "fix" def from_wkt( geometry: ArrayLikeSeq[str | None], on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", **kwargs ) -> GeoArray: ... + @overload def from_wkb(geometry: None, on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", **kwargs) -> None: ... @overload @@ -144,6 +148,7 @@ def from_wkb( def from_wkb( geometry: ArrayLikeSeq[str | bytes | None], on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", **kwargs ) -> GeoArray: ... + @overload def from_geojson(geometry: None, on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", **kwargs) -> None: ... @overload diff --git a/stubs/shapely/shapely/lib.pyi b/stubs/shapely/shapely/lib.pyi index 45a785f91909..ea224928eab6 100644 --- a/stubs/shapely/shapely/lib.pyi +++ b/stubs/shapely/shapely/lib.pyi @@ -167,6 +167,7 @@ class ShapelyError(Exception): ... class GEOSException(ShapelyError): ... def count_coordinates(geoms: NDArray[np.object_], /) -> int: ... + @overload def get_coordinates(arr: NDArray[np.object_], include_z: bool, return_index: Literal[False], /) -> NDArray[np.float64]: ... @overload @@ -177,4 +178,5 @@ def get_coordinates( def get_coordinates( arr: NDArray[np.object_], include_z: bool, return_index: bool, / ) -> NDArray[np.float64] | tuple[NDArray[np.float64], NDArray[np.int64]]: ... + def set_coordinates(geoms: NDArray[np.object_], coords: NDArray[np.float64], /) -> NDArray[np.object_]: ... diff --git a/stubs/shapely/shapely/linear.pyi b/stubs/shapely/shapely/linear.pyi index 10701f0c5ed7..904a00ce1f95 100644 --- a/stubs/shapely/shapely/linear.pyi +++ b/stubs/shapely/shapely/linear.pyi @@ -27,6 +27,7 @@ def line_interpolate_point( def line_interpolate_point( line: OptGeoArrayLikeSeq, distance: ArrayLike[float], normalized: bool = False, **kwargs ) -> GeoArray: ... + @overload def line_locate_point( line: LineString | MultiLineString | GeometryCollection | None, other: Point | None, normalized: bool = False, **kwargs @@ -39,12 +40,14 @@ def line_locate_point( def line_locate_point( line: OptGeoArrayLikeSeq, other: OptGeoArrayLike, normalized: bool = False, **kwargs ) -> NDArray[np.float64]: ... + @overload def line_merge(line: None, directed: bool = False, **kwargs) -> None: ... @overload def line_merge(line: Geometry, directed: bool = False, **kwargs) -> LineString | MultiLineString | GeometryCollection: ... @overload def line_merge(line: OptGeoArrayLikeSeq, directed: bool = False, **kwargs) -> GeoArray: ... + @overload def shared_paths(a: LineString | MultiLineString | None, b: None, **kwargs) -> None: ... @overload @@ -57,6 +60,7 @@ def shared_paths( def shared_paths(a: LineString | MultiLineString | None, b: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... @overload def shared_paths(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> GeoArray: ... + @overload def shortest_line(a: Geometry | None, b: None, **kwargs) -> None: ... @overload diff --git a/stubs/shapely/shapely/measurement.pyi b/stubs/shapely/shapely/measurement.pyi index 065e6b831d09..b0291b92f633 100644 --- a/stubs/shapely/shapely/measurement.pyi +++ b/stubs/shapely/shapely/measurement.pyi @@ -22,18 +22,22 @@ __all__ = [ def area(geometry: Geometry | None, **kwargs) -> np.float64: ... @overload def area(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def distance(a: Geometry | None, b: Geometry | None, **kwargs) -> np.float64: ... @overload def distance(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... @overload def distance(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + def bounds(geometry: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... def total_bounds(geometry: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... + @overload def length(geometry: Geometry | None, **kwargs) -> np.float64: ... @overload def length(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def hausdorff_distance(a: Geometry | None, b: Geometry | None, densify: float | None = None, **kwargs) -> np.float64: ... @overload @@ -46,6 +50,7 @@ def hausdorff_distance( def hausdorff_distance( a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, densify: ArrayLike[float] | None = None, **kwargs ) -> NDArray[np.float64]: ... + @overload def frechet_distance(a: Geometry | None, b: Geometry | None, densify: float | None = None, **kwargs) -> np.float64: ... @overload @@ -58,10 +63,12 @@ def frechet_distance( def frechet_distance( a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, densify: ArrayLike[float] | None = None, **kwargs ) -> NDArray[np.float64]: ... + @overload def minimum_clearance(geometry: Geometry | None, **kwargs) -> np.float64: ... @overload def minimum_clearance(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... + @overload def minimum_bounding_radius(geometry: Geometry | None, **kwargs) -> np.float64: ... @overload diff --git a/stubs/shapely/shapely/ops.pyi b/stubs/shapely/shapely/ops.pyi index f1f188bcb9b1..206f91861b3e 100644 --- a/stubs/shapely/shapely/ops.pyi +++ b/stubs/shapely/shapely/ops.pyi @@ -34,6 +34,7 @@ class CollectionOperator: def shapeup(self, ob: dict[str, Any] | SupportsGeoInterface) -> BaseGeometry: ... # type: ignore[overload-overlap] @overload def shapeup(self, ob: _ConvertibleToLineString) -> LineString: ... + def polygonize( self, lines: OptGeoArrayLike | Iterable[_ConvertibleToLineString | None] ) -> GeometrySequence[GeometryCollection[Polygon]]: ... @@ -62,6 +63,7 @@ def triangulate(geom: Geometry, tolerance: float = 0.0, *, edges: Literal[True]) def triangulate(geom: Geometry, tolerance: float, edges: Literal[True]) -> list[LineString]: ... @overload # fallback def triangulate(geom: Geometry, tolerance: float = 0.0, edges: bool = False) -> list[Polygon] | list[LineString]: ... + @overload def voronoi_diagram( geom: Geometry, envelope: Geometry | None = None, tolerance: float = 0.0, edges: Literal[False] = False @@ -78,12 +80,14 @@ def voronoi_diagram( def voronoi_diagram( geom: Geometry, envelope: Geometry | None = None, tolerance: float = 0.0, edges: bool = False ) -> GeometryCollection[Polygon | LineString | MultiLineString]: ... + @overload def validate(geom: None) -> None: ... @overload def validate(geom: Geometry) -> str: ... @overload def validate(geom: Geometry | None) -> str | None: ... + def transform(func: Callable[[float, float, float | None], tuple[float, ...]], geom: GeoT) -> GeoT: ... def nearest_points(g1: Geometry, g2: Geometry) -> tuple[Point, Point]: ... def snap(g1: GeoT, g2: Geometry, tolerance: float) -> GeoT: ... diff --git a/stubs/shapely/shapely/plotting.pyi b/stubs/shapely/shapely/plotting.pyi index 0aded7e79f21..5afa968029c4 100644 --- a/stubs/shapely/shapely/plotting.pyi +++ b/stubs/shapely/shapely/plotting.pyi @@ -9,6 +9,7 @@ from .geometry import LinearRing, LineString, MultiLineString, MultiPolygon, Pol from .lib import Geometry def patch_from_polygon(polygon: Polygon | MultiPolygon, **kwargs: Any) -> PathPatch: ... + @overload def plot_polygon( polygon: Polygon | MultiPolygon, @@ -43,6 +44,7 @@ def plot_polygon( linewidth: float | None = None, **kwargs: Any, ) -> PathPatch: ... + @overload def plot_line( line: LineString | LinearRing | MultiLineString, @@ -71,6 +73,7 @@ def plot_line( linewidth: float = 2, **kwargs: Any, ) -> PathPatch: ... + def plot_points( geom: Geometry, ax: Axes | None = None, color: ColorType | None = None, marker: str = "o", **kwargs: Any ) -> Line2D: ... diff --git a/stubs/shapely/shapely/predicates.pyi b/stubs/shapely/shapely/predicates.pyi index 2145c60b54a9..85790e546d9f 100644 --- a/stubs/shapely/shapely/predicates.pyi +++ b/stubs/shapely/shapely/predicates.pyi @@ -45,22 +45,27 @@ __all__ = [ def has_z(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def has_z(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def has_m(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def has_m(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_ccw(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_ccw(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_closed(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_closed(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_empty(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_empty(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_geometry(geometry: Geometry, **kwargs) -> np.bool_[Literal[True]]: ... @overload @@ -69,6 +74,7 @@ def is_geometry(geometry: None, **kwargs) -> np.bool_[Literal[False]]: ... def is_geometry(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload def is_geometry(geometry: object, **kwargs) -> TypeGuard[BaseGeometry]: ... + @overload def is_missing(geometry: Geometry, **kwargs) -> np.bool_[Literal[False]]: ... @overload @@ -77,100 +83,118 @@ def is_missing(geometry: None, **kwargs) -> np.bool_[Literal[True]]: ... def is_missing(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload def is_missing(geometry: object, **kwargs) -> TypeGuard[None]: ... + @overload def is_prepared(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_prepared(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_valid_input(geometry: Geometry | None, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_valid_input(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload def is_valid_input(geometry: object, **kwargs) -> TypeGuard[BaseGeometry | None]: ... + @overload def is_ring(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_ring(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_simple(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_simple(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_valid(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_valid(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def is_valid_reason(geometry: None, **kwargs) -> None: ... @overload def is_valid_reason(geometry: Geometry, **kwargs) -> str: ... @overload def is_valid_reason(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.object_]: ... + @overload def crosses(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def crosses(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def crosses(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def contains(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def contains(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def contains(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def contains_properly(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def contains_properly(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def contains_properly(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def covered_by(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def covered_by(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def covered_by(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def covers(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def covers(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def covers(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def disjoint(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def disjoint(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def disjoint(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def equals(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def equals(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def equals(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def intersects(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def intersects(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def intersects(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def overlaps(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def overlaps(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def overlaps(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def touches(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def touches(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def touches(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def within(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def within(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def within(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def equals_exact( a: Geometry | None, b: Geometry | None, tolerance: float = 0.0, *, normalize: bool = False, **kwargs @@ -187,12 +211,14 @@ def equals_exact( def equals_exact( a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, tolerance: ArrayLike[float] = 0.0, *, normalize: bool = False, **kwargs ) -> NDArray[np.bool_]: ... + @overload def equals_identical(a: Geometry | None, b: Geometry | None, **kwargs) -> np.bool_: ... @overload def equals_identical(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... @overload def equals_identical(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... + @overload def relate(a: Geometry | None, b: None, **kwargs) -> None: ... @overload @@ -203,18 +229,21 @@ def relate(a: Geometry, b: Geometry, **kwargs) -> str: ... def relate(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.object_]: ... @overload def relate(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.object_]: ... + @overload def relate_pattern(a: Geometry | None, b: Geometry | None, pattern: str, **kwargs) -> np.bool_: ... @overload def relate_pattern(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, pattern: str, **kwargs) -> NDArray[np.bool_]: ... @overload def relate_pattern(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, pattern: str, **kwargs) -> NDArray[np.bool_]: ... + @overload def dwithin(a: Geometry | None, b: Geometry | None, distance: float, **kwargs) -> np.bool_: ... @overload def dwithin(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, distance: float, **kwargs) -> NDArray[np.bool_]: ... @overload def dwithin(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, distance: float, **kwargs) -> NDArray[np.bool_]: ... + @overload def contains_xy(geom: Geometry | None, x: float, y: float, **kwargs) -> np.bool_: ... @overload @@ -225,6 +254,7 @@ def contains_xy(geom: Geometry | None, x: ArrayLike[float], y: ArrayLikeSeq[floa def contains_xy(geom: Geometry | None, x: ArrayLikeSeq[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... @overload def contains_xy(geom: OptGeoArrayLikeSeq, x: ArrayLike[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... + @overload def intersects_xy(geom: Geometry | None, x: float, y: float, **kwargs) -> np.bool_: ... @overload diff --git a/stubs/shapely/shapely/set_operations.pyi b/stubs/shapely/shapely/set_operations.pyi index a243b3028e5c..7328583d2ad1 100644 --- a/stubs/shapely/shapely/set_operations.pyi +++ b/stubs/shapely/shapely/set_operations.pyi @@ -30,6 +30,7 @@ def difference(a: Geometry | None, b: None, grid_size: float | None = None, **kw def difference(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... @overload def difference(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... + @overload def intersection(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... @overload @@ -40,10 +41,12 @@ def intersection(a: Geometry | None, b: None, grid_size: float | None = None, ** def intersection(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... @overload def intersection(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... + @overload def intersection_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... @overload def intersection_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... + @overload def symmetric_difference(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... @overload @@ -54,12 +57,14 @@ def symmetric_difference(a: Geometry | None, b: None, grid_size: float | None = def symmetric_difference(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... @overload def symmetric_difference(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... + @overload @deprecated("symmetric_difference_all behaves incorrectly and will be removed in a future version.") def symmetric_difference_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... @overload @deprecated("symmetric_difference_all behaves incorrectly and will be removed in a future version.") def symmetric_difference_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... + @overload def union(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... @overload @@ -70,6 +75,7 @@ def union(a: Geometry | None, b: None, grid_size: float | None = None, **kwargs) def union(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... @overload def union(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... + @overload def union_all(geometries: OptGeoArrayLike, grid_size: float | None = None, axis: None = None, **kwargs) -> BaseGeometry: ... @overload @@ -85,11 +91,14 @@ unary_union = union_all def coverage_union(a: OptGeoArrayLike, b: OptGeoArrayLike, *, axis: None = None, **kwargs) -> BaseGeometry: ... @overload def coverage_union(a: OptGeoArrayLike, b: OptGeoArrayLike, *, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... + @overload def coverage_union_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... @overload def coverage_union_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... + def disjoint_subset_union(a: OptGeoArrayLike, b: OptGeoArrayLike, **kwargs) -> BaseGeometry | GeoArray: ... + @overload def disjoint_subset_union_all(geometries: OptGeoArrayLike, *, axis: None = None, **kwargs) -> BaseGeometry: ... @overload diff --git a/stubs/shapely/shapely/strtree.pyi b/stubs/shapely/shapely/strtree.pyi index fda47412cd7a..c9728d0f687c 100644 --- a/stubs/shapely/shapely/strtree.pyi +++ b/stubs/shapely/shapely/strtree.pyi @@ -29,6 +29,7 @@ class STRtree: def __len__(self) -> int: ... @property def geometries(self) -> GeoArray: ... + @overload def query( self, geometry: OptGeoArrayLike, predicate: Literal["dwithin"], distance: ArrayLike[float] @@ -37,11 +38,13 @@ class STRtree: def query( self, geometry: OptGeoArrayLike, predicate: _BinaryPredicate | None = None, distance: object = None ) -> NDArray[np.int64]: ... + # nearest may return `None` if the tree is empty, use the "Any trick" @overload def nearest(self, geometry: Geometry) -> np.int64 | Any: ... @overload def nearest(self, geometry: GeoArrayLikeSeq) -> NDArray[np.int64] | Any: ... + @overload # return_distance=False def query_nearest( self, diff --git a/stubs/shapely/shapely/vectorized/__init__.pyi b/stubs/shapely/shapely/vectorized/__init__.pyi index d4db8f593412..c7b42e6c5e0a 100644 --- a/stubs/shapely/shapely/vectorized/__init__.pyi +++ b/stubs/shapely/shapely/vectorized/__init__.pyi @@ -26,6 +26,7 @@ def contains( def contains( geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLike[float], y: ArrayLike[float] ) -> np.bool_ | NDArray[np.bool_]: ... + @overload @deprecated("Use 'shapely.intersects_xy' instead (available since shapely 2.0.0).") def touches(geometry: Geometry | PreparedGeometry[Geometry], x: float, y: float) -> np.bool_: ... diff --git a/stubs/shapely/shapely/wkb.pyi b/stubs/shapely/shapely/wkb.pyi index 6114e40b43ba..9a9adffe2884 100644 --- a/stubs/shapely/shapely/wkb.pyi +++ b/stubs/shapely/shapely/wkb.pyi @@ -6,10 +6,12 @@ from .lib import Geometry def loads(data: str | bytes, hex: bool = False) -> BaseGeometry: ... def load(fp: SupportsRead[str] | SupportsRead[bytes], hex: bool = False) -> BaseGeometry: ... + @overload def dumps(ob: Geometry, hex: Literal[False] = False, srid: int | None = None, **kw) -> bytes: ... @overload def dumps(ob: Geometry, hex: Literal[True], srid: int | None = None, **kw) -> str: ... + @overload def dump(ob: Geometry, fp: SupportsWrite[bytes], hex: Literal[False] = False, *, srid: int | None = None, **kw) -> None: ... @overload diff --git a/stubs/simplejson/simplejson/__init__.pyi b/stubs/simplejson/simplejson/__init__.pyi index 7c523a8f603a..73dd284fbe41 100644 --- a/stubs/simplejson/simplejson/__init__.pyi +++ b/stubs/simplejson/simplejson/__init__.pyi @@ -59,6 +59,7 @@ def dumps( int_as_string_bitcount: int | None = None, iterable_as_array: bool = False, ) -> str: ... + @overload def dump( obj: Any, @@ -109,6 +110,7 @@ def dump( int_as_string_bitcount: int | None = None, iterable_as_array: bool = False, ) -> None: ... + @overload def loads( s: _LoadsString, @@ -137,6 +139,7 @@ def loads( use_decimal: bool = False, allow_nan: bool = False, ) -> Any: ... + @overload def load( fp: IO[str], @@ -165,6 +168,7 @@ def load( use_decimal: bool = False, allow_nan: bool = False, ) -> Any: ... + def simple_first(kv: tuple[_T, object]) -> tuple[bool, _T]: ... __all__ = [ diff --git a/stubs/singledispatch/singledispatch.pyi b/stubs/singledispatch/singledispatch.pyi index feafcc251c88..62e59c9fe30f 100644 --- a/stubs/singledispatch/singledispatch.pyi +++ b/stubs/singledispatch/singledispatch.pyi @@ -8,10 +8,12 @@ _S = TypeVar("_S") class _SingleDispatchCallable(Generic[_T]): registry: Mapping[Any, Callable[..., _T]] def dispatch(self, cls: Any) -> Callable[..., _T]: ... + @overload def register(self, cls: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload def register(self, cls: Any, func: Callable[..., _T]) -> Callable[..., _T]: ... + def _clear_cache(self) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... @@ -23,12 +25,14 @@ class singledispatchmethod(Generic[_T]): def __init__(self, func: Callable[..., _T]) -> None: ... @property def __isabstractmethod__(self) -> bool: ... + @overload def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ... @overload def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... + def __get__(self, obj: _S, cls: type[_S] | None = ...) -> Callable[..., _T]: ... __all__ = ["singledispatch", "singledispatchmethod"] diff --git a/stubs/six/six/__init__.pyi b/stubs/six/six/__init__.pyi index c59e91ccb3be..3c67386b7d80 100644 --- a/stubs/six/six/__init__.pyi +++ b/stubs/six/six/__init__.pyi @@ -68,10 +68,12 @@ indexbytes = operator.getitem iterbytes = iter def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str | None = ...) -> None: ... + @overload def assertRaisesRegex(self: unittest.TestCase, msg: str | None = ...) -> Any: ... @overload def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., object], *args: Any, **kwargs: Any) -> Any: ... + def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... def assertNotRegex(self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... diff --git a/stubs/str2bool/str2bool/__init__.pyi b/stubs/str2bool/str2bool/__init__.pyi index 6471b0280054..d7d801d9a239 100644 --- a/stubs/str2bool/str2bool/__init__.pyi +++ b/stubs/str2bool/str2bool/__init__.pyi @@ -4,4 +4,5 @@ from typing import Literal, overload def str2bool(value: str, raise_exc: Literal[True]) -> bool: ... @overload def str2bool(value: str, raise_exc: bool = False) -> bool | None: ... + def str2bool_exc(value: str) -> bool: ... diff --git a/stubs/tensorflow/tensorflow/__init__.pyi b/stubs/tensorflow/tensorflow/__init__.pyi index 3908cbdca79a..23e62c413dab 100644 --- a/stubs/tensorflow/tensorflow/__init__.pyi +++ b/stubs/tensorflow/tensorflow/__init__.pyi @@ -230,10 +230,12 @@ class TensorShape(metaclass=ABCMeta): def assert_has_rank(self, rank: int) -> None: ... def assert_is_compatible_with(self, other: Iterable[int | None]) -> None: ... def __bool__(self) -> _bool: ... + @overload def __getitem__(self, key: int) -> int | None: ... @overload def __getitem__(self, key: slice) -> TensorShape: ... + def __iter__(self) -> Iterator[int | None]: ... def __len__(self) -> int: ... def __add__(self, other: Iterable[int | None]) -> TensorShape: ... @@ -378,20 +380,24 @@ def convert_to_tensor( dtype_hint: DTypeLike | None = None, name: str | None = None, ) -> Tensor: ... + @overload def expand_dims(input: TensorCompatible, axis: int, name: str | None = None) -> Tensor: ... @overload def expand_dims(input: RaggedTensor, axis: int, name: str | None = None) -> RaggedTensor: ... + @overload def concat(values: TensorCompatible, axis: int, name: str | None = "concat") -> Tensor: ... @overload def concat(values: Sequence[RaggedTensor], axis: int, name: str | None = "concat") -> RaggedTensor: ... + @overload def squeeze( input: TensorCompatible, axis: int | tuple[int, ...] | list[int] | None = None, name: str | None = None ) -> Tensor: ... @overload def squeeze(input: RaggedTensor, axis: int | tuple[int, ...] | list[int], name: str | None = None) -> RaggedTensor: ... + def split( value: TensorCompatible, num_or_size_splits: int | TensorCompatible, @@ -405,14 +411,17 @@ def tensor_scatter_nd_update( def constant( value: TensorCompatible, dtype: DTypeLike | None = None, shape: ShapeLike | None = None, name: str | None = "Const" ) -> Tensor: ... + @overload def cast(x: TensorCompatible, dtype: DTypeLike, name: str | None = None) -> Tensor: ... @overload def cast(x: SparseTensor, dtype: DTypeLike, name: str | None = None) -> SparseTensor: ... @overload def cast(x: RaggedTensor, dtype: DTypeLike, name: str | None = None) -> RaggedTensor: ... + def zeros(shape: ShapeLike, dtype: DTypeLike = ..., name: str | None = None, layout: Layout | None = None) -> Tensor: ... def ones(shape: ShapeLike, dtype: DTypeLike = ..., name: str | None = None, layout: Layout | None = None) -> Tensor: ... + @overload def zeros_like( input: TensorCompatible | IndexedSlices, dtype: DTypeLike | None = None, name: str | None = None, layout: Layout | None = None @@ -421,6 +430,7 @@ def zeros_like( def zeros_like( input: RaggedTensor, dtype: DTypeLike | None = None, name: str | None = None, layout: Layout | None = None ) -> RaggedTensor: ... + @overload def ones_like( input: TensorCompatible, dtype: DTypeLike | None = None, name: str | None = None, layout: Layout | None = None @@ -429,6 +439,7 @@ def ones_like( def ones_like( input: RaggedTensor, dtype: DTypeLike | None = None, name: str | None = None, layout: Layout | None = None ) -> RaggedTensor: ... + def reshape(tensor: TensorCompatible, shape: ShapeLike | Tensor, name: str | None = None) -> Tensor: ... def pad( tensor: TensorCompatible, diff --git a/stubs/tensorflow/tensorflow/autodiff.pyi b/stubs/tensorflow/tensorflow/autodiff.pyi index 47f5e1bb911c..23bce8f0254e 100644 --- a/stubs/tensorflow/tensorflow/autodiff.pyi +++ b/stubs/tensorflow/tensorflow/autodiff.pyi @@ -22,6 +22,7 @@ class GradientTape: def __init__(self, persistent: _bool = False, watch_accessed_variables: _bool = True) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... + # Higher kinded types would be nice here and these overloads are a way to simulate some of them. @overload def gradient( @@ -55,6 +56,7 @@ class GradientTape: output_gradients: list[Tensor] | None = None, unconnected_gradients: UnconnectedGradients = ..., ) -> ContainerGradients: ... + @contextmanager def stop_recording(self) -> Generator[None]: ... def reset(self) -> None: ... diff --git a/stubs/tensorflow/tensorflow/autograph/experimental.pyi b/stubs/tensorflow/tensorflow/autograph/experimental.pyi index 36a8c98d3ca0..559c230db66f 100644 --- a/stubs/tensorflow/tensorflow/autograph/experimental.pyi +++ b/stubs/tensorflow/tensorflow/autograph/experimental.pyi @@ -21,6 +21,7 @@ class Feature(Enum): def do_not_convert(func: Callable[_Param, _RetType]) -> Callable[_Param, _RetType]: ... @overload def do_not_convert(func: None = None) -> Callable[[Callable[_Param, _RetType]], Callable[_Param, _RetType]]: ... + def set_loop_options( parallel_iterations: Integer = ..., swap_memory: bool = ..., diff --git a/stubs/tensorflow/tensorflow/bitwise.pyi b/stubs/tensorflow/tensorflow/bitwise.pyi index f01e1bbc1a82..10671acebe88 100644 --- a/stubs/tensorflow/tensorflow/bitwise.pyi +++ b/stubs/tensorflow/tensorflow/bitwise.pyi @@ -14,22 +14,27 @@ _BitwiseCompatible: TypeAlias = tf.Tensor | int | FloatArray | IntArray | np.num def bitwise_and(x: _BitwiseCompatible, y: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload def bitwise_and(x: tf.RaggedTensor, y: tf.RaggedTensor, name: str | None = None) -> tf.RaggedTensor: ... + @overload def bitwise_or(x: _BitwiseCompatible, y: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload def bitwise_or(x: tf.RaggedTensor, y: tf.RaggedTensor, name: str | None = None) -> tf.RaggedTensor: ... + @overload def bitwise_xor(x: _BitwiseCompatible, y: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload def bitwise_xor(x: tf.RaggedTensor, y: tf.RaggedTensor, name: str | None = None) -> tf.RaggedTensor: ... + @overload def invert(x: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload def invert(x: tf.RaggedTensor, name: str | None = None) -> tf.RaggedTensor: ... + @overload def left_shift(x: _BitwiseCompatible, y: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload def left_shift(x: tf.RaggedTensor, y: tf.RaggedTensor, name: str | None = None) -> tf.RaggedTensor: ... + @overload def right_shift(x: _BitwiseCompatible, y: _BitwiseCompatible, name: str | None = None) -> tf.Tensor: ... @overload diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi index 05eaf7379849..30b4ef4a491a 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi @@ -167,6 +167,7 @@ class JobInfo(google.protobuf.message.Message): b"user", ], ) -> None: ... + @typing.overload def WhichOneof(self, oneof_group: typing.Literal["_cell", b"_cell"]) -> typing.Literal["cell"] | None: ... @typing.overload diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi index 724249f3c540..284c97869d3c 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi @@ -170,6 +170,7 @@ class AutotuneOptions(google.protobuf.message.Message): b"ram_budget", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["optional_autotune_algorithm", b"optional_autotune_algorithm"] @@ -426,6 +427,7 @@ class OptimizationOptions(google.protobuf.message.Message): b"shuffle_and_repeat_fusion", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["optional_apply_default_optimizations", b"optional_apply_default_optimizations"] @@ -535,6 +537,7 @@ class ThreadingOptions(google.protobuf.message.Message): b"private_threadpool_size", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["optional_max_intra_op_parallelism", b"optional_max_intra_op_parallelism"] @@ -694,6 +697,7 @@ class Options(google.protobuf.message.Message): b"warm_start", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["optional_dataset_name", b"optional_dataset_name"] diff --git a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi index 152ce34664ac..dc34e823efdf 100644 --- a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi @@ -156,6 +156,7 @@ class OptimizedFunctionGraph(google.protobuf.message.Message): b"source", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["_optimization_time_usecs", b"_optimization_time_usecs"] diff --git a/stubs/tensorflow/tensorflow/data/__init__.pyi b/stubs/tensorflow/tensorflow/data/__init__.pyi index 329b85a2967c..9ef306dbe795 100644 --- a/stubs/tensorflow/tensorflow/data/__init__.pyi +++ b/stubs/tensorflow/tensorflow/data/__init__.pyi @@ -147,6 +147,7 @@ class Dataset(ABC, Generic[_T1_co]): def random( seed: int | None = None, rerandomize_each_iteration: bool | None = None, name: str | None = None ) -> Dataset[tf.Tensor]: ... + @staticmethod @overload def range(stop: ScalarTensorCompatible, /, output_type: DType = ..., name: str | None = None) -> Dataset[tf.Tensor]: ... @@ -160,6 +161,7 @@ class Dataset(ABC, Generic[_T1_co]): output_type: DType = ..., name: str | None = None, ) -> Dataset[tf.Tensor]: ... + def rebatch( self, batch_size: ScalarTensorCompatible, drop_remainder: bool = False, name: str | None = None ) -> Dataset[_T1_co]: ... @@ -227,6 +229,7 @@ class Dataset(ABC, Generic[_T1_co]): name: str | None = None, ) -> Dataset[Dataset[_T1_co]]: ... def with_options(self, options: Options, name: str | None = None) -> Dataset[_T1_co]: ... + @overload @staticmethod def zip( @@ -240,6 +243,7 @@ class Dataset(ABC, Generic[_T1_co]): def zip( *, datasets: tuple[Dataset[_T2], Dataset[_T3]] | None = None, name: str | None = None ) -> Dataset[tuple[_T2, _T3]]: ... + def __len__(self) -> int: ... def __nonzero__(self) -> bool: ... def __getattr__(self, name: str) -> Incomplete: ... diff --git a/stubs/tensorflow/tensorflow/keras/constraints.pyi b/stubs/tensorflow/tensorflow/keras/constraints.pyi index ccc6a92f445b..d7cb2651678e 100644 --- a/stubs/tensorflow/tensorflow/keras/constraints.pyi +++ b/stubs/tensorflow/tensorflow/keras/constraints.pyi @@ -13,4 +13,5 @@ def get(identifier: None) -> None: ... def get(identifier: str | dict[str, Any] | Constraint) -> Constraint: ... @overload def get(identifier: Callable[[Tensor], Tensor]) -> Callable[[Tensor], Tensor]: ... + def __getattr__(name: str): ... # incomplete module diff --git a/stubs/tensorflow/tensorflow/keras/initializers.pyi b/stubs/tensorflow/tensorflow/keras/initializers.pyi index fc6c7669ed70..33bec78ef07c 100644 --- a/stubs/tensorflow/tensorflow/keras/initializers.pyi +++ b/stubs/tensorflow/tensorflow/keras/initializers.pyi @@ -47,4 +47,5 @@ def get(identifier: None) -> None: ... def get(identifier: str | Initializer | dict[str, Any] | type[Initializer]) -> Initializer: ... @overload def get(identifier: Callable[[ShapeLike], Tensor]) -> Callable[[ShapeLike], Tensor]: ... + def __getattr__(name: str): ... # incomplete module diff --git a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi index 427dcdc254c8..19f93c023109 100644 --- a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi +++ b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi @@ -49,6 +49,7 @@ class Layer(tf.Module, Generic[_InputT_contra, _OutputT_co]): def trainable(self) -> bool: ... @trainable.setter def trainable(self, value: bool) -> None: ... + def __init__( self, *, @@ -73,10 +74,12 @@ class Layer(tf.Module, Generic[_InputT_contra, _OutputT_co]): # input_shape's real type depends on _InputT_contra, but we can't express that without HKT. # For example _InputT_contra tf.Tensor -> tf.TensorShape, _InputT_contra dict[str, tf.Tensor] -> dict[str, tf.TensorShape]. def build(self, input_shape: Any, /) -> None: ... + @overload def compute_output_shape(self: Layer[tf.Tensor, tf.Tensor], input_shape: tf.TensorShape, /) -> tf.TensorShape: ... @overload def compute_output_shape(self, input_shape: Any, /) -> Any: ... + def add_weight( self, shape: Iterable[int | None] | None = None, @@ -395,6 +398,7 @@ class MultiHeadAttention(Layer[Any, tf.Tensor]): autocast: bool = True, name: str | None = None, ) -> None: ... + @overload # type: ignore[override] def __call__( self, diff --git a/stubs/tensorflow/tensorflow/keras/regularizers.pyi b/stubs/tensorflow/tensorflow/keras/regularizers.pyi index 9935bd1c3a1b..6065650d1092 100644 --- a/stubs/tensorflow/tensorflow/keras/regularizers.pyi +++ b/stubs/tensorflow/tensorflow/keras/regularizers.pyi @@ -18,4 +18,5 @@ def get(identifier: None) -> None: ... def get(identifier: str | dict[str, Any] | Regularizer) -> Regularizer: ... @overload def get(identifier: Callable[[Tensor], Tensor]) -> Callable[[Tensor], Tensor]: ... + def __getattr__(name: str): ... # incomplete module diff --git a/stubs/tensorflow/tensorflow/linalg.pyi b/stubs/tensorflow/tensorflow/linalg.pyi index 7294144cf88d..e31e02dfeb92 100644 --- a/stubs/tensorflow/tensorflow/linalg.pyi +++ b/stubs/tensorflow/tensorflow/linalg.pyi @@ -37,6 +37,7 @@ def matmul( grad_b: _bool = False, name: str | None = None, ) -> RaggedTensor: ... + def set_diag( input: TensorCompatible, diagonal: TensorCompatible, diff --git a/stubs/tensorflow/tensorflow/math.pyi b/stubs/tensorflow/tensorflow/math.pyi index a9a6c6c4a6a6..50a1a8d52d78 100644 --- a/stubs/tensorflow/tensorflow/math.pyi +++ b/stubs/tensorflow/tensorflow/math.pyi @@ -21,66 +21,81 @@ def abs(x: TensorCompatible, name: str | None = None) -> Tensor: ... def abs(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def abs(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def angle(input: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def angle(input: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def sin(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def sin(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def cos(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def cos(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def exp(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def exp(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def sinh(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def sinh(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def cosh(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def cosh(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def tanh(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def tanh(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def tanh(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def expm1(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def expm1(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def log(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def log(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def log1p(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def log1p(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def negative(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def negative(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def negative(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def sigmoid(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def sigmoid(x: SparseTensor, name: str | None = None) -> SparseTensor: ... + @overload def add(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def add(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def add_n(inputs: Iterable[TensorCompatible | IndexedSlices], name: str | None = None) -> Tensor: ... @overload def add_n(inputs: Iterable[RaggedTensor], name: str | None = None) -> RaggedTensor: ... + @overload def subtract(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload @@ -89,30 +104,37 @@ def subtract(x: TensorCompatible | RaggedTensor, y: RaggedTensor, name: str | No def subtract( x: TensorCompatible | RaggedTensor, y: TensorCompatible | RaggedTensor, name: str | None = None ) -> Tensor | RaggedTensor: ... + @overload def multiply(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def multiply(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def multiply_no_nan(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def multiply_no_nan(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def divide(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def divide(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def divide_no_nan(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def divide_no_nan(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def floormod(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def floormod(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def ceil(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def ceil(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def floor(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload @@ -126,97 +148,119 @@ def accumulate_n( tensor_dtype: DTypeLike | None = None, name: str | None = None, ) -> Tensor: ... + @overload def pow(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def pow(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def reciprocal(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def reciprocal(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def is_nan(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def is_nan(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def minimum(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def minimum(x: RaggedTensor, y: TensorCompatible | RaggedTensor, name: str | None = None) -> RaggedTensor: ... @overload def minimum(x: TensorCompatible | RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def maximum(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def maximum(x: RaggedTensor, y: TensorCompatible | RaggedTensor, name: str | None = None) -> RaggedTensor: ... @overload def maximum(x: TensorCompatible | RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def logical_not(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def logical_not(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def logical_and(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def logical_and(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def logical_or(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def logical_or(x: RaggedTensor, y: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def logical_xor(x: TensorCompatible, y: TensorCompatible, name: str | None = "LogicalXor") -> Tensor: ... @overload def logical_xor(x: RaggedTensor, y: RaggedTensor, name: str | None = "LogicalXor") -> RaggedTensor: ... + @overload def equal(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def equal(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + @overload def not_equal(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def not_equal(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + @overload def greater(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def greater(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + @overload def greater_equal(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def greater_equal(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + @overload def less(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def less(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + @overload def less_equal(x: TensorCompatible, y: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def less_equal(x: RaggedTensor, y: RaggedTensor | float, name: str | None = None) -> RaggedTensor: ... + def segment_sum(data: TensorCompatible, segment_ids: TensorCompatible, name: str | None = None) -> Tensor: ... + @overload def sign(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def sign(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def sign(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def sqrt(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def sqrt(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def sqrt(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def rsqrt(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def rsqrt(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def square(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def square(x: SparseTensor, name: str | None = None) -> SparseTensor: ... @overload def square(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def softplus(features: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def softplus(features: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def round(x: TensorCompatible, name: str | None = None) -> Tensor: ... @overload diff --git a/stubs/tensorflow/tensorflow/nn.pyi b/stubs/tensorflow/tensorflow/nn.pyi index 10b1b88b6111..014daddd9bba 100644 --- a/stubs/tensorflow/tensorflow/nn.pyi +++ b/stubs/tensorflow/tensorflow/nn.pyi @@ -156,6 +156,7 @@ def ctc_loss( name: str | None = None, ) -> Tensor: ... def ctc_unique_labels(labels: Tensor, name: str | None = None) -> tuple[Tensor, Tensor]: ... + @overload def embedding_lookup( params: TensorCompatible, ids: TensorCompatible, max_norm: float | None = None, name: str | None = None @@ -164,6 +165,7 @@ def embedding_lookup( def embedding_lookup( params: TensorCompatible, ids: RaggedTensor, max_norm: float | None = None, name: str | None = None ) -> RaggedTensor: ... + def leaky_relu(features: TensorCompatible, alpha: float = 0.2, name: str | None = None) -> Tensor: ... def log_poisson_loss( targets: TensorCompatible, log_input: TensorCompatible, compute_full_loss: bool = False, name: str | None = None diff --git a/stubs/tensorflow/tensorflow/strings.pyi b/stubs/tensorflow/tensorflow/strings.pyi index 85937f6f52b5..10a5615c909b 100644 --- a/stubs/tensorflow/tensorflow/strings.pyi +++ b/stubs/tensorflow/tensorflow/strings.pyi @@ -27,19 +27,23 @@ def as_string( fill: str = "", name: str | None = None, ) -> RaggedTensor: ... + def bytes_split(input: TensorCompatible | RaggedTensor, name: str | None = None) -> RaggedTensor: ... def format( template: str, inputs: TensorCompatible, placeholder: str = "{}", summarize: int = 3, name: str | None = None ) -> Tensor: ... def join(inputs: Sequence[TensorCompatible | RaggedTensor], separator: str = "", name: str | None = None) -> Tensor: ... + @overload def length(input: TensorCompatible, unit: Literal["BYTE", "UTF8_CHAR"] = "BYTE", name: str | None = None) -> Tensor: ... @overload def length(input: RaggedTensor, unit: Literal["BYTE", "UTF8_CHAR"] = "BYTE", name: str | None = None) -> RaggedTensor: ... + @overload def lower(input: TensorCompatible, encoding: Literal["utf-8", ""] = "", name: str | None = None) -> Tensor: ... @overload def lower(input: RaggedTensor, encoding: Literal["utf-8", ""] = "", name: str | None = None) -> RaggedTensor: ... + def ngrams( data: StringTensorCompatible | RaggedTensor, ngram_width: int | Sequence[int], @@ -56,10 +60,12 @@ def reduce_join( separator: str = "", name: str | None = None, ) -> Tensor: ... + @overload def regex_full_match(input: StringTensorCompatible, pattern: StringTensorCompatible, name: str | None = None) -> Tensor: ... @overload def regex_full_match(input: RaggedTensor, pattern: StringTensorCompatible, name: str | None = None) -> RaggedTensor: ... + @overload def regex_replace( input: StringTensorCompatible, @@ -76,16 +82,19 @@ def regex_replace( replace_global: bool = True, name: str | None = None, ) -> RaggedTensor: ... + def split( input: StringTensorCompatible | RaggedTensor, sep: StringTensorCompatible | None = None, maxsplit: int = -1, name: str | None = None, ) -> RaggedTensor: ... + @overload def strip(input: StringTensorCompatible, name: str | None = None) -> Tensor: ... @overload def strip(input: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def substr( input: StringTensorCompatible, @@ -102,24 +111,29 @@ def substr( unit: Literal["BYTE", "UTF8_CHAR"] = "BYTE", name: str | None = None, ) -> RaggedTensor: ... + @overload def to_hash_bucket(input: StringTensorCompatible, num_buckets: int, name: str | None = None) -> Tensor: ... @overload def to_hash_bucket(input: RaggedTensor, num_buckets: int, name: str | None = None) -> RaggedTensor: ... + @overload def to_hash_bucket_fast(input: StringTensorCompatible, num_buckets: int, name: str | None = None) -> Tensor: ... @overload def to_hash_bucket_fast(input: RaggedTensor, num_buckets: int, name: str | None = None) -> RaggedTensor: ... + @overload def to_hash_bucket_strong( input: StringTensorCompatible, num_buckets: int, key: Sequence[int], name: str | None = None ) -> Tensor: ... @overload def to_hash_bucket_strong(input: RaggedTensor, num_buckets: int, key: Sequence[int], name: str | None = None) -> RaggedTensor: ... + @overload def to_number(input: StringTensorCompatible, out_type: DType = ..., name: str | None = None) -> Tensor: ... @overload def to_number(input: RaggedTensor, out_type: DType = ..., name: str | None = None) -> RaggedTensor: ... + @overload def unicode_decode( input: StringTensorCompatible, @@ -138,6 +152,7 @@ def unicode_decode( replace_control_characters: bool = False, name: str | None = None, ) -> RaggedTensor: ... + @overload def unicode_decode_with_offsets( input: StringTensorCompatible, @@ -156,6 +171,7 @@ def unicode_decode_with_offsets( replace_control_characters: bool = False, name: str | None = None, ) -> tuple[RaggedTensor, RaggedTensor]: ... + @overload def unicode_encode( input: TensorCompatible, @@ -172,10 +188,12 @@ def unicode_encode( replacement_char: int = 65533, name: str | None = None, ) -> RaggedTensor: ... + @overload def unicode_script(input: TensorCompatible, name: str | None = None) -> Tensor: ... @overload def unicode_script(input: RaggedTensor, name: str | None = None) -> RaggedTensor: ... + @overload def unicode_split( input: StringTensorCompatible, @@ -192,6 +210,7 @@ def unicode_split( replacement_char: int = 65533, name: str | None = None, ) -> RaggedTensor: ... + @overload def unicode_split_with_offsets( input: StringTensorCompatible, @@ -208,6 +227,7 @@ def unicode_split_with_offsets( replacement_char: int = 65533, name: str | None = None, ) -> tuple[RaggedTensor, RaggedTensor]: ... + @overload def unicode_transcode( input: StringTensorCompatible, @@ -228,6 +248,7 @@ def unicode_transcode( replace_control_characters: bool = False, name: str | None = None, ) -> RaggedTensor: ... + def unsorted_segment_join( inputs: StringTensorCompatible, segment_ids: UIntTensorCompatible, @@ -235,6 +256,7 @@ def unsorted_segment_join( separator: str = "", name: str | None = None, ) -> Tensor: ... + @overload def upper(input: TensorCompatible, encoding: Literal["utf-8", ""] = "", name: str | None = None) -> Tensor: ... @overload diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi index c8d947994d74..9e0f1184183d 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi @@ -541,6 +541,7 @@ class AlgorithmConfigProto(google.protobuf.message.Message): b"scratch_size", ], ) -> None: ... + @typing.overload def WhichOneof( self, oneof_group: typing.Literal["optional_algorithm", b"optional_algorithm"] diff --git a/stubs/tensorflow/tensorflow/types/experimental.pyi b/stubs/tensorflow/tensorflow/types/experimental.pyi index 86b3570b8f04..a8c81fbb4894 100644 --- a/stubs/tensorflow/tensorflow/types/experimental.pyi +++ b/stubs/tensorflow/tensorflow/types/experimental.pyi @@ -22,6 +22,7 @@ class PolymorphicFunction(Callable[_P, _R_co], metaclass=abc.ABCMeta): def get_concrete_function( self, *args: ContainerGeneric[tf.TypeSpec[Any]], **kwargs: ContainerGeneric[tf.TypeSpec[Any]] ) -> ConcreteFunction[_P, _R_co]: ... + def experimental_get_compiler_ir(self, *args, **kwargs): ... GenericFunction = PolymorphicFunction diff --git a/stubs/toml/toml/decoder.pyi b/stubs/toml/toml/decoder.pyi index da0217df9391..1ed6cd7c3378 100644 --- a/stubs/toml/toml/decoder.pyi +++ b/stubs/toml/toml/decoder.pyi @@ -38,6 +38,7 @@ def load( _dict: type[dict[str, Any]] = ..., decoder: TomlDecoder[dict[str, Any]] | None = None, ) -> dict[str, Any]: ... + @overload def loads(s: str, _dict: type[_MutableMappingT], decoder: TomlDecoder[_MutableMappingT] | None = None) -> _MutableMappingT: ... @overload @@ -47,10 +48,12 @@ class InlineTableDict: ... class TomlDecoder(Generic[_MutableMappingT]): _dict: type[_MutableMappingT] + @overload def __init__(self, _dict: type[_MutableMappingT]) -> None: ... @overload def __init__(self: TomlDecoder[dict[str, Any]], _dict: type[dict[str, Any]] = ...) -> None: ... + def get_empty_table(self) -> _MutableMappingT: ... def get_empty_inline_table(self) -> InlineTableDict: ... # incomplete python/typing#213 def load_inline_object( diff --git a/stubs/toml/toml/encoder.pyi b/stubs/toml/toml/encoder.pyi index 1f1f90b9e272..eff069b2bf25 100644 --- a/stubs/toml/toml/encoder.pyi +++ b/stubs/toml/toml/encoder.pyi @@ -11,10 +11,12 @@ class TomlEncoder(Generic[_MappingT]): _dict: type[_MappingT] preserve: bool dump_funcs: MutableMapping[type[Any], Callable[[Any], str]] + @overload def __init__(self, _dict: type[_MappingT], preserve: bool = False) -> None: ... @overload def __init__(self: TomlEncoder[dict[str, Any]], _dict: type[dict[str, Any]] = ..., preserve: bool = False) -> None: ... + def get_empty_table(self) -> _MappingT: ... def dump_list(self, v: Iterable[Any]) -> str: ... def dump_inline_table(self, section: dict[str, Any] | Any) -> str: ... @@ -29,6 +31,7 @@ class TomlPreserveInlineDictEncoder(TomlEncoder[_MappingT]): class TomlArraySeparatorEncoder(TomlEncoder[_MappingT]): separator: str + @overload def __init__(self, _dict: type[_MappingT], preserve: bool = False, separator: str = ",") -> None: ... @overload @@ -38,6 +41,7 @@ class TomlArraySeparatorEncoder(TomlEncoder[_MappingT]): preserve: bool = False, separator: str = ",", ) -> None: ... + def dump_list(self, v: Iterable[Any]) -> str: ... class TomlNumpyEncoder(TomlEncoder[_MappingT]): ... diff --git a/stubs/tqdm/tqdm/asyncio.pyi b/stubs/tqdm/tqdm/asyncio.pyi index c0c1af4f3314..e986ec973136 100644 --- a/stubs/tqdm/tqdm/asyncio.pyi +++ b/stubs/tqdm/tqdm/asyncio.pyi @@ -82,6 +82,7 @@ class tqdm_asyncio(std_tqdm[_T]): colour: str | None = ..., delay: float | None = ..., ) -> list[_T]: ... + @overload def __init__( self, diff --git a/stubs/tqdm/tqdm/contrib/concurrent.pyi b/stubs/tqdm/tqdm/contrib/concurrent.pyi index 5fc0e24e480a..982a359416cd 100644 --- a/stubs/tqdm/tqdm/contrib/concurrent.pyi +++ b/stubs/tqdm/tqdm/contrib/concurrent.pyi @@ -92,6 +92,7 @@ def thread_map( *iterables: Iterable[Any], **tqdm_kwargs: Unpack[_TqdmKwargs], ) -> list[_R]: ... + @overload def process_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], **tqdm_kwargs: Unpack[_TqdmKwargs]) -> list[_R]: ... @overload diff --git a/stubs/tqdm/tqdm/contrib/discord.pyi b/stubs/tqdm/tqdm/contrib/discord.pyi index 20f141c3a469..190e6e4fcf09 100644 --- a/stubs/tqdm/tqdm/contrib/discord.pyi +++ b/stubs/tqdm/tqdm/contrib/discord.pyi @@ -28,6 +28,7 @@ _T = TypeVar("_T") class tqdm_discord(tqdm_auto[_T]): dio: Incomplete + @overload def __init__( self, @@ -90,6 +91,7 @@ class tqdm_discord(tqdm_auto[_T]): gui: bool = ..., **kwargs, ) -> None: ... + def display( # type: ignore[override] self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style=..., check_delay: bool = ... ) -> None: ... diff --git a/stubs/tqdm/tqdm/contrib/slack.pyi b/stubs/tqdm/tqdm/contrib/slack.pyi index 1ff1fd83e19e..a7ba2019efc4 100644 --- a/stubs/tqdm/tqdm/contrib/slack.pyi +++ b/stubs/tqdm/tqdm/contrib/slack.pyi @@ -18,6 +18,7 @@ _T = TypeVar("_T") class tqdm_slack(tqdm_auto[_T]): sio: Incomplete + @overload def __init__( self, @@ -84,6 +85,7 @@ class tqdm_slack(tqdm_auto[_T]): channel: int = ..., **kwargs, ) -> None: ... + def display( # type: ignore[override] self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style=..., check_delay: bool = ... ) -> None: ... diff --git a/stubs/tqdm/tqdm/contrib/telegram.pyi b/stubs/tqdm/tqdm/contrib/telegram.pyi index 38c5b09535d9..f894aff15f30 100644 --- a/stubs/tqdm/tqdm/contrib/telegram.pyi +++ b/stubs/tqdm/tqdm/contrib/telegram.pyi @@ -23,6 +23,7 @@ _T = TypeVar("_T") class tqdm_telegram(tqdm_auto[_T]): tgio: Incomplete + @overload def __init__( self, @@ -89,6 +90,7 @@ class tqdm_telegram(tqdm_auto[_T]): chat_id: str = ..., **kwargs, ) -> None: ... + def display( # type: ignore[override] self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style=..., check_delay: bool = ... ) -> None: ... diff --git a/stubs/tqdm/tqdm/gui.pyi b/stubs/tqdm/tqdm/gui.pyi index 7156e55cb3b1..c01e78ee0200 100644 --- a/stubs/tqdm/tqdm/gui.pyi +++ b/stubs/tqdm/tqdm/gui.pyi @@ -23,6 +23,7 @@ class tqdm_gui(std_tqdm[_T]): def close(self) -> None: ... def clear(self, *_, **__) -> None: ... def display(self, *_, **__) -> None: ... + @overload def __init__( self, diff --git a/stubs/tqdm/tqdm/notebook.pyi b/stubs/tqdm/tqdm/notebook.pyi index 5f7d3f74585d..bfea206f3c72 100644 --- a/stubs/tqdm/tqdm/notebook.pyi +++ b/stubs/tqdm/tqdm/notebook.pyi @@ -22,13 +22,16 @@ class tqdm_notebook(std_tqdm[_T]): bar_style: str | None = None, check_delay: bool = True, ) -> None: ... + @property def colour(self): ... @colour.setter def colour(self, bar_color: str) -> None: ... + disp: Incomplete ncols: Incomplete container: Incomplete + @overload def __init__( self, @@ -91,6 +94,7 @@ class tqdm_notebook(std_tqdm[_T]): display: bool = ..., **kwargs, ) -> None: ... + def __iter__(self) -> Iterator[_T]: ... def update(self, n: int = 1): ... # type: ignore[override] def close(self) -> None: ... diff --git a/stubs/tqdm/tqdm/rich.pyi b/stubs/tqdm/tqdm/rich.pyi index 9af999b21a49..37ee5d347e36 100644 --- a/stubs/tqdm/tqdm/rich.pyi +++ b/stubs/tqdm/tqdm/rich.pyi @@ -39,6 +39,7 @@ class tqdm_rich(std_tqdm[_T]): def clear(self, *_, **__) -> None: ... def display(self, *_, **__) -> None: ... def reset(self, total: Incomplete | None = ...) -> None: ... + @overload def __init__( self, diff --git a/stubs/tqdm/tqdm/std.pyi b/stubs/tqdm/tqdm/std.pyi index 975e7170fe97..c2743b03b3cf 100644 --- a/stubs/tqdm/tqdm/std.pyi +++ b/stubs/tqdm/tqdm/std.pyi @@ -61,6 +61,7 @@ class tqdm(Comparable, Generic[_T]): initial: float | None = 0, colour: str | None = None, ) -> str: ... + @overload def __init__( self, @@ -123,6 +124,7 @@ class tqdm(Comparable, Generic[_T]): gui: bool = False, **kwargs, ) -> None: ... + def __new__(cls, *_, **__) -> Self: ... @classmethod def write(cls, s: str, file: SupportsWrite[str] | None = None, end: str = "\n", nolock: bool = False) -> None: ... @@ -223,6 +225,7 @@ class tqdm(Comparable, Generic[_T]): @property def format_dict(self) -> MutableMapping[str, Any]: ... def display(self, msg: str | None = None, pos: int | None = None) -> None: ... + @overload @classmethod def wrapattr( diff --git a/stubs/tqdm/tqdm/tk.pyi b/stubs/tqdm/tqdm/tk.pyi index 84f018692a3c..e4e4a956489d 100644 --- a/stubs/tqdm/tqdm/tk.pyi +++ b/stubs/tqdm/tqdm/tk.pyi @@ -77,6 +77,7 @@ class tqdm_tk(std_tqdm[_T]): cancel_callback=..., **kwargs, ) -> None: ... + disable: bool def close(self) -> None: ... def clear(self, *_, **__) -> None: ... diff --git a/stubs/uWSGI/uwsgi.pyi b/stubs/uWSGI/uwsgi.pyi index b605b8cf37ac..987a8b6a98eb 100644 --- a/stubs/uWSGI/uwsgi.pyi +++ b/stubs/uWSGI/uwsgi.pyi @@ -87,10 +87,12 @@ def cache_update( ) -> _TrueOrNone: ... def queue_get(index: int, /) -> bytes | None: ... def queue_set(index: int, message: str | bytes | ReadOnlyBuffer, /) -> _TrueOrNone: ... + @overload def queue_last(num: Literal[0] = 0, /) -> bytes | None: ... # type: ignore[overload-overlap] @overload def queue_last(num: int, /) -> list[bytes | None]: ... + def queue_push(message: str | bytes | ReadOnlyBuffer, /) -> _TrueOrNone: ... def queue_pull() -> bytes | None: ... def queue_pop() -> bytes | None: ... @@ -106,6 +108,7 @@ def snmp_incr_gauge(oid_num: int, increment: int, /) -> _TrueOrNone: ... def snmp_decr_counter32(oid_num: int, decrement: int, /) -> _TrueOrNone: ... def snmp_decr_counter64(oid_num: int, decrement: int, /) -> _TrueOrNone: ... def snmp_decr_gauge(oid_num: int, decrement: int, /) -> _TrueOrNone: ... + @overload def send_to_spooler(mesage_dict: dict[bytes, bytes], /) -> bytes | None: ... @overload @@ -158,17 +161,20 @@ def metric_set_min(key: str, value: int = 1, /) -> _TrueOrNone: ... def micros() -> int: ... def mule_get_msg(signals: bool = True, farms: bool = True, buffer_size: int = 65536, timeout: int = -1) -> bytes: ... def mule_id() -> int: ... + @overload def mule_msg(mesage: str | bytes | ReadOnlyBuffer, /) -> bool: ... @overload def mule_msg(mesage: str | bytes | ReadOnlyBuffer, mule_id: int, /) -> bool: ... @overload def mule_msg(mesage: str | bytes | ReadOnlyBuffer, farm_name: str, /) -> bool: ... + def offload(filename: str, len: int = 0, /) -> Literal[b""]: ... def parsefile(filename: str, /) -> dict[bytes, bytes] | None: ... def ready() -> _TrueOrNone: ... def ready_fd() -> int: ... def recv(fd: int, max_size: int = 4096, /) -> bytes | None: ... + @overload def register_rpc(name: str, func: Callable[[], bytes | None], /) -> Literal[True]: ... @overload @@ -177,6 +183,7 @@ def register_rpc(name: str, func: Callable[[bytes], bytes | None], /, arg_count: def register_rpc(name: str, func: Callable[[bytes, bytes], bytes | None], /, arg_count: Literal[2]) -> Literal[True]: ... @overload def register_rpc(name: str, func: _RPCCallable, /, arg_count: int) -> Literal[True]: ... + def register_signal(signum: int, who: str, handler: Callable[[int], Any], /) -> None: ... def reload() -> _TrueOrNone: ... def request_id() -> int: ... @@ -184,10 +191,12 @@ def route(router_name: str, router_args: str, /) -> int: ... def rpc(node: str | bytes, rpc_name: bytes, /, *rpc_args: bytes) -> bytes | None: ... def rpc_list() -> tuple[bytes, ...]: ... def scrolls(legion_name: str, /) -> list[bytes] | None: ... + @overload def send(data: bytes, /) -> _TrueOrNone: ... @overload def send(fd: int, data: bytes, /) -> _TrueOrNone: ... + def sendfile( filename_or_fd: str | bytes | int | HasFileno, chunk: int = 0, pos: int = 0, /, filesize: int = 0 ) -> _TrueOrNone: ... diff --git a/stubs/uWSGI/uwsgidecorators.pyi b/stubs/uWSGI/uwsgidecorators.pyi index 26bbc0e76bed..5c8029f3fdd5 100644 --- a/stubs/uWSGI/uwsgidecorators.pyi +++ b/stubs/uWSGI/uwsgidecorators.pyi @@ -24,10 +24,12 @@ def postfork_chain_hook() -> None: ... class postfork(Generic[_P, _T]): wid: int f: Callable[_P, _T] | None + @overload def __init__(self: postfork[..., Any], f: int) -> None: ... @overload def __init__(self: postfork[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 + @overload def __call__(self, f: Callable[_P2, _T2], /) -> postfork[_P2, _T2]: ... @overload @@ -52,14 +54,17 @@ def spool_decorate( def spool_decorate( f: None = None, pass_arguments: bool = False, _class: type[_spoolraw[..., Any]] = ... ) -> Callable[[Callable[_P, _SR]], _spoolraw[_P, _SR]]: ... + @overload def spoolraw(f: Callable[_P, _SR], pass_arguments: bool = False) -> _spoolraw[_P, _SR]: ... @overload def spoolraw(f: None = None, pass_arguments: bool = False) -> Callable[[Callable[_P, _SR]], _spoolraw[_P, _SR]]: ... + @overload def spool(f: Callable[_P, _SR], pass_arguments: bool = False) -> _spool[_P, _SR]: ... @overload def spool(f: None = None, pass_arguments: bool = False) -> Callable[[Callable[_P, _SR]], _spool[_P, _SR]]: ... + @overload def spoolforever(f: Callable[_P, _SR], pass_arguments: bool = False) -> _spoolforever[_P, _SR]: ... @overload @@ -68,11 +73,14 @@ def spoolforever(f: None = None, pass_arguments: bool = False) -> Callable[[Call class mulefunc(Generic[_P, _T]): fname: str | None mule: int + @overload def __init__(self: mulefunc[..., Any], f: int) -> None: ... @overload def __init__(self: mulefunc[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 + def real_call(self, *args: _P.args, **kwargs: _P.kwargs) -> None: ... + @overload def __call__(self, f: Callable[_P2, _T2], /) -> mulefunc[_P2, _T2]: ... @overload diff --git a/stubs/unidiff/unidiff/patch.pyi b/stubs/unidiff/unidiff/patch.pyi index cf631fec72c8..019f6d7580b0 100644 --- a/stubs/unidiff/unidiff/patch.pyi +++ b/stubs/unidiff/unidiff/patch.pyi @@ -93,16 +93,19 @@ class PatchSet(list[PatchedFile]): def __init__(self, f: Iterable[str] | str, encoding: None = None, metadata_only: bool = False) -> None: ... @overload def __init__(self, f: Iterable[bytes] | bytes, encoding: str | None = None, metadata_only: bool = False) -> None: ... + @classmethod def from_filename( cls, filename: StrPath, encoding: str = "UTF-8", errors: str | None = None, newline: str | None = None ) -> Self: ... + @classmethod @overload def from_string(cls, data: str, encoding: None = None, errors: str | None = "strict") -> Self: ... @classmethod @overload def from_string(cls, data: bytes, encoding: str | None = None, errors: str | None = "strict") -> Self: ... + @property def added_files(self) -> list[PatchedFile]: ... @property diff --git a/stubs/vobject/vobject/base.pyi b/stubs/vobject/vobject/base.pyi index 5fbc52905c76..3c48123e7fbc 100644 --- a/stubs/vobject/vobject/base.pyi +++ b/stubs/vobject/vobject/base.pyi @@ -38,6 +38,7 @@ class VBase: def transformFromNative(self): ... def transformChildrenToNative(self) -> None: ... def transformChildrenFromNative(self, clearBehavior: bool = True) -> None: ... + # Use Any because args and kwargs are passed to the behavior object @overload def serialize( @@ -93,6 +94,7 @@ class Component(VBase): def __setattr__(self, name: str, value) -> None: ... def __delattr__(self, name: str) -> None: ... def getChildValue(self, childName: str, default=None, childNumber: int = 0): ... + @overload def add(self, objOrName: _V, group: str | None = None) -> _V: ... @overload @@ -103,6 +105,7 @@ class Component(VBase): ) -> ContentLine: ... @overload def add(self, objOrName: str, group: str | None = None) -> Any: ... # returns VBase sub-class + def remove(self, obj) -> None: ... def getChildren(self) -> list[Incomplete]: ... def components(self) -> Generator[Component]: ... diff --git a/stubs/vobject/vobject/icalendar.pyi b/stubs/vobject/vobject/icalendar.pyi index 327b28e207bf..5d0cab4d4bb9 100644 --- a/stubs/vobject/vobject/icalendar.pyi +++ b/stubs/vobject/vobject/icalendar.pyi @@ -20,6 +20,7 @@ twoHours: Final[timedelta] def toUnicode(s: None) -> None: ... @overload def toUnicode(s: str | bytes) -> str: ... + def registerTzid(tzid: str | bytes, tzinfo) -> None: ... def getTzid(tzid: str, smart: bool = True): ... diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi index 3bb23d966fed..26e1369b578e 100644 --- a/stubs/watchpoints/watchpoints/watch_element.pyi +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -48,8 +48,10 @@ class WatchElement: def changed(self, frame: FrameType) -> tuple[bool, bool]: ... def obj_changed(self, other: object) -> bool: ... def same(self, other: object) -> bool: ... + @property def track(self) -> _TrackKind: ... @track.setter def track(self, val: _TrackKind) -> None: ... + def update(self) -> None: ... diff --git a/stubs/workalendar/workalendar/core.pyi b/stubs/workalendar/workalendar/core.pyi index d11fdb5a509b..934dc32dbd24 100644 --- a/stubs/workalendar/workalendar/core.pyi +++ b/stubs/workalendar/workalendar/core.pyi @@ -25,6 +25,7 @@ ISO_SUN: Final = 7 def cleaned_date(day: _D, keep_datetime: Literal[True]) -> _D: ... @overload def cleaned_date(day: datetime.date | datetime.datetime, keep_datetime: Literal[False] | None = False) -> datetime.date: ... + def daterange(start: _DT, end: _DT) -> Generator[_DT]: ... class ChristianMixin: diff --git a/stubs/www-authenticate/www_authenticate.pyi b/stubs/www-authenticate/www_authenticate.pyi index 9dbaaa1ced9a..392bee206f6d 100644 --- a/stubs/www-authenticate/www_authenticate.pyi +++ b/stubs/www-authenticate/www_authenticate.pyi @@ -17,6 +17,7 @@ class CaseFoldedOrderedDict(OrderedDict[str, _VT]): def __getitem__(self, key: _SupportsCasefold | _SupportsLower) -> _VT: ... def __setitem__(self, key: _SupportsCasefold | _SupportsLower, value: _VT) -> None: ... def __contains__(self, key: _SupportsCasefold | _SupportsLower) -> bool: ... # type: ignore[override] + # See overloads for dict class: @overload def get(self, key: _SupportsCasefold | _SupportsLower, default: None = None) -> _VT | None: ... @@ -24,6 +25,7 @@ class CaseFoldedOrderedDict(OrderedDict[str, _VT]): def get(self, key: _SupportsCasefold | _SupportsLower, default: _VT) -> _VT: ... @overload def get(self, key: _SupportsCasefold | _SupportsLower, default: _T) -> _VT | _T: ... + @overload # type: ignore[override] def pop(self, key: _SupportsCasefold | _SupportsLower, default: None = None) -> _VT | None: ... @overload diff --git a/stubs/xlrd/xlrd/sheet.pyi b/stubs/xlrd/xlrd/sheet.pyi index 4bd4ce301c64..7aa5806dcaea 100644 --- a/stubs/xlrd/xlrd/sheet.pyi +++ b/stubs/xlrd/xlrd/sheet.pyi @@ -143,10 +143,12 @@ class Sheet(BaseObject): def cell_xf_index(self, rowx: int, colx: int) -> int: ... def row_len(self, rowx: int) -> int: ... def row(self, rowx: int) -> list[Cell]: ... + @overload def __getitem__(self, item: int) -> list[Cell]: ... @overload def __getitem__(self, item: tuple[int, int]) -> Cell: ... + def get_rows(self) -> Generator[list[Cell]]: ... __iter__ = get_rows def row_types(self, rowx: int, start_colx: int = 0, end_colx: int | None = None) -> Sequence[int]: ... diff --git a/stubs/xmldiff/xmldiff/main.pyi b/stubs/xmldiff/xmldiff/main.pyi index 46d521b90474..8283095ec0bd 100644 --- a/stubs/xmldiff/xmldiff/main.pyi +++ b/stubs/xmldiff/xmldiff/main.pyi @@ -45,6 +45,7 @@ def diff_trees(left: _ET, right: _ET, *, diff_options: dict[str, Any] | None = N def diff_trees( left: _ET, right: _ET, diff_options: dict[str, Any] | None = None, formatter: None = None ) -> Iterable[_ACTIONS]: ... + @overload def diff_texts( left: str | bytes, right: str | bytes, *, diff_options: dict[str, Any] | None = None, formatter: BaseFormatter @@ -53,12 +54,14 @@ def diff_texts( def diff_texts( left: str | bytes, right: str | bytes, diff_options: dict[str, Any] | None = None, formatter: None = None ) -> Iterable[_ACTIONS]: ... + @overload def diff_files(left: str, right: str, *, diff_options: dict[str, Any] | None = None, formatter: BaseFormatter) -> str: ... @overload def diff_files( left: str, right: str, diff_options: dict[str, Any] | None = None, formatter: None = None ) -> Iterable[_ACTIONS]: ... + def validate_F(arg: float | str) -> float: ... def make_diff_parser() -> ArgumentParser: ... def diff_command(args: Sequence[str] | None = None) -> int | None: ... diff --git a/stubs/xmltodict/xmltodict.pyi b/stubs/xmltodict/xmltodict.pyi index 6edb52a2fae2..d0e1237d3360 100644 --- a/stubs/xmltodict/xmltodict.pyi +++ b/stubs/xmltodict/xmltodict.pyi @@ -75,6 +75,7 @@ def parse( force_list: bool | Container[str] | Callable[[tuple[str, _AttrDict | None], str, str], bool] | None = None, comment_key: str = "#comment", ) -> dict[str, Any]: ... + @overload def unparse( input_dict: Mapping[str, Any], diff --git a/stubs/yt-dlp/yt_dlp/extractor/common.pyi b/stubs/yt-dlp/yt_dlp/extractor/common.pyi index 882a504087d5..ece237453e0a 100644 --- a/stubs/yt-dlp/yt_dlp/extractor/common.pyi +++ b/stubs/yt-dlp/yt_dlp/extractor/common.pyi @@ -220,11 +220,13 @@ class InfoExtractor: def write_debug(self, msg: str, only_once: bool = False) -> None: ... # *args and **kwargs are passed to .params.get() where params is normally a mapping but is not required to be. def get_param(self, name: str, default: Any = None, *args: Any, **kwargs: Any) -> Any: ... + @overload def report_drm(self, video_id: str, partial: type[NO_DEFAULT] = ...) -> None: ... @overload @deprecated("InfoExtractor.report_drm no longer accepts the argument partial") def report_drm(self, video_id: str, partial: bool) -> None: ... + def report_extraction(self, id_or_name: str) -> None: ... def report_download_webpage(self, video_id: str) -> None: ... def report_age_confirmation(self) -> None: ... @@ -238,12 +240,14 @@ class InfoExtractor: def raise_geo_restricted( self, msg: str = ..., countries: Collection[str] | None = None, metadata_available: bool = False ) -> None: ... + @overload def raise_no_formats( self, msg: str | ExtractorError, expected: Literal[False] = False, video_id: str | None = None ) -> Never: ... @overload def raise_no_formats(self, msg: str | ExtractorError, expected: Literal[True], video_id: str | None = None) -> None: ... + @staticmethod def url_result( url: str, diff --git a/stubs/yt-dlp/yt_dlp/networking/common.pyi b/stubs/yt-dlp/yt_dlp/networking/common.pyi index bb600721f6e2..ea71e3336673 100644 --- a/stubs/yt-dlp/yt_dlp/networking/common.pyi +++ b/stubs/yt-dlp/yt_dlp/networking/common.pyi @@ -83,22 +83,27 @@ class Request: method: str | None = None, extensions: Mapping[str, Any] | None = None, ) -> None: ... + @property def url(self) -> str: ... @url.setter def url(self, url: str) -> None: ... + @property def method(self) -> str: ... @method.setter def method(self, method: str) -> None: ... + @property def data(self) -> _RequestData | io.IOBase: ... @data.setter def data(self, data: _RequestData) -> None: ... + @property def headers(self) -> HTTPHeaderDict | dict[str, str]: ... @headers.setter def headers(self, new_headers: Mapping[str, str] | HTTPHeaderDict) -> None: ... + def update( self, url: str | None = None, diff --git a/stubs/yt-dlp/yt_dlp/utils/_utils.pyi b/stubs/yt-dlp/yt_dlp/utils/_utils.pyi index 3fdb4afa67c6..e95a5a4c0286 100644 --- a/stubs/yt-dlp/yt_dlp/utils/_utils.pyi +++ b/stubs/yt-dlp/yt_dlp/utils/_utils.pyi @@ -136,6 +136,7 @@ class LenientJSONDecoder(json.JSONDecoder): def sanitize_open(filename: FileDescriptorOrPath, open_mode: OpenBinaryMode) -> BinaryIO: ... @overload def sanitize_open(filename: FileDescriptorOrPath, open_mode: OpenTextMode) -> TextIO: ... + def timeconvert(timestr: str) -> str: ... def sanitize_filename(s: str, restricted: bool = False, is_id: bool | type[NO_DEFAULT] = ...) -> str: ... def sanitize_path(s: str, force: bool = False) -> str: ... @@ -369,10 +370,12 @@ class LazyList(Sequence[_T]): def __init__(self, iterable: Iterable[_T], *, reverse: bool = False, _cache: list[Any] | None = None) -> None: ... def __iter__(self) -> Iterator[_T]: ... def exhaust(self) -> list[_T]: ... + @overload def __getitem__(self, idx: int, /) -> _T: ... @overload def __getitem__(self, idx: slice, /) -> list[_T]: ... + def __bool__(self) -> bool: ... def __len__(self) -> int: ... def __reversed__(self) -> Iterator[_T]: ... @@ -383,10 +386,12 @@ class PagedList: def __init__(self, pagefunc: Callable[[int], Iterator[Any]], pagesize: int, use_cache: bool = True) -> None: ... def getpage(self, pagenum: int) -> list[Any]: ... def getslice(self, start: int = 0, end: int | None = None) -> list[Any]: ... + @overload def __getitem__(self, idx: int, /) -> Any: ... @overload def __getitem__(self, idx: slice, /) -> list[Any]: ... + def __bool__(self) -> bool: ... class OnDemandPagedList(PagedList): ... @@ -637,10 +642,12 @@ class RetryManager: def __init__( self, _retries: int | None, _error_callback: Callable[..., Any], **kwargs: Any # kwargs passed to _error_callback. ) -> None: ... + @property def error(self) -> None: ... @error.setter def error(self, value: type[NO_DEFAULT] | BaseException) -> None: ... + def __iter__(self) -> Self: ... @staticmethod def report_retry( diff --git a/stubs/yt-dlp/yt_dlp/utils/networking.pyi b/stubs/yt-dlp/yt_dlp/utils/networking.pyi index 1d3d18310dd3..a773bb7b4fe8 100644 --- a/stubs/yt-dlp/yt_dlp/utils/networking.pyi +++ b/stubs/yt-dlp/yt_dlp/utils/networking.pyi @@ -14,24 +14,28 @@ class HTTPHeaderDict(dict[str, str]): # *args is passed to filter: filter(None, args) def __init__(self, /, *args: Any, **kwargs: str) -> None: ... def sensitive(self, /) -> dict[str, str]: ... + @overload # type: ignore[override] def get(self, key: str, /) -> str | None: ... @overload def get(self, key: str, /, default: _T) -> str | _T: ... @overload def get(self, key: str, /, default: type[NO_DEFAULT] | _T = ...) -> str | _T | type[NO_DEFAULT]: ... + @overload def pop(self, key: str, /) -> str: ... @overload def pop(self, key: str, /, default: _T) -> str | _T: ... @overload def pop(self, key: str, /, default: type[NO_DEFAULT] | _T | str = ...) -> str | _T | type[NO_DEFAULT]: ... + @overload def setdefault(self, key: str, /) -> str: ... @overload def setdefault(self, key: str, /, default: str) -> str: ... @overload def setdefault(self, key: str, /, default: str | None = None) -> str: ... + def update(self, other: Mapping[str, str], /, **kwargs: str) -> None: ... # type: ignore[override] std_headers: HTTPHeaderDict diff --git a/stubs/yt-dlp/yt_dlp/utils/progress.pyi b/stubs/yt-dlp/yt_dlp/utils/progress.pyi index bb213136def3..eb1833e74b7d 100644 --- a/stubs/yt-dlp/yt_dlp/utils/progress.pyi +++ b/stubs/yt-dlp/yt_dlp/utils/progress.pyi @@ -7,10 +7,12 @@ class ProgressCalculator: speed: SmoothValue eta: SmoothValue def __init__(self, initial: int) -> None: ... + @property def total(self) -> int | None: ... @total.setter def total(self, value: int | None) -> None: ... + def thread_reset(self) -> None: ... def update(self, size: int | None) -> None: ... diff --git a/stubs/yt-dlp/yt_dlp/utils/traversal.pyi b/stubs/yt-dlp/yt_dlp/utils/traversal.pyi index f50ace1d4f80..f20e736d797d 100644 --- a/stubs/yt-dlp/yt_dlp/utils/traversal.pyi +++ b/stubs/yt-dlp/yt_dlp/utils/traversal.pyi @@ -32,6 +32,7 @@ def subs_list_to_dict( def subs_list_to_dict( subs: list[dict[str, Any]] | None, /, *, lang: str | None = "und", ext: str | None = None ) -> dict[str, list[dict[str, Any]]]: ... + @overload def find_element(*, attr: str, value: str, tag: str | None = None, html: bool = False, regex: bool = False) -> str: ... @overload @@ -51,6 +52,7 @@ def find_element( html: bool = False, regex: bool = False, ) -> str: ... + @overload def find_elements(*, cls: str, html: bool = False) -> list[str]: ... @overload @@ -65,6 +67,7 @@ def find_elements( html: bool = False, regex: bool = False, ) -> list[str]: ... + def trim_str(*, start: str | None = None, end: str | None = None) -> Callable[[str], str]: ... # Returns a callable f(items) which calls func(*items, **kwargs). @@ -79,6 +82,7 @@ def get_first( is_user_input: bool | type[NO_DEFAULT] = ..., traverse_string: bool = False, ) -> Any: ... + @overload def dict_get(d: str, key_or_keys: str | Collection[str]) -> Any | None: ... @overload diff --git a/stubs/zxcvbn/zxcvbn/matching.pyi b/stubs/zxcvbn/zxcvbn/matching.pyi index 7f8bfb28af20..849b66cccab7 100644 --- a/stubs/zxcvbn/zxcvbn/matching.pyi +++ b/stubs/zxcvbn/zxcvbn/matching.pyi @@ -81,6 +81,7 @@ def regex_match( password: str, _regexen: dict[str, Pattern[str]] = ..., _ranked_dictionaries: dict[str, dict[str, int]] = ... ) -> list[_Match]: ... def date_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... + @type_check_only class _DM(TypedDict): month: int