diff --git a/python/helpers/typeshed/.github/workflows/daily.yml b/python/helpers/typeshed/.github/workflows/daily.yml index 58d85ed3fefb..516e6a2633b9 100644 --- a/python/helpers/typeshed/.github/workflows/daily.yml +++ b/python/helpers/typeshed/.github/workflows/daily.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] fail-fast: false steps: diff --git a/python/helpers/typeshed/.github/workflows/meta_tests.yml b/python/helpers/typeshed/.github/workflows/meta_tests.yml index 6acd88a39d42..af2711512728 100644 --- a/python/helpers/typeshed/.github/workflows/meta_tests.yml +++ b/python/helpers/typeshed/.github/workflows/meta_tests.yml @@ -65,7 +65,7 @@ jobs: with: version: PATH python-platform: ${{ matrix.python-platform }} - python-version: "3.9" # Oldest version supported for running scripts and tests + python-version: "3.10" # Oldest version supported for running scripts and tests project: ./pyrightconfig.scripts_and_tests.json stubsabot-dry-run: name: Stubsabot dry run diff --git a/python/helpers/typeshed/.github/workflows/stubtest_stdlib.yml b/python/helpers/typeshed/.github/workflows/stubtest_stdlib.yml index fd7c6cdebcb1..db679c9971cd 100644 --- a/python/helpers/typeshed/.github/workflows/stubtest_stdlib.yml +++ b/python/helpers/typeshed/.github/workflows/stubtest_stdlib.yml @@ -31,7 +31,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] fail-fast: false steps: diff --git a/python/helpers/typeshed/.github/workflows/tests.yml b/python/helpers/typeshed/.github/workflows/tests.yml index 6c93c9a84ee2..f00b63ab0db0 100644 --- a/python/helpers/typeshed/.github/workflows/tests.yml +++ b/python/helpers/typeshed/.github/workflows/tests.yml @@ -42,7 +42,7 @@ jobs: strategy: matrix: platform: ["linux", "win32", "darwin"] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] fail-fast: false steps: - uses: actions/checkout@v6 @@ -84,7 +84,7 @@ jobs: strategy: matrix: python-platform: ["Linux", "Windows", "Darwin"] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.11", "3.12", "3.13", "3.14"] fail-fast: false steps: - uses: actions/checkout@v6 diff --git a/python/helpers/typeshed/CONTRIBUTING.md b/python/helpers/typeshed/CONTRIBUTING.md index 1daa489eaf3e..79072a1bb9d1 100644 --- a/python/helpers/typeshed/CONTRIBUTING.md +++ b/python/helpers/typeshed/CONTRIBUTING.md @@ -55,8 +55,6 @@ Note that some tests require extra setup steps to install the required dependenc Linux / macOS / WSL - On Linux and macOS, you will be able to run the full test suite on Python - 3.9-3.12. To install the necessary requirements, run the following commands from a terminal window: diff --git a/python/helpers/typeshed/README.md b/python/helpers/typeshed/README.md index d295b56bc05d..4bf78a830062 100644 --- a/python/helpers/typeshed/README.md +++ b/python/helpers/typeshed/README.md @@ -21,7 +21,7 @@ the project the stubs are for, but instead report them here to typeshed.** Further documentation on stub files, typeshed, and Python's typing system in general, can also be found at https://typing.readthedocs.io/en/latest/. -Typeshed supports Python versions 3.9 to 3.14. +Typeshed supports Python versions 3.10 to 3.14. ## Using diff --git a/python/helpers/typeshed/pyproject.toml b/python/helpers/typeshed/pyproject.toml index d121b0d4e3b9..b17677df41af 100644 --- a/python/helpers/typeshed/pyproject.toml +++ b/python/helpers/typeshed/pyproject.toml @@ -3,7 +3,7 @@ # https://github.com/astral-sh/uv/issues/8666 name = "typeshed" version = "0" -requires-python = ">=3.9" # Minimum version to run tests, used by uv run +requires-python = ">=3.10" # Minimum version to run tests, used by uv run [tool.black] line-length = 130 @@ -12,8 +12,6 @@ skip-magic-trailing-comma = true [tool.ruff] line-length = 130 -# Oldest supported Python version -target-version = "py39" fix = true exclude = [ # virtual environment @@ -149,6 +147,12 @@ extend-safe-fixes = [ "UP036", # Remove unnecessary `sys.version_info` blocks ] ignore = [ + ### + # TODO: Disabled temporarily, until Python 3.9 support is fully removed in + # May 2026. + ### + "UP035", # import from typing + "UP036", # Remove unnecessary `sys.version_info` blocks ### # Rules that can conflict with the formatter (Black) # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules @@ -255,12 +259,10 @@ extra-standard-library = [ "_typeshed", "typing_extensions", # Extra modules not recognized by Ruff - # Added in Python 3.9 - "zoneinfo", # Added in Python 3.14 "compression", ] known-first-party = ["_utils", "ts_utils"] [tool.typeshed] -oldest_supported_python = "3.9" +oldest_supported_python = "3.10" diff --git a/python/helpers/typeshed/pyrightconfig.stricter.json b/python/helpers/typeshed/pyrightconfig.stricter.json index c8ade412980c..de9383275efa 100644 --- a/python/helpers/typeshed/pyrightconfig.stricter.json +++ b/python/helpers/typeshed/pyrightconfig.stricter.json @@ -67,7 +67,6 @@ "stubs/opentracing/opentracing/span.pyi", "stubs/paramiko/paramiko/_winapi.pyi", "stubs/parsimonious/parsimonious/nodes.pyi", - "stubs/passlib", "stubs/peewee", "stubs/pexpect", "stubs/pika", diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/common.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/common.txt index d8956df6b327..761945e91f80 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/common.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/common.txt @@ -59,6 +59,7 @@ _frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY _frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY_DEBUG builtins.OSError.characters_written # GetSetDescriptor that always raises AttributeError +builtins.ellipsis # does not exist at runtime, see https://github.com/python/typeshed/issues/7580 builtins.float.__getformat__ # Internal method for CPython test suite # These super() dunders don't seem to be particularly useful, @@ -180,11 +181,22 @@ sys.tracebacklimit # Must be set first # ========================================================== # async at runtime, deliberately not in the stub, see #7491 -_collections_abc.AsyncGenerator.asend # pos-only differences also. +_collections_abc.AsyncGenerator.asend # pos-only differences also _collections_abc.AsyncGenerator.__anext__ _collections_abc.AsyncGenerator.aclose +_collections_abc.AsyncGenerator.athrow # pos-only differences also _collections_abc.AsyncIterator.__anext__ +# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib +_collections_abc.Coroutine.send +_collections_abc.Coroutine.throw +_collections_abc.Generator.send +_collections_abc.Generator.throw + +# These are not positional-only at runtime, but we treat them as positional-only to match dict. +_collections_abc.MutableMapping.pop +_collections_abc.MutableMapping.setdefault + # Pretend typing.ByteString is a Union, to better match its documented semantics. # As a side effect, this changes the definition of collections.abc.ByteString, which is okay, # because it's not an ABC that makes any sense and was deprecated in 3.12 @@ -217,6 +229,7 @@ argparse.Namespace.__getattr__ # The whole point of this class is its attribute _?ast.AST.__init__ _?ast.excepthandler.__init__ _?ast.expr.__init__ +_?ast.pattern.__init__ _?ast.stmt.__init__ _ast.ImportFrom.level # None on the class, but never None on instances @@ -235,6 +248,7 @@ asyncio.locks.Condition.locked asyncio.locks.Condition.release builtins.memoryview.__contains__ # C type that implements __getitem__ +builtins.property.__set_name__ # Doesn't actually exist builtins.reveal_locals # Builtins that type checkers pretends exist builtins.reveal_type # Builtins that type checkers pretends exist @@ -251,6 +265,7 @@ codecs.CodecInfo.streamwriter codecs.StreamReaderWriter.\w+ codecs.StreamRecoder.\w+ +collections.UserList.index # ignoring pos-or-keyword parameter collections.UserList.sort # Runtime has *args but will error if any are supplied collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used @@ -287,6 +302,8 @@ _?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend # These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220 _?ctypes.Array.__iter__ +dataclasses.KW_ONLY # white lies around defaults + # __all__-related weirdness (see #6523) email.__all__ email.base64mime @@ -317,6 +334,8 @@ http.HTTPStatus.description # set in __new__; work-around for enum wierdness http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness imaplib.IMAP4_SSL.ssl # Depends on the existence and flags of SSL +importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility + # runtime is *args, **kwargs due to a wrapper; we have more accurate signatures in the stubs importlib._bootstrap_external.ExtensionFileLoader.get_filename importlib._bootstrap_external.FileLoader.get_filename @@ -326,6 +345,8 @@ importlib.abc.FileLoader.get_filename importlib.abc.FileLoader.load_module importlib.machinery.ExtensionFileLoader.get_filename +importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect + # We can't distinguish not having a default value from having a default value of inspect.Parameter.empty inspect.Parameter.__init__ inspect.Signature.__init__ @@ -446,6 +467,8 @@ traceback.TracebackException.from_exception # explicitly expanding arguments go turtle.ScrolledCanvas.find_all # Dynamically created, has unnecessary *args turtle.ScrolledCanvas.select_clear # Dynamically created, has unnecessary *args turtle.ScrolledCanvas.select_item # Dynamically created, has unnecessary *args +# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) +tkinter.ttk.Style.element_create types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 types.GenericAlias.__getattr__ @@ -516,6 +539,17 @@ typing(_extensions)?\.(Async)?ContextManager typing(_extensions)?\.IO\.__iter__ typing(_extensions)?\.IO\.__next__ +# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer +# to mark these as positional-only for compatibility with existing sub-classes. +typing(_extensions)?\.BinaryIO\.write +typing(_extensions)?\.IO\.read +typing(_extensions)?\.IO\.readline +typing(_extensions)?\.IO\.readlines +typing(_extensions)?\.IO\.seek +typing(_extensions)?\.IO\.truncate +typing(_extensions)?\.IO\.write +typing(_extensions)?\.IO\.writelines + types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist. types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist. types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist. @@ -550,3 +584,8 @@ xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signatu # These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220 xml.etree.ElementTree.Element.__iter__ xml.etree.cElementTree.Element.__iter__ + +# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 +posixpath.join +ntpath.join +os.path.join diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/darwin-py39.txt deleted file mode 100644 index 0e55e7f25a3f..000000000000 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ /dev/null @@ -1,83 +0,0 @@ -# ========= -# Temporary -# ========= - -# Added in Python 3.9.14 -# (Remove once 3.9.14 becomes available for GitHub Actions) -sys.set_int_max_str_digits -sys.get_int_max_str_digits - -# Incompatible changes introduced in Python 3.9.17 -# (Remove once 3.9.17 becomes available for GitHub Actions) -shutil.unpack_archive -tarfile.AbsoluteLinkError -tarfile.AbsolutePathError -tarfile.FilterError -tarfile.LinkOutsideDestinationError -tarfile.OutsideDestinationError -tarfile.SpecialFileError -tarfile.TarFile.extract -tarfile.TarFile.extractall -tarfile.TarInfo.replace -tarfile.data_filter -tarfile.fully_trusted_filter -tarfile.tar_filter - -# Incompatible changes introduced in Python 3.9.19 -# (Remove once 3.9.19 becomes available for GitHub Actions) -pyexpat.XMLParserType.GetReparseDeferralEnabled -pyexpat.XMLParserType.SetReparseDeferralEnabled -xml.etree.ElementTree.XMLParser.flush -xml.etree.ElementTree.XMLPullParser.flush -xml.etree.cElementTree.XMLParser.flush -xml.etree.cElementTree.XMLPullParser.flush -xml.parsers.expat.XMLParserType.GetReparseDeferralEnabled -xml.parsers.expat.XMLParserType.SetReparseDeferralEnabled -xml.sax.expatreader.ExpatParser.flush -zipfile.ZipInfo.__slots__ - -# Incompatible changes introduced in Python 3.9.20 -# (Remove once 3.9.20 becomes available for GitHub Actions) -email._header_value_parser.NLSET -email._header_value_parser.SPECIALSNL -email.errors.HeaderWriteError -email.utils.getaddresses -email.utils.parseaddr - -# Incompatible changes introduced in Python 3.9.22 -# (Remove once 3.9.22 becomes available for GitHub Actions) -email._header_value_parser.get_encoded_word - -# Incompatible changes introduced in Python 3.9.23 -# (Remove once 3.9.23 becomes available for GitHub Actions) -genericpath.__all__ -genericpath.ALLOW_MISSING -(ntpath.__all__)? -(ntpath.ALLOW_MISSING)? -(ntpath.realpath)? -(os.path.__all__)? -(os.path.ALLOW_MISSING)? -(os.path.realpath)? -(posixpath.__all__)? -(posixpath.ALLOW_MISSING)? -(posixpath.realpath)? -tarfile.LinkFallbackError -tarfile.TarFile._extract_member -tarfile.TarFile.makelink_with_filter -html.parser.HTMLParser.set_cdata_mode # parameter `escapable` -email._header_value_parser.make_quoted_pairs - -# Parameter `scripting` added in Python 3.9.25 -# (Remove once 3.9.25 becomes available for GitHub Actions) -html.parser.HTMLParser.__init__ - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.12 -# ============================================================= - -# Doesn't exist on macos: -_msi -msilib(.[a-z]+)? -ossaudiodev -spwd diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/linux-py39.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/linux-py39.txt deleted file mode 100644 index b92f8267f499..000000000000 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/linux-py39.txt +++ /dev/null @@ -1,25 +0,0 @@ -# ======== -# 3.9 only -# ======== - -# `eventmask` argument exists at runtime, but is not correctly recognized -# while being inspected by stubtest. Fixed in Python 3.10. -select.epoll.register - -# According to stubtest, these are sometimes not present at runtime, starting -# with Python 3.9.24. Which is not true. -(_frozen_importlib_external.PathFinder.find_distributions)? -(importlib._bootstrap_external.PathFinder.find_distributions)? -(importlib.machinery.PathFinder.find_distributions)? - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.12 -# ============================================================= - -# doesn't exist on linux -_msi -msilib(.[a-z]+)? - -# doesn't exist in all installations -(nis)? diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py310.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py310.txt index b11ea3c6c7db..403a93a5e26f 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py310.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py310.txt @@ -3,43 +3,6 @@ # ========================= -# ======= -# >= 3.10 -# ======= - -builtins.ellipsis # type is not exposed anywhere -importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility - -# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw - -# These are not positional-only at runtime, but we treat them as positional-only to match dict. -_collections_abc.MutableMapping.pop -_collections_abc.MutableMapping.setdefault - -# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 -posixpath.join -ntpath.join -os.path.join - -# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) -tkinter.ttk.Style.element_create - -# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer -# to mark these as positional-only for compatibility with existing sub-classes. -typing(_extensions)?\.BinaryIO\.write -typing(_extensions)?\.IO\.read -typing(_extensions)?\.IO\.readline -typing(_extensions)?\.IO\.readlines -typing(_extensions)?\.IO\.seek -typing(_extensions)?\.IO\.truncate -typing(_extensions)?\.IO\.write -typing(_extensions)?\.IO\.writelines - - # ========= # 3.10 only # ========= @@ -166,22 +129,6 @@ importlib.abc.Traversable.open # Problematic protocol signature at runtime, see typing_extensions.TypeAliasType.__call__ -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.10 -# ============================================================= - -# Runtime AST node runtime constructor behaviour is too loose. -# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). -# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858) -_?ast.pattern.__init__ - -_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -builtins.property.__set_name__ # Doesn't actually exist -collections\.UserList\.index # ignoring pos-or-keyword parameter -dataclasses.KW_ONLY # white lies around defaults -importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect - - # =============================================================== # Allowlist entries that cannot or should not be fixed; 3.10 only # =============================================================== diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py311.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py311.txt index e7ef0c7af054..56cf672fda59 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py311.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py311.txt @@ -23,43 +23,6 @@ enum.StrEnum._generate_next_value_ # ==================================== -# ======= -# >= 3.10 -# ======= - -builtins.ellipsis # type is not exposed anywhere -importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility - -# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw - -# These are not positional-only at runtime, but we treat them as positional-only to match dict. -_collections_abc.MutableMapping.pop -_collections_abc.MutableMapping.setdefault - -# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 -posixpath.join -ntpath.join -os.path.join - -# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) -tkinter.ttk.Style.element_create - -# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer -# to mark these as positional-only for compatibility with existing sub-classes. -typing(_extensions)?\.BinaryIO\.write -typing(_extensions)?\.IO\.read -typing(_extensions)?\.IO\.readline -typing(_extensions)?\.IO\.readlines -typing(_extensions)?\.IO\.seek -typing(_extensions)?\.IO\.truncate -typing(_extensions)?\.IO\.write -typing(_extensions)?\.IO\.writelines - - # ============ # 3.10 to 3.11 # ============ @@ -152,22 +115,6 @@ typing\._SpecialForm.* # Super-special typing primitive typing\.LiteralString # Super-special typing primitive -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.10 -# ============================================================= - -# Runtime AST node runtime constructor behaviour is too loose. -# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). -# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858) -_?ast.pattern.__init__ - -_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -builtins.property.__set_name__ # Doesn't actually exist -collections\.UserList\.index # ignoring pos-or-keyword parameter -dataclasses.KW_ONLY # white lies around defaults -importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect - - # =============================================================== # Allowlist entries that cannot or should not be fixed; 3.11 only # =============================================================== diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py312.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py312.txt index 24e1b1f80d37..d5d66bddfe59 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py312.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py312.txt @@ -40,43 +40,6 @@ typing.NewType.__mro_entries__ enum.Enum.__init__ -# ======= -# >= 3.10 -# ======= - -builtins.ellipsis # type is not exposed anywhere -importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility - -# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw - -# These are not positional-only at runtime, but we treat them as positional-only to match dict. -_collections_abc.MutableMapping.pop -_collections_abc.MutableMapping.setdefault - -# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 -posixpath.join -ntpath.join -os.path.join - -# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) -tkinter.ttk.Style.element_create - -# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer -# to mark these as positional-only for compatibility with existing sub-classes. -typing(_extensions)?\.BinaryIO\.write -typing(_extensions)?\.IO\.read -typing(_extensions)?\.IO\.readline -typing(_extensions)?\.IO\.readlines -typing(_extensions)?\.IO\.seek -typing(_extensions)?\.IO\.truncate -typing(_extensions)?\.IO\.write -typing(_extensions)?\.IO\.writelines - - # ======= # <= 3.12 # ======= @@ -184,22 +147,6 @@ typing\.LiteralString # Super-special typing primitive argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.10 -# ============================================================= - -# Runtime AST node runtime constructor behaviour is too loose. -# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). -# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858) -_?ast.pattern.__init__ - -_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -builtins.property.__set_name__ # Doesn't actually exist -collections\.UserList\.index # ignoring pos-or-keyword parameter -dataclasses.KW_ONLY # white lies around defaults -importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect - - # =============================================================== # Allowlist entries that cannot or should not be fixed; 3.12 only # =============================================================== diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py313.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py313.txt index a79fc83fe0c7..27d7a14a36d6 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py313.txt @@ -40,43 +40,6 @@ typing.NewType.__mro_entries__ enum.Enum.__init__ -# ======= -# >= 3.10 -# ======= - -builtins.ellipsis # type is not exposed anywhere -importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility - -# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw - -# These are not positional-only at runtime, but we treat them as positional-only to match dict. -_collections_abc.MutableMapping.pop -_collections_abc.MutableMapping.setdefault - -# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 -posixpath.join -ntpath.join -os.path.join - -# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) -tkinter.ttk.Style.element_create - -# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer -# to mark these as positional-only for compatibility with existing sub-classes. -typing(_extensions)?\.BinaryIO\.write -typing(_extensions)?\.IO\.read -typing(_extensions)?\.IO\.readline -typing(_extensions)?\.IO\.readlines -typing(_extensions)?\.IO\.seek -typing(_extensions)?\.IO\.truncate -typing(_extensions)?\.IO\.write -typing(_extensions)?\.IO\.writelines - - # ======= # <= 3.13 # ======= @@ -174,19 +137,3 @@ typing\.LiteralString # Super-special typing primitive # ================================================================== argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.10 -# ============================================================= - -# Runtime AST node runtime constructor behaviour is too loose. -# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). -# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858) -_?ast.pattern.__init__ - -_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -builtins.property.__set_name__ # Doesn't actually exist -collections\.UserList\.index # ignoring pos-or-keyword parameter -dataclasses.KW_ONLY # white lies around defaults -importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py314.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py314.txt index 2ed18b5a2fea..59d0fd81a77f 100644 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py314.txt @@ -71,43 +71,6 @@ types.SimpleNamespace.__delattr__ typing.NewType.__mro_entries__ -# ======= -# >= 3.10 -# ======= - -builtins.ellipsis # type is not exposed anywhere -importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility - -# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw - -# These are not positional-only at runtime, but we treat them as positional-only to match dict. -_collections_abc.MutableMapping.pop -_collections_abc.MutableMapping.setdefault - -# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 -posixpath.join -ntpath.join -os.path.join - -# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that) -tkinter.ttk.Style.element_create - -# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer -# to mark these as positional-only for compatibility with existing sub-classes. -typing(_extensions)?\.BinaryIO\.write -typing(_extensions)?\.IO\.read -typing(_extensions)?\.IO\.readline -typing(_extensions)?\.IO\.readlines -typing(_extensions)?\.IO\.seek -typing(_extensions)?\.IO\.truncate -typing(_extensions)?\.IO\.write -typing(_extensions)?\.IO\.writelines - - # ============================================================= # Allowlist entries that cannot or should not be fixed; >= 3.14 # ============================================================= @@ -212,19 +175,3 @@ importlib.resources.abc.Traversable.open # Problematic protocol signature at ru inspect._ParameterKind.description # Still exists, but stubtest can't see it typing\._SpecialForm.* # Super-special typing primitive typing\.LiteralString # Super-special typing primitive - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; >= 3.10 -# ============================================================= - -# Runtime AST node runtime constructor behaviour is too loose. -# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378). -# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858) -_?ast.pattern.__init__ - -_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -builtins.property.__set_name__ # Doesn't actually exist -collections\.UserList\.index # ignoring pos-or-keyword parameter -dataclasses.KW_ONLY # white lies around defaults -importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py39.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py39.txt deleted file mode 100644 index 76ee91c4cb1b..000000000000 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/py39.txt +++ /dev/null @@ -1,257 +0,0 @@ -# ======== -# 3.9 only -# ======== - -# Exists at runtime, but missing from stubs -collections.AsyncIterable.__class_getitem__ -collections.Awaitable.__class_getitem__ -collections.Container.__class_getitem__ -collections.Iterable.__class_getitem__ -collections.MappingView.__class_getitem__ -hmac.HMAC.digest_cons -hmac.HMAC.inner -hmac.HMAC.outer -xxsubtype # module missing from the stubs - -builtins.input # Incorrect default value in text signature, fixed in 3.10 -collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491 -collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491 -collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491 -collections.ByteString # see comments in common.txt -collections.Callable -collections.Mapping.get # Adding None to the Union messed up mypy -collections.Sequence.index # Supporting None in end is not mandatory - - -# ======= -# <= 3.10 -# ======= - -builtins.float.__setformat__ # Internal method for CPython test suite -email.contentmanager.typ -gettext.install # codeset default value is ['unspecified'] so can't be specified -gettext.translation # codeset default value is ['unspecified'] so can't be specified -inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this -inspect.Signature.from_function # Removed in 3.11, can add if someone needs this - -# SpooledTemporaryFile implements IO except these methods before Python 3.11 -# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 -tempfile.SpooledTemporaryFile.__next__ -tempfile.SpooledTemporaryFile.readable -tempfile.SpooledTemporaryFile.seekable -tempfile.SpooledTemporaryFile.writable - -tkinter.Tk.split # Exists at runtime, but missing from stubs -typing._SpecialForm.__mro_entries__ # Exists at runtime, but missing from stubs - -# Will always raise. Not included to avoid type checkers inferring that -# Sentinel instances are callable. -typing_extensions.Sentinel.__call__ - - -# ======= -# <= 3.11 -# ======= - -enum.Enum._generate_next_value_ -importlib.abc.Finder.find_module -urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified -xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub -xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub - - -# ======= -# <= 3.12 -# ======= - -# Exists at runtime, but missing from stubs -lib2to3.btm_utils -lib2to3.fixer_util -lib2to3.patcomp -lib2to3.pgen2.grammar.Grammar.loads -lib2to3.pygram.pattern_symbols -lib2to3.pygram.python_symbols -lib2to3.pytree.Base.__new__ -lib2to3.pytree.Base.children -lib2to3.pytree.Base.type -lib2to3.pytree.BasePattern.__new__ -lib2to3.pytree.BasePattern.type -lib2to3.pytree.NegatedPattern.match -lib2to3.pytree.NegatedPattern.match_seq -tkinter.tix.[A-Z_]+ -tkinter.tix.CObjView -tkinter.tix.DialogShell -tkinter.tix.ExFileSelectDialog -tkinter.tix.FileSelectDialog -tkinter.tix.FileTypeList -tkinter.tix.Grid -tkinter.tix.NoteBookFrame -tkinter.tix.OptionName -tkinter.tix.ResizeHandle -tkinter.tix.ScrolledGrid -tkinter.tix.ScrolledHList -tkinter.tix.ScrolledListBox -tkinter.tix.ScrolledTList -tkinter.tix.ScrolledText -tkinter.tix.ScrolledWindow -tkinter.tix.Shell -tkinter.tix.TclVersion -tkinter.tix.TkVersion - - -# ======= -# <= 3.13 -# ======= - -ast.Ellipsis.__new__ # Implementation has *args, but shouldn't allow any - -_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None - -importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments. - -# Will always raise. Not included to avoid type checkers inferring that -# TypeAliasType instances are callable. -typing_extensions.TypeAliasType.__call__ - - -# ============================================================== -# Allowlist entries that cannot or should not be fixed; 3.9 only -# ============================================================== - -ast.FormattedValue.conversion # None on the class, but never None on instances -_ast.FormattedValue.conversion # None on the class, but never None on instances - -_ssl.RAND_egd # Depends on the existence and flags of SSL -builtins.classmethod.__get__ # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -builtins.property.__get__ # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -builtins.staticmethod.__get__ # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only -collections.Mapping.__reversed__ # Set to None at runtime for a better error message, omitted from typeshed - -# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414. -collections.Set.__rand__ -collections.Set.__ror__ -collections.Set.__rsub__ -collections.Set.__rxor__ - -ssl.RAND_egd # Depends on the existence and flags of SSL -test # Modules that exist at runtime, but shouldn't be added to typeshed - -# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -types.ClassMethodDescriptorType.__get__ -types.FunctionType.__get__ -types.GetSetDescriptorType.__get__ -types.LambdaType.__get__ -types.MemberDescriptorType.__get__ -types.MethodDescriptorType.__get__ -types.WrapperDescriptorType.__get__ - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.10 -# ============================================================= - -# Side effects from module initialization -_compat_pickle.excname -email.contentmanager.maintype -email.contentmanager.subtype -inspect.k -inspect.mod_dict -inspect.v -json.encoder.i -lib2to3.pgen2.grammar.line -lib2to3.pgen2.grammar.name -lib2to3.pgen2.grammar.op - -pstats.SortKey.__new__ # Derives from (str, Enum) -pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 -pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 -pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 -sqlite3.test # Modules that exist at runtime, but shouldn't be added to typeshed -sqlite3\.test\..+ # Modules that exist at runtime, but shouldn't be added to typeshed -tkinter.EventType.__new__ # Derives from (str, Enum) -types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.11 -# ============================================================= - -.*.__buffer__ # We lie about the existence of these methods -.*.__release_buffer__ # We lie about the existence of these methods -asynchat.async_chat.encoding # Removed in 3.12 -asynchat.async_chat.use_encoding # Removed in 3.12 -asynchat.find_prefix_at_end # Removed in 3.12 -asyncore.dispatcher.addr # Removed in 3.12 -asyncore.dispatcher.handle_accepted # Removed in 3.12 -ctypes.test # Modules that exist at runtime, but shouldn't be added to typeshed -ctypes\.test\..+ # Modules that exist at runtime, but shouldn't be added to typeshed -distutils\..* # Removed in 3.12 -lib2to3.tests # Modules that exist at runtime, but shouldn't be added to typeshed -lib2to3\.tests\..+ # Modules that exist at runtime, but shouldn't be added to typeshed -pkgutil.ImpImporter\..* # Removed in 3.12 -pkgutil.ImpLoader\..* # Removed in 3.12 -platform.platform # runtime default is 0, we pretend it's a bool -poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi -tkinter.test # Modules that exist at runtime, but shouldn't be added to typeshed -tkinter\.test\..+ # Modules that exist at runtime, but shouldn't be added to typeshed - -# We call them read-only properties, runtime implementation is slightly different -typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__ - -unittest.test # Modules that exist at runtime, but shouldn't be added to typeshed -unittest\.test\..+ # Modules that exist at runtime, but shouldn't be added to typeshed - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.12 -# ============================================================= - -# Undocumented implementation details -cgi.FieldStorage.bufsize -cgi.FieldStorage.read_binary -cgi.FieldStorage.read_lines -cgi.FieldStorage.read_lines_to_eof -cgi.FieldStorage.read_lines_to_outerboundary -cgi.FieldStorage.read_multi -cgi.FieldStorage.read_single -cgi.FieldStorage.read_urlencoded -cgi.FieldStorage.skip_lines - -ctypes._endian.DEFAULT_MODE # Incorrectly star import. -ctypes._endian.RTLD_GLOBAL # Incorrectly star import. -ctypes._endian.RTLD_LOCAL # Incorrectly star import. -multiprocessing.dummy.Lock # Factory function at runtime, but that wouldn't let us use it in type hints - -# These multiprocessing proxy methods have *args, **kwargs signatures at runtime, -# But have more precise (accurate) signatures in the stub -multiprocessing.managers.DictProxy.__iter__ -multiprocessing.managers.DictProxy.__len__ -multiprocessing.managers.DictProxy.copy -multiprocessing.managers.DictProxy.items -multiprocessing.managers.DictProxy.keys -multiprocessing.managers.DictProxy.values - -# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) -multiprocessing.managers.DictProxy.clear -multiprocessing.managers.DictProxy.popitem - -# Undocumented implementation details -pipes.Template.makepipeline -pipes.Template.open_r -pipes.Template.open_w -sunau.Au_read.initfp -sunau.Au_write.initfp - -threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints -types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature -typing_extensions\.Annotated # Undocumented implementation details -typing\.Annotated # Super-special typing primitive - -# These methods have no default implementation for Python < 3.13. -_pickle.Pickler.persistent_id -_pickle.Unpickler.persistent_load -pickle.Pickler.persistent_id -pickle.Unpickler.persistent_load diff --git a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/win32-py39.txt b/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/win32-py39.txt deleted file mode 100644 index 9e7cf677f711..000000000000 --- a/python/helpers/typeshed/stdlib/@tests/stubtest_allowlists/win32-py39.txt +++ /dev/null @@ -1,89 +0,0 @@ -# ========= -# Temporary -# ========= - -# According to stubtest, these are sometimes not present at runtime, starting -# with Python 3.9.13. Which is not true. -(_frozen_importlib_external.PathFinder.find_distributions)? -(importlib._bootstrap_external.PathFinder.find_distributions)? -(importlib.machinery.PathFinder.find_distributions)? - -# Added in Python 3.9.14 -# (Remove once 3.9.14 becomes available for GitHub Actions) -sys.set_int_max_str_digits -sys.get_int_max_str_digits - -# Incompatible changes introduced in Python 3.9.17 -# (Remove once 3.9.17 becomes available for GitHub Actions) -shutil.unpack_archive -tarfile.AbsoluteLinkError -tarfile.AbsolutePathError -tarfile.FilterError -tarfile.LinkOutsideDestinationError -tarfile.OutsideDestinationError -tarfile.SpecialFileError -tarfile.TarFile.extract -tarfile.TarFile.extractall -tarfile.TarInfo.replace -tarfile.data_filter -tarfile.fully_trusted_filter -tarfile.tar_filter - -# Incompatible changes introduced in Python 3.9.19 -# (Remove once 3.9.19 becomes available for GitHub Actions) -pyexpat.XMLParserType.GetReparseDeferralEnabled -pyexpat.XMLParserType.SetReparseDeferralEnabled -xml.etree.ElementTree.XMLParser.flush -xml.etree.ElementTree.XMLPullParser.flush -xml.etree.cElementTree.XMLParser.flush -xml.etree.cElementTree.XMLPullParser.flush -xml.parsers.expat.XMLParserType.GetReparseDeferralEnabled -xml.parsers.expat.XMLParserType.SetReparseDeferralEnabled -xml.sax.expatreader.ExpatParser.flush -zipfile.ZipInfo.__slots__ - -# Incompatible changes introduced in Python 3.9.20 -# (Remove once 3.9.20 becomes available for GitHub Actions) -email._header_value_parser.NLSET -email._header_value_parser.SPECIALSNL -email.errors.HeaderWriteError -email.utils.getaddresses -email.utils.parseaddr - -# Incompatible changes introduced in Python 3.9.22 -# (Remove once 3.9.22 becomes available for GitHub Actions) -email._header_value_parser.get_encoded_word - -# Incompatible changes introduced in Python 3.9.23 -# (Remove once 3.9.23 becomes available for GitHub Actions) -genericpath.__all__ -genericpath.ALLOW_MISSING -(ntpath.__all__)? -(ntpath.ALLOW_MISSING)? -(ntpath.realpath)? -(os.path.__all__)? -(os.path.ALLOW_MISSING)? -(os.path.realpath)? -(posixpath.__all__)? -(posixpath.ALLOW_MISSING)? -(posixpath.realpath)? -tarfile.LinkFallbackError -tarfile.TarFile._extract_member -tarfile.TarFile.makelink_with_filter -html.parser.HTMLParser.set_cdata_mode # parameter `escapable` -email._header_value_parser.make_quoted_pairs - -# Parameter `scripting` added in Python 3.9.25 -# (Remove once 3.9.25 becomes available for GitHub Actions) -html.parser.HTMLParser.__init__ - - -# ============================================================= -# Allowlist entries that cannot or should not be fixed; <= 3.12 -# ============================================================= - -# Modules that don't exist on Windows -crypt -nis -ossaudiodev -spwd diff --git a/python/helpers/typeshed/stdlib/_collections_abc.pyi b/python/helpers/typeshed/stdlib/_collections_abc.pyi index 319577c9284b..0fa81662dfbc 100644 --- a/python/helpers/typeshed/stdlib/_collections_abc.pyi +++ b/python/helpers/typeshed/stdlib/_collections_abc.pyi @@ -1,7 +1,7 @@ import sys from abc import abstractmethod from types import MappingProxyType -from typing import ( # noqa: Y022,Y038,UP035,Y057 +from typing import ( # noqa: Y022,Y038,UP035,Y057,RUF100 AbstractSet as Set, AsyncGenerator as AsyncGenerator, AsyncIterable as AsyncIterable, diff --git a/python/helpers/typeshed/stdlib/builtins.pyi b/python/helpers/typeshed/stdlib/builtins.pyi index efc51fe257ae..5695b17ca36d 100644 --- a/python/helpers/typeshed/stdlib/builtins.pyi +++ b/python/helpers/typeshed/stdlib/builtins.pyi @@ -37,7 +37,7 @@ from types import CellType, CodeType, GenericAlias, TracebackType # mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping} # are imported from collections.abc in builtins.pyi -from typing import ( # noqa: Y022,UP035 +from typing import ( # noqa: Y022,UP035,RUF100 IO, Any, BinaryIO, @@ -1385,10 +1385,10 @@ def abs(x: SupportsAbs[_T], /) -> _T: ... def all(iterable: Iterable[object], /) -> bool: ... def any(iterable: Iterable[object], /) -> bool: ... def ascii(obj: object, /) -> str: ... -def bin(number: int | SupportsIndex, /) -> str: ... +def bin(number: SupportsIndex, /) -> str: ... def breakpoint(*args: Any, **kws: Any) -> None: ... def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ... -def chr(i: int | SupportsIndex, /) -> str: ... +def chr(i: SupportsIndex, /) -> str: ... if sys.version_info >= (3, 10): def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ... @@ -1546,7 +1546,7 @@ def hash(obj: object, /) -> int: ... help: _sitebuiltins._Helper -def hex(number: int | SupportsIndex, /) -> str: ... +def hex(number: SupportsIndex, /) -> str: ... def id(obj: object, /) -> int: ... def input(prompt: object = "", /) -> str: ... @type_check_only @@ -1713,7 +1713,7 @@ def min(iterable: Iterable[_T1], /, *, key: Callable[[_T1], SupportsRichComparis def next(i: SupportsNext[_T], /) -> _T: ... @overload def next(i: SupportsNext[_T], default: _VT, /) -> _T | _VT: ... -def oct(number: int | SupportsIndex, /) -> str: ... +def oct(number: SupportsIndex, /) -> str: ... _Opener: TypeAlias = Callable[[str, int], int] diff --git a/python/helpers/typeshed/stdlib/logging/__init__.pyi b/python/helpers/typeshed/stdlib/logging/__init__.pyi index 8248f82ea87a..3a79e3a65d19 100644 --- a/python/helpers/typeshed/stdlib/logging/__init__.pyi +++ b/python/helpers/typeshed/stdlib/logging/__init__.pyi @@ -616,6 +616,7 @@ class FileHandler(StreamHandler[TextIOWrapper]): encoding: str | None # undocumented delay: bool # undocumented errors: str | None # undocumented + stream: TextIOWrapper | None # type: ignore[assignment] # None when delay=True or after close() def __init__( self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: ... diff --git a/python/helpers/typeshed/stdlib/socket.pyi b/python/helpers/typeshed/stdlib/socket.pyi index 36a335e13d02..a55273a8772c 100644 --- a/python/helpers/typeshed/stdlib/socket.pyi +++ b/python/helpers/typeshed/stdlib/socket.pyi @@ -1427,7 +1427,7 @@ def getfqdn(name: str = "") -> str: ... if sys.version_info >= (3, 11): def create_connection( - address: tuple[str | None, int], + address: tuple[str | None, bytes | str | int | None], timeout: float | None = ..., source_address: _Address | None = None, *, diff --git a/python/helpers/typeshed/stdlib/sqlite3/__init__.pyi b/python/helpers/typeshed/stdlib/sqlite3/__init__.pyi index 56bccb56d63a..62b4055e118e 100644 --- a/python/helpers/typeshed/stdlib/sqlite3/__init__.pyi +++ b/python/helpers/typeshed/stdlib/sqlite3/__init__.pyi @@ -352,7 +352,7 @@ class Connection: self, name: str, num_params: int, aggregate_class: Callable[[], _WindowAggregateClass] | None, / ) -> None: ... - def create_collation(self, name: str, callback: Callable[[str, str], int | SupportsIndex] | None, /) -> None: ... + def create_collation(self, name: str, callback: Callable[[str, str], SupportsIndex] | None, /) -> None: ... def create_function( self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = False ) -> None: ... diff --git a/python/helpers/typeshed/stdlib/typing.pyi b/python/helpers/typeshed/stdlib/typing.pyi index 369af41a7ad9..83e114aac1a2 100644 --- a/python/helpers/typeshed/stdlib/typing.pyi +++ b/python/helpers/typeshed/stdlib/typing.pyi @@ -704,6 +704,8 @@ class AbstractSet(Collection[_T_co]): def __contains__(self, x: object) -> bool: ... def _hash(self) -> int: ... # Mixin methods + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> AbstractSet[_S]: ... def __le__(self, other: AbstractSet[Any]) -> bool: ... def __lt__(self, other: AbstractSet[Any]) -> bool: ... def __gt__(self, other: AbstractSet[Any]) -> bool: ... @@ -736,6 +738,8 @@ class MappingView(Sized): class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): def __init__(self, mapping: SupportsGetItemViewable[_KT_co, _VT_co]) -> None: ... # undocumented + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, item: tuple[object, object]) -> bool: ... # type: ignore[override] @@ -749,6 +753,8 @@ class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, class KeysView(MappingView, AbstractSet[_KT_co]): def __init__(self, mapping: Viewable[_KT_co]) -> None: ... # undocumented + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ... def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, key: object) -> bool: ... diff --git a/python/helpers/typeshed/stdlib/typing_extensions.pyi b/python/helpers/typeshed/stdlib/typing_extensions.pyi index 8a9f0f3919ba..16cf0611a58a 100644 --- a/python/helpers/typeshed/stdlib/typing_extensions.pyi +++ b/python/helpers/typeshed/stdlib/typing_extensions.pyi @@ -30,7 +30,7 @@ from collections.abc import ( from contextlib import AbstractAsyncContextManager as AsyncContextManager, AbstractContextManager as ContextManager from re import Match as Match, Pattern as Pattern from types import GenericAlias, ModuleType -from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035 +from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035,RUF100 IO as IO, TYPE_CHECKING as TYPE_CHECKING, AbstractSet as AbstractSet, diff --git a/python/helpers/typeshed/stubs/Authlib/METADATA.toml b/python/helpers/typeshed/stubs/Authlib/METADATA.toml index b08e8df40134..f1c66c1c958f 100644 --- a/python/helpers/typeshed/stubs/Authlib/METADATA.toml +++ b/python/helpers/typeshed/stubs/Authlib/METADATA.toml @@ -1,3 +1,3 @@ -version = "1.6.7" +version = "1.6.8" upstream_repository = "https://github.com/authlib/authlib" requires = ["cryptography"] diff --git a/python/helpers/typeshed/stubs/Markdown/METADATA.toml b/python/helpers/typeshed/stubs/Markdown/METADATA.toml index 348b7b26267e..c29279ee2404 100644 --- a/python/helpers/typeshed/stubs/Markdown/METADATA.toml +++ b/python/helpers/typeshed/stubs/Markdown/METADATA.toml @@ -1,2 +1,2 @@ -version = "3.10.*" +version = "~=3.10.2" upstream_repository = "https://github.com/Python-Markdown/markdown" diff --git a/python/helpers/typeshed/stubs/Markdown/markdown/htmlparser.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/htmlparser.pyi index 3e6fbfa305aa..b0d95592ef93 100644 --- a/python/helpers/typeshed/stubs/Markdown/markdown/htmlparser.pyi +++ b/python/helpers/typeshed/stubs/Markdown/markdown/htmlparser.pyi @@ -7,7 +7,6 @@ from markdown import Markdown spec: ModuleSpec commentclose: re.Pattern[str] -commentabruptclose: re.Pattern[str] blank_line_re: re.Pattern[str] class HTMLExtractor(htmlparser.HTMLParser): diff --git a/python/helpers/typeshed/stubs/convertdate/METADATA.toml b/python/helpers/typeshed/stubs/convertdate/METADATA.toml index bc4079a14a27..f8f016bb7ffb 100644 --- a/python/helpers/typeshed/stubs/convertdate/METADATA.toml +++ b/python/helpers/typeshed/stubs/convertdate/METADATA.toml @@ -1,2 +1,2 @@ -version = "2.4.*" +version = "2.4.1" upstream_repository = "https://github.com/fitnr/convertdate" diff --git a/python/helpers/typeshed/stubs/convertdate/convertdate/__init__.pyi b/python/helpers/typeshed/stubs/convertdate/convertdate/__init__.pyi index 340d2b00a06b..b33581cac340 100644 --- a/python/helpers/typeshed/stubs/convertdate/convertdate/__init__.pyi +++ b/python/helpers/typeshed/stubs/convertdate/convertdate/__init__.pyi @@ -25,24 +25,23 @@ from . import ( __version__: Final[str] __all__ = [ - "holidays", "armenian", "bahai", "coptic", - "dublin", "daycount", + "dublin", "french_republican", "gregorian", "hebrew", + "holidays", "indian_civil", "islamic", "iso", "julian", "julianday", "mayan", + "ordinal", "persian", "positivist", - "mayan", - "ordinal", "utils", ] diff --git a/python/helpers/typeshed/stubs/convertdate/convertdate/hebrew.pyi b/python/helpers/typeshed/stubs/convertdate/convertdate/hebrew.pyi index c2d1fda2dd2b..dfe5544d185d 100644 --- a/python/helpers/typeshed/stubs/convertdate/convertdate/hebrew.pyi +++ b/python/helpers/typeshed/stubs/convertdate/convertdate/hebrew.pyi @@ -1,4 +1,5 @@ from typing import Final, Literal +from typing_extensions import deprecated EPOCH: Final = 347995.5 HEBREW_YEAR_OFFSET: Final = 3760 @@ -23,6 +24,8 @@ def year_months(year: int) -> Literal[12, 13]: ... def delay_1(year: int) -> int: ... def delay_2(year: int) -> Literal[0, 1, 2]: ... def year_days(year: int) -> float: ... +def month_length(year: int, month: int) -> Literal[29, 30]: ... +@deprecated("The `month_days` function is deprecated. Use `month_length` instead.") def month_days(year: int, month: int) -> Literal[29, 30]: ... def to_jd(year: int, month: int, day: int) -> float: ... def from_jd(jd: float) -> tuple[int, int, int]: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/__init__.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/__init__.pyi index cec3cb7b8a26..ff3ab72b686a 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/__init__.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/__init__.pyi @@ -1,18 +1,16 @@ import datetime -from typing import Literal, TypedDict, type_check_only -from typing_extensions import TypeAlias +from typing import Any, Final, Literal, TypedDict, type_check_only + +from dateparser.conf import Settings from .date import DateDataParser, _DetectLanguagesFunction -__version__: str +__version__: Final[str] _default_parser: DateDataParser -_Part: TypeAlias = Literal["day", "month", "year"] -_ParserKind: TypeAlias = Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"] - @type_check_only -class _Settings(TypedDict, total=False): +class _Settings(TypedDict, total=False): # noqa: Y049 DATE_ORDER: str PREFER_LOCALE_DATE_ORDER: bool TIMEZONE: str @@ -23,14 +21,14 @@ class _Settings(TypedDict, total=False): PREFER_DATES_FROM: Literal["current_period", "future", "past"] RELATIVE_BASE: datetime.datetime STRICT_PARSING: bool - REQUIRE_PARTS: list[_Part] + REQUIRE_PARTS: list[Literal["day", "month", "year"]] SKIP_TOKENS: list[str] NORMALIZE: bool RETURN_TIME_AS_PERIOD: bool RETURN_TIME_SPAN: bool DEFAULT_START_OF_WEEK: Literal["monday", "sunday"] DEFAULT_DAYS_IN_MONTH: int - PARSERS: list[_ParserKind] + PARSERS: list[Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"]] DEFAULT_LANGUAGES: list[str] LANGUAGE_DETECTION_CONFIDENCE_THRESHOLD: float CACHE_SIZE_LIMIT: int @@ -41,6 +39,6 @@ def parse( languages: list[str] | tuple[str, ...] | set[str] | None = None, locales: list[str] | tuple[str, ...] | set[str] | None = None, region: str | None = None, - settings: _Settings | None = None, + settings: Settings | dict[str, Any] | None = None, detect_languages_function: _DetectLanguagesFunction | None = None, ) -> datetime.datetime | None: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/__init__.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/__init__.pyi index 105f27431aad..82f7f5df75b6 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/__init__.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/__init__.pyi @@ -1,24 +1,47 @@ -from _typeshed import Incomplete from abc import abstractmethod +from datetime import datetime +from typing import ClassVar, Protocol, type_check_only from dateparser.conf import Settings +from dateparser.date import DateData from dateparser.parser import _parser +# Examples: `hijri_parser.hijri` class or `convertdate.persian` module +@type_check_only +class _CalendarConverter(Protocol): + @classmethod + def to_gregorian(cls, year: int, month: int, day: int) -> tuple[int, int, int]: ... + @classmethod + def from_gregorian( + cls, year: int | None = None, month: int | None = None, day: int | None = None + ) -> tuple[int, int, int]: ... + @classmethod + def month_length(cls, year: int, month: int) -> int: ... + +# Examples: `hijri_parser.HijriDate` or `jalali_parser.PersianDate` +@type_check_only +class _NonGregorianDate(Protocol): + year: int + month: int + day: int + def __init__(self, year: int, month: int, day: int) -> None: ... + def weekday(self) -> int | None: ... + class CalendarBase: - parser: Incomplete - source: Incomplete - def __init__(self, source) -> None: ... - def get_date(self): ... + parser: type[_parser] + source: str + def __init__(self, source: str) -> None: ... + def get_date(self) -> DateData | None: ... class non_gregorian_parser(_parser): - calendar_converter: Incomplete - default_year: Incomplete - default_month: Incomplete - default_day: Incomplete - non_gregorian_date_cls: Incomplete + calendar_converter: ClassVar[type[_CalendarConverter]] + default_year: ClassVar[int] + default_month: ClassVar[int] + default_day: ClassVar[int] + non_gregorian_date_cls: ClassVar[type[_NonGregorianDate]] @classmethod - def to_latin(cls, source): ... + def to_latin(cls, source: str) -> str: ... @abstractmethod def handle_two_digit_year(self, year: int) -> int: ... @classmethod - def parse(cls, datestring: str, settings: Settings) -> tuple[Incomplete, Incomplete]: ... # type: ignore[override] + def parse(cls, datestring: str, settings: Settings) -> tuple[datetime, str | None]: ... # type: ignore[override] diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/hijri_parser.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/hijri_parser.pyi index f73a18bd1a0c..13551dba93dc 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/hijri_parser.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/hijri_parser.pyi @@ -1,5 +1,4 @@ -from _typeshed import Incomplete -from typing import SupportsIndex +from typing import ClassVar from dateparser.calendars import non_gregorian_parser @@ -8,22 +7,22 @@ class hijri: def to_gregorian(cls, year: int | None = None, month: int | None = None, day: int | None = None) -> tuple[int, int, int]: ... @classmethod def from_gregorian( - cls, year: SupportsIndex | None = None, month: SupportsIndex | None = None, day: SupportsIndex | None = None + cls, year: int | None = None, month: int | None = None, day: int | None = None ) -> tuple[int, int, int]: ... @classmethod - def month_length(cls, year: int, month: int) -> int: ... + def month_length(cls, year: int | None, month: int | None) -> int: ... class HijriDate: - year: Incomplete - month: Incomplete - day: Incomplete - def __init__(self, year, month, day) -> None: ... - def weekday(self): ... + year: int + month: int + day: int + def __init__(self, year: int, month: int, day: int) -> None: ... + def weekday(self) -> int | None: ... class hijri_parser(non_gregorian_parser): - calendar_converter: type[hijri] - default_year: int - default_month: int - default_day: int - non_gregorian_date_cls: type[HijriDate] + calendar_converter: ClassVar[type[hijri]] + default_year: ClassVar[int] + default_month: ClassVar[int] + default_day: ClassVar[int] + non_gregorian_date_cls: ClassVar[type[HijriDate]] def handle_two_digit_year(self, year: int) -> int: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/jalali_parser.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/jalali_parser.pyi index d70a244cbfef..9c8064135b31 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/jalali_parser.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/calendars/jalali_parser.pyi @@ -1,18 +1,18 @@ -from _typeshed import Incomplete +from typing import ClassVar from dateparser.calendars import non_gregorian_parser class PersianDate: - year: Incomplete - month: Incomplete - day: Incomplete - def __init__(self, year, month, day) -> None: ... - def weekday(self): ... + year: int + month: int + day: int + def __init__(self, year: int, month: int, day: int) -> None: ... + def weekday(self) -> int | None: ... class jalali_parser(non_gregorian_parser): - calendar_converter: Incomplete - default_year: int - default_month: int - default_day: int - non_gregorian_date_cls: type[PersianDate] + # `calendar_converter` is `convertdate.persian` module + default_year: ClassVar[int] + default_month: ClassVar[int] + default_day: ClassVar[int] + non_gregorian_date_cls: ClassVar[type[PersianDate]] def handle_two_digit_year(self, year: int) -> int: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/conf.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/conf.pyi index 7c1f85361186..74b98a5c82c4 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/conf.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/conf.pyi @@ -1,8 +1,37 @@ -from typing import Any -from typing_extensions import Self +import datetime +from collections.abc import Callable +from typing import Any, Literal, TypeVar +from typing_extensions import ParamSpec, Self + +_P = ParamSpec("_P") +_R = TypeVar("_R") class Settings: - def __new__(cls, *args, **kw) -> Self: ... + # Next attributes are optional and may be missing. + # Please keep in sync with _Settings TypedDict + DATE_ORDER: str + PREFER_LOCALE_DATE_ORDER: bool + TIMEZONE: str + TO_TIMEZONE: str + RETURN_AS_TIMEZONE_AWARE: bool + PREFER_MONTH_OF_YEAR: Literal["current", "first", "last"] + PREFER_DAY_OF_MONTH: Literal["current", "first", "last"] + PREFER_DATES_FROM: Literal["current_period", "future", "past"] + RELATIVE_BASE: datetime.datetime + STRICT_PARSING: bool + REQUIRE_PARTS: list[Literal["day", "month", "year"]] + SKIP_TOKENS: list[str] + NORMALIZE: bool + RETURN_TIME_AS_PERIOD: bool + RETURN_TIME_SPAN: bool + DEFAULT_START_OF_WEEK: Literal["monday", "sunday"] + DEFAULT_DAYS_IN_MONTH: int + PARSERS: list[Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"]] + DEFAULT_LANGUAGES: list[str] + LANGUAGE_DETECTION_CONFIDENCE_THRESHOLD: float + CACHE_SIZE_LIMIT: int + + def __new__(cls, *args, **kwargs) -> Self: ... def __init__(self, settings: dict[str, Any] | None = None) -> None: ... @classmethod def get_key(cls, settings: dict[str, Any] | None = None) -> str: ... @@ -10,7 +39,7 @@ class Settings: settings: Settings -def apply_settings(f): ... +def apply_settings(f: Callable[_P, _R]) -> Callable[_P, _R]: ... class SettingValidationError(ValueError): ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/data/languages_info.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/data/languages_info.pyi index 92038f5150de..5ac61c380052 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/data/languages_info.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/data/languages_info.pyi @@ -1,5 +1,5 @@ from typing import Final language_order: Final[list[str]] -language_locale_dict: Final[dict[str, str]] language_map: Final[dict[str, list[str]]] +language_locale_dict: Final[dict[str, list[str]]] diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/date.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/date.pyi index c26e35566218..a38d05448f15 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/date.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/date.pyi @@ -1,48 +1,79 @@ -import collections -from collections.abc import Callable, Iterable, Iterator -from datetime import datetime, tzinfo -from re import Pattern -from typing import ClassVar, Final, Literal, overload +import re +from _typeshed import Incomplete +from collections import OrderedDict +from collections.abc import Callable, Iterable, Iterator, Set as AbstractSet +from datetime import date, datetime, tzinfo +from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar, overload, type_check_only from typing_extensions import TypeAlias -from dateparser import _Settings from dateparser.conf import Settings from dateparser.languages.loader import LocaleDataLoader from dateparser.languages.locale import Locale +_DateT = TypeVar("_DateT", bound=date) + _DetectLanguagesFunction: TypeAlias = Callable[[str, float], list[str]] _Period: TypeAlias = Literal["time", "day", "week", "month", "year"] +# Work around attribute and type having the same name. +_Weekday: TypeAlias = Incomplete # Actually it's dateutil._common.weekday class + +@type_check_only +class _DateData(NamedTuple): + date_obj: datetime | None + locale: str | None + period: _Period | None APOSTROPHE_LOOK_ALIKE_CHARS: Final[list[str]] -RE_NBSP: Final[Pattern[str]] -RE_SPACES: Final[Pattern[str]] -RE_TRIM_SPACES: Final[Pattern[str]] -RE_TRIM_COLONS: Final[Pattern[str]] -RE_SANITIZE_SKIP: Final[Pattern[str]] -RE_SANITIZE_RUSSIAN: Final[Pattern[str]] -RE_SANITIZE_PERIOD: Final[Pattern[str]] -RE_SANITIZE_ON: Final[Pattern[str]] -RE_SANITIZE_APOSTROPHE: Final[Pattern[str]] -RE_SEARCH_TIMESTAMP: Final[Pattern[str]] -RE_SANITIZE_CROATIAN: Final[Pattern[str]] -RE_SEARCH_NEGATIVE_TIMESTAMP: Final[Pattern[str]] +RE_NBSP: Final[re.Pattern[str]] +RE_SPACES: Final[re.Pattern[str]] +RE_TRIM_SPACES: Final[re.Pattern[str]] +RE_TRIM_COLONS: Final[re.Pattern[str]] +RE_SANITIZE_SKIP: Final[re.Pattern[str]] +RE_SANITIZE_RUSSIAN: Final[re.Pattern[str]] +RE_SANITIZE_PERIOD: Final[re.Pattern[str]] +RE_SANITIZE_ON: Final[re.Pattern[str]] +RE_SANITIZE_APOSTROPHE: Final[re.Pattern[str]] +RE_SEARCH_TIMESTAMP: Final[re.Pattern[str]] +RE_SANITIZE_CROATIAN: Final[re.Pattern[str]] +RE_SEARCH_NEGATIVE_TIMESTAMP: Final[re.Pattern[str]] def sanitize_spaces(date_string: str) -> str: ... -def date_range(begin: datetime, end: datetime, **kwargs) -> None: ... -def get_intersecting_periods(low: datetime, high: datetime, period: str = "day") -> None: ... +def date_range( + begin: _DateT, + end: _DateT, + *, + dt1: date | None = None, + dt2: date | None = None, + years: int = 0, + months: int = 0, + days: int = 0, + leapdays: int = 0, + weeks: int = 0, + hours: int = 0, + minutes: int = 0, + seconds: int = 0, + microseconds: int = 0, + weekday: int | _Weekday | None = None, + yearday: int | None = None, + nlyearday: int | None = None, + microsecond: int | None = None, +) -> Iterator[_DateT]: ... +def get_intersecting_periods( + low: _DateT, high: _DateT, period: Literal["year", "month", "week", "day", "hour", "minute", "second", "microsecond"] = "day" +) -> Iterator[_DateT]: ... def sanitize_date(date_string: str) -> str: ... -def get_date_from_timestamp(date_string: str, settings: Settings, negative: bool = False) -> datetime | None: ... +def get_date_from_timestamp(date_string: str, settings: Settings, negative: bool | None = False) -> datetime | None: ... def parse_with_formats(date_string: str, date_formats: Iterable[str], settings: Settings) -> DateData: ... class _DateLocaleParser: locale: Locale date_string: str - date_formats: list[str] | tuple[str, ...] | set[str] | None + date_formats: list[str] | tuple[str, ...] | AbstractSet[str] | None def __init__( self, locale: Locale, date_string: str, - date_formats: list[str] | tuple[str, ...] | set[str] | None, + date_formats: list[str] | tuple[str, ...] | AbstractSet[str] | None, settings: Settings | None = None, ) -> None: ... @classmethod @@ -50,7 +81,7 @@ class _DateLocaleParser: cls, locale: Locale, date_string: str, - date_formats: list[str] | tuple[str, ...] | set[str] | None = None, + date_formats: list[str] | tuple[str, ...] | AbstractSet[str] | None = None, settings: Settings | None = None, ) -> DateData: ... def _parse(self) -> DateData | None: ... @@ -88,22 +119,26 @@ class DateDataParser: try_previous_locales: bool use_given_order: bool languages: list[str] | None - locales: list[str] | tuple[str, ...] | set[str] | None + locales: list[str] | tuple[str, ...] | AbstractSet[str] | None region: str detect_languages_function: _DetectLanguagesFunction | None - previous_locales: collections.OrderedDict[Locale, None] + previous_locales: OrderedDict[Locale, None] def __init__( self, - languages: list[str] | tuple[str, ...] | set[str] | None = None, - locales: list[str] | tuple[str, ...] | set[str] | None = None, + languages: list[str] | tuple[str, ...] | AbstractSet[str] | None = None, + locales: list[str] | tuple[str, ...] | AbstractSet[str] | None = None, region: str | None = None, try_previous_locales: bool = False, use_given_order: bool = False, - settings: _Settings | None = None, + settings: Settings | dict[str, Any] | None = None, detect_languages_function: _DetectLanguagesFunction | None = None, ) -> None: ... - def get_date_data(self, date_string: str, date_formats: list[str] | tuple[str, ...] | set[str] | None = None) -> DateData: ... - def get_date_tuple(self, date_string: str, date_formats: list[str] | tuple[str, ...] | set[str] | None = ...): ... + def get_date_data( + self, date_string: str, date_formats: list[str] | tuple[str, ...] | AbstractSet[str] | None = None + ) -> DateData: ... + def get_date_tuple( + self, date_string: str, date_formats: list[str] | tuple[str, ...] | AbstractSet[str] | None = None + ) -> _DateData: ... def _get_applicable_locales(self, date_string: str) -> Iterator[Locale]: ... def _is_applicable_locale(self, locale: Locale, date_string: str) -> bool: ... @classmethod diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/freshness_date_parser.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/freshness_date_parser.pyi index 32aed2d4a2f2..e05a0318a175 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/freshness_date_parser.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/freshness_date_parser.pyi @@ -1,18 +1,20 @@ import re from _typeshed import Incomplete +from datetime import datetime from typing import Final from zoneinfo import ZoneInfo +from dateparser.conf import Settings from dateparser.date import DateData PATTERN: Final[re.Pattern[str]] class FreshnessDateDataParser: def get_local_tz(self) -> ZoneInfo: ... - def parse(self, date_string: str, settings) -> tuple[Incomplete | None, str | None]: ... + def parse(self, date_string: str, settings: Settings) -> tuple[datetime | None, str | None]: ... def get_kwargs( self, date_string: str ) -> tuple[dict[str, float], dict[str, Incomplete]] | dict[None, None]: ... # return empty dict if pattern not found - def get_date_data(self, date_string: str, settings=None) -> DateData: ... + def get_date_data(self, date_string: str, settings: Settings | None = None) -> DateData: ... freshness_date_parser: FreshnessDateDataParser diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/dictionary.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/dictionary.pyi index ef3abee8b304..183ed097269f 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/dictionary.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/dictionary.pyi @@ -3,6 +3,8 @@ from _typeshed import Incomplete from itertools import chain from typing import Final, overload +from dateparser.conf import Settings + PARSER_HARDCODED_TOKENS: Final[list[str]] PARSER_KNOWN_TOKENS: Final[list[str]] ALWAYS_KEEP_TOKENS: Final[list[str]] @@ -14,11 +16,11 @@ KEEP_TOKEN_PATTERN: Final[re.Pattern[str]] class UnknownTokenError(Exception): ... class Dictionary: - info: Incomplete - def __init__(self, locale_info: dict[str, Incomplete], settings=None) -> None: ... - def __contains__(self, key): ... - def __getitem__(self, key): ... - def __iter__(self) -> chain[Incomplete]: ... + info: dict[str, Incomplete] + def __init__(self, locale_info: dict[str, Incomplete], settings: Settings | None = None) -> None: ... + def __contains__(self, key: str) -> bool: ... + 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: ... @@ -26,4 +28,4 @@ class Dictionary: def split(self, string: str, keep_formatting: bool = False) -> list[str]: ... class NormalizedDictionary(Dictionary): - def __init__(self, locale_info: dict[str, Incomplete], settings=None) -> None: ... + def __init__(self, locale_info: dict[str, Incomplete], settings: Settings | None = None) -> None: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/locale.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/locale.pyi index edbc1a403085..ad6ae9d283d2 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/locale.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/locale.pyi @@ -1,18 +1,25 @@ +from _typeshed import Incomplete +from collections import OrderedDict +from collections.abc import Mapping, Sized from re import Pattern -from typing import Final +from typing import Final, TypeVar from dateparser.conf import Settings +_K = TypeVar("_K", bound=Sized) +_V = TypeVar("_V") + NUMERAL_PATTERN: Final[Pattern[str]] class Locale: shortname: str - def __init__(self, shortname: str, language_info) -> None: ... + info: OrderedDict[str, Incomplete] + def __init__(self, shortname: str, language_info: Mapping[Incomplete, Incomplete]) -> None: ... def is_applicable(self, date_string: str, strip_timezone: bool = False, settings: Settings | None = None) -> bool: ... - def count_applicability(self, text: str, strip_timezone: bool = False, settings: Settings | None = None): ... + def count_applicability(self, text: str, strip_timezone: bool = False, settings: Settings | None = None) -> list[int]: ... @staticmethod - def clean_dictionary(dictionary, threshold: int = 2): ... + def clean_dictionary(dictionary: Mapping[_K, _V], threshold: int = 2) -> Mapping[_K, _V]: ... def translate(self, date_string: str, keep_formatting: bool = False, settings: Settings | None = None) -> str: ... - def translate_search(self, search_string, settings: Settings | None = None): ... - def get_wordchars_for_detection(self, settings): ... - def to_parserinfo(self, base_cls=...): ... + def translate_search(self, search_string: str, settings: Settings | None = None) -> tuple[list[str], list[str]]: ... + def get_wordchars_for_detection(self, settings: Settings) -> set[str]: ... + def to_parserinfo(self, base_cls: type = ...): ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/validation.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/validation.pyi index d14701860ae8..b98ed3d6e90c 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/languages/validation.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/languages/validation.pyi @@ -1,9 +1,10 @@ from _typeshed import Incomplete from logging import Logger +from typing import ClassVar class LanguageValidator: + VALID_KEYS: ClassVar[list[str]] logger: Logger | None - VALID_KEYS: list[str] @classmethod def get_logger(cls) -> Logger: ... @classmethod diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/parser.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/parser.pyi index 45ef89115746..55a3756893a8 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/parser.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/parser.pyi @@ -1,10 +1,10 @@ -import collections import datetime import re from _typeshed import Incomplete -from collections.abc import Callable, Generator +from collections import OrderedDict +from collections.abc import Callable, Iterable, Iterator from io import StringIO -from typing import Any, Final, Literal, overload +from typing import Final, Literal, overload from dateparser.conf import Settings @@ -35,30 +35,32 @@ time_parser: _time_parser class _no_spaces_parser: period: dict[str, list[str]] date_formats: dict[str, list[str]] - def __init__(self, *args, **kwargs): ... + def __init__(self, *args, **kwargs) -> None: ... @classmethod def parse(cls, datestring: str, settings: Settings) -> tuple[datetime.datetime, str]: ... class _parser: - alpha_directives: collections.OrderedDict[str, list[str]] + alpha_directives: OrderedDict[str, list[str]] num_directives: dict[str, list[str]] settings: Settings tokens: list[tuple[Incomplete, Incomplete]] filtered_tokens: list[tuple[Incomplete, Incomplete, int]] - unset_tokens: list[Incomplete] + unset_tokens: list[tuple[Incomplete, Incomplete, Incomplete]] day: int | None month: int | None year: int | None time: Callable[[], datetime.time] | None auto_order: list[str] - ordered_num_directives: collections.OrderedDict[str, list[str]] - def __init__(self, tokens, settings: Settings): ... + ordered_num_directives: OrderedDict[str, list[str]] + def __init__(self, tokens: Iterable[Incomplete], settings: Settings) -> None: ... @classmethod - def parse(cls, datestring: str, settings: Settings, tz: datetime.tzinfo | None = None) -> tuple[Incomplete, Incomplete]: ... + def parse( + cls, datestring: str, settings: Settings, tz: datetime.tzinfo | None = None + ) -> tuple[datetime.datetime, str | None]: ... class tokenizer: digits: Literal["0123456789:"] letters: Literal["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"] instream: StringIO def __init__(self, ds: str) -> None: ... - def tokenize(self) -> Generator[tuple[str, Literal[0, 1, 2]], Any, None]: ... + def tokenize(self) -> Iterator[tuple[str, Literal[0, 1, 2]]]: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/search/__init__.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/search/__init__.pyi index 25afddd2b856..a30045a570c3 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/search/__init__.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/search/__init__.pyi @@ -1,14 +1,16 @@ -from collections.abc import Mapping, Set as AbstractSet +from collections.abc import Set as AbstractSet from datetime import datetime from typing import Any, Literal, overload +from dateparser.conf import Settings + from ..date import _DetectLanguagesFunction @overload def search_dates( text: str, languages: list[str] | tuple[str, ...] | AbstractSet[str] | None, - settings: Mapping[Any, Any] | None, + settings: Settings | dict[str, Any] | None, add_detected_language: Literal[True], detect_languages_function: _DetectLanguagesFunction | None = None, ) -> list[tuple[str, datetime, str]]: ... @@ -16,7 +18,7 @@ def search_dates( def search_dates( text: str, languages: list[str] | tuple[str, ...] | AbstractSet[str] | None = None, - settings: Mapping[Any, Any] | None = None, + settings: Settings | dict[str, Any] | None = None, add_detected_language: Literal[False] = False, detect_languages_function: _DetectLanguagesFunction | None = None, ) -> list[tuple[str, datetime]]: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/search/detection.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/search/detection.pyi index a9839e7e12a8..1466b18175cc 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/search/detection.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/search/detection.pyi @@ -1,17 +1,25 @@ -from _typeshed import Incomplete +from collections.abc import Iterator + +from dateparser.conf import Settings +from dateparser.languages.locale import Locale class BaseLanguageDetector: - languages: Incomplete - def __init__(self, languages) -> None: ... - def iterate_applicable_languages(self, date_string, modify: bool = False, settings=None) -> None: ... + languages: list[Locale] + def __init__(self, languages: list[Locale]) -> None: ... + def iterate_applicable_languages( + self, date_string: str, modify: bool = False, settings: Settings | None = None + ) -> Iterator[Locale]: ... class AutoDetectLanguage(BaseLanguageDetector): - language_pool: Incomplete - allow_redetection: Incomplete - def __init__(self, languages, allow_redetection: bool = False) -> None: ... - languages: Incomplete - def iterate_applicable_languages(self, date_string, modify: bool = False, settings=None) -> None: ... + language_pool: list[Locale] + allow_redetection: bool + def __init__(self, languages: list[Locale], allow_redetection: bool = False) -> None: ... + def iterate_applicable_languages( + self, date_string: str, modify: bool = False, settings: Settings | None = None + ) -> Iterator[Locale]: ... class ExactLanguages(BaseLanguageDetector): - def __init__(self, languages) -> None: ... - def iterate_applicable_languages(self, date_string, modify: bool = False, settings=None) -> None: ... + def __init__(self, languages: list[Locale]) -> None: ... + def iterate_applicable_languages( + self, date_string: str, modify: bool = False, settings: Settings | None = None + ) -> Iterator[Locale]: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/search/search.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/search/search.pyi index b2bf582f82a5..5e3c3d37dda2 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/search/search.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/search/search.pyi @@ -1,39 +1,76 @@ +import datetime import re from _typeshed import Incomplete -from collections.abc import Collection -from typing import Final +from collections import OrderedDict +from collections.abc import Iterable, Sequence, Set as AbstractSet +from typing import Any, Final, TypedDict, type_check_only -from ..date import _DetectLanguagesFunction +from dateparser.conf import Settings +from dateparser.date import DateData, DateDataParser, _DetectLanguagesFunction +from dateparser.languages.loader import LocaleDataLoader +from dateparser.languages.locale import Locale +from dateparser.search.text_detection import FullTextLanguageDetector + +@type_check_only +class _SearchDates(TypedDict): + Language: str | None + Dates: list[tuple[str, datetime.datetime]] | None RELATIVE_REG: Final[re.Pattern[str]] -def date_is_relative(translation): ... +def date_is_relative(translation: str) -> bool: ... class _ExactLanguageSearch: - loader: Incomplete - language: Incomplete - def __init__(self, loader) -> None: ... - def get_current_language(self, shortname) -> None: ... - def search(self, shortname, text, settings): ... + loader: LocaleDataLoader + language: Locale | None + def __init__(self, loader: LocaleDataLoader) -> None: ... + def get_current_language(self, shortname: str) -> None: ... + def search(self, shortname: str, text: str, settings: Settings | None) -> tuple[list[str], list[str]]: ... @staticmethod - def set_relative_base(substring, already_parsed): ... - def choose_best_split(self, possible_parsed_splits, possible_substrings_splits): ... - def split_by(self, item, original, splitter): ... - def split_if_not_parsed(self, item, original): ... - def parse_item(self, parser, item, translated_item, parsed, need_relative_base): ... - def parse_found_objects(self, parser, to_parse, original, translated, settings): ... - def search_parse(self, shortname, text, settings) -> list[tuple[Incomplete, Incomplete]]: ... + def set_relative_base( + substring: str, already_parsed: list[tuple[DateData, bool]] + ) -> tuple[str, datetime.datetime | None]: ... + def choose_best_split( + self, possible_parsed_splits: list[Incomplete], possible_substrings_splits: list[Incomplete] + ) -> tuple[Incomplete, Incomplete]: ... + def split_by(self, item: str, original: str, splitter: str) -> list[list[list[str]]]: ... + def split_if_not_parsed(self, item: str, original: str) -> list[list[list[str]]]: ... + def parse_item( + self, + parser: DateDataParser, + item: str, + translated_item: str, + parsed: list[tuple[DateData, bool]], + need_relative_base: bool | None, + ) -> tuple[DateData, bool]: ... + def parse_found_objects( + self, + parser: DateDataParser, + to_parse: Iterable[str], + original: Sequence[str], + translated: Sequence[str], + settings: Settings, + ) -> tuple[list[tuple[DateData, bool]], list[str]]: ... + def search_parse(self, shortname: str, text: str, settings: Settings) -> list[tuple[str, datetime.datetime]]: ... class DateSearchWithDetection: - loader: Incomplete - available_language_map: Incomplete - search: Incomplete + loader: LocaleDataLoader + available_language_map: OrderedDict[str, Locale] + search: _ExactLanguageSearch + language_detector: FullTextLanguageDetector def __init__(self) -> None: ... - language_detector: Incomplete def detect_language( - self, text, languages, settings=None, detect_languages_function: _DetectLanguagesFunction | None = None - ): ... + self, + text: str, + languages: list[str] | tuple[str, ...] | AbstractSet[str] | None, + settings: Settings | dict[str, Any] | None = None, + detect_languages_function: _DetectLanguagesFunction | None = None, + ) -> str | None: ... def search_dates( - self, text, languages=None, settings=None, detect_languages_function: _DetectLanguagesFunction | None = None - ): ... - def preprocess_text(self, text: str, languages: Collection[str]) -> str: ... + self, + text: str, + languages: list[str] | tuple[str, ...] | AbstractSet[str] | None = None, + settings: Settings | dict[str, Any] | None = None, + detect_languages_function: _DetectLanguagesFunction | None = None, + ) -> _SearchDates: ... + def preprocess_text(self, text: str, languages: Iterable[str] | None) -> str: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/search/text_detection.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/search/text_detection.pyi index 4bf7991a58e7..fdbe298e2c0d 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/search/text_detection.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/search/text_detection.pyi @@ -1,11 +1,10 @@ -from _typeshed import Incomplete - +from dateparser.conf import Settings +from dateparser.languages.locale import Locale from dateparser.search.detection import BaseLanguageDetector class FullTextLanguageDetector(BaseLanguageDetector): - languages: Incomplete - language_unique_chars: Incomplete - language_chars: Incomplete - def __init__(self, languages) -> None: ... - def get_unique_characters(self, settings) -> None: ... - def character_check(self, date_string, settings) -> None: ... + language_unique_chars: list[set[str]] + language_chars: list[set[str]] + def __init__(self, languages: list[Locale]) -> None: ... + def get_unique_characters(self, settings: Settings) -> None: ... + def character_check(self, date_string: str, settings: Settings) -> None: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/timezone_parser.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/timezone_parser.pyi index ff86e7810c39..9efc88217c70 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/timezone_parser.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/timezone_parser.pyi @@ -1,24 +1,26 @@ -import pathlib import re from collections.abc import Generator from datetime import datetime, timedelta, tzinfo -from typing import Final +from pathlib import Path +from typing import Final, TypeVar + +_DateTimeT = TypeVar("_DateTimeT", bound=datetime) class StaticTzInfo(tzinfo): def __init__(self, name: str, offset: timedelta) -> None: ... - def tzname(self, dt) -> str: ... - def utcoffset(self, dt) -> timedelta: ... - def dst(self, dt) -> timedelta: ... - def localize(self, dt: datetime, is_dst: bool = False) -> datetime: ... + def tzname(self, dt: datetime | None) -> str: ... + def utcoffset(self, dt: datetime | None) -> timedelta: ... + def dst(self, dt: datetime | None) -> timedelta: ... + def localize(self, dt: _DateTimeT, is_dst: bool = False) -> _DateTimeT: ... def __getinitargs__(self) -> tuple[str, timedelta]: ... def pop_tz_offset_from_string(date_string: str, as_offset: bool = True) -> tuple[str, StaticTzInfo | str | None]: ... def word_is_tz(word: str) -> bool: ... -def convert_to_local_tz(datetime_obj: datetime, datetime_tz_offset: timedelta) -> datetime: ... +def convert_to_local_tz(datetime_obj: _DateTimeT, datetime_tz_offset: timedelta) -> _DateTimeT: ... def build_tz_offsets(search_regex_parts: list[str]) -> Generator[tuple[str, dict[str, re.Pattern[str] | timedelta]]]: ... def get_local_tz_offset() -> timedelta: ... local_tz_offset: timedelta -CACHE_PATH: Final[pathlib.Path] +CACHE_PATH: Final[Path] current_hash: int | None diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/__init__.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/__init__.pyi index 43ee4205a32a..695d51a09400 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/__init__.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/__init__.pyi @@ -1,8 +1,14 @@ +import datetime from _typeshed import MaybeNone from collections import OrderedDict from collections.abc import Mapping from logging import Logger -from typing import Any +from typing import Any, TypeVar + +from dateparser.conf import Settings + +_DateT = TypeVar("_DateT", bound=datetime.date) +_DateTimeT = TypeVar("_DateTimeT", bound=datetime.datetime) def strip_braces(date_string: str) -> str: ... def normalize_unicode(string: str, form: str = "NFKD") -> str: ... @@ -10,16 +16,16 @@ def combine_dicts( primary_dict: Mapping[Any, Any], supplementary_dict: Mapping[Any, Any] ) -> OrderedDict[str, str | list[Any]]: ... def find_date_separator(format: str) -> str | MaybeNone | None: ... -def localize_timezone(date_time, tz_string): ... -def apply_tzdatabase_timezone(date_time, pytz_string): ... -def apply_dateparser_timezone(utc_datetime, offset_or_timezone_abb): ... -def apply_timezone(date_time, tz_string): ... -def apply_timezone_from_settings(date_obj, settings): ... -def get_last_day_of_month(year, month): ... -def get_previous_leap_year(year): ... -def get_next_leap_year(year): ... -def set_correct_day_from_settings(date_obj, settings, current_day=None): ... -def set_correct_month_from_settings(date_obj, settings, current_month=None): ... +def localize_timezone(date_time: _DateTimeT, tz_string: str) -> _DateTimeT: ... +def apply_tzdatabase_timezone(date_time: _DateTimeT, pytz_string: str) -> _DateTimeT: ... +def apply_dateparser_timezone(utc_datetime: _DateTimeT, offset_or_timezone_abb) -> _DateTimeT | None: ... +def apply_timezone(date_time: _DateTimeT, tz_string: str) -> _DateTimeT: ... +def apply_timezone_from_settings(date_obj: _DateTimeT, settings: Settings | None) -> _DateTimeT: ... +def get_last_day_of_month(year: int, month: int) -> int: ... +def get_previous_leap_year(year: int) -> int: ... +def get_next_leap_year(year: int) -> int: ... +def set_correct_day_from_settings(date_obj: _DateT, settings: Settings, current_day: int | None = None) -> _DateT: ... +def set_correct_month_from_settings(date_obj: _DateT, settings: Settings, current_month: int | None = None) -> _DateT: ... def registry(cls): ... def get_logger() -> Logger: ... def setup_logging() -> None: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/strptime.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/strptime.pyi index f2171fa58873..69d630a709d0 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/strptime.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/strptime.pyi @@ -1,9 +1,14 @@ import re from datetime import datetime -from typing import Any, Final +from time import struct_time +from typing import Final, Protocol, type_check_only TIME_MATCHER: Final[re.Pattern[str]] MS_SEARCHER: Final[re.Pattern[str]] -def patch_strptime() -> Any: ... -def strptime(date_string, format) -> datetime: ... +@type_check_only +class _strptime_time(Protocol): + def __call__(self, data_string: str, format: str = "%a %b %d %H:%M:%S %Y") -> struct_time: ... + +def patch_strptime() -> _strptime_time: ... +def strptime(date_string: str, format: str) -> datetime: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/time_spans.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/time_spans.pyi index a43a4963b0ea..61726ba82839 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser/utils/time_spans.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser/utils/time_spans.pyi @@ -1,8 +1,10 @@ -from datetime import date, datetime -from typing import TypedDict, overload, type_check_only +import datetime +from typing import TypedDict, TypeVar, type_check_only from typing_extensions import NotRequired -from dateparser import _Settings +from dateparser.conf import Settings + +_DateT = TypeVar("_DateT", bound=datetime.date) @type_check_only class _SpanInformation(TypedDict): @@ -13,20 +15,9 @@ class _SpanInformation(TypedDict): end_pos: int number: NotRequired[int] -@overload -def get_week_start(date: datetime, start_of_week: str = "monday") -> datetime: ... -@overload -def get_week_start(date: date, start_of_week: str = "monday") -> date: ... -@overload -def get_week_end(date: datetime, start_of_week: str = "monday") -> datetime: ... -@overload -def get_week_end(date: date, start_of_week: str = "monday") -> date: ... +def get_week_start(date: _DateT, start_of_week: str = "monday") -> _DateT: ... +def get_week_end(date: _DateT, start_of_week: str = "monday") -> _DateT: ... def detect_time_span(text: str) -> _SpanInformation | None: ... -@overload def generate_time_span( - span_info: _SpanInformation, base_date: datetime | None = None, settings: _Settings | None = None -) -> tuple[datetime, datetime]: ... -@overload -def generate_time_span( - span_info: _SpanInformation, base_date: date = ..., settings: _Settings | None = None -) -> tuple[date, date]: ... + span_info: _SpanInformation, base_date: _DateT | None = None, settings: Settings | None = None +) -> tuple[_DateT, _DateT]: ... diff --git a/python/helpers/typeshed/stubs/dateparser/dateparser_data/settings.pyi b/python/helpers/typeshed/stubs/dateparser/dateparser_data/settings.pyi index bc4d69704e4a..42d65ec2bca0 100644 --- a/python/helpers/typeshed/stubs/dateparser/dateparser_data/settings.pyi +++ b/python/helpers/typeshed/stubs/dateparser/dateparser_data/settings.pyi @@ -1,4 +1,6 @@ from typing import Final +from dateparser import _Settings + default_parsers: Final[list[str]] -settings: Final[dict[str, str | bool | list[str] | float | int]] +settings: Final[_Settings] diff --git a/python/helpers/typeshed/stubs/django-filter/django_filters/filters.pyi b/python/helpers/typeshed/stubs/django-filter/django_filters/filters.pyi index ad6af3fcbf89..40707625c9b0 100644 --- a/python/helpers/typeshed/stubs/django-filter/django_filters/filters.pyi +++ b/python/helpers/typeshed/stubs/django-filter/django_filters/filters.pyi @@ -2,7 +2,7 @@ from collections.abc import Callable, Iterable from typing import Any from django import forms -from django.db.models import Q, QuerySet +from django.db.models import QuerySet from django.forms import Field from django_stubs_ext import StrOrPromise @@ -131,7 +131,7 @@ class MultipleChoiceFilter(Filter): ) -> None: ... def is_noop(self, qs: QuerySet[Any], value: Any) -> bool: ... # Value can be any filter input def filter(self, qs: QuerySet[Any], value: Any) -> QuerySet[Any]: ... - def get_filter_predicate(self, v: Any) -> Q: ... # Predicate value can be any filter input type + def get_filter_predicate(self, v: Any) -> dict[str, Any]: ... # Predicate value can be any filter input type class TypedMultipleChoiceFilter(MultipleChoiceFilter): field_class: type[forms.TypedMultipleChoiceField] # More specific than parent MultipleChoiceField diff --git a/python/helpers/typeshed/stubs/gunicorn/METADATA.toml b/python/helpers/typeshed/stubs/gunicorn/METADATA.toml index 91b6f67282ab..98ac9a6a255b 100644 --- a/python/helpers/typeshed/stubs/gunicorn/METADATA.toml +++ b/python/helpers/typeshed/stubs/gunicorn/METADATA.toml @@ -1,4 +1,4 @@ -version = "25.0.*" +version = "25.1.0" upstream_repository = "https://github.com/benoitc/gunicorn" requires = ["types-gevent"] diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/config.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/config.pyi index f0acc340e177..b5fa328c6ee3 100644 --- a/python/helpers/typeshed/stubs/gunicorn/gunicorn/config.pyi +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/config.pyi @@ -1175,6 +1175,16 @@ class ASGILifespan(Setting): default: ClassVar[str] desc: ClassVar[str] +class ASGIDisconnectGracePeriod(Setting): + name: ClassVar[str] + section: ClassVar[str] + cli: ClassVar[list[str]] + meta: ClassVar[str] + validator: ClassVar[_IntValidatorType] + type: ClassVar[type[int]] + default: ClassVar[int] + desc: ClassVar[str] + class RootPath(Setting): name: ClassVar[str] section: ClassVar[str] @@ -1273,3 +1283,31 @@ class DirtyWorkerExit(Setting): desc: ClassVar[str] def dirty_worker_exit(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + +class ControlSocket(Setting): + name: ClassVar[str] + section: ClassVar[str] + cli: ClassVar[list[str]] + meta: ClassVar[str] + validator: ClassVar[_StringValidatorType] + default: ClassVar[str] + desc: ClassVar[str] + +class ControlSocketMode(Setting): + name: ClassVar[str] + section: ClassVar[str] + cli: ClassVar[list[str]] + meta: ClassVar[str] + validator: ClassVar[_IntValidatorType] + type: ClassVar[Callable[[Any, str], int]] + default: ClassVar[int] + desc: ClassVar[str] + +class ControlSocketDisable(Setting): + name: ClassVar[str] + section: ClassVar[str] + cli: ClassVar[list[str]] + validator: ClassVar[_BoolValidatorType] + action: ClassVar[str] + default: ClassVar[bool] + desc: ClassVar[str] diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/__init__.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/__init__.pyi new file mode 100644 index 000000000000..03f497fa809f --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/__init__.pyi @@ -0,0 +1,5 @@ +from gunicorn.ctl.client import ControlClient as ControlClient +from gunicorn.ctl.protocol import ControlProtocol as ControlProtocol +from gunicorn.ctl.server import ControlSocketServer as ControlSocketServer + +__all__ = ["ControlSocketServer", "ControlClient", "ControlProtocol"] diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/cli.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/cli.pyi new file mode 100644 index 000000000000..e0e4775c6910 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/cli.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +def format_workers(data: dict[str, Incomplete]) -> str: ... +def format_dirty(data: dict[str, Incomplete]) -> str: ... +def format_stats(data: dict[str, Incomplete]) -> str: ... +def format_listeners(data: dict[str, Incomplete]) -> str: ... +def format_config(data: dict[str, Incomplete]) -> str: ... +def format_help(data: dict[str, Incomplete]) -> str: ... +def format_all(data: dict[str, Incomplete]) -> str: ... +def format_response(command: str, data: dict[str, Incomplete]) -> str: ... +def run_command(socket_path: str, command: str, json_output: bool = False) -> int: ... +def run_interactive(socket_path: str, json_output: bool = False) -> int: ... +def main() -> int: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/client.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/client.pyi new file mode 100644 index 000000000000..7cc5912eed33 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/client.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete, Unused +from typing_extensions import Self + +class ControlClientError(Exception): ... + +class ControlClient: + socket_path: str + timeout: float + def __init__(self, socket_path: str, timeout: float = 30.0) -> None: ... + def connect(self) -> None: ... + def close(self) -> None: ... + def send_command(self, command: str, args: list[str] | None = None) -> dict[Incomplete, Incomplete]: ... + def __enter__(self) -> Self: ... + def __exit__(self, *args: Unused) -> None: ... + +def parse_command(line: str) -> tuple[str, list[str]]: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/handlers.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/handlers.pyi new file mode 100644 index 000000000000..f70f3d102a6d --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/handlers.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete + +from gunicorn.arbiter import Arbiter + +class CommandHandlers: + arbiter: Arbiter + def __init__(self, arbiter: Arbiter) -> None: ... + # TODO: Use TypedDict for next return types + def show_workers(self) -> dict[str, Incomplete]: ... + def show_dirty(self) -> dict[str, Incomplete]: ... + def show_config(self) -> dict[str, Incomplete]: ... + def show_stats(self) -> dict[str, Incomplete]: ... + def show_listeners(self) -> dict[str, Incomplete]: ... + def worker_add(self, count: int = 1) -> dict[str, Incomplete]: ... + def worker_remove(self, count: int = 1) -> dict[str, Incomplete]: ... + def worker_kill(self, pid: int) -> dict[str, Incomplete]: ... + def dirty_add(self, count: int = 1) -> dict[str, Incomplete]: ... + def dirty_remove(self, count: int = 1) -> dict[str, Incomplete]: ... + def reload(self) -> dict[str, Incomplete]: ... + def reopen(self) -> dict[str, Incomplete]: ... + def shutdown(self, mode: str = "graceful") -> dict[str, Incomplete]: ... + def show_all(self) -> dict[str, Incomplete]: ... + def help(self) -> dict[str, Incomplete]: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/protocol.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/protocol.pyi new file mode 100644 index 000000000000..aa3e3ba92566 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/protocol.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete +from asyncio import StreamReader, StreamWriter +from socket import socket +from typing import ClassVar + +class ProtocolError(Exception): ... + +class ControlProtocol: + MAX_MESSAGE_SIZE: ClassVar[int] + @staticmethod + def encode_message(data: dict[Incomplete, Incomplete]) -> bytes: ... + @staticmethod + def decode_message(data: bytes) -> dict[Incomplete, Incomplete]: ... + @staticmethod + def read_message(sock: socket) -> dict[Incomplete, Incomplete]: ... + @staticmethod + def write_message(sock: socket, data: dict[Incomplete, Incomplete]) -> None: ... + @staticmethod + async def read_message_async(reader: StreamReader) -> dict[Incomplete, Incomplete]: ... + @staticmethod + async def write_message_async(writer: StreamWriter, data: dict[Incomplete, Incomplete]) -> None: ... + +# TODO: Use TypedDict for next return types +def make_request(request_id: int, command: str, args: list[str] | None = None) -> dict[str, Incomplete]: ... +def make_response(request_id: int, data: dict[Incomplete, Incomplete] | None = None) -> dict[str, Incomplete]: ... +def make_error_response(request_id: int, error: str) -> dict[str, Incomplete]: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/server.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/server.pyi new file mode 100644 index 000000000000..0ab97c7a2df9 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/ctl/server.pyi @@ -0,0 +1,11 @@ +from gunicorn.arbiter import Arbiter +from gunicorn.ctl.handlers import CommandHandlers + +class ControlSocketServer: + arbiter: Arbiter + socket_path: str + socket_mode: int + handlers: CommandHandlers + def __init__(self, arbiter: Arbiter, socket_path: str, socket_mode: int = 0o600) -> None: ... + def start(self) -> None: ... + def stop(self) -> None: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/__init__.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/__init__.pyi index bce1f1dfe24a..9d0294631e6f 100644 --- a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/__init__.pyi +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/__init__.pyi @@ -1,3 +1,4 @@ +from . import stash as stash from .app import DirtyApp as DirtyApp from .arbiter import DirtyArbiter as DirtyArbiter from .client import ( @@ -17,6 +18,13 @@ from .errors import ( DirtyTimeoutError as DirtyTimeoutError, DirtyWorkerError as DirtyWorkerError, ) +from .stash import ( + StashClient as StashClient, + StashError as StashError, + StashKeyNotFoundError as StashKeyNotFoundError, + StashTable as StashTable, + StashTableNotFoundError as StashTableNotFoundError, +) __all__ = [ "DirtyError", @@ -32,6 +40,12 @@ __all__ = [ "get_dirty_client_async", "close_dirty_client", "close_dirty_client_async", + "stash", + "StashClient", + "StashTable", + "StashError", + "StashTableNotFoundError", + "StashKeyNotFoundError", "DirtyArbiter", "set_dirty_socket_path", ] diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/arbiter.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/arbiter.pyi index 250f66db9e1a..c1e9114c29a3 100644 --- a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/arbiter.pyi +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/arbiter.pyi @@ -25,17 +25,22 @@ class DirtyArbiter: worker_consumers: dict[int, asyncio.Task[None]] worker_age: int alive: bool + num_workers: int app_specs: dict[str, dict[Incomplete, Incomplete]] app_worker_map: dict[str, set[Incomplete]] worker_app_map: dict[int, list[Incomplete]] + stash_tables: dict[str, dict[Incomplete, Incomplete]] def __init__(self, cfg: Config, log: GLogger, socket_path: str | None = None, pidfile: str | None = None) -> None: ... def run(self) -> None: ... def init_signals(self) -> None: ... async def handle_client(self, reader: StreamReader, writer: StreamWriter) -> None: ... async def route_request(self, request: dict[str, Incomplete], client_writer: StreamWriter) -> None: ... + async def handle_status_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ... + async def handle_manage_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ... + async def handle_stash_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ... async def manage_workers(self) -> None: ... - def spawn_worker(self) -> int | None: ... + def spawn_worker(self, force_all_apps: bool = False) -> int | None: ... def kill_worker(self, pid: int, sig: int) -> None: ... async def murder_workers(self) -> None: ... def reap_workers(self) -> None: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/protocol.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/protocol.pyi index ef13bf4c7ebd..ce36f88dcd88 100644 --- a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/protocol.pyi +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/protocol.pyi @@ -1,10 +1,45 @@ import asyncio import socket from _typeshed import Incomplete -from typing import ClassVar +from typing import ClassVar, Final -class DirtyProtocol: - HEADER_FORMAT: ClassVar[str] +MAGIC: Final = b"GD" +VERSION: Final = 0x01 +MSG_TYPE_REQUEST: Final = 0x01 +MSG_TYPE_RESPONSE: Final = 0x02 +MSG_TYPE_ERROR: Final = 0x03 +MSG_TYPE_CHUNK: Final = 0x04 +MSG_TYPE_END: Final = 0x05 +MSG_TYPE_STASH: Final = 0x10 +MSG_TYPE_STATUS: Final = 0x11 +MSG_TYPE_MANAGE: Final = 0x12 +MSG_TYPE_REQUEST_STR: Final = "request" +MSG_TYPE_RESPONSE_STR: Final = "response" +MSG_TYPE_ERROR_STR: Final = "error" +MSG_TYPE_CHUNK_STR: Final = "chunk" +MSG_TYPE_END_STR: Final = "end" +MSG_TYPE_STASH_STR: Final = "stash" +MSG_TYPE_STATUS_STR: Final = "status" +MSG_TYPE_MANAGE_STR: Final = "manage" +MSG_TYPE_TO_STR: Final[dict[int, str]] +MSG_TYPE_FROM_STR: Final[dict[str, int]] +STASH_OP_PUT: Final = 1 +STASH_OP_GET: Final = 2 +STASH_OP_DELETE: Final = 3 +STASH_OP_KEYS: Final = 4 +STASH_OP_CLEAR: Final = 5 +STASH_OP_INFO: Final = 6 +STASH_OP_ENSURE: Final = 7 +STASH_OP_DELETE_TABLE: Final = 8 +STASH_OP_TABLES: Final = 9 +STASH_OP_EXISTS: Final = 10 +MANAGE_OP_ADD: Final = 1 +MANAGE_OP_REMOVE: Final = 2 +HEADER_FORMAT: Final = ">2sBBIQ" +HEADER_SIZE: Final[int] +MAX_MESSAGE_SIZE: Final = 67108864 + +class BinaryProtocol: HEADER_SIZE: ClassVar[int] MAX_MESSAGE_SIZE: ClassVar[int] MSG_TYPE_REQUEST: ClassVar[str] @@ -12,29 +47,66 @@ class DirtyProtocol: MSG_TYPE_ERROR: ClassVar[str] MSG_TYPE_CHUNK: ClassVar[str] MSG_TYPE_END: ClassVar[str] + MSG_TYPE_STASH: ClassVar[str] + MSG_TYPE_STATUS: ClassVar[str] + MSG_TYPE_MANAGE: ClassVar[str] @staticmethod - def encode(message: dict[Incomplete, Incomplete]) -> bytes: ... + def encode_header(msg_type: int, request_id: int, payload_length: int) -> bytes: ... @staticmethod - def decode(data: bytes) -> dict[Incomplete, Incomplete]: ... + def decode_header(data: bytes) -> tuple[int, int, int]: ... @staticmethod - async def read_message_async(reader: asyncio.StreamReader) -> dict[Incomplete, Incomplete]: ... + def encode_request( + request_id: int, + app_path: str, + action: str, + args: tuple[Incomplete, ...] | None = None, + kwargs: dict[str, Incomplete] | None = None, + ) -> bytes: ... @staticmethod - async def write_message_async(writer: asyncio.StreamWriter, message: dict[Incomplete, Incomplete]) -> None: ... + def encode_response(request_id: int, result) -> bytes: ... @staticmethod - def read_message(sock: socket.socket) -> dict[Incomplete, Incomplete]: ... + def encode_error(request_id: int, error: BaseException | dict[str, Incomplete]) -> bytes: ... @staticmethod - def write_message(sock: socket.socket, message: dict[Incomplete, Incomplete]) -> None: ... + def encode_chunk(request_id: int, data) -> bytes: ... + @staticmethod + def encode_end(request_id: int) -> bytes: ... + @staticmethod + def encode_status(request_id: int) -> bytes: ... + @staticmethod + def encode_manage(request_id: int, op: int, count: int = 1) -> bytes: ... + @staticmethod + def encode_stash(request_id: int, op: int, table: str, key=None, value=None, pattern=None) -> bytes: ... + @staticmethod + def decode_message(data: bytes) -> tuple[str, int, Incomplete]: ... + @staticmethod + async def read_message_async(reader: asyncio.StreamReader) -> dict[str, Incomplete]: ... + @staticmethod + async def write_message_async(writer: asyncio.StreamWriter, message: dict[str, Incomplete]) -> None: ... + @staticmethod + def _recv_exactly(sock: socket.socket, n: int) -> bytes: ... + @staticmethod + def read_message(sock: socket.socket) -> dict[str, Incomplete]: ... + @staticmethod + def write_message(sock: socket.socket, message: dict[str, Incomplete]) -> None: ... + @staticmethod + def _encode_from_dict(message: dict[str, Incomplete]) -> bytes: ... + +DirtyProtocol = BinaryProtocol # TODO: Use TypedDict for results def make_request( - request_id: str, + request_id: int | str, app_path: str, action: str, args: tuple[Incomplete, ...] | None = None, kwargs: dict[str, Incomplete] | None = None, ) -> dict[str, Incomplete]: ... -def make_response(request_id: str, result) -> dict[str, Incomplete]: ... -def make_error_response(request_id: str, error) -> dict[str, Incomplete]: ... -def make_chunk_message(request_id: str, data) -> dict[str, Incomplete]: ... -def make_end_message(request_id: str) -> dict[str, Incomplete]: ... +def make_response(request_id: int | str, result) -> dict[str, Incomplete]: ... +def make_error_response(request_id: int | str, error) -> dict[str, Incomplete]: ... +def make_chunk_message(request_id: int | str, data) -> dict[str, Incomplete]: ... +def make_end_message(request_id: int | str) -> dict[str, Incomplete]: ... +def make_stash_message( + request_id: int | str, op: int, table: str, key=None, value=None, pattern=None +) -> dict[str, Incomplete]: ... +def make_manage_message(request_id: int | str, op: int, count: int = 1) -> dict[str, Incomplete]: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/stash.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/stash.pyi new file mode 100644 index 000000000000..113180170b71 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/stash.pyi @@ -0,0 +1,71 @@ +from _typeshed import Incomplete +from collections.abc import Iterator +from types import TracebackType +from typing_extensions import Self + +from .errors import DirtyError + +class StashError(DirtyError): ... + +class StashTableNotFoundError(StashError): + table_name: str + + def __init__(self, table_name: str) -> None: ... + +class StashKeyNotFoundError(StashError): + table_name: str + key: str + + def __init__(self, table_name: str, key: str) -> None: ... + +class StashClient: + socket_path: str + timeout: float + + def __init__(self, socket_path: str, timeout: float = 30.0) -> None: ... + def put(self, table: str, key: str, value) -> None: ... + def get(self, table: str, key: str, default=None): ... + def delete(self, table: str, key: str) -> bool: ... + def keys(self, table: str, pattern: str | None = None) -> list[str]: ... + def clear(self, table: str) -> None: ... + def info(self, table: str) -> dict[str, Incomplete]: ... + def ensure(self, table: str) -> None: ... + def exists(self, table: str, key=None) -> bool: ... + def delete_table(self, table: str) -> None: ... + def tables(self) -> list[str]: ... + def table(self, name: str) -> StashTable: ... + def close(self) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + +class StashTable: + def __init__(self, client: StashClient, name: str) -> None: ... + @property + def name(self) -> str: ... + def __getitem__(self, key: str): ... + def __setitem__(self, key: str, value) -> None: ... + def __delitem__(self, key: str) -> None: ... + def __contains__(self, key: str) -> bool: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def get(self, key: str, default=None): ... + def keys(self, pattern: str | None = None) -> list[str]: ... + def clear(self) -> None: ... + def items(self) -> Iterator[tuple[Incomplete, Incomplete]]: ... + def values(self) -> Iterator[Incomplete]: ... + +def set_stash_socket_path(path: str) -> None: ... +def get_stash_socket_path() -> str: ... +def put(table: str, key: str, value) -> None: ... +def get(table: str, key: str, default=None): ... +def delete(table: str, key: str) -> bool: ... +def keys(table: str, pattern: str | None = None) -> list[str]: ... +def clear(table: str) -> None: ... +def info(table: str) -> dict[str, Incomplete]: ... +def ensure(table: str) -> None: ... +def exists(table: str, key: str | None = None) -> bool: ... +def delete_table(table: str) -> None: ... +def tables() -> list[str]: ... +def table(name: str) -> StashTable: ... diff --git a/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/tlv.pyi b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/tlv.pyi new file mode 100644 index 000000000000..abc9f1432a34 --- /dev/null +++ b/python/helpers/typeshed/stubs/gunicorn/gunicorn/dirty/tlv.pyi @@ -0,0 +1,25 @@ +from _typeshed import Incomplete +from typing import Final + +TYPE_NONE: Final = 0x00 +TYPE_BOOL: Final = 0x01 +TYPE_INT64: Final = 0x05 +TYPE_FLOAT64: Final = 0x06 +TYPE_BYTES: Final = 0x10 +TYPE_STRING: Final = 0x11 +TYPE_LIST: Final = 0x20 +TYPE_DICT: Final = 0x21 +MAX_STRING_SIZE: Final = 67108864 +MAX_BYTES_SIZE: Final = 67108864 +MAX_LIST_SIZE: Final = 1048576 +MAX_DICT_SIZE: Final = 1048576 + +class TLVEncoder: + @staticmethod + def encode( + value: bool | float | str | bytes | list[Incomplete] | tuple[Incomplete, ...] | dict[object, Incomplete] | None, + ) -> bytes: ... # dict key passed to `str()` function + @staticmethod + def decode(data: bytes, offset: int = 0) -> tuple[Incomplete, int]: ... + @staticmethod + def decode_full(data: bytes): ... diff --git a/python/helpers/typeshed/stubs/icalendar/METADATA.toml b/python/helpers/typeshed/stubs/icalendar/METADATA.toml index 9fbe58c111a2..3596ada3cede 100644 --- a/python/helpers/typeshed/stubs/icalendar/METADATA.toml +++ b/python/helpers/typeshed/stubs/icalendar/METADATA.toml @@ -1,6 +1,7 @@ version = "6.3.2" upstream_repository = "https://github.com/collective/icalendar" requires = ["types-python-dateutil", "types-pytz"] +obsolete_since = "7.0.0" # Released on 2026-02-11 [tool.stubtest] stubtest_requirements = ["pytz"] diff --git a/python/helpers/typeshed/stubs/libsass/@tests/stubtest_allowlist.txt b/python/helpers/typeshed/stubs/libsass/@tests/stubtest_allowlist.txt deleted file mode 100644 index a93ae4db300f..000000000000 --- a/python/helpers/typeshed/stubs/libsass/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Error: is not present in stub -# ============================= -# These are only implemented for the purposes of emitting an error -# we don't want these to appear mutable in a type checking context -sass.SassMap.__delitem__ -sass.SassMap.__setitem__ diff --git a/python/helpers/typeshed/stubs/libsass/METADATA.toml b/python/helpers/typeshed/stubs/libsass/METADATA.toml deleted file mode 100644 index 77f836f94edb..000000000000 --- a/python/helpers/typeshed/stubs/libsass/METADATA.toml +++ /dev/null @@ -1,7 +0,0 @@ -version = "0.23.*" -requires = ["types-setuptools"] -upstream_repository = "https://github.com/sass/libsass-python" - -[tool.stubtest] -# The runtime package has an undeclared dependency on setuptools -stubtest_requirements = ["setuptools"] diff --git a/python/helpers/typeshed/stubs/libsass/sass.pyi b/python/helpers/typeshed/stubs/libsass/sass.pyi deleted file mode 100644 index b81a15213378..000000000000 --- a/python/helpers/typeshed/stubs/libsass/sass.pyi +++ /dev/null @@ -1,202 +0,0 @@ -import enum -from _typeshed import ConvertibleToFloat, SupportsKeysAndGetItem -from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence, Set as AbstractSet -from typing import Any, Generic, Literal, NamedTuple, TypeVar, overload, type_check_only -from typing_extensions import ParamSpec, Self, TypeAlias - -_T = TypeVar("_T") -_KT = TypeVar("_KT") -_VT_co = TypeVar("_VT_co", covariant=True) -_P = ParamSpec("_P") -_Mode: TypeAlias = Literal["string", "filename", "dirname"] -_OutputStyle: TypeAlias = Literal["nested", "expanded", "compact", "compressed"] -_CustomFunctions: TypeAlias = Mapping[str, Callable[..., Any]] | Sequence[Callable[..., Any]] | AbstractSet[Callable[..., Any]] -_ImportCallbackRet: TypeAlias = ( - list[tuple[str, str, str]] | list[tuple[str, str]] | list[tuple[str]] | list[tuple[str, ...]] | None -) -_ImportCallback: TypeAlias = Callable[[str], _ImportCallbackRet] | Callable[[str, str], _ImportCallbackRet] - -__version__: str -libsass_version: str -OUTPUT_STYLES: dict[str, int] -SOURCE_COMMENTS: dict[str, int] -MODES: frozenset[_Mode] - -class CompileError(ValueError): - def __init__(self, msg: str) -> None: ... - -# _P needs to be positional only and can't contain varargs, but there is no way to express that -# the arguments also need -class SassFunction(Generic[_P, _T]): - @classmethod - def from_lambda(cls, name: str, lambda_: Callable[_P, _T]) -> SassFunction[_P, _T]: ... - @classmethod - def from_named_function(cls, function: Callable[_P, _T]) -> SassFunction[_P, _T]: ... - name: str - arguments: tuple[str, ...] - callable_: Callable[_P, _T] - def __init__(self, name: str, arguments: Sequence[str], callable_: Callable[_P, _T]) -> None: ... - @property - def signature(self) -> str: ... - def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _T: ... - -@overload -def compile( - *, - string: str, - output_style: _OutputStyle = "nested", - source_comments: bool = False, - source_map_contents: bool = False, - source_map_embed: bool = False, - omit_source_map_url: bool = False, - source_map_root: str | None = None, - include_paths: Sequence[str] = (), - precision: int = 5, - custom_functions: _CustomFunctions = (), - indented: bool = False, - importers: Iterable[tuple[int, _ImportCallback]] | None = None, -) -> str: ... -@overload -def compile( - *, - filename: str, - output_style: _OutputStyle = "nested", - source_comments: bool = False, - source_map_filename: None = None, - output_filename_hint: str | None = None, - source_map_contents: bool = False, - source_map_embed: bool = False, - omit_source_map_url: bool = False, - source_map_root: str | None = None, - include_paths: Sequence[str] = (), - precision: int = 5, - custom_functions: _CustomFunctions = (), - importers: Iterable[tuple[int, _ImportCallback]] | None = None, -) -> str: ... -@overload -def compile( - *, - filename: str, - output_style: _OutputStyle = "nested", - source_comments: bool = False, - source_map_filename: str, - output_filename_hint: str | None = None, - source_map_contents: bool = False, - source_map_embed: bool = False, - omit_source_map_url: bool = False, - source_map_root: str | None = None, - include_paths: Sequence[str] = (), - precision: int = 5, - custom_functions: _CustomFunctions = (), - importers: Iterable[tuple[int, _ImportCallback]] | None = None, -) -> tuple[str, str]: ... -@overload -def compile( - *, - dirname: tuple[str, str], - output_style: _OutputStyle = "nested", - source_comments: bool = False, - source_map_contents: bool = False, - source_map_embed: bool = False, - omit_source_map_url: bool = False, - source_map_root: str | None = None, - include_paths: Sequence[str] = (), - precision: int = 5, - custom_functions: _CustomFunctions = (), - importers: Iterable[tuple[int, _ImportCallback]] | None = None, -) -> None: ... -def and_join(strings: Sequence[str]) -> str: ... -@type_check_only -class _SassNumber(NamedTuple): - value: float - unit: str - -class SassNumber(_SassNumber): - def __new__(cls, value: ConvertibleToFloat, unit: str | bytes) -> Self: ... - -@type_check_only -class _SassColor(NamedTuple): - r: float - g: float - b: float - a: float - -class SassColor(_SassColor): - def __new__(cls, r: ConvertibleToFloat, g: ConvertibleToFloat, b: ConvertibleToFloat, a: ConvertibleToFloat) -> Self: ... - -@type_check_only -class _Separator(enum.Enum): - SASS_SEPARATOR_COMMA = enum.auto() - SASS_SEPARATOR_SPACE = enum.auto() - -SASS_SEPARATOR_COMMA: Literal[_Separator.SASS_SEPARATOR_COMMA] -SASS_SEPARATOR_SPACE: Literal[_Separator.SASS_SEPARATOR_SPACE] - -@type_check_only -class _SassList(NamedTuple, Generic[_T]): - items: tuple[_T, ...] - separator: _Separator - bracketed: bool - -class SassList(_SassList[_T]): - def __new__(cls, items: Iterable[_T], separator: _Separator, bracketed: bool = ...) -> SassList[_T]: ... - -@type_check_only -class _SassError(NamedTuple): - msg: str - -class SassError(_SassError): - def __new__(cls, msg: str | bytes) -> Self: ... - -@type_check_only -class _SassWarning(NamedTuple): - msg: str - -class SassWarning(_SassWarning): - def __new__(cls, msg: str | bytes) -> Self: ... - -class SassMap(Mapping[_KT, _VT_co]): - # copied from dict.__init__ in builtins.pyi, since it uses dict() internally - @overload - def __init__(self) -> None: ... - @overload - def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 - @overload - def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT_co], /) -> None: ... - @overload - def __init__( - self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780 - map: SupportsKeysAndGetItem[str, _VT_co], - /, - **kwargs: _VT_co, - ) -> None: ... - @overload - def __init__(self, iterable: Iterable[tuple[_KT, _VT_co]], /) -> None: ... - @overload - def __init__( - self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780 - iterable: Iterable[tuple[str, _VT_co]], - /, - **kwargs: _VT_co, - ) -> None: ... - def __getitem__(self, key: _KT) -> _VT_co: ... - def __iter__(self) -> Iterator[_KT]: ... - def __len__(self) -> int: ... - def __hash__(self) -> int: ... - -__all__ = ( - "MODES", - "OUTPUT_STYLES", - "SOURCE_COMMENTS", - "CompileError", - "SassColor", - "SassError", - "SassFunction", - "SassList", - "SassMap", - "SassNumber", - "SassWarning", - "and_join", - "compile", - "libsass_version", -) diff --git a/python/helpers/typeshed/stubs/libsass/sassutils/__init__.pyi b/python/helpers/typeshed/stubs/libsass/sassutils/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/python/helpers/typeshed/stubs/libsass/sassutils/builder.pyi b/python/helpers/typeshed/stubs/libsass/sassutils/builder.pyi deleted file mode 100644 index 851767cd3827..000000000000 --- a/python/helpers/typeshed/stubs/libsass/sassutils/builder.pyi +++ /dev/null @@ -1,36 +0,0 @@ -from collections.abc import Mapping -from re import Pattern -from typing import Any - -from sass import _OutputStyle - -SUFFIXES: frozenset[str] -SUFFIX_PATTERN: Pattern[str] - -def build_directory( - sass_path: str, - css_path: str, - output_style: _OutputStyle = "nested", - _root_sass: None = None, # internal arguments for recursion - _root_css: None = None, # internal arguments for recursion - strip_extension: bool = False, -) -> dict[str, str]: ... - -class Manifest: - @classmethod - def normalize_manifests( - cls, manifests: Mapping[str, Manifest | tuple[Any, ...] | Mapping[str, Any] | str] | None - ) -> dict[str, Manifest]: ... - sass_path: str - css_path: str - wsgi_path: str - strip_extension: bool - def __init__( - self, sass_path: str, css_path: str | None = None, wsgi_path: str | None = None, strip_extension: bool | None = None - ) -> None: ... - def resolve_filename(self, package_dir: str, filename: str) -> tuple[str, str]: ... - def unresolve_filename(self, package_dir: str, filename: str) -> str: ... - def build(self, package_dir: str, output_style: _OutputStyle = "nested") -> frozenset[str]: ... - def build_one(self, package_dir: str, filename: str, source_map: bool = False) -> str: ... - -__all__ = ("SUFFIXES", "SUFFIX_PATTERN", "Manifest", "build_directory") diff --git a/python/helpers/typeshed/stubs/libsass/sassutils/distutils.pyi b/python/helpers/typeshed/stubs/libsass/sassutils/distutils.pyi deleted file mode 100644 index faa810dc424f..000000000000 --- a/python/helpers/typeshed/stubs/libsass/sassutils/distutils.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import ClassVar - -from sassutils.builder import Manifest as Manifest -from setuptools import Command, Distribution - -def validate_manifests(dist: Distribution, attr: str, value: object) -> None: ... - -class build_sass(Command): - description: str - user_options: ClassVar[list[tuple[str, str, str]]] - package_dir: dict[str, str] | None - output_style: str - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... - def get_package_dir(self, package: str) -> str: ... - -__all__ = ("build_sass", "validate_manifests") diff --git a/python/helpers/typeshed/stubs/libsass/sassutils/wsgi.pyi b/python/helpers/typeshed/stubs/libsass/sassutils/wsgi.pyi deleted file mode 100644 index 8d9a62ea8aed..000000000000 --- a/python/helpers/typeshed/stubs/libsass/sassutils/wsgi.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from collections.abc import Iterable, Mapping -from typing import Any - -from sassutils.builder import Manifest - -class SassMiddleware: - app: WSGIApplication - manifests: dict[str, Manifest] - error_status: str - package_dir: Mapping[str, str] - paths: list[tuple[str, str, Manifest]] - def __init__( - self, - app: WSGIApplication, - manifests: Mapping[str, Manifest | tuple[Any, ...] | Mapping[str, Any] | str] | None, - package_dir: Mapping[str, str] = {}, - error_status: str = "200 OK", - ) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - @staticmethod - def quote_css_string(s: str) -> str: ... - -__all__ = ("SassMiddleware",) diff --git a/python/helpers/typeshed/stubs/networkx/METADATA.toml b/python/helpers/typeshed/stubs/networkx/METADATA.toml index 9259f40c5f97..417099c70922 100644 --- a/python/helpers/typeshed/stubs/networkx/METADATA.toml +++ b/python/helpers/typeshed/stubs/networkx/METADATA.toml @@ -2,8 +2,6 @@ version = "3.6.1" upstream_repository = "https://github.com/networkx/networkx" # requires a version of numpy with a `py.typed` file requires = ["numpy>=1.20"] -# Uses more recent dataclass kwargs -requires_python = ">=3.10" [tool.stubtest] # stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90 diff --git a/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist.txt b/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist.txt deleted file mode 100644 index 0faf0d50d983..000000000000 --- a/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,57 +0,0 @@ -# proxy module that uses some import magic incompatible with stubtest -passlib.hash - -# django unsupported in stubs -passlib.ext.django.models - -# uses @memoized_property at runtime, but @property in the stubs -passlib.crypto.digest.HashInfo.supported -passlib.crypto.digest.HashInfo.supported_by_fastpbkdf2 -passlib.crypto.digest.HashInfo.supported_by_hashlib_pbkdf2 -passlib.pwd.PhraseGenerator.symbol_count -passlib.pwd.SequenceGenerator.entropy -passlib.pwd.SequenceGenerator.entropy_per_symbol -passlib.pwd.SequenceGenerator.symbol_count -passlib.pwd.WordGenerator.symbol_count -passlib.totp.TotpMatch.cache_seconds -passlib.totp.TotpMatch.cache_time -passlib.totp.TotpMatch.expected_counter -passlib.totp.TotpMatch.expire_time -passlib.totp.TotpMatch.skipped -passlib.totp.TotpToken.expire_time -passlib.totp.TotpToken.start_time - -# "hybrid" method that can be called on an instance or class -passlib.totp.TOTP.normalize_token - -# import problem -passlib.utils.compat._ordered_dict - -# initialized to None, but set by concrete sub-classes -passlib.handlers.pbkdf2.Pbkdf2DigestHandler.default_rounds -passlib.utils.handlers.GenericHandler.setting_kwds - -# set to None on class level, but initialized in __init__ -passlib.utils.handlers.HasManyIdents.ident -passlib.utils.handlers.HasRounds.rounds - -# Errors in `__all__` at runtime: -# TODO: change after https://github.com/python/mypy/pull/14217 is released -passlib.handlers.oracle.__all__ -passlib.handlers.mysql.__all__ - -# Compat tools are ignored: -passlib.utils.compat.* - -# Tests are not included: -passlib.tests.* - -# This is only available when the crypt module is available. This module -# was dropped from the standard library of Python 3.13, but is still available -# in some environments. -passlib.hosts.__all__ -(passlib.hosts.host_context)? - -# Fields differs at runtime: -passlib.apache._CommonFile.encoding -passlib.apache._CommonFile.return_unicode diff --git a/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist_win32.txt b/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist_win32.txt deleted file mode 100644 index 217d59c71678..000000000000 --- a/python/helpers/typeshed/stubs/passlib/@tests/stubtest_allowlist_win32.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Only exists if crypt is present -passlib.hosts.host_context diff --git a/python/helpers/typeshed/stubs/passlib/@tests/test_cases/check_bcrypt_using_rounds.py b/python/helpers/typeshed/stubs/passlib/@tests/test_cases/check_bcrypt_using_rounds.py deleted file mode 100644 index b7099a59d4e8..000000000000 --- a/python/helpers/typeshed/stubs/passlib/@tests/test_cases/check_bcrypt_using_rounds.py +++ /dev/null @@ -1,3 +0,0 @@ -from passlib.hash import bcrypt - -bcrypt.using(rounds=13).hash("password") diff --git a/python/helpers/typeshed/stubs/passlib/METADATA.toml b/python/helpers/typeshed/stubs/passlib/METADATA.toml deleted file mode 100644 index 625e9bf3d907..000000000000 --- a/python/helpers/typeshed/stubs/passlib/METADATA.toml +++ /dev/null @@ -1,6 +0,0 @@ -version = "1.7.*" -upstream_repository = "https://foss.heptapod.net/python-libs/passlib" - -[tool.stubtest] -# The runtime package has an undeclared dependency on setuptools -stubtest_requirements = ["setuptools"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/__init__.pyi deleted file mode 100644 index c5dd95466063..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Final - -__version__: Final[str] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/apache.pyi b/python/helpers/typeshed/stubs/passlib/passlib/apache.pyi deleted file mode 100644 index f474dee62763..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/apache.pyi +++ /dev/null @@ -1,102 +0,0 @@ -from typing_extensions import Self - -from .context import CryptContext -from .hash import htdigest - -class _CommonFile: - encoding: str - return_unicode: bool - autosave: bool - @classmethod - def from_string( - cls, - data: str | bytes, - *, - new: bool = False, - autoload: bool = True, - autosave: bool = False, - encoding: str = "utf-8", - return_unicode: bool = True, - ) -> Self: ... - @classmethod - def from_path( - cls, - path: str, - *, - new: bool = False, - autoload: bool = True, - autosave: bool = False, - encoding: str = "utf-8", - return_unicode: bool = True, - ) -> Self: ... - def __init__( - self, - path: str | None = None, - new: bool = False, - autoload: bool = True, - autosave: bool = False, - encoding: str = "utf-8", - return_unicode: bool = True, - ) -> None: ... - @property - def path(self) -> str: ... - @path.setter - def path(self, value: str) -> None: ... - @property - def mtime(self) -> float: ... - def load_if_changed(self) -> bool: ... - def load(self, path: str | None = None, force: bool = True) -> bool: ... - def load_string(self, data: str | bytes) -> None: ... - def save(self, path: str | None = None) -> None: ... - def to_string(self) -> bytes: ... - -class HtpasswdFile(_CommonFile): - context: CryptContext - def __init__( - self, - path: str | None = None, - default_scheme: str | None = None, - context: CryptContext = ..., - *, - new: bool = False, - autoload: bool = True, - autosave: bool = False, - encoding: str = "utf-8", - return_unicode: bool = True, - ) -> None: ... - def users(self) -> list[str | bytes]: ... - def set_password(self, user: str, password: str | bytes) -> bool: ... - def update(self, user: str, password: str | bytes) -> bool: ... - def get_hash(self, user: str) -> bytes | None: ... - def set_hash(self, user: str, hash: str | bytes) -> bool: ... - def find(self, user: str) -> bytes | None: ... - def delete(self, user: str) -> bool: ... - def check_password(self, user: str, password: str | bytes) -> bool | None: ... - def verify(self, user: str, password: str | bytes) -> bool | None: ... - -class HtdigestFile(_CommonFile): - default_realm: str | None - def __init__( - self, - path: str | None = None, - default_realm: str | None = None, - *, - new: bool = False, - autoload: bool = True, - autosave: bool = False, - encoding: str = "utf-8", - return_unicode: bool = True, - ) -> None: ... - def realms(self) -> list[str | bytes]: ... - def users(self, realm: str | None = None) -> list[str | bytes]: ... - def set_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool: ... - def update(self, user: str, realm: str | None, password: str | bytes) -> bool: ... - def get_hash(self, user: str, realm: str | None = None) -> htdigest | None: ... - def set_hash(self, user: str, realm: str | None = None, hash: str | bytes = ...) -> bool: ... - def find(self, user: str, realm: str | None) -> htdigest | None: ... - def delete(self, user: str, realm: str | None = None) -> bool: ... - def delete_realm(self, realm: str | None) -> int: ... - def check_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool | None: ... - def verify(self, user: str, realm: str | None, password: str | bytes) -> bool | None: ... - -__all__ = ["HtpasswdFile", "HtdigestFile"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/apps.pyi b/python/helpers/typeshed/stubs/passlib/passlib/apps.pyi deleted file mode 100644 index fb567f574142..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/apps.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from .context import CryptContext - -__all__ = [ - "custom_app_context", - "django_context", - "ldap_context", - "ldap_nocrypt_context", - "mysql_context", - "mysql4_context", - "mysql3_context", - "phpass_context", - "phpbb3_context", - "postgres_context", -] - -master_context: CryptContext -custom_app_context: CryptContext -django10_context: CryptContext -django14_context: CryptContext -django16_context: CryptContext -django110_context: CryptContext -django21_context: CryptContext -django_context = django21_context -std_ldap_schemes: list[str] -ldap_nocrypt_context: CryptContext -ldap_context: CryptContext -mysql3_context: CryptContext -mysql4_context: CryptContext -mysql_context = mysql4_context -postgres_context: CryptContext -phpass_context: CryptContext -phpbb3_context: CryptContext -roundup10_context: CryptContext -roundup15_context: CryptContext -roundup_context = roundup15_context diff --git a/python/helpers/typeshed/stubs/passlib/passlib/context.pyi b/python/helpers/typeshed/stubs/passlib/passlib/context.pyi deleted file mode 100644 index c6a779aafb13..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/context.pyi +++ /dev/null @@ -1,87 +0,0 @@ -from _typeshed import StrOrBytesPath, SupportsItems -from typing import Any -from typing_extensions import Self - -class CryptPolicy: - @classmethod - def from_path(cls, path, section: str = "passlib", encoding: str = "utf-8"): ... - @classmethod - def from_string(cls, source, section: str = "passlib", encoding: str = "utf-8"): ... - @classmethod - def from_source(cls, source, _warn: bool = True): ... - @classmethod - def from_sources(cls, sources, _warn: bool = True): ... - def replace(self, *args, **kwds): ... - def __init__(self, *args, **kwds) -> None: ... - def has_schemes(self): ... - def iter_handlers(self): ... - def schemes(self, resolve: bool = False): ... - def get_handler(self, name=None, category=None, required: bool = False): ... - def get_min_verify_time(self, category=None): ... - def get_options(self, name, category=None): ... - def handler_is_deprecated(self, name, category=None): ... - def iter_config(self, ini: bool = False, resolve: bool = False): ... - def to_dict(self, resolve: bool = False): ... - def to_file(self, stream, section: str = "passlib") -> None: ... - def to_string(self, section: str = "passlib", encoding=None): ... - -class CryptContext: - @classmethod - def from_string(cls, source: str | bytes, section: str = "passlib", encoding: str = "utf-8") -> Self: ... - @classmethod - def from_path(cls, path: StrOrBytesPath, section: str = "passlib", encoding: str = "utf-8") -> Self: ... - def copy(self, **kwds: Any) -> CryptContext: ... - def using(self, **kwds: Any) -> CryptContext: ... - def replace(self, **kwds): ... - def __init__(self, schemes=None, policy=..., _autoload: bool = True, **kwds) -> None: ... - policy: CryptPolicy - def load_path( - self, path: StrOrBytesPath, update: bool = False, section: str = "passlib", encoding: str = "utf-8" - ) -> None: ... - def load( - self, - source: str | bytes | SupportsItems[str, Any] | CryptContext, - update: bool = False, - section: str = "passlib", - encoding: str = "utf-8", - ) -> None: ... - def update(self, *args: Any, **kwds: Any) -> None: ... - def schemes(self, resolve: bool = False, category=None, unconfigured: bool = False): ... - def default_scheme(self, category=None, resolve: bool = False, unconfigured: bool = False): ... - def handler(self, scheme=None, category=None, unconfigured: bool = False): ... - @property - def context_kwds(self): ... - def to_dict(self, resolve: bool = False) -> dict[str, Any]: ... - def to_string(self, section: str = "passlib") -> str: ... - mvt_estimate_max_samples: int - mvt_estimate_min_samples: int - mvt_estimate_max_time: int - mvt_estimate_resolution: float - harden_verify: Any - min_verify_time: int - def reset_min_verify_time(self) -> None: ... - def needs_update( - self, hash: str | bytes, scheme: str | None = None, category: str | None = None, secret: str | bytes | None = None - ) -> bool: ... - def hash_needs_update(self, hash, scheme=None, category=None): ... - def genconfig(self, scheme=None, category=None, **settings): ... - def genhash(self, secret, config, scheme=None, category=None, **kwds): ... - def identify(self, hash, category=None, resolve: bool = False, required: bool = False, unconfigured: bool = False): ... - def hash(self, secret: str | bytes, scheme: str | None = None, category: str | None = None, **kwds: Any) -> str: ... - def encrypt(self, *args, **kwds): ... - def verify( - self, secret: str | bytes, hash: str | bytes | None, scheme: str | None = None, category: str | None = None, **kwds: Any - ) -> bool: ... - def verify_and_update( - self, secret: str | bytes, hash: str | bytes | None, scheme: str | None = None, category: str | None = None, **kwds: Any - ) -> tuple[bool, str | None]: ... - def dummy_verify(self, elapsed: int = 0): ... - def is_enabled(self, hash: str | bytes) -> bool: ... - def disable(self, hash: str | bytes | None = None) -> str: ... - def enable(self, hash: str | bytes) -> str: ... - -class LazyCryptContext(CryptContext): - def __init__(self, schemes=None, **kwds) -> None: ... - def __getattribute__(self, attr: str) -> Any: ... - -__all__ = ["CryptContext", "LazyCryptContext", "CryptPolicy"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi deleted file mode 100644 index f73ccb004ecc..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from passlib.crypto._blowfish.unrolled import BlowfishEngine as BlowfishEngine - -def raw_bcrypt(password, ident, salt, log_rounds): ... - -__all__ = ["BlowfishEngine", "raw_bcrypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi deleted file mode 100644 index 8913fb4e4da2..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -def varlist(name, count): ... -def indent_block(block, padding): ... - -BFSTR: Any - -def render_encipher(write, indent: int = 0) -> None: ... -def write_encipher_function(write, indent: int = 0) -> None: ... -def write_expand_function(write, indent: int = 0) -> None: ... -def main() -> None: ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/base.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/base.pyi deleted file mode 100644 index d882673d5be3..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/base.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Any - -class BlowfishEngine: - P: Any - S: Any - def __init__(self) -> None: ... - @staticmethod - def key_to_words(data, size: int = 18): ... - def encipher(self, l, r): ... - def expand(self, key_words) -> None: ... - def eks_salted_expand(self, key_words, salt_words) -> None: ... - def eks_repeated_expand(self, key_words, salt_words, rounds) -> None: ... - def repeat_encipher(self, l, r, count): ... - -__all__ = ["BlowfishEngine"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi deleted file mode 100644 index cb584d2b1310..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from passlib.crypto._blowfish.base import BlowfishEngine as _BlowfishEngine - -class BlowfishEngine(_BlowfishEngine): - def encipher(self, l, r): ... - def expand(self, key_words) -> None: ... - -__all__ = ["BlowfishEngine"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_md4.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/_md4.pyi deleted file mode 100644 index 448d2abb05b5..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/_md4.pyi +++ /dev/null @@ -1,12 +0,0 @@ -class md4: - name: str - digest_size: int - digestsize: int - block_size: int - def __init__(self, content=None) -> None: ... - def update(self, content) -> None: ... - def copy(self): ... - def digest(self): ... - def hexdigest(self): ... - -__all__ = ["md4"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/des.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/des.pyi deleted file mode 100644 index a71e9fe82c50..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/des.pyi +++ /dev/null @@ -1,5 +0,0 @@ -__all__ = ["expand_des_key", "des_encrypt_block"] - -def expand_des_key(key): ... -def des_encrypt_block(key, input, salt: int = 0, rounds: int = 1): ... -def des_encrypt_int_block(key, input, salt: int = 0, rounds: int = 1): ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/digest.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/digest.pyi deleted file mode 100644 index f4ffced63eaf..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/digest.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from typing import Any - -from passlib.utils import SequenceMixin - -def lookup_hash(digest, return_unknown: bool = False, required: bool = True): ... -def norm_hash_name(name, format: str = "hashlib"): ... - -class HashInfo(SequenceMixin): - name: Any - iana_name: Any - aliases: Any - const: Any - digest_size: Any - block_size: Any - error_text: Any - unknown: bool - def __init__(self, const, names, required: bool = True) -> None: ... - @property - def supported(self): ... - @property - def supported_by_fastpbkdf2(self): ... - @property - def supported_by_hashlib_pbkdf2(self): ... - -def compile_hmac(digest, key, multipart: bool = False): ... -def pbkdf1(digest, secret, salt, rounds, keylen=None): ... -def pbkdf2_hmac(digest, secret, salt, rounds, keylen=None): ... - -__all__ = [ - # hash utils - "lookup_hash", - "HashInfo", - "norm_hash_name", - # hmac utils - "compile_hmac", - # kdfs - "pbkdf1", - "pbkdf2_hmac", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/__init__.pyi deleted file mode 100644 index 68cd983a0089..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/__init__.pyi +++ /dev/null @@ -1,4 +0,0 @@ -def validate(n, r, p): ... -def scrypt(secret, salt, n, r, p: int = 1, keylen: int = 32): ... - -__all__ = ["validate", "scrypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi deleted file mode 100644 index 4cb28c9221f5..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from collections.abc import Generator -from typing import Any - -class ScryptEngine: - n: int - r: int - p: int - smix_bytes: int - iv_bytes: int - bmix_len: int - bmix_half_len: int - bmix_struct: Any - integerify: Any - @classmethod - def execute(cls, secret, salt, n, r, p, keylen): ... - def __init__(self, n, r, p): ... - def run(self, secret, salt, keylen): ... - def smix(self, input) -> Generator[None, None, Any]: ... - def bmix(self, source, target) -> None: ... - -__all__ = ["ScryptEngine"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi deleted file mode 100644 index 7e7363e797f3..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi +++ /dev/null @@ -1 +0,0 @@ -def main() -> None: ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi b/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi deleted file mode 100644 index d5ead6326a8b..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi +++ /dev/null @@ -1 +0,0 @@ -def salsa20(input): ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/exc.pyi b/python/helpers/typeshed/stubs/passlib/passlib/exc.pyi deleted file mode 100644 index f68f28f414c6..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/exc.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from typing import Any - -class UnknownBackendError(ValueError): - hasher: Any - backend: Any - def __init__(self, hasher, backend) -> None: ... - -class MissingBackendError(RuntimeError): ... -class InternalBackendError(RuntimeError): ... -class PasswordValueError(ValueError): ... - -class PasswordSizeError(PasswordValueError): - max_size: Any - def __init__(self, max_size, msg=None) -> None: ... - -class PasswordTruncateError(PasswordSizeError): - def __init__(self, cls, msg=None) -> None: ... - -class PasslibSecurityError(RuntimeError): ... - -class TokenError(ValueError): - def __init__(self, msg=None, *args, **kwds) -> None: ... - -class MalformedTokenError(TokenError): ... -class InvalidTokenError(TokenError): ... - -class UsedTokenError(TokenError): - expire_time: Any - def __init__(self, *args, **kwds) -> None: ... - -class UnknownHashError(ValueError): - value: Any - message: Any - def __init__(self, message=None, value=None) -> None: ... - -class PasslibWarning(UserWarning): ... -class PasslibConfigWarning(PasslibWarning): ... -class PasslibHashWarning(PasslibWarning): ... -class PasslibRuntimeWarning(PasslibWarning): ... -class PasslibSecurityWarning(PasslibWarning): ... - -def type_name(value): ... -def ExpectedTypeError(value, expected, param): ... -def ExpectedStringError(value, param): ... -def MissingDigestError(handler=None): ... -def NullPasswordError(handler=None): ... -def InvalidHashError(handler=None): ... -def MalformedHashError(handler=None, reason=None): ... -def ZeroPaddedRoundsError(handler=None): ... -def ChecksumSizeError(handler, raw: bool = False): ... - -ENABLE_DEBUG_ONLY_REPR: bool - -def debug_only_repr(value, param: str = "hash"): ... -def CryptBackendError(handler, config, hash, source: str = "crypt.crypt()") -> None: ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/ext/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/ext/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/python/helpers/typeshed/stubs/passlib/passlib/ext/django/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/ext/django/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/python/helpers/typeshed/stubs/passlib/passlib/ext/django/models.pyi b/python/helpers/typeshed/stubs/passlib/passlib/ext/django/models.pyi deleted file mode 100644 index 2fd1d214552f..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/ext/django/models.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -password_context: Any diff --git a/python/helpers/typeshed/stubs/passlib/passlib/ext/django/utils.pyi b/python/helpers/typeshed/stubs/passlib/passlib/ext/django/utils.pyi deleted file mode 100644 index c97ad907a0a3..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/ext/django/utils.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from typing import Any - -__all__ = ["DJANGO_VERSION", "MIN_DJANGO_VERSION", "get_preset_config", "quirks"] - -DJANGO_VERSION: tuple[Any, ...] -MIN_DJANGO_VERSION: tuple[int, int] - -class quirks: - none_causes_check_password_error: Any - empty_is_usable_password: Any - invalid_is_usable_password: Any - -def get_preset_config(name): ... - -class DjangoTranslator: - context: Any - def __init__(self, context=None, **kwds) -> None: ... - def reset_hashers(self) -> None: ... - def passlib_to_django_name(self, passlib_name): ... - def passlib_to_django(self, passlib_hasher, cached: bool = True): ... - def django_to_passlib_name(self, django_name): ... - def django_to_passlib(self, django_name, cached: bool = True): ... - def resolve_django_hasher(self, django_name, cached: bool = True): ... - -class DjangoContextAdapter(DjangoTranslator): - context: Any - is_password_usable: Any - enabled: bool - patched: bool - log: Any - def __init__(self, context=None, get_user_category=None, **kwds) -> None: ... - def reset_hashers(self) -> None: ... - def get_hashers(self): ... - def get_hasher(self, algorithm: str = "default"): ... - def identify_hasher(self, encoded): ... - def make_password(self, password, salt=None, hasher: str = "default"): ... - def check_password(self, password, encoded, setter=None, preferred: str = "default"): ... - def user_check_password(self, user, password): ... - def user_set_password(self, user, password) -> None: ... - def get_user_category(self, user): ... - HASHERS_PATH: str - MODELS_PATH: str - USER_CLASS_PATH: Any - FORMS_PATH: str - patch_locations: Any - def install_patch(self): ... - def remove_patch(self): ... - def load_model(self) -> None: ... - -class ProxyProperty: - attr: Any - def __init__(self, attr) -> None: ... - def __get__(self, obj, cls): ... - def __set__(self, obj, value) -> None: ... - def __delete__(self, obj) -> None: ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/argon2.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/argon2.pyi deleted file mode 100644 index ca461275f944..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/argon2.pyi +++ /dev/null @@ -1,79 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class _DummyCffiHasher: - time_cost: int - memory_cost: int - parallelism: int - salt_len: int - hash_len: int - -class _Argon2Common( # type: ignore[misc] - uh.SubclassBackendMixin, uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler -): - name: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - max_parallelism: ClassVar[int] - max_version: ClassVar[int] - min_desired_version: ClassVar[int | None] - min_memory_cost: ClassVar[int] - max_threads: ClassVar[int] - pure_use_threads: ClassVar[bool] - def type_values(cls): ... - type: str - parallelism: int - version: int - memory_cost: int - @property - def type_d(self): ... - data: Any - @classmethod - def using( # type: ignore[override] - cls, - type=None, - memory_cost=None, - salt_len=None, - time_cost=None, - digest_size=None, - checksum_size=None, - hash_len=None, - max_threads=None, - **kwds, - ): ... - @classmethod - def identify(cls, hash): ... - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - def __init__(self, type=None, type_d: bool = False, version=None, memory_cost=None, data=None, **kwds) -> None: ... - -class _NoBackend(_Argon2Common): - @classmethod - def hash(cls, secret): ... # type: ignore[override] - @classmethod - def verify(cls, secret, hash): ... # type: ignore[override] - @classmethod - def genhash(cls, secret, config): ... # type: ignore[override] - -class _CffiBackend(_Argon2Common): - @classmethod - def hash(cls, secret): ... # type: ignore[override] - @classmethod - def verify(cls, secret, hash): ... # type: ignore[override] - @classmethod - def genhash(cls, secret, config): ... # type: ignore[override] - -class _PureBackend(_Argon2Common): ... - -class argon2(_NoBackend, _Argon2Common): # type: ignore[misc] - backends: ClassVar[tuple[str, ...]] - -__all__ = ["argon2"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/bcrypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/bcrypt.pyi deleted file mode 100644 index 384070eb3337..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/bcrypt.pyi +++ /dev/null @@ -1,57 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - default_ident: ClassVar[str] - ident_values: ClassVar[tuple[str, ...]] - ident_aliases: ClassVar[dict[str, str]] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - final_salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - truncate_size: ClassVar[int | None] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - @classmethod - def needs_update(cls, hash, **kwds): ... # type: ignore[override] - @classmethod - def normhash(cls, hash): ... - -class _NoBackend(_BcryptCommon): ... -class _BcryptBackend(_BcryptCommon): ... -class _BcryptorBackend(_BcryptCommon): ... -class _PyBcryptBackend(_BcryptCommon): ... -class _OsCryptBackend(_BcryptCommon): ... -class _BuiltinBackend(_BcryptCommon): ... - -class bcrypt(_NoBackend, _BcryptCommon): # type: ignore[misc] - backends: ClassVar[tuple[str, ...]] - -class _wrapped_bcrypt(bcrypt): - truncate_size: ClassVar[None] - -class bcrypt_sha256(_wrapped_bcrypt): - name: ClassVar[str] - ident_values: ClassVar[tuple[str, ...]] - ident_aliases: ClassVar[dict[str, str]] - default_ident: ClassVar[str] - version: ClassVar[int] - @classmethod - def using(cls, version=None, **kwds): ... # type: ignore[override] - prefix: Any - @classmethod - def identify(cls, hash): ... - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - def __init__(self, version=None, **kwds) -> None: ... - -__all__ = ["bcrypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/cisco.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/cisco.pyi deleted file mode 100644 index b1510e13c7c3..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/cisco.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class cisco_pix(uh.HasUserContext, uh.StaticHandler): - name: ClassVar[str] - truncate_size: ClassVar[int] - truncate_error: ClassVar[bool] - truncate_verify_reject: ClassVar[bool] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - -class cisco_asa(cisco_pix): ... - -class cisco_type7(uh.GenericHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - min_salt_value: ClassVar[int] - max_salt_value: ClassVar[int] - @classmethod - def using(cls, salt: int | None = None, **kwds): ... # type: ignore[override] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - salt: int - def __init__(self, salt: int | None = None, **kwds) -> None: ... - @classmethod - def decode(cls, hash, encoding: str = "utf-8"): ... - -__all__ = ["cisco_pix", "cisco_asa", "cisco_type7"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/des_crypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/des_crypt.pyi deleted file mode 100644 index 3335c77ad1bb..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/des_crypt.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class des_crypt(uh.TruncateMixin, uh.HasManyBackends, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - truncate_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - backends: ClassVar[tuple[str, ...]] - -class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - @classmethod - def using(cls, **kwds): ... # type: ignore[override] - backends: ClassVar[tuple[str, ...]] - -class bigcrypt(uh.HasSalt, uh.GenericHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class crypt16(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - truncate_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -__all__ = ["des_crypt", "bsdi_crypt", "bigcrypt", "crypt16"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/digests.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/digests.pyi deleted file mode 100644 index 01c3641210de..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/digests.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from _typeshed import Incomplete -from typing import ClassVar -from typing_extensions import deprecated - -import passlib.utils.handlers as uh - -class HexDigestHash(uh.StaticHandler): - checksum_chars: ClassVar[str] - supported: ClassVar[bool] - -def create_hex_hash(digest, module="passlib.handlers.digests", django_name=None, required: bool = True): ... - -hex_md4: Incomplete -hex_md5: Incomplete -hex_sha1: Incomplete -hex_sha256: Incomplete -hex_sha512: Incomplete - -class htdigest(uh.MinimalHandler): - name: ClassVar[str] - default_encoding: ClassVar[str] - setting_kwds: ClassVar[tuple[str, ...]] - context_kwds: ClassVar[tuple[str, ...]] - @classmethod - def hash(cls, secret, user, realm, encoding=None): ... # type: ignore[override] - @classmethod - def verify(cls, secret, hash, user, realm, encoding: str = "utf-8"): ... # type: ignore[override] - @classmethod - def identify(cls, hash): ... - @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") - @classmethod - def genconfig(cls): ... # type: ignore[override] - @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") - @classmethod - def genhash(cls, secret, config, user, realm, encoding=None): ... # type: ignore[override] - -__all__ = ["create_hex_hash", "hex_md4", "hex_md5", "hex_sha1", "hex_sha256", "hex_sha512"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/django.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/django.pyi deleted file mode 100644 index c7a2f38ab701..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/django.pyi +++ /dev/null @@ -1,93 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh -from passlib.handlers.bcrypt import _wrapped_bcrypt -from passlib.ifc import DisabledHash - -class DjangoSaltedHash(uh.HasSalt, uh.GenericHandler): - default_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - checksum_chars: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class DjangoVariableHash(uh.HasRounds, DjangoSaltedHash): # type: ignore[misc] - min_rounds: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class django_salted_sha1(DjangoSaltedHash): - name: ClassVar[str] - django_name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - -class django_salted_md5(DjangoSaltedHash): - name: ClassVar[str] - django_name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - -django_bcrypt: Any - -class django_bcrypt_sha256(_wrapped_bcrypt): - name: ClassVar[str] - django_name: ClassVar[str] - django_prefix: ClassVar[str] - @classmethod - def identify(cls, hash): ... - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class django_pbkdf2_sha256(DjangoVariableHash): - name: ClassVar[str] - django_name: ClassVar[str] - ident: ClassVar[str] - min_salt_size: ClassVar[int] - max_rounds: ClassVar[int] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - default_rounds: ClassVar[int] - -class django_pbkdf2_sha1(django_pbkdf2_sha256): - name: ClassVar[str] - django_name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_rounds: ClassVar[int] - -django_argon2: Any - -class django_des_crypt(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - django_name: ClassVar[str] - ident: ClassVar[str] - checksum_chars: ClassVar[str] - salt_chars: ClassVar[str] - checksum_size: ClassVar[int] - min_salt_size: ClassVar[int] - default_salt_size: ClassVar[int] - truncate_size: ClassVar[int] - use_duplicate_salt: bool - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class django_disabled(DisabledHash, uh.StaticHandler): - name: ClassVar[str] - suffix_length: ClassVar[int] - @classmethod - def identify(cls, hash: str | bytes) -> bool: ... - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] - -__all__ = [ - "django_salted_sha1", - "django_salted_md5", - "django_bcrypt", - "django_pbkdf2_sha1", - "django_pbkdf2_sha256", - "django_argon2", - "django_des_crypt", - "django_disabled", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/fshp.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/fshp.pyi deleted file mode 100644 index 73caa3bedf55..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/fshp.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_chars: ClassVar[str] - ident: ClassVar[str] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[None] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - default_variant: ClassVar[int] - @classmethod - def using(cls, variant: int | str | bytes | None = None, **kwds): ... # type: ignore[override] - variant: int | None - use_defaults: Any - def __init__(self, variant: int | str | bytes | None = None, **kwds) -> None: ... - @property - def checksum_alg(self): ... - @property - def checksum_size(self): ... # type: ignore[override] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -__all__ = ["fshp"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/ldap_digests.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/ldap_digests.pyi deleted file mode 100644 index 1abaf2aa8e9e..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/ldap_digests.pyi +++ /dev/null @@ -1,82 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh -from passlib.handlers.misc import plaintext -from passlib.utils.handlers import PrefixWrapper - -__all__ = [ - "ldap_plaintext", - "ldap_md5", - "ldap_sha1", - "ldap_salted_md5", - "ldap_salted_sha1", - "ldap_salted_sha256", - "ldap_salted_sha512", - "ldap_des_crypt", - "ldap_bsdi_crypt", - "ldap_md5_crypt", - "ldap_sha1_crypt", - "ldap_bcrypt", - "ldap_sha256_crypt", - "ldap_sha512_crypt", -] - -class _Base64DigestHelper(uh.StaticHandler): - ident: ClassVar[str | None] - checksum_chars: ClassVar[str] - -class _SaltedBase64DigestHelper(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): - checksum_chars: ClassVar[str] - ident: ClassVar[str | None] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_salt_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class ldap_md5(_Base64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - -class ldap_sha1(_Base64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - -class ldap_salted_md5(_SaltedBase64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - -class ldap_salted_sha1(_SaltedBase64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - -class ldap_salted_sha256(_SaltedBase64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - -class ldap_salted_sha512(_SaltedBase64DigestHelper): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - -class ldap_plaintext(plaintext): - name: ClassVar[str] - @classmethod - def genconfig(cls): ... # type: ignore[override] - @classmethod - def identify(cls, hash): ... - -# Dynamically created -ldap_sha512_crypt: PrefixWrapper -ldap_sha256_crypt: PrefixWrapper -ldap_sha1_crypt: PrefixWrapper -ldap_bcrypt: PrefixWrapper -ldap_md5_crypt: PrefixWrapper -ldap_bsdi_crypt: PrefixWrapper -ldap_des_crypt: PrefixWrapper diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/md5_crypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/md5_crypt.pyi deleted file mode 100644 index 0f3e2df5d8a7..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/md5_crypt.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class _MD5_Common(uh.HasSalt, uh.GenericHandler): - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class md5_crypt(uh.HasManyBackends, _MD5_Common): - name: ClassVar[str] - ident: ClassVar[str] - backends: ClassVar[tuple[str, ...]] - -class apr_md5_crypt(_MD5_Common): - name: ClassVar[str] - ident: ClassVar[str] - -__all__ = ["md5_crypt", "apr_md5_crypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/misc.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/misc.pyi deleted file mode 100644 index 7f7e8f24c0f6..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/misc.pyi +++ /dev/null @@ -1,54 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import deprecated - -import passlib.utils.handlers as uh -from passlib.ifc import DisabledHash - -class unix_fallback(DisabledHash, uh.StaticHandler): - name: ClassVar[str] - @classmethod - def identify(cls, hash: str | bytes) -> bool: ... - enable_wildcard: Any - def __init__(self, enable_wildcard: bool = False, **kwds) -> None: ... - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes, enable_wildcard: bool = False): ... # type: ignore[override] - -class unix_disabled(DisabledHash, uh.MinimalHandler): - name: ClassVar[str] - default_marker: ClassVar[str] - setting_kwds: ClassVar[tuple[str, ...]] - context_kwds: ClassVar[tuple[str, ...]] - @classmethod - def using(cls, marker=None, **kwds): ... # type: ignore[override] - @classmethod - def identify(cls, hash: str | bytes) -> bool: ... - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] - @classmethod - def hash(cls, secret: str | bytes, **kwds) -> str: ... - @classmethod - def genhash(cls, secret: str | bytes, config, marker=None): ... # type: ignore[override] - @classmethod - def disable(cls, hash: str | bytes | None = None) -> str: ... - @classmethod - def enable(cls, hash: str | bytes) -> str: ... - -class plaintext(uh.MinimalHandler): - name: ClassVar[str] - default_encoding: ClassVar[str] - setting_kwds: ClassVar[tuple[str, ...]] - context_kwds: ClassVar[tuple[str, ...]] - @classmethod - def identify(cls, hash: str | bytes): ... - @classmethod - def hash(cls, secret: str | bytes, encoding=None): ... # type: ignore[override] - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes, encoding: str | None = None): ... # type: ignore[override] - @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") - @classmethod - def genconfig(cls): ... # type: ignore[override] - @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") - @classmethod - def genhash(cls, secret, config, encoding: str | None = None): ... # type: ignore[override] - -__all__ = ["unix_disabled", "unix_fallback", "plaintext"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/mssql.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/mssql.pyi deleted file mode 100644 index a0687e911d02..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/mssql.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): - name: ClassVar[str] - checksum_size: ClassVar[int] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] - -class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): - name: ClassVar[str] - checksum_size: ClassVar[int] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -__all__ = ["mssql2000", "mssql2005"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/mysql.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/mysql.pyi deleted file mode 100644 index ae08bdb2d2db..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/mysql.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import ClassVar - -import passlib.utils.handlers as uh - -__all__ = ["mysql323"] - -class mysql323(uh.StaticHandler): - name: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - -class mysql41(uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/oracle.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/oracle.pyi deleted file mode 100644 index 0456bda1ea39..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/oracle.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -__all__: list[str] = [] - -class oracle10(uh.HasUserContext, uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - -class oracle11(uh.HasSalt, uh.GenericHandler): - name: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/pbkdf2.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/pbkdf2.pyi deleted file mode 100644 index e1a0040c0c9c..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/pbkdf2.pyi +++ /dev/null @@ -1,91 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh -from passlib.utils.handlers import PrefixWrapper - -class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] - checksum_chars: ClassVar[str] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] - -# dynamically created by create_pbkdf2_hash() -class pbkdf2_sha1(Pbkdf2DigestHandler): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - encoded_checksum_size: ClassVar[int] - -# dynamically created by create_pbkdf2_hash() -class pbkdf2_sha256(Pbkdf2DigestHandler): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - encoded_checksum_size: ClassVar[int] - -# dynamically created by create_pbkdf2_hash() -class pbkdf2_sha512(Pbkdf2DigestHandler): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - encoded_checksum_size: ClassVar[int] - -ldap_pbkdf2_sha1: PrefixWrapper -ldap_pbkdf2_sha256: PrefixWrapper -ldap_pbkdf2_sha512: PrefixWrapper - -class cta_pbkdf2_sha1(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class dlitz_pbkdf2_sha1(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - ident: ClassVar[str] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class atlassian_pbkdf2_sha1(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -class grub_pbkdf2_sha512(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - -__all__ = ["pbkdf2_sha1", "pbkdf2_sha256", "pbkdf2_sha512", "cta_pbkdf2_sha1", "dlitz_pbkdf2_sha1", "grub_pbkdf2_sha512"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/phpass.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/phpass.pyi deleted file mode 100644 index e13cacf49436..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/phpass.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_chars: ClassVar[str] - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - default_ident: ClassVar[str] - ident_values: ClassVar[tuple[str, ...]] - ident_aliases: ClassVar[dict[str, str]] - @classmethod - def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] - -__all__ = ["phpass"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/postgres.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/postgres.pyi deleted file mode 100644 index 263fda727a50..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/postgres.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import ClassVar - -import passlib.utils.handlers as uh - -class postgres_md5(uh.HasUserContext, uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - -__all__ = ["postgres_md5"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/roundup.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/roundup.pyi deleted file mode 100644 index 24b9f60ed9e8..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/roundup.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any - -roundup_plaintext: Any -ldap_hex_md5: Any -ldap_hex_sha1: Any - -__all__ = ["roundup_plaintext", "ldap_hex_md5", "ldap_hex_sha1"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/scram.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/scram.pyi deleted file mode 100644 index 1e07e4c9b39e..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/scram.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from _typeshed import Incomplete -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - ident: ClassVar[str] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - default_algs: ClassVar[list[str]] - algs: Incomplete | None - @classmethod - def extract_digest_info(cls, hash, alg): ... - @classmethod - def extract_digest_algs(cls, hash, format: str = "iana"): ... - @classmethod - def derive_digest(cls, password, salt, rounds, alg): ... - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - @classmethod - def using(cls, default_algs=None, algs=None, **kwds): ... # type: ignore[override] - def __init__(self, algs=None, **kwds) -> None: ... - @classmethod - def verify(cls, secret, hash, full: bool = False): ... # type: ignore[override] - -__all__ = ["scram"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/scrypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/scrypt.pyi deleted file mode 100644 index ce01e8d62132..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/scrypt.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class scrypt(uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.HasManyIdents, uh.GenericHandler): # type: ignore[misc] - backends: ClassVar[tuple[str, ...]] - name: ClassVar[str] - checksum_size: ClassVar[int] - default_ident: ClassVar[str] - ident_values: ClassVar[tuple[str, ...]] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - parallelism: int - block_size: int - @classmethod - def using(cls, block_size=None, **kwds): ... # type: ignore[override] - @classmethod - def from_string(cls, hash) -> Self: ... # type: ignore[override] - @classmethod - def parse(cls, hash): ... - def to_string(self): ... - def __init__(self, block_size=None, **kwds) -> None: ... - @classmethod - def get_backend(cls): ... - @classmethod - def has_backend(cls, name: str = "any"): ... - @classmethod - def set_backend(cls, name: str = "any", dryrun: bool = False) -> None: ... - -__all__ = ["scrypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha1_crypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha1_crypt.pyi deleted file mode 100644 index 9380a736a8bd..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha1_crypt.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Any, ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -log: Any - -class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - checksum_chars: ClassVar[str] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - @classmethod - def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] - def to_string(self, config: bool = False) -> str: ... - backends: ClassVar[tuple[str, ...]] - -__all__: list[str] = [] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha2_crypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha2_crypt.pyi deleted file mode 100644 index 44e6dcdebe50..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sha2_crypt.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class _SHA2_Common(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - checksum_chars: ClassVar[str] - max_salt_size: ClassVar[int] - salt_chars: ClassVar[str] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - implicit_rounds: bool - def __init__(self, implicit_rounds: bool | None = None, **kwds) -> None: ... - @classmethod - def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] - backends: ClassVar[tuple[str, ...]] - -class sha256_crypt(_SHA2_Common): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_rounds: ClassVar[int] - -class sha512_crypt(_SHA2_Common): - name: ClassVar[str] - ident: ClassVar[str] - checksum_size: ClassVar[int] - default_rounds: ClassVar[int] - -__all__ = ["sha512_crypt", "sha256_crypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi deleted file mode 100644 index 6bec6a56b1f6..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import ClassVar -from typing_extensions import Self - -import passlib.utils.handlers as uh - -class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - default_salt_size: ClassVar[int] - max_salt_size: ClassVar[int | None] - salt_chars: ClassVar[str] - default_rounds: ClassVar[int] - min_rounds: ClassVar[int] - max_rounds: ClassVar[int] - rounds_cost: ClassVar[str] - ident_values: ClassVar[tuple[str, ...]] - bare_salt: bool - def __init__(self, bare_salt: bool = False, **kwds) -> None: ... - @classmethod - def identify(cls, hash): ... - @classmethod - def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] - def to_string(self, _withchk: bool = True) -> str: ... - -__all__ = ["sun_md5_crypt"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/handlers/windows.pyi b/python/helpers/typeshed/stubs/passlib/passlib/handlers/windows.pyi deleted file mode 100644 index 28a8fd7181ac..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/handlers/windows.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Any, ClassVar, Literal, overload - -import passlib.utils.handlers as uh - -class lmhash(uh.TruncateMixin, uh.HasEncodingContext, uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - truncate_size: ClassVar[int] - @classmethod - def raw(cls, secret, encoding=None): ... - -class nthash(uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - @classmethod - def raw(cls, secret): ... - @overload - @classmethod - def raw_nthash(cls, secret: str | bytes, hex: Literal[True]) -> str: ... - @overload - @classmethod - def raw_nthash(cls, secret: str | bytes, hex: Literal[False] = False) -> bytes: ... - @overload - @classmethod - def raw_nthash(cls, secret: str | bytes, hex: bool = False) -> str | bytes: ... - -bsd_nthash: Any - -class msdcc(uh.HasUserContext, uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - @classmethod - def raw(cls, secret, user): ... - -class msdcc2(uh.HasUserContext, uh.StaticHandler): - name: ClassVar[str] - checksum_chars: ClassVar[str] - checksum_size: ClassVar[int] - @classmethod - def raw(cls, secret, user): ... - -__all__ = ["lmhash", "nthash", "bsd_nthash", "msdcc", "msdcc2"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/hash.pyi b/python/helpers/typeshed/stubs/passlib/passlib/hash.pyi deleted file mode 100644 index b71311a30228..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/hash.pyi +++ /dev/null @@ -1,75 +0,0 @@ -from passlib.handlers.argon2 import argon2 as argon2 -from passlib.handlers.bcrypt import bcrypt as bcrypt, bcrypt_sha256 as bcrypt_sha256 -from passlib.handlers.cisco import cisco_asa as cisco_asa, cisco_pix as cisco_pix, cisco_type7 as cisco_type7 -from passlib.handlers.des_crypt import bigcrypt as bigcrypt, bsdi_crypt as bsdi_crypt, crypt16 as crypt16, des_crypt as des_crypt -from passlib.handlers.digests import ( - hex_md4 as hex_md4, - hex_md5 as hex_md5, - hex_sha1 as hex_sha1, - hex_sha256 as hex_sha256, - hex_sha512 as hex_sha512, - htdigest as htdigest, -) -from passlib.handlers.django import ( - django_bcrypt as django_bcrypt, - django_bcrypt_sha256 as django_bcrypt_sha256, - django_des_crypt as django_des_crypt, - django_disabled as django_disabled, - django_pbkdf2_sha1 as django_pbkdf2_sha1, - django_pbkdf2_sha256 as django_pbkdf2_sha256, - django_salted_md5 as django_salted_md5, - django_salted_sha1 as django_salted_sha1, -) -from passlib.handlers.fshp import fshp as fshp -from passlib.handlers.ldap_digests import ( - ldap_bcrypt as ldap_bcrypt, - ldap_bsdi_crypt as ldap_bsdi_crypt, - ldap_des_crypt as ldap_des_crypt, - ldap_md5 as ldap_md5, - ldap_md5_crypt as ldap_md5_crypt, - ldap_plaintext as ldap_plaintext, - ldap_salted_md5 as ldap_salted_md5, - ldap_salted_sha1 as ldap_salted_sha1, - ldap_salted_sha256 as ldap_salted_sha256, - ldap_salted_sha512 as ldap_salted_sha512, - ldap_sha1 as ldap_sha1, - ldap_sha1_crypt as ldap_sha1_crypt, - ldap_sha256_crypt as ldap_sha256_crypt, - ldap_sha512_crypt as ldap_sha512_crypt, -) -from passlib.handlers.md5_crypt import apr_md5_crypt as apr_md5_crypt, md5_crypt as md5_crypt -from passlib.handlers.misc import plaintext as plaintext, unix_disabled as unix_disabled, unix_fallback as unix_fallback -from passlib.handlers.mssql import mssql2000 as mssql2000, mssql2005 as mssql2005 -from passlib.handlers.mysql import mysql41 as mysql41, mysql323 as mysql323 -from passlib.handlers.oracle import oracle10 as oracle10, oracle11 as oracle11 -from passlib.handlers.pbkdf2 import ( - atlassian_pbkdf2_sha1 as atlassian_pbkdf2_sha1, - cta_pbkdf2_sha1 as cta_pbkdf2_sha1, - dlitz_pbkdf2_sha1 as dlitz_pbkdf2_sha1, - grub_pbkdf2_sha512 as grub_pbkdf2_sha512, - ldap_pbkdf2_sha1 as ldap_pbkdf2_sha1, - ldap_pbkdf2_sha256 as ldap_pbkdf2_sha256, - ldap_pbkdf2_sha512 as ldap_pbkdf2_sha512, - pbkdf2_sha1 as pbkdf2_sha1, - pbkdf2_sha256 as pbkdf2_sha256, - pbkdf2_sha512 as pbkdf2_sha512, -) -from passlib.handlers.phpass import phpass as phpass -from passlib.handlers.postgres import postgres_md5 as postgres_md5 -from passlib.handlers.roundup import ( - ldap_hex_md5 as ldap_hex_md5, - ldap_hex_sha1 as ldap_hex_sha1, - roundup_plaintext as roundup_plaintext, -) -from passlib.handlers.scram import scram as scram -from passlib.handlers.scrypt import scrypt as scrypt -from passlib.handlers.sha1_crypt import sha1_crypt as sha1_crypt -from passlib.handlers.sha2_crypt import sha256_crypt as sha256_crypt, sha512_crypt as sha512_crypt -from passlib.handlers.sun_md5_crypt import sun_md5_crypt as sun_md5_crypt -from passlib.handlers.windows import ( - bsd_nthash as bsd_nthash, - lmhash as lmhash, - msdcc as msdcc, - msdcc2 as msdcc2, - nthash as nthash, -) diff --git a/python/helpers/typeshed/stubs/passlib/passlib/hosts.pyi b/python/helpers/typeshed/stubs/passlib/passlib/hosts.pyi deleted file mode 100644 index c07bbc048ce3..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/hosts.pyi +++ /dev/null @@ -1,15 +0,0 @@ -import sys - -from passlib.context import CryptContext - -linux_context: CryptContext -linux2_context: CryptContext -freebsd_context: CryptContext -openbsd_context: CryptContext -netbsd_context: CryptContext -# Only exists if crypt is present -if sys.version_info < (3, 13) and sys.platform != "win32": - host_context: CryptContext - __all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context", "host_context"] -else: - __all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/ifc.pyi b/python/helpers/typeshed/stubs/passlib/passlib/ifc.pyi deleted file mode 100644 index 03e22623f894..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/ifc.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from abc import ABCMeta, abstractmethod -from typing import Any, ClassVar, Literal -from typing_extensions import Self - -class PasswordHash(metaclass=ABCMeta): - is_disabled: ClassVar[bool] - truncate_size: ClassVar[int | None] - truncate_error: ClassVar[bool] - truncate_verify_reject: ClassVar[bool] - @classmethod - @abstractmethod - def hash(cls, secret: str | bytes, **setting_and_context_kwds) -> str: ... - @classmethod - def encrypt(cls, secret: str | bytes, **kwds) -> str: ... - @classmethod - @abstractmethod - def verify(cls, secret: str | bytes, hash: str | bytes, **context_kwds): ... - @classmethod - @abstractmethod - def using(cls, relaxed: bool = False, **kwds: Any) -> type[Self]: ... - @classmethod - def needs_update(cls, hash: str, secret: str | bytes | None = None) -> bool: ... - @classmethod - @abstractmethod - def identify(cls, hash: str | bytes) -> bool: ... - @classmethod - def genconfig(cls, **setting_kwds: Any) -> str: ... - @classmethod - def genhash(cls, secret: str | bytes, config: str, **context: Any) -> str: ... - deprecated: bool - -class DisabledHash(PasswordHash, metaclass=ABCMeta): - is_disabled: ClassVar[Literal[True]] - @classmethod - def disable(cls, hash: str | None = None) -> str: ... - @classmethod - def enable(cls, hash: str) -> str: ... - -__all__ = ["PasswordHash"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/pwd.pyi b/python/helpers/typeshed/stubs/passlib/passlib/pwd.pyi deleted file mode 100644 index a1189c161b7d..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/pwd.pyi +++ /dev/null @@ -1,142 +0,0 @@ -import random -from abc import abstractmethod -from collections.abc import Callable, Iterator, MutableMapping, Sequence -from typing import Any, Final, Literal, overload -from typing_extensions import Self, TypeAlias - -class SequenceGenerator: - length: int | None - requested_entropy: str - rng: random.Random - @property - @abstractmethod - def symbol_count(self) -> int: ... - def __init__(self, entropy: int | None = None, length: int | None = None, rng: random.Random | None = None) -> None: ... - @property - def entropy_per_symbol(self) -> float: ... - @property - def entropy(self) -> float: ... - def __next__(self) -> str: ... - @overload - def __call__(self, returns: None = None) -> str: ... - @overload - def __call__(self, returns: int) -> list[str]: ... - @overload - def __call__(self, returns: Callable[[Any], Iterator[Any]]) -> Iterator[str]: ... # "returns" must be the "iter" builtin - def __iter__(self) -> Self: ... - -_Charset: TypeAlias = Literal["ascii_72", "ascii_62", "ascii_50", "hex"] -default_charsets: Final[dict[_Charset, str]] - -class WordGenerator(SequenceGenerator): - charset: _Charset - chars: str | bytes | None - def __init__( - self, - chars: str | bytes | None = None, - charset: _Charset | None = None, - *, - entropy: int | None = None, - length: int | None = None, - rng: random.Random | None = None, - ) -> None: ... - @property - def symbol_count(self) -> int: ... - -@overload -def genword( - entropy: int | None = None, - length: int | None = None, - returns: None = None, - *, - chars: str | None = None, - charset: _Charset | None = None, - rng: random.Random | None = None, -) -> str: ... -@overload -def genword( - returns: int, - entropy: int | None = None, - length: int | None = None, - *, - chars: str | None = None, - charset: _Charset | None = None, - rng: random.Random | None = None, -) -> list[str]: ... -@overload -def genword( - returns: Callable[[Any], Iterator[Any]], - entropy: int | None = None, - length: int | None = None, - *, - chars: str | None = None, - charset: _Charset | None = None, - rng: random.Random | None = None, -) -> Iterator[str]: ... - -class WordsetDict(MutableMapping[Any, Any]): - paths: dict[str, str] | None - def __init__(self, *args, **kwds) -> None: ... - def __getitem__(self, key: str) -> tuple[str | bytes, ...]: ... - def set_path(self, key: str, path: str) -> None: ... - def __setitem__(self, key: str, value: tuple[str | bytes, ...]) -> None: ... - def __delitem__(self, key: str) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - def __contains__(self, key: object) -> bool: ... - -default_wordsets: WordsetDict -_Wordset: TypeAlias = Literal["eff_long", "eff_short", "eff_prefixed", "bip39"] - -class PhraseGenerator(SequenceGenerator): - wordset: _Wordset - words: Sequence[str | bytes] | None - sep: str | None - def __init__( - self, - wordset: _Wordset | None = None, - words: Sequence[str | bytes] | None = None, - sep: str | bytes | None = None, - *, - entropy: int | None = None, - length: int | None = None, - rng: random.Random | None = None, - ) -> None: ... - @property - def symbol_count(self) -> int: ... - -@overload -def genphrase( - entropy: int | None = None, - length: int | None = None, - returns: None = None, - *, - wordset: _Wordset | None = None, - words: Sequence[str | bytes] | None = None, - sep: str | bytes | None = None, - rng: random.Random | None = None, -) -> str: ... -@overload -def genphrase( - returns: int, - entropy: int | None = None, - length: int | None = None, - *, - wordset: _Wordset | None = None, - words: Sequence[str | bytes] | None = None, - sep: str | bytes | None = None, - rng: random.Random | None = None, -) -> list[str]: ... -@overload -def genphrase( - returns: Callable[[Any], Iterator[Any]], - entropy: int | None = None, - length: int | None = None, - *, - wordset: _Wordset | None = None, - words: Sequence[str | bytes] | None = None, - sep: str | bytes | None = None, - rng: random.Random | None = None, -) -> Iterator[str]: ... - -__all__ = ["genword", "default_charsets", "genphrase", "default_wordsets"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/registry.pyi b/python/helpers/typeshed/stubs/passlib/passlib/registry.pyi deleted file mode 100644 index ff1e5d7a213c..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/registry.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any - -class _PasslibRegistryProxy: - __name__: str - __package__: str | None - def __getattr__(self, attr: str) -> Any: ... # returns handler that is a value from object.__dict__ - def __setattr__(self, attr: str, value) -> None: ... - def __dir__(self) -> list[str]: ... - -def register_crypt_handler_path(name: str, path: str) -> None: ... -def register_crypt_handler( - handler: Any, force: bool = False, _attr: str | None = None -) -> None: ... # expected handler is object with attr handler.name -def get_crypt_handler(name: str, default: Any = ...) -> Any: ... # returns handler or default -def list_crypt_handlers(loaded_only: bool = False) -> list[str]: ... - -__all__ = ["register_crypt_handler_path", "register_crypt_handler", "get_crypt_handler", "list_crypt_handlers"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/totp.pyi b/python/helpers/typeshed/stubs/passlib/passlib/totp.pyi deleted file mode 100644 index 74096fa25862..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/totp.pyi +++ /dev/null @@ -1,159 +0,0 @@ -from collections.abc import Callable -from datetime import datetime -from typing import Any, Literal -from typing_extensions import Self - -from passlib.exc import ( - InvalidTokenError as InvalidTokenError, - MalformedTokenError as MalformedTokenError, - TokenError as TokenError, - UsedTokenError as UsedTokenError, -) -from passlib.utils import SequenceMixin - -class AppWallet: - salt_size: int - encrypt_cost: int - default_tag: str | None - def __init__( - self, - secrets: dict[int, str] | dict[int, bytes] | dict[str, str] | dict[str, bytes] | str | None = None, - default_tag: str | None = None, - encrypt_cost: int | None = None, - secrets_path: str | None = None, - ) -> None: ... - @property - def has_secrets(self) -> bool: ... - def get_secret(self, tag: str) -> bytes: ... - def encrypt_key(self, key: bytes) -> dict[str, Any]: ... - def decrypt_key(self, enckey: dict[str, Any]) -> tuple[bytes, bool]: ... - -class TOTP: - min_json_version: int - json_version: int - wallet: AppWallet | None - now: Callable[[], float] - digits: int - alg: str - label: str | None - issuer: str | None - period: int - changed: bool - @classmethod - def using( - cls, - digits: int | None = None, - alg: Literal["sha1", "sha256", "sha512"] | None = None, - period: int | None = None, - issuer: str | None = None, - wallet: AppWallet | None = None, - now: Callable[[], float] | None = None, - *, - secrets: dict[int, str] | dict[int, bytes] | dict[str, str] | dict[str, bytes] | str | None = None, - **kwds: Any, - ) -> type[TOTP]: ... - @classmethod - def new(cls, **kwds: Any) -> Self: ... - def __init__( - self, - key: str | bytes | None = None, - format: str = "base32", - new: bool = False, - digits: int | None = None, - alg: Literal["sha1", "sha256", "sha512"] | None = None, - size: int | None = None, - period: int | None = None, - label: str | None = None, - issuer: str | None = None, - changed: bool = False, - **kwds: Any, - ) -> None: ... - @property - def key(self) -> bytes: ... - @key.setter - def key(self, value: bytes) -> None: ... - @property - def encrypted_key(self) -> dict[str, Any]: ... - @encrypted_key.setter - def encrypted_key(self, value: dict[str, Any]) -> None: ... - @property - def hex_key(self) -> str: ... - @property - def base32_key(self) -> str: ... - def pretty_key(self, format: str = "base32", sep: str | Literal[False] = "-") -> str: ... - @classmethod - def normalize_time(cls, time: float | datetime | None) -> int: ... - def normalize_token(self_or_cls, token: bytes | str | int) -> str: ... - def generate(self, time: float | datetime | None = None) -> TotpToken: ... - @classmethod - def verify( - cls, - token: int | str, - source: TOTP | dict[str, Any] | str | bytes, - *, - time: float | datetime | None = ..., - window: int = ..., - skew: int = ..., - last_counter: int | None = ..., - ) -> TotpMatch: ... - def match( - self, - token: int | str, - time: float | datetime | None = None, - window: int = 30, - skew: int = 0, - last_counter: int | None = None, - ) -> TotpMatch: ... - @classmethod - def from_source(cls, source: TOTP | dict[str, Any] | str | bytes) -> Self: ... - @classmethod - def from_uri(cls, uri: str) -> Self: ... - def to_uri(self, label: str | None = None, issuer: str | None = None) -> str: ... - @classmethod - def from_json(cls, source: str | bytes) -> Self: ... - def to_json(self, encrypt: bool | None = None) -> str: ... - @classmethod - def from_dict(cls, source: dict[str, Any]) -> Self: ... - def to_dict(self, encrypt: bool | None = None) -> dict[str, Any]: ... - -class TotpToken(SequenceMixin): - totp: TOTP | None - token: str | None - counter: int | None - def __init__(self, totp: TOTP, token: str, counter: int) -> None: ... - @property - def start_time(self) -> int: ... - @property - def expire_time(self) -> int: ... - @property - def remaining(self) -> float: ... - @property - def valid(self) -> bool: ... - -class TotpMatch(SequenceMixin): - totp: TOTP | None - counter: int - time: int - window: int - def __init__(self, totp: TOTP, counter: int, time: int, window: int = 30) -> None: ... - @property - def expected_counter(self) -> int: ... - @property - def skipped(self) -> int: ... - @property - def expire_time(self) -> int: ... - @property - def cache_seconds(self) -> int: ... - @property - def cache_time(self) -> int: ... - -__all__ = [ - "AppWallet", - "TOTP", - "TokenError", - "MalformedTokenError", - "InvalidTokenError", - "UsedTokenError", - "TotpToken", - "TotpMatch", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/__init__.pyi deleted file mode 100644 index 0e1c25103bca..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/__init__.pyi +++ /dev/null @@ -1,87 +0,0 @@ -import random -import timeit -from _typeshed import ReadableBuffer -from collections.abc import Iterable -from hmac import compare_digest -from typing import Final, Literal, SupportsBytes, SupportsIndex, overload - -from passlib.utils.compat import JYTHON as JYTHON - -__all__ = [ - "JYTHON", - "sys_bits", - "unix_crypt_schemes", - "rounds_cost_values", - "consteq", - "saslprep", - "xor_bytes", - "render_bytes", - "is_same_codec", - "is_ascii_safe", - "to_bytes", - "to_unicode", - "to_native_str", - "has_crypt", - "test_crypt", - "safe_crypt", - "tick", - "rng", - "getrandbytes", - "getrandstr", - "generate_password", - "is_crypt_handler", - "is_crypt_context", - "has_rounds_info", - "has_salt_info", -] - -sys_bits: Final[int] -unix_crypt_schemes: list[str] -rounds_cost_values: Final[list[str]] - -class SequenceMixin: - def __getitem__(self, idx): ... - def __iter__(self): ... - def __len__(self) -> int: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - -consteq = compare_digest - -def str_consteq(left: str | bytes, right: str | bytes) -> bool: ... -def splitcomma(source: str, sep: str = ",") -> list[str]: ... -def saslprep(source: str, param: str = "value") -> str: ... -def render_bytes(source: str | bytes, *args: str | bytes) -> bytes: ... -def bytes_to_int(value: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... -def int_to_bytes(value: int, count: SupportsIndex) -> bytes: ... -def xor_bytes( - left: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer, - right: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer, -) -> bytes: ... -def repeat_string(source: str | bytes, size: int) -> str | bytes: ... -def is_ascii_codec(codec: str) -> bool: ... -def is_same_codec(left: str, right: str) -> bool: ... -def is_ascii_safe(source: str | bytes) -> bool: ... -def to_bytes(source: str | bytes, encoding: str = "utf-8", param: str = "value", source_encoding: str | None = None) -> bytes: ... -def to_unicode(source: str | bytes, encoding: str = "utf-8", param: str = "value") -> str: ... -def to_native_str(source: str | bytes, encoding: str = "utf-8", param: str = "value") -> str: ... - -has_crypt: bool - -def safe_crypt(secret: str | bytes, hash: str | bytes) -> str | None: ... -def test_crypt(secret: str | bytes, hash: str) -> bool: ... - -timer = timeit.default_timer -tick = timer -rng: random.Random - -@overload -def getrandbytes(rng: random.Random, count: None) -> Literal[b""]: ... -@overload -def getrandbytes(rng: random.Random, count) -> bytes: ... -def getrandstr(rng: random.Random, charset: str, count: int) -> str: ... -def generate_password(size: int = 10, charset: str = ...) -> str: ... -def is_crypt_handler(obj) -> bool: ... -def is_crypt_context(obj) -> bool: ... -def has_rounds_info(handler) -> bool: ... -def has_salt_info(handler) -> bool: ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/binary.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/binary.pyi deleted file mode 100644 index 2c1336b5131d..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/binary.pyi +++ /dev/null @@ -1,83 +0,0 @@ -from _typeshed import ReadableBuffer -from logging import Logger -from typing import Any, Final - -log: Logger - -BASE64_CHARS: Final[str] -AB64_CHARS: Final[str] -HASH64_CHARS: Final[str] -BCRYPT_CHARS: Final[str] -PADDED_BASE64_CHARS: Final[str] -HEX_CHARS: Final[str] -UPPER_HEX_CHARS: Final[str] -LOWER_HEX_CHARS: Final[str] -ALL_BYTE_VALUES: Final[bytes] - -def compile_byte_translation(mapping: dict[str | bytes | int, str | bytes], source: bytes | None = None) -> bytes: ... -def b64s_encode(data: ReadableBuffer) -> bytes: ... -def b64s_decode(data: str | ReadableBuffer) -> bytes: ... -def ab64_encode(data: ReadableBuffer) -> bytes: ... -def ab64_decode(data: str | ReadableBuffer) -> bytes: ... -def b32encode(source: ReadableBuffer) -> str: ... -def b32decode(source: str | bytes) -> bytes: ... - -class Base64Engine: - bytemap: Any - big: Any - def __init__(self, charmap, big: bool = False) -> None: ... - @property - def charmap(self): ... - def encode_bytes(self, source): ... - def decode_bytes(self, source): ... - def check_repair_unused(self, source): ... - def repair_unused(self, source): ... - def encode_transposed_bytes(self, source, offsets): ... - def decode_transposed_bytes(self, source, offsets): ... - def decode_int6(self, source): ... - def decode_int12(self, source): ... - def decode_int24(self, source): ... - def decode_int30(self, source): ... - def decode_int64(self, source): ... - def encode_int6(self, value): ... - def encode_int12(self, value): ... - def encode_int24(self, value): ... - def encode_int30(self, value): ... - def encode_int64(self, value): ... - -class LazyBase64Engine(Base64Engine): - def __init__(self, *args, **kwds) -> None: ... - def __getattribute__(self, attr: str): ... - -h64: Base64Engine -h64big: Base64Engine -bcrypt64: Base64Engine - -__all__ = [ - # constants - "BASE64_CHARS", - "PADDED_BASE64_CHARS", - "AB64_CHARS", - "HASH64_CHARS", - "BCRYPT_CHARS", - "HEX_CHARS", - "LOWER_HEX_CHARS", - "UPPER_HEX_CHARS", - "ALL_BYTE_VALUES", - # misc - "compile_byte_translation", - # base64 - "ab64_encode", - "ab64_decode", - "b64s_encode", - "b64s_decode", - # base32 - "b32encode", - "b32decode", - # custom encodings - "Base64Engine", - "LazyBase64Engine", - "h64", - "h64big", - "bcrypt64", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/__init__.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/__init__.pyi deleted file mode 100644 index 591083c8a8dd..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/__init__.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Literal - -PY2: Literal[False] -PY3: Literal[True] -PY26: Literal[False] -JYTHON: bool -PYPY: bool -PYSTON: bool diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi deleted file mode 100644 index 7fafb44f3c4e..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Generator -from typing import Any - -class OrderedDict(dict[Any, Any]): - def __init__(self, *args, **kwds) -> None: ... - def __setitem__(self, key, value, dict_setitem=...) -> None: ... - def __delitem__(self, key, dict_delitem=...) -> None: ... - def __iter__(self): ... - def __reversed__(self) -> Generator[Any, None, None]: ... - def clear(self) -> None: ... - def popitem(self, last: bool = ...): ... - def keys(self): ... - def values(self): ... - def items(self): ... - def iterkeys(self): ... - def itervalues(self) -> Generator[Any, None, None]: ... - def iteritems(self) -> Generator[Any, None, None]: ... - def update(*args, **kwds) -> None: ... # type: ignore[override] - def pop(self, key, default=...): ... - def setdefault(self, key, default: Incomplete | None = ...): ... - def __reduce__(self): ... - def copy(self): ... - @classmethod - def fromkeys(cls, iterable, value: Incomplete | None = ...): ... - def __eq__(self, other): ... - def __ne__(self, other): ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/decor.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/decor.pyi deleted file mode 100644 index 939db459430c..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/decor.pyi +++ /dev/null @@ -1,38 +0,0 @@ -from typing import Any - -class classproperty: - im_func: Any - def __init__(self, func) -> None: ... - def __get__(self, obj, cls): ... - @property - def __func__(self): ... - -class hybrid_method: - func: Any - def __init__(self, func) -> None: ... - def __get__(self, obj, cls): ... - -def memoize_single_value(func): ... - -class memoized_property: - __func__: Any - __name__: Any - __doc__: Any - def __init__(self, func) -> None: ... - def __get__(self, obj, cls): ... - def clear_cache(self, obj) -> None: ... - def peek_cache(self, obj, default=None): ... - -def deprecated_function( - msg=None, deprecated=None, removed=None, updoc: bool = True, replacement=None, _is_method: bool = False, func_module=None -): ... -def deprecated_method(msg=None, deprecated=None, removed=None, updoc: bool = True, replacement=None): ... - -__all__ = [ - "classproperty", - "hybrid_method", - "memoize_single_value", - "memoized_property", - "deprecated_function", - "deprecated_method", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/des.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/des.pyi deleted file mode 100644 index 082fe898160c..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/des.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from passlib.crypto.des import ( - des_encrypt_block as des_encrypt_block, - des_encrypt_int_block as des_encrypt_int_block, - expand_des_key as expand_des_key, -) -from passlib.utils.decor import deprecated_function as deprecated_function - -def mdes_encrypt_int_block(key, input, salt: int = 0, rounds: int = 1): ... diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/handlers.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/handlers.pyi deleted file mode 100644 index c4ece5c75b0d..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/handlers.pyi +++ /dev/null @@ -1,192 +0,0 @@ -import abc -from _typeshed import Incomplete -from typing import Any, ClassVar -from typing_extensions import Self - -from passlib.ifc import PasswordHash -from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS - -H64_CHARS = HASH64_CHARS -B64_CHARS = BASE64_CHARS -PADDED_B64_CHARS = PADDED_BASE64_CHARS -UC_HEX_CHARS = UPPER_HEX_CHARS -LC_HEX_CHARS = LOWER_HEX_CHARS - -def parse_mc2(hash, prefix, sep="$", handler=None): ... -def parse_mc3(hash, prefix, sep="$", rounds_base: int = 10, default_rounds=None, handler=None): ... -def render_mc2(ident, salt, checksum, sep="$"): ... -def render_mc3(ident, rounds, salt, checksum, sep="$", rounds_base: int = 10): ... - -class MinimalHandler(PasswordHash, metaclass=abc.ABCMeta): - @classmethod - def using(cls, relaxed: bool = False) -> type[Self]: ... # type: ignore[override] - -class TruncateMixin(MinimalHandler, metaclass=abc.ABCMeta): - truncate_error: ClassVar[bool] - truncate_verify_reject: ClassVar[bool] - @classmethod - def using(cls, truncate_error: object = None, **kwds: Any) -> type[Self]: ... # type: ignore[override] - -class GenericHandler(MinimalHandler): - setting_kwds: ClassVar[tuple[str, ...]] - context_kwds: ClassVar[tuple[str, ...]] - ident: ClassVar[str | None] - checksum_size: ClassVar[int | None] - checksum_chars: ClassVar[str | None] - checksum: str | None - use_defaults: bool - def __init__(self, checksum: str | None = None, use_defaults: bool = False) -> None: ... - @classmethod - def identify(cls, hash: str | bytes) -> bool: ... - @classmethod - def from_string(cls, hash: str | bytes, **context: Any) -> Self: ... # context parameters are passed to constructor - def to_string(self) -> str: ... - @classmethod - def hash(cls, secret: str | bytes, **kwds: Any) -> str: ... - @classmethod - def verify(cls, secret: str | bytes, hash: str | bytes, **context: Any) -> bool: ... - @classmethod - def genconfig(cls, **kwds: Any) -> str: ... - @classmethod - def genhash(cls, secret: str | bytes, config: str, **context: Any) -> str: ... - @classmethod - def needs_update(cls, hash: str | bytes, secret: str | bytes | None = None, **kwds: Any) -> bool: ... - @classmethod - def parsehash(cls, hash: str | bytes, checksum: bool = True, sanitize: bool = False) -> dict[str, Any]: ... - @classmethod - def bitsize(cls, **kwds: Any) -> dict[str, Any]: ... - -class StaticHandler(GenericHandler): - setting_kwds: ClassVar[tuple[str, ...]] - -class HasEncodingContext(GenericHandler): - default_encoding: ClassVar[str] - encoding: str - def __init__(self, encoding: str | None = None, **kwds) -> None: ... - -class HasUserContext(GenericHandler): - user: Incomplete | None - def __init__(self, user=None, **kwds) -> None: ... - @classmethod - def hash(cls, secret, user=None, **context): ... - @classmethod - def verify(cls, secret, hash, user=None, **context): ... - @classmethod - def genhash(cls, secret, config, user=None, **context): ... - -class HasRawChecksum(GenericHandler): ... - -class HasManyIdents(GenericHandler): - default_ident: ClassVar[str | None] - ident_values: ClassVar[tuple[str, ...] | None] - ident_aliases: ClassVar[dict[str, str] | None] - ident: str # type: ignore[misc] - @classmethod - def using(cls, default_ident=None, ident=None, **kwds): ... # type: ignore[override] - def __init__(self, ident=None, **kwds) -> None: ... - -class HasSalt(GenericHandler): - min_salt_size: ClassVar[int] - max_salt_size: ClassVar[int | None] - salt_chars: ClassVar[str | None] - default_salt_size: ClassVar[int | None] - default_salt_chars: ClassVar[str | None] - salt: str | bytes | None - @classmethod - def using( # type: ignore[override] - cls, default_salt_size: int | None = None, salt_size: int | None = None, salt: str | bytes | None = None, **kwds - ): ... - def __init__(self, salt: str | bytes | None = None, **kwds) -> None: ... - @classmethod - def bitsize(cls, salt_size: int | None = None, **kwds): ... - -class HasRawSalt(HasSalt): - salt_chars: ClassVar[bytes] # type: ignore[assignment] - -class HasRounds(GenericHandler): - min_rounds: ClassVar[int] - max_rounds: ClassVar[int | None] - rounds_cost: ClassVar[str] - using_rounds_kwds: ClassVar[tuple[str, ...]] - min_desired_rounds: ClassVar[int | None] - max_desired_rounds: ClassVar[int | None] - default_rounds: ClassVar[int | None] - vary_rounds: ClassVar[Incomplete | None] - rounds: int - @classmethod - def using( # type: ignore[override] - cls, - min_desired_rounds=None, - max_desired_rounds=None, - default_rounds=None, - vary_rounds=None, - min_rounds=None, - max_rounds=None, - rounds=None, - **kwds, - ): ... - def __init__(self, rounds=None, **kwds) -> None: ... - @classmethod - def bitsize(cls, rounds=None, vary_rounds: float = 0.1, **kwds): ... - -class ParallelismMixin(GenericHandler): - parallelism: int - @classmethod - def using(cls, parallelism=None, **kwds): ... # type: ignore[override] - def __init__(self, parallelism=None, **kwds) -> None: ... - -class BackendMixin(PasswordHash, metaclass=abc.ABCMeta): - backends: ClassVar[tuple[str, ...] | None] - @classmethod - def get_backend(cls): ... - @classmethod - def has_backend(cls, name: str = "any") -> bool: ... - @classmethod - def set_backend(cls, name: str = "any", dryrun: bool = False): ... - -class SubclassBackendMixin(BackendMixin, metaclass=abc.ABCMeta): ... -class HasManyBackends(BackendMixin, GenericHandler): ... - -class PrefixWrapper: - name: Any - prefix: Any - orig_prefix: Any - __doc__: Any - def __init__(self, name, wrapped, prefix="", orig_prefix="", lazy: bool = False, doc=None, ident=None) -> None: ... - @property - def wrapped(self): ... - @property - def ident(self): ... - @property - def ident_values(self): ... - def __dir__(self): ... - def __getattr__(self, attr: str): ... - def __setattr__(self, attr: str, value) -> None: ... - def using(self, **kwds): ... - def needs_update(self, hash, **kwds): ... - def identify(self, hash): ... - def genconfig(self, **kwds): ... - def genhash(self, secret, config, **kwds): ... - def encrypt(self, secret, **kwds): ... - def hash(self, secret, **kwds): ... - def verify(self, secret, hash, **kwds): ... - -__all__ = [ - # helpers for implementing MCF handlers - "parse_mc2", - "parse_mc3", - "render_mc2", - "render_mc3", - # framework for implementing handlers - "GenericHandler", - "StaticHandler", - "HasUserContext", - "HasRawChecksum", - "HasManyIdents", - "HasSalt", - "HasRawSalt", - "HasRounds", - "HasManyBackends", - # other helpers - "PrefixWrapper", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/md4.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/md4.pyi deleted file mode 100644 index 3ce1272632b6..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/md4.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Any - -md4: Any - -__all__ = ["md4"] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/utils/pbkdf2.pyi b/python/helpers/typeshed/stubs/passlib/passlib/utils/pbkdf2.pyi deleted file mode 100644 index f64dfb4d02aa..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/utils/pbkdf2.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from passlib.crypto.digest import norm_hash_name as norm_hash_name - -def get_prf(name): ... -def pbkdf1(secret, salt, rounds, keylen=None, hash: str = "sha1"): ... -def pbkdf2(secret, salt, rounds, keylen=None, prf: str = "hmac-sha1"): ... - -__all__ = [ - # hash utils - "norm_hash_name", - # prf utils - "get_prf", - # kdfs - "pbkdf1", - "pbkdf2", -] diff --git a/python/helpers/typeshed/stubs/passlib/passlib/win32.pyi b/python/helpers/typeshed/stubs/passlib/passlib/win32.pyi deleted file mode 100644 index b9118d9c4b73..000000000000 --- a/python/helpers/typeshed/stubs/passlib/passlib/win32.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from binascii import hexlify as hexlify -from typing import Final, Literal, overload - -from passlib.handlers.windows import nthash as nthash - -LM_MAGIC: Final[bytes] -raw_nthash = nthash.raw_nthash - -@overload -def raw_lmhash(secret: str | bytes, encoding: str = "ascii", hex: Literal[False] = False) -> bytes: ... -@overload -def raw_lmhash(secret: str | bytes, encoding: str, hex: Literal[True]) -> str: ... -@overload -def raw_lmhash(secret: str | bytes, *, hex: Literal[True]) -> str: ... - -__all__ = ["nthash", "raw_lmhash", "raw_nthash"] diff --git a/python/helpers/typeshed/stubs/pyinstaller/METADATA.toml b/python/helpers/typeshed/stubs/pyinstaller/METADATA.toml index c66bbb9fab64..2da8e52679a8 100644 --- a/python/helpers/typeshed/stubs/pyinstaller/METADATA.toml +++ b/python/helpers/typeshed/stubs/pyinstaller/METADATA.toml @@ -1,2 +1,2 @@ -version = "6.18.*" +version = "6.19.*" upstream_repository = "https://github.com/pyinstaller/pyinstaller" diff --git a/python/helpers/typeshed/stubs/pyperclip/METADATA.toml b/python/helpers/typeshed/stubs/pyperclip/METADATA.toml index 885e7747f335..9e2c211f627d 100644 --- a/python/helpers/typeshed/stubs/pyperclip/METADATA.toml +++ b/python/helpers/typeshed/stubs/pyperclip/METADATA.toml @@ -1,4 +1,4 @@ -version = "1.9.*" +version = "1.11.*" upstream_repository = "https://github.com/asweigart/pyperclip" [tool.stubtest] diff --git a/python/helpers/typeshed/stubs/reportlab/@tests/stubtest_allowlist.txt b/python/helpers/typeshed/stubs/reportlab/@tests/stubtest_allowlist.txt index 4d0f9ed51ff3..0c7995b12587 100644 --- a/python/helpers/typeshed/stubs/reportlab/@tests/stubtest_allowlist.txt +++ b/python/helpers/typeshed/stubs/reportlab/@tests/stubtest_allowlist.txt @@ -73,7 +73,6 @@ reportlab.lib.abag.ABag.__setattr__ reportlab.lib.styles.PropertySet.__setattr__ # *-imports that cause a mess we don't want to propagate -reportlab.graphics.charts.lineplots.pi reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.EVEN_ODD reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.FILL_EVEN_ODD reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.FILL_NON_ZERO diff --git a/python/helpers/typeshed/stubs/reportlab/METADATA.toml b/python/helpers/typeshed/stubs/reportlab/METADATA.toml index d97d0d814420..33ce4a87e357 100644 --- a/python/helpers/typeshed/stubs/reportlab/METADATA.toml +++ b/python/helpers/typeshed/stubs/reportlab/METADATA.toml @@ -1,4 +1,4 @@ -version = "4.4.9" +version = "4.4.10" # GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file upstream_repository = "https://github.com/MrBitBucket/reportlab-mirror" diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/graphics/charts/utils.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/graphics/charts/utils.pyi index 607d3b15a387..5139374047ea 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/graphics/charts/utils.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/graphics/charts/utils.pyi @@ -1,6 +1,29 @@ from _typeshed import Incomplete -from typing import Final +from collections.abc import Sequence +from typing import Final, Literal +__all__ = ( + "angle2corner", + "angle2dir", + "boxCornerCoords", + "CustomDrawChanger", + "DrawTimeCollector", + "FillPairedData", + "find_good_grid", + "find_interval", + "findNones", + "lineSegmentIntersect", + "makeCircularString", + "maverage", + "mkTimeTuple", + "nextRoundNumber", + "pairFixNones", + "pairMaverage", + "seconds2str", + "str2seconds", + "ticks", + "xyDist", +) __version__: Final[str] def mkTimeTuple(timeString): ... @@ -43,3 +66,7 @@ class CustomDrawChanger: class FillPairedData(list[Incomplete]): other: Incomplete def __init__(self, v, other: int = 0) -> None: ... + +def angle2dir(angle: float) -> Literal["n", "ne", "e", "se", "s", "sw", "w", "nw", "c"]: ... +def angle2corner(angle: float) -> Literal["n", "ne", "e", "se", "s", "sw", "w", "nw", "c"]: ... +def boxCornerCoords(bb: Sequence[float], cn: Literal["n", "ne", "e", "se", "s", "sw", "w", "nw", "c"]) -> tuple[float, float]: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/PyFontify.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/PyFontify.pyi index c1bcc0d67e05..cf5a8f4c7b38 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/PyFontify.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/PyFontify.pyi @@ -1,3 +1,4 @@ +import re from _typeshed import Incomplete from typing import Final @@ -5,17 +6,17 @@ __version__: Final[str] def replace(src, sep, rep): ... -keywordsList: Incomplete +keywordsList: list[str] commentPat: str pat: str -quotePat: Incomplete -tripleQuotePat: Incomplete +quotePat: str +tripleQuotePat: str nonKeyPat: str -keyPat: Incomplete -matchPat: Incomplete -matchRE: Incomplete +keyPat: str +matchPat: str +matchRE: re.Pattern[str] idKeyPat: str -idRE: Incomplete +idRE: re.Pattern[str] -def fontify(pytext, searchfrom: int = 0, searchto=None): ... +def fontify(pytext, searchfrom: int = 0, searchto=None) -> list[tuple[str, int, int, Incomplete]]: ... def test(path) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/arciv.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/arciv.pyi index 0fa1d8aee78c..501f1df37996 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/arciv.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/arciv.pyi @@ -1,9 +1,9 @@ class ArcIV: def __init__(self, key) -> None: ... def reset(self) -> None: ... - def encode(self, S): ... + def encode(self, S: str | bytes | list[int]) -> bytes: ... -def encode(text, key): ... -def decode(text, key): ... +def encode(text: str | bytes | list[int], key) -> bytes: ... +def decode(text: str | bytes | list[int], key) -> bytes: ... __all__ = ["ArcIV", "encode", "decode"] diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/attrmap.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/attrmap.pyi index ac586aadc7f1..a951823e0b91 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/attrmap.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/attrmap.pyi @@ -19,8 +19,8 @@ class AttrMapValue: class AttrMap(dict[str, AttrMapValue]): def __init__(self, BASE=None, UNWANTED=[], **kw) -> None: ... def remove(self, unwanted) -> None: ... - def clone(self, UNWANTED=[], **kw): ... + def clone(self, UNWANTED=[], **kw) -> AttrMap: ... def validateSetattr(obj, name, value) -> None: ... -def hook__setattr__(obj): ... +def hook__setattr__(obj) -> None: ... def addProxyAttribute(src, name, validate=None, desc=None, initial=None, dst=None) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/boxstuff.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/boxstuff.pyi index 1bd2d1f13466..24343fe30f39 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/boxstuff.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/boxstuff.pyi @@ -1,6 +1,14 @@ -from typing import Final +from _typeshed import Incomplete +from typing import Final, Literal, overload __version__: Final[str] -def rectCorner(x, y, width, height, anchor: str = "sw", dims: bool = False): ... -def aspectRatioFix(preserve, anchor, x, y, width, height, imWidth, imHeight, anchorAtXY: bool = False): ... +@overload +def rectCorner( + x, y, width, height, anchor: str = "sw", dims: Literal[True] = ... +) -> 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/python/helpers/typeshed/stubs/reportlab/reportlab/lib/codecharts.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/codecharts.pyi index 2f514340c0b1..b91508e6c77a 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/codecharts.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/codecharts.pyi @@ -1,11 +1,12 @@ from _typeshed import Incomplete from typing import Final +from reportlab.graphics.shapes import Group from reportlab.graphics.widgetbase import Widget from reportlab.platypus import Flowable __version__: Final[str] -adobe2codec: Incomplete +adobe2codec: dict[str, str] class CodeChartBase(Flowable): rows: Incomplete @@ -14,7 +15,7 @@ class CodeChartBase(Flowable): ylist: Incomplete xlist: Incomplete def calcLayout(self) -> None: ... - def formatByte(self, byt): ... + def formatByte(self, byt) -> str: ... def drawChars(self, charList) -> None: ... def drawLabels(self, topLeft: str = "") -> None: ... @@ -35,7 +36,7 @@ class SingleByteEncodingChart(CodeChartBase): boxSize: int = 14, hex: int = 1, ) -> None: ... - def draw(self): ... + def draw(self) -> None: ... class KutenRowCodeChart(CodeChartBase): row: Incomplete @@ -49,7 +50,7 @@ class KutenRowCodeChart(CodeChartBase): encodingName: Incomplete fontName: Incomplete def __init__(self, row, faceName, encodingName) -> None: ... - def makeRow(self, row): ... + def makeRow(self, row) -> list[bytes | list[None]]: ... def draw(self) -> None: ... class Big5CodeChart(CodeChartBase): @@ -64,7 +65,7 @@ class Big5CodeChart(CodeChartBase): rowLabels: Incomplete fontName: Incomplete def __init__(self, row, faceName, encodingName) -> None: ... - def makeRow(self, row): ... + def makeRow(self, row) -> list[bytes | list[None]]: ... def draw(self) -> None: ... def hBoxText(msg, canvas, x, y, fontName) -> None: ... @@ -75,6 +76,6 @@ class CodeWidget(Widget): width: int height: int def __init__(self) -> None: ... - def draw(self): ... + def draw(self) -> Group: ... def test() -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/corp.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/corp.pyi index 59df816f8c0f..9c71b4a4cc9f 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/corp.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/corp.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete +from collections.abc import Iterable from typing import Final +from reportlab.graphics.shapes import Drawing, Group from reportlab.graphics.widgetbase import Widget from reportlab.lib.attrmap import * from reportlab.lib.validators import * @@ -24,10 +26,10 @@ class RL_CorpLogo(Widget): pageColors: Incomplete prec: Incomplete def __init__(self) -> None: ... - def demo(self): ... + def demo(self) -> Drawing: ... @staticmethod def applyPrec(P, prec): ... - def draw(self): ... + def draw(self) -> Group: ... class RL_CorpLogoReversed(RL_CorpLogo): background: Incomplete @@ -42,8 +44,8 @@ class RL_CorpLogoThin(Widget): height: Incomplete width: Incomplete def __init__(self) -> None: ... - def demo(self): ... - def draw(self): ... + def demo(self) -> Drawing: ... + def draw(self) -> Group: ... class ReportLabLogo: origin: Incomplete @@ -73,7 +75,7 @@ class RL_BusinessCard(Widget): web: str rh_blurb_top: Incomplete def __init__(self) -> None: ... - def demo(self): ... - def draw(self): ... + def demo(self) -> Drawing: ... + def draw(self) -> Group: ... -def test(formats=["pdf", "eps", "jpg", "gif", "svg"]) -> None: ... +def test(formats: Iterable[str] = ["pdf", "eps", "jpg", "gif", "svg"]) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/extformat.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/extformat.pyi index b63e249399ae..4d9f857e35f8 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/extformat.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/extformat.pyi @@ -1,6 +1,9 @@ -from typing import Final +from collections.abc import Mapping +from typing import Any, Final __version__: Final[str] -def dictformat(_format, L={}, G={}): ... -def magicformat(format): ... +def dictformat( + _format: str, L: Mapping[str, object] | None = {}, G: dict[str, Any] | None = {} # `L` and `G` are passed to `eval` function +) -> str: ... +def magicformat(format: str) -> str: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/fontfinder.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/fontfinder.pyi index 05370969b197..1cbcb05c185e 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/fontfinder.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/fontfinder.pyi @@ -1,20 +1,21 @@ from _typeshed import Incomplete from typing import Final +from typing_extensions import LiteralString __version__: Final[str] -def asNative(s): ... +def asNative(s) -> str: ... -EXTENSIONS: Incomplete -FF_FIXED: Incomplete -FF_SERIF: Incomplete -FF_SYMBOLIC: Incomplete -FF_SCRIPT: Incomplete -FF_NONSYMBOLIC: Incomplete -FF_ITALIC: Incomplete -FF_ALLCAP: Incomplete -FF_SMALLCAP: Incomplete -FF_FORCEBOLD: Incomplete +EXTENSIONS: Final = [".ttf", ".ttc", ".otf", ".pfb", ".pfa"] +FF_FIXED: Final = 1 +FF_SERIF: Final = 2 +FF_SYMBOLIC: Final = 4 +FF_SCRIPT: Final = 8 +FF_NONSYMBOLIC: Final = 32 +FF_ITALIC: Final = 64 +FF_ALLCAP: Final = 65536 +FF_SMALLCAP: Final = 131072 +FF_FORCEBOLD: Final = 262144 class FontDescriptor: name: Incomplete @@ -30,7 +31,7 @@ class FontDescriptor: metricsFileName: Incomplete timeModified: int def __init__(self) -> None: ... - def getTag(self): ... + def getTag(self) -> LiteralString: ... class FontFinder: useCache: Incomplete @@ -41,11 +42,11 @@ class FontFinder: ) -> None: ... def addDirectory(self, dirName, recur=None) -> None: ... def addDirectories(self, dirNames, recur=None) -> None: ... - def getFamilyNames(self): ... + def getFamilyNames(self) -> list[bytes]: ... def getFontsInFamily(self, familyName): ... - def getFamilyXmlReport(self): ... - def getFontsWithAttributes(self, **kwds): ... - def getFont(self, familyName, bold: bool = False, italic: bool = False): ... + def getFamilyXmlReport(self) -> LiteralString: ... + def getFontsWithAttributes(self, **kwds) -> list[FontDescriptor]: ... + def getFont(self, familyName, bold: bool = False, italic: bool = False) -> FontDescriptor: ... def save(self, fileName) -> None: ... def load(self, fileName) -> None: ... def search(self) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/formatters.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/formatters.pyi index c88692bc1331..bb46a3be1d94 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/formatters.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/formatters.pyi @@ -1,19 +1,23 @@ from _typeshed import Incomplete +from typing import Literal +from typing_extensions import LiteralString class Formatter: - pattern: Incomplete - def __init__(self, pattern) -> None: ... - def format(self, obj): ... - def __call__(self, x): ... + pattern: str + def __init__(self, pattern: str) -> None: ... + def format(self, obj: object) -> str: ... + def __call__(self, x: object) -> str: ... class DecimalFormatter(Formatter): calcPlaces: Incomplete - places: Incomplete + places: int dot: Incomplete comma: Incomplete prefix: Incomplete suffix: Incomplete - def __init__(self, places: int = 2, decimalSep: str = ".", thousandSep=None, prefix=None, suffix=None) -> None: ... - def format(self, num): ... + def __init__( + self, places: int | Literal["auto"] = 2, decimalSep: str = ".", thousandSep=None, prefix=None, suffix=None + ) -> None: ... + def format(self, num) -> LiteralString: ... __all__ = ("Formatter", "DecimalFormatter") diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/geomutils.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/geomutils.pyi index a3d70aa15bd5..1fec093fb40c 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/geomutils.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/geomutils.pyi @@ -2,4 +2,4 @@ from typing import Final __version__: Final[str] -def normalizeTRBL(p): ... +def normalizeTRBL(p: float | tuple[float, ...] | list[float]) -> tuple[float, ...]: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/logger.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/logger.pyi index 5e802c369ef2..ce7635c168ee 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/logger.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/logger.pyi @@ -10,15 +10,15 @@ class Logger: def write(self, text) -> None: ... def __call__(self, text) -> None: ... -logger: Incomplete +logger: Logger class WarnOnce: - uttered: Incomplete - pfx: Incomplete - enabled: int + uttered: dict[Incomplete, Incomplete] + pfx: str + enabled: bool | int def __init__(self, kind: str = "Warn") -> None: ... def once(self, warning) -> None: ... def __call__(self, warning) -> None: ... -warnOnce: Incomplete -infoOnce: Incomplete +warnOnce: WarnOnce +infoOnce: WarnOnce diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/normalDate.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/normalDate.pyi index 0d26498cb29e..98e40086381d 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/normalDate.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/normalDate.pyi @@ -1,82 +1,83 @@ -from _typeshed import Incomplete -from typing import Final +from _typeshed import ConvertibleToInt +from typing import Final, Literal +from typing_extensions import Self __version__: Final[str] -def getStdMonthNames(): ... -def getStdShortMonthNames(): ... -def getStdDayNames(): ... -def getStdShortDayNames(): ... -def isLeapYear(year): ... +def getStdMonthNames() -> list[str]: ... +def getStdShortMonthNames() -> list[str]: ... +def getStdDayNames() -> list[str]: ... +def getStdShortDayNames() -> list[str]: ... +def isLeapYear(year: int) -> Literal[0, 1]: ... class NormalDateException(Exception): ... class NormalDate: def __init__(self, normalDate=None) -> None: ... def add(self, days) -> None: ... - def __add__(self, days): ... - def __radd__(self, days): ... - def clone(self): ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __ge__(self, other): ... - def __gt__(self, other): ... - def day(self): ... - def dayOfWeek(self): ... + def __add__(self, days: int) -> Self: ... + def __radd__(self, days: int) -> Self: ... + def clone(self) -> Self: ... + def __lt__(self, other) -> bool: ... + def __le__(self, other) -> bool: ... + def __eq__(self, other) -> bool: ... + def __ne__(self, other) -> bool: ... + def __ge__(self, other) -> bool: ... + def __gt__(self, other) -> bool: ... + def day(self) -> int: ... + def dayOfWeek(self) -> int: ... @property def __day_of_week_name__(self): ... def dayOfWeekAbbrev(self): ... def dayOfWeekName(self): ... - def dayOfYear(self): ... - def daysBetweenDates(self, normalDate): ... - def equals(self, target): ... - def endOfMonth(self): ... - def firstDayOfMonth(self): ... - def formatUS(self): ... - def formatUSCentury(self): ... + def dayOfYear(self) -> int: ... + def daysBetweenDates(self, normalDate) -> int: ... + def equals(self, target) -> bool | Literal[0]: ... + def endOfMonth(self) -> Self: ... + def firstDayOfMonth(self) -> Self: ... + def formatUS(self) -> str: ... + def formatUSCentury(self) -> str: ... def formatMS(self, fmt): ... - def __hash__(self): ... + def __hash__(self) -> int: ... def __int__(self) -> int: ... - def isLeapYear(self): ... - def lastDayOfMonth(self): ... - def localeFormat(self): ... - def month(self): ... + def isLeapYear(self) -> Literal[0, 1]: ... + def lastDayOfMonth(self) -> int: ... + def localeFormat(self) -> str: ... + def month(self) -> int: ... @property def __month_name__(self): ... def monthAbbrev(self): ... def monthName(self): ... def normalize(self, scalar) -> None: ... - def range(self, days): ... - def scalar(self): ... + def range(self, days) -> list[NormalDate]: ... + def scalar(self) -> int: ... def setDay(self, day) -> None: ... def setMonth(self, month) -> None: ... - normalDate: Incomplete + normalDate: int | None def setNormalDate(self, normalDate) -> None: ... def setYear(self, year) -> None: ... def __sub__(self, v): ... def __rsub__(self, v): ... - def toTuple(self): ... - def year(self): ... + def toTuple(self) -> tuple[int, int, int]: ... + def year(self) -> int: ... -def bigBang(): ... -def bigCrunch(): ... -def dayOfWeek(y, m, d): ... -def firstDayOfYear(year): ... +def bigBang() -> NormalDate: ... +def bigCrunch() -> NormalDate: ... +def dayOfWeek(y: int, m: int, d: int) -> int: ... +def firstDayOfYear(year: int) -> int: ... def FND(d): ... -Epoch: Incomplete +Epoch: NormalDate ND = NormalDate -BDEpoch: Incomplete +BDEpoch: ND BDEpochScalar: int class BusinessDate(NormalDate): - def add(self, days) -> None: ... - def __add__(self, days): ... + def add(self, days: int) -> None: ... + def __add__(self, days: int) -> Self: ... def __sub__(self, v): ... - def asNormalDate(self): ... - def daysBetweenDates(self, normalDate): ... - def normalize(self, i) -> None: ... + def asNormalDate(self) -> ND: ... + def daysBetweenDates(self, normalDate) -> int: ... + def normalize(self, i: ConvertibleToInt) -> None: ... def scalar(self): ... def setNormalDate(self, normalDate) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pdfencrypt.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pdfencrypt.pyi index d81d451618ec..50e9e4ba13de 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pdfencrypt.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pdfencrypt.pyi @@ -7,17 +7,17 @@ from reportlab.platypus.flowables import Flowable __version__: Final[str] -def xorKey(num, key): ... +def xorKey(num: int, key: bytes) -> bytes: ... CLOBBERID: int CLOBBERPERMISSIONS: int -DEBUG: Incomplete +DEBUG: int reserved1: int -reserved2: Incomplete -printable: Incomplete -modifiable: Incomplete -copypastable: Incomplete -annotatable: Incomplete +reserved2: int +printable: int +modifiable: int +copypastable: int +annotatable: int higherbits: int os_urandom = os.urandom @@ -43,8 +43,8 @@ class StandardEncryption: strength=None, ) -> None: ... def setAllPermissions(self, value) -> None: ... - def permissionBits(self): ... - def encode(self, t): ... + def permissionBits(self) -> int: ... + def encode(self, t) -> bytes: ... P: Incomplete key: Incomplete U: Incomplete @@ -55,32 +55,32 @@ class StandardEncryption: def prepare(self, document, overrideID=None) -> None: ... version: Incomplete def register(self, objnum, version) -> None: ... - def info(self): ... + def info(self) -> StandardEncryptionDictionary: ... class StandardEncryptionDictionary(PDFObject): __RefOnly__: int revision: Incomplete def __init__(self, O, OE, U, UE, P, Perms, revision) -> None: ... - def format(self, document): ... + def format(self, document) -> bytes: ... padding: str -def hexText(text): ... -def unHexText(hexText): ... +def hexText(text: str | bytes | bytearray) -> str: ... +def unHexText(hexText) -> bytes: ... -PadString: Incomplete +PadString: bytes def checkRevision(revision): ... -def encryptionkey(password, OwnerKey, Permissions, FileId1, revision=None): ... -def computeO(userPassword, ownerPassword, revision): ... +def encryptionkey(password, OwnerKey, Permissions, FileId1, revision=None) -> bytes: ... +def computeO(userPassword, ownerPassword, revision) -> bytes: ... def computeU( encryptionkey, encodestring=b"(\xbfN^Nu\x8aAd\x00NV\xff\xfa\x01\x08..\x00\xb6\xd0h>\x80/\x0c\xa9\xfedSiz", revision=None, documentId=None, -): ... +) -> bytes: ... def checkU(encryptionkey, U) -> None: ... -def encodePDF(key, objectNumber, generationNumber, string, revision=None): ... +def encodePDF(key, objectNumber, generationNumber, string, revision=None) -> bytes: ... def equalityCheck(observed, expected, label) -> None: ... def test() -> None: ... def encryptCanvas( @@ -117,7 +117,7 @@ def encryptPdfInMemory( canCopy: int = 1, canAnnotate: int = 1, strength: int = 40, -): ... +) -> bytes: ... def encryptPdfOnDisk( inputFileName, outputFileName, @@ -128,6 +128,6 @@ def encryptPdfOnDisk( canCopy: int = 1, canAnnotate: int = 1, strength: int = 40, -): ... +) -> int: ... def scriptInterp() -> None: ... def main() -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pygments2xpre.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pygments2xpre.pyi index f31768798b46..b18d5296345f 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pygments2xpre.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/pygments2xpre.pyi @@ -1,3 +1,3 @@ -def pygments2xpre(s, language: str = "python"): ... - __all__ = ("pygments2xpre",) + +def pygments2xpre(s, language: str = "python"): ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi index 6c2eed8f2074..8ba0650d1fec 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi @@ -5,6 +5,7 @@ import time from _typeshed import Incomplete from collections.abc import Generator from typing import NoReturn +from typing_extensions import Self eval_debug: int strTypes: tuple[type[bytes], type[str]] @@ -25,42 +26,42 @@ class UntrustedAstTransformer(ast.NodeTransformer): nameIsAllowed: Incomplete def __init__(self, names_seen=None, nameIsAllowed=None) -> None: ... @property - def tmpName(self): ... + def tmpName(self) -> str: ... def error(self, node, msg) -> NoReturn: ... def guard_iter(self, node): ... def is_starred(self, ob): ... - def gen_unpack_spec(self, tpl): ... - def protect_unpack_sequence(self, target, value): ... - def gen_unpack_wrapper(self, node, target, ctx: str = "store"): ... - def gen_lambda(self, args, body): ... - def gen_del_stmt(self, name_to_del): ... + def gen_unpack_spec(self, tpl) -> ast.Dict: ... + def protect_unpack_sequence(self, target, value) -> ast.Call: ... + def gen_unpack_wrapper(self, node, target, ctx: str = "store") -> tuple[ast.Name, ast.Try]: ... + def gen_lambda(self, args, body) -> ast.Lambda: ... + def gen_del_stmt(self, name_to_del) -> ast.Delete: ... def transform_slice(self, slice_): ... def isAllowedName(self, node, name) -> None: ... def check_function_argument_names(self, node) -> None: ... - def check_import_names(self, node): ... - def gen_attr_check(self, node, attr_name): ... - def visit_Constant(self, node): ... - def visit_Name(self, node): ... - def visit_Call(self, node): ... - def visit_Attribute(self, node): ... - def visit_Subscript(self, node): ... + def check_import_names(self, node) -> ast.AST: ... + def gen_attr_check(self, node, attr_name) -> ast.BoolOp: ... + def visit_Constant(self, node) -> ast.AST: ... + def visit_Name(self, node) -> ast.AST: ... + def visit_Call(self, node) -> ast.AST: ... + def visit_Attribute(self, node) -> ast.AST: ... + def visit_Subscript(self, node) -> ast.AST: ... def visit_Assign(self, node): ... - def visit_AugAssign(self, node): ... + def visit_AugAssign(self, node) -> ast.Assign: ... # Bug in `reportlab`'s source code: def visit_While(node): ... # type: ignore[override] - def visit_ExceptHandler(self, node): ... - def visit_With(self, node): ... - def visit_FunctionDef(self, node): ... - def visit_Lambda(self, node): ... - def visit_ClassDef(self, node): ... - def visit_Import(self, node): ... + def visit_ExceptHandler(self, node) -> ast.AST: ... + def visit_With(self, node) -> ast.AST: ... + def visit_FunctionDef(self, node) -> ast.AST: ... + def visit_Lambda(self, node) -> ast.AST: ... + def visit_ClassDef(self, node) -> ast.stmt: ... + def visit_Import(self, node) -> ast.AST: ... def visit_BinOp(self, node): ... visit_ImportFrom = visit_Import # pyright: ignore[reportAssignmentType] visit_For = guard_iter visit_comprehension = guard_iter def generic_visit(self, node: ast.AST) -> None: ... # type: ignore[override] def not_allowed(self, node: ast.AST) -> NoReturn: ... - def visit_children(self, node): ... + def visit_children(self, node) -> ast.AST: ... def visit(self, node): ... visit_Ellipsis = not_allowed visit_MatMult = not_allowed @@ -154,7 +155,7 @@ class __rl_SafeIter__: __rl_iter__: Incomplete __rl_owner__: Incomplete def __init__(self, it, owner) -> None: ... - def __iter__(self): ... + def __iter__(self) -> Self: ... def __next__(self): ... next = __next__ diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rparsexml.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rparsexml.pyi index 62816ccd098f..5feac4c061e5 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rparsexml.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/rparsexml.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete -from typing import type_check_only +from _typeshed import FileDescriptorOrPath, Unused +from collections.abc import Iterable +from typing import Final, type_check_only RequirePyRXP: int simpleparse: int @@ -7,23 +8,23 @@ simpleparse: int @type_check_only class _smartDecode: @staticmethod - def __call__(s): ... + def __call__(s: str | bytes | bytearray) -> str: ... smartDecode: _smartDecode -NONAME: str -NAMEKEY: int -CONTENTSKEY: int -CDATAMARKER: str -LENCDATAMARKER: Incomplete -CDATAENDMARKER: str -replacelist: Incomplete +NONAME: Final = "" +NAMEKEY: Final = 0 +CONTENTSKEY: Final = 1 +CDATAMARKER: Final = "" +replacelist: list[tuple[str, str]] -def unEscapeContentList(contentList): ... -def parsexmlSimple(xmltext, oneOutermostTag: int = 0, eoCB=None, entityReplacer=...): ... +def unEscapeContentList(contentList: Iterable[str]) -> list[str]: ... +def parsexmlSimple(xmltext, oneOutermostTag: int = 0, eoCB: Unused = None, entityReplacer=...): ... parsexml = parsexmlSimple -def parseFile(filename): ... +def parseFile(filename: FileDescriptorOrPath): ... verbose: int diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/sequencer.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/sequencer.pyi index 1973b8138cdc..ce2461bd9848 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/sequencer.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/sequencer.pyi @@ -1,29 +1,38 @@ +from collections.abc import Callable + __all__ = ["Sequencer", "getSequencer", "setSequencer"] +from typing import overload + class _Counter: + _value: int def __init__(self) -> None: ... - def setFormatter(self, formatFunc) -> None: ... - def reset(self, value=None) -> None: ... - def next(self): ... + def setFormatter(self, formatFunc: Callable[[int], str]) -> None: ... + def reset(self, value: int | None = None) -> None: ... + def next(self) -> int: ... __next__ = next - def nextf(self): ... - def thisf(self): ... - def chain(self, otherCounter) -> None: ... + def _this(self) -> int: ... + def nextf(self) -> str: ... + def thisf(self) -> str: ... + def chain(self, otherCounter: _Counter) -> None: ... class Sequencer: def __init__(self) -> None: ... - def __next__(self): ... - def next(self, counter=None): ... - def thisf(self, counter=None): ... - def nextf(self, counter=None): ... + def __next__(self) -> int: ... + def next(self, counter=None) -> int: ... + def thisf(self, counter=None) -> str: ... + def nextf(self, counter=None) -> str: ... def setDefaultCounter(self, default=None) -> None: ... - def registerFormat(self, format, func) -> None: ... - def setFormat(self, counter, format) -> None: ... + def registerFormat(self, format: str, func: Callable[[int], str]) -> None: ... + def setFormat(self, counter, format: str) -> None: ... def reset(self, counter=None, base: int = 0) -> None: ... def chain(self, parent, child) -> None: ... - def __getitem__(self, key): ... - def format(self, template): ... + def __getitem__(self, key: str) -> str: ... + def format(self, template: str) -> str: ... def dump(self) -> None: ... -def getSequencer(): ... -def setSequencer(seq): ... +def getSequencer() -> Sequencer: ... +@overload +def setSequencer(seq: Sequencer) -> Sequencer: ... +@overload +def setSequencer(seq: None) -> None: ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/textsplit.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/textsplit.pyi index beb2241de85b..8ad3489c99a2 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/textsplit.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/textsplit.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete +import re +from _typeshed import Incomplete, ReadableBuffer from collections.abc import Sequence from typing import Final @@ -8,12 +9,12 @@ ALL_CANNOT_START: Final[str] CANNOT_END_LINE: Final[Sequence[str]] ALL_CANNOT_END: Final[str] -def is_multi_byte(ch): ... -def getCharWidths(word, fontName, fontSize): ... -def wordSplit(word, maxWidths, fontName, fontSize, encoding: str = "utf8"): ... -def dumbSplit(word, widths, maxWidths): ... +def is_multi_byte(ch: str | bytes | bytearray) -> bool: ... +def getCharWidths(word: str, fontName: str, fontSize: float) -> list[float]: ... +def wordSplit(word, maxWidths, fontName, fontSize, encoding: str = "utf8") -> list[list[Incomplete]]: ... +def dumbSplit(word, widths, maxWidths) -> list[list[Incomplete]]: ... def kinsokuShoriSplit(word, widths, availWidth) -> None: ... -rx: Incomplete +rx: re.Pattern[str] -def cjkwrap(text, width, encoding: str = "utf8"): ... +def cjkwrap(text: ReadableBuffer, width: float, encoding: str = "utf8"): ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/utils.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/utils.pyi index 8aafa063ccf3..44f0af9ae341 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/utils.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/utils.pyi @@ -1,10 +1,11 @@ import datetime import zipimport from _typeshed import Incomplete, SupportsItems -from collections.abc import Generator, Iterable +from collections.abc import Generator, Iterable, MutableMapping from os import PathLike from types import TracebackType from typing import AnyStr, Final, Literal, TypeVar, overload, type_check_only +from urllib.request import _UrlopenRet from reportlab.lib.rltempfile import get_rl_tempdir as get_rl_tempdir, get_rl_tempfile as get_rl_tempfile @@ -85,7 +86,7 @@ class ArgvDictValue: def getArgvDict(**kw): ... def getHyphenater(hDict=None): ... def open_for_read_by_name(name, mode: str = "b"): ... -def rlUrlRead(name): ... +def rlUrlRead(name: str, headers: MutableMapping[str, str] | None = None) -> _UrlopenRet: ... def open_for_read(name, mode: str = "b"): ... def open_and_read(name, mode: str = "b"): ... def open_and_readlines(name, mode: str = "t"): ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/validators.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/validators.pyi index 689aa1ffb60e..a739cafe87df 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/validators.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/validators.pyi @@ -123,7 +123,7 @@ class DerivedValue: class Inherit(DerivedValue): def getValue(self, renderer, attr): ... -inherit: Incomplete +inherit: Inherit class NumericAlign(str): def __new__(cls, dp: str = ".", dpLen: int = 0): ... diff --git a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/yaml.pyi b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/yaml.pyi index 2c4af45d955c..62cd8164c841 100644 --- a/python/helpers/typeshed/stubs/reportlab/reportlab/lib/yaml.pyi +++ b/python/helpers/typeshed/stubs/reportlab/reportlab/lib/yaml.pyi @@ -1,26 +1,27 @@ +from _typeshed import FileDescriptorOrPath from typing import Final __version__: Final[str] -PLAIN: int -PREFORMATTED: int -BULLETCHAR: str +PLAIN: Final = 1 +PREFORMATTED: Final = 2 +BULLETCHAR: Final = "\267" class BaseParser: def __init__(self) -> None: ... def reset(self) -> None: ... - def parseFile(self, filename): ... - def parseText(self, textBlock): ... - def readLine(self, line) -> None: ... + def parseFile(self, filename: FileDescriptorOrPath) -> list[tuple[str, str] | tuple[str, str, str]]: ... + def parseText(self, textBlock: str) -> list[tuple[str, str] | tuple[str, str, str]]: ... + def readLine(self, line: str) -> None: ... def endPara(self) -> None: ... - def beginPre(self, stylename) -> None: ... + def beginPre(self, stylename: str) -> None: ... def endPre(self) -> None: ... - def image(self, filename) -> None: ... + def image(self, filename: str) -> None: ... class Parser(BaseParser): def vSpace(self, points) -> None: ... def pageBreak(self) -> None: ... - def custom(self, moduleName, funcName) -> None: ... - def nextPageTemplate(self, templateName) -> None: ... + def custom(self, moduleName: str, funcName: str) -> None: ... + def nextPageTemplate(self, templateName: str) -> None: ... -def parseFile(filename): ... -def parseText(textBlock): ... +def parseFile(filename: FileDescriptorOrPath) -> list[tuple[str, str] | tuple[str, str, str]]: ... +def parseText(textBlock: str) -> list[tuple[str, str] | tuple[str, str, str]]: ... diff --git a/python/helpers/typeshed/stubs/setuptools/@tests/stubtest_allowlist.txt b/python/helpers/typeshed/stubs/setuptools/@tests/stubtest_allowlist.txt index 500a32862d49..09c4d676af8d 100644 --- a/python/helpers/typeshed/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/python/helpers/typeshed/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -70,16 +70,16 @@ setuptools._distutils.command.install_headers setuptools._distutils.compat.numpy setuptools._distutils.compat.py39 setuptools._distutils.core -setuptools._distutils.cygwinccompiler setuptools._distutils.debug setuptools._distutils.dir_util setuptools._distutils.fancy_getopt setuptools._distutils.file_util setuptools._distutils.log setuptools._distutils.text_file -setuptools._distutils.version +setuptools._distutils.version.Version._cmp # abstract method +setuptools._distutils.version.Version.parse # abstract method +setuptools._distutils.version.suppress_known_deprecation setuptools._distutils.versionpredicate -setuptools._distutils.zosccompiler # Reexported from setuptools._distutils; problems should be fixed there distutils\..+ diff --git a/python/helpers/typeshed/stubs/setuptools/METADATA.toml b/python/helpers/typeshed/stubs/setuptools/METADATA.toml index 1c4a31504f87..1c1e95de18e3 100644 --- a/python/helpers/typeshed/stubs/setuptools/METADATA.toml +++ b/python/helpers/typeshed/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "81.0.*" +version = "82.0.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ Given that `pkg_resources` is typed since `setuptools >= 71.1`, \ diff --git a/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/cygwin.pyi b/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/cygwin.pyi new file mode 100644 index 000000000000..9b7a9d9e0ca0 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/cygwin.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.cygwin import * diff --git a/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/zos.pyi b/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/zos.pyi new file mode 100644 index 000000000000..921cd46b47ef --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/distutils/compilers/C/zos.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.zos import * diff --git a/python/helpers/typeshed/stubs/setuptools/distutils/cygwinccompiler.pyi b/python/helpers/typeshed/stubs/setuptools/distutils/cygwinccompiler.pyi new file mode 100644 index 000000000000..1784f31d60fc --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/distutils/cygwinccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.cygwinccompiler import * diff --git a/python/helpers/typeshed/stubs/setuptools/distutils/version.pyi b/python/helpers/typeshed/stubs/setuptools/distutils/version.pyi new file mode 100644 index 000000000000..1cac35f20653 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/distutils/version.pyi @@ -0,0 +1 @@ +from setuptools._distutils.version import * diff --git a/python/helpers/typeshed/stubs/setuptools/distutils/zosccompiler.pyi b/python/helpers/typeshed/stubs/setuptools/distutils/zosccompiler.pyi new file mode 100644 index 000000000000..b69c6320e43b --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/distutils/zosccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.zosccompiler import * diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi index 7ee78dababdc..90e8cfc22b99 100644 --- a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -2,7 +2,7 @@ from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused from collections.abc import Callable, Iterable, MutableSequence, Sequence from subprocess import _ENV from typing import ClassVar, Final, Literal, TypeVar, overload -from typing_extensions import TypeAlias, TypeVarTuple, Unpack +from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated _Macro: TypeAlias = tuple[str] | tuple[str, str | None] _StrPathT = TypeVar("_StrPathT", bound=StrPath) @@ -53,6 +53,12 @@ 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 + ) -> bool: ... + @overload + @deprecated("The `includes`, `include_dirs` parameters are deprecated.") def has_function( self, funcname: str, diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi new file mode 100644 index 000000000000..814209f3d25c --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi @@ -0,0 +1,68 @@ +from _typeshed import StrPath +from collections.abc import Callable, Iterable +from shlex import _ShlexInstream +from typing import ClassVar, Final, Literal, NoReturn +from typing_extensions import Never, deprecated + +from ...version import LooseVersion +from . import unix + +def get_msvcr() -> list[str]: ... + +class Compiler(unix.Compiler): + compiler_type: ClassVar[str] + obj_extension: ClassVar[str] + static_lib_extension: ClassVar[str] + shared_lib_extension: ClassVar[str] + dylib_lib_extension: ClassVar[str] + static_lib_format: ClassVar[str] + shared_lib_format: ClassVar[str] + dylib_lib_format: ClassVar[str] + exe_extension: ClassVar[str] + cc: str + cxx: str + linker_dll: str + linker_dll_cxx: str + dll_libraries: list[str] + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... + @property + @deprecated( + "gcc_version attribute of CygwinCCompiler is deprecated. " + "Instead of returning actual gcc version a fixed value 11.2.0 is returned." + ) + def gcc_version(self) -> LooseVersion: ... + # `objects` and `libraries` uses list methods + def link( + self, + target_desc: str, + objects: list[str], # type: ignore[override] + output_filename: str, + output_dir: str | None = None, + libraries: list[str] | None = None, # type: ignore[override] + library_dirs: list[str] | tuple[str, ...] | None = None, + runtime_library_dirs: list[str] | tuple[str, ...] | None = None, + export_symbols: Iterable[str] | None = None, + debug: bool = False, + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + build_temp: StrPath | None = None, + target_lang: str | None = None, + ) -> None: ... + # cygwin doesn't support rpath; prints a warning and returns an empty list + def runtime_library_dir_option(self, dir: str) -> list[Never]: ... # type: ignore[override] + @property + def out_extensions(self) -> dict[str, str]: ... + +class MinGW32Compiler(Compiler): + compiler_type: ClassVar[str] + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... + def runtime_library_dir_option(self, dir: str) -> NoReturn: ... + +CONFIG_H_OK: Final = "ok" +CONFIG_H_NOTOK: Final = "not ok" +CONFIG_H_UNCERTAIN: Final = "uncertain" + +def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ... +def is_cygwincc(cc: str | _ShlexInstream) -> bool: ... + +get_versions: Callable[[], tuple[LooseVersion | None, ...]] | None diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi index ad2f16eb7d14..a882dd2c57ed 100644 --- a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -16,6 +16,7 @@ class Compiler(base.Compiler): static_lib_format = shared_lib_format exe_extension: ClassVar[str] initialized: bool + plat_name: str | None def initialize(self, plat_name: str | None = None) -> None: ... @property def out_extensions(self) -> dict[str, str]: ... diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi new file mode 100644 index 000000000000..d948cbbf8056 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi @@ -0,0 +1,27 @@ +from _typeshed import StrPath +from collections.abc import Iterable +from typing import ClassVar, Literal + +from . import unix + +class Compiler(unix.Compiler): + src_extensions: ClassVar[list[str]] + zos_compiler: Literal["ibm-openxl", "ibm-xlclang", "ibm-xlc"] + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... + def runtime_library_dir_option(self, dir: str) -> str: ... + def link( + self, + target_desc: str, + objects: list[str] | tuple[str, ...], + output_filename: str, + output_dir: str | None = None, + libraries: list[str] | tuple[str, ...] | None = None, + library_dirs: list[str] | tuple[str, ...] | None = None, + runtime_library_dirs: list[str] | tuple[str, ...] | None = None, + export_symbols: Iterable[str] | None = None, + debug: bool = False, + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + build_temp: StrPath | None = None, + target_lang: str | None = None, + ) -> None: ... diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi new file mode 100644 index 000000000000..db2a886c6882 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi @@ -0,0 +1,28 @@ +from collections.abc import Callable + +from .compilers.C import cygwin +from .compilers.C.cygwin import ( + CONFIG_H_NOTOK as CONFIG_H_NOTOK, + CONFIG_H_OK as CONFIG_H_OK, + CONFIG_H_UNCERTAIN as CONFIG_H_UNCERTAIN, + check_config_h as check_config_h, + get_msvcr as get_msvcr, + is_cygwincc as is_cygwincc, +) +from .version import LooseVersion + +__all__ = [ + "CONFIG_H_NOTOK", + "CONFIG_H_OK", + "CONFIG_H_UNCERTAIN", + "CygwinCCompiler", + "Mingw32CCompiler", + "check_config_h", + "get_msvcr", + "is_cygwincc", +] + +CygwinCCompiler = cygwin.Compiler +Mingw32CCompiler = cygwin.MinGW32Compiler + +get_versions: Callable[[], tuple[LooseVersion | None, ...]] | None diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/version.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/version.pyi new file mode 100644 index 000000000000..94b0512e37f5 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/version.pyi @@ -0,0 +1,35 @@ +from abc import abstractmethod +from re import Pattern +from typing_extensions import Self, deprecated + +@deprecated("The `Version` class is deprecated. Use `packaging.version` instead.") +class Version: + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Self | str) -> bool: ... + def __le__(self, other: Self | str) -> bool: ... + def __gt__(self, other: Self | str) -> bool: ... + def __ge__(self, other: Self | str) -> bool: ... + @abstractmethod + def __init__(self, vstring: str | None = None) -> None: ... + @abstractmethod + def parse(self, vstring: str) -> Self: ... + @abstractmethod + def _cmp(self, other: Self | str) -> bool: ... + +@deprecated("The `StrictVersion` class is deprecated. Use `packaging.version` instead.") +class StrictVersion(Version): + version_re: Pattern[str] + version: tuple[int, int, int] + prerelease: tuple[str, int] | None + def __init__(self, vstring: str | None = None) -> None: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... + +@deprecated("The `LooseVersion` class is deprecated. Use `packaging.version` instead.") +class LooseVersion(Version): + component_re: Pattern[str] + vstring: str + version: tuple[str | int, ...] + def __init__(self, vstring: str | None = None) -> None: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... diff --git a/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi new file mode 100644 index 000000000000..e49630ac6ed8 --- /dev/null +++ b/python/helpers/typeshed/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi @@ -0,0 +1,3 @@ +from .compilers.C import zos + +zOSCCompiler = zos.Compiler diff --git a/python/helpers/typeshed/tests/mypy_test.py b/python/helpers/typeshed/tests/mypy_test.py index 5e263a9cbb15..dfc7adba8062 100644 --- a/python/helpers/typeshed/tests/mypy_test.py +++ b/python/helpers/typeshed/tests/mypy_test.py @@ -44,7 +44,7 @@ except ImportError: print_error("Cannot import mypy. Did you install it?") sys.exit(1) -SUPPORTED_VERSIONS = ["3.14", "3.13", "3.12", "3.11", "3.10", "3.9"] +SUPPORTED_VERSIONS = ["3.14", "3.13", "3.12", "3.11", "3.10"] SUPPORTED_PLATFORMS = ("linux", "win32", "darwin") DIRECTORIES_TO_TEST = [STDLIB_PATH, STUBS_PATH] diff --git a/python/helpers/typeshed/tests/regr_test.py b/python/helpers/typeshed/tests/regr_test.py index 0693974a901f..b37509ad9f83 100644 --- a/python/helpers/typeshed/tests/regr_test.py +++ b/python/helpers/typeshed/tests/regr_test.py @@ -41,7 +41,7 @@ VENV_DIR = ".venv" TYPESHED = "typeshed" SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"] -SUPPORTED_VERSIONS = ["3.14", "3.13", "3.12", "3.11", "3.10", "3.9"] +SUPPORTED_VERSIONS = ["3.14", "3.13", "3.12", "3.11", "3.10"] def distribution_with_test_cases(distribution_name: str) -> DistributionTests: diff --git a/python/helpers/typeshed/tests/runtests.py b/python/helpers/typeshed/tests/runtests.py index 296cb8ccd068..832ade5216ba 100644 --- a/python/helpers/typeshed/tests/runtests.py +++ b/python/helpers/typeshed/tests/runtests.py @@ -50,7 +50,7 @@ def main() -> None: parser.add_argument( "--python-version", default=None, - choices=("3.9", "3.10", "3.11", "3.12", "3.13", "3.14"), + choices=("3.10", "3.11", "3.12", "3.13", "3.14"), # We're using the oldest fully supported version because it's the most likely to produce errors # due to unsupported syntax, feature, or bug in a tool. help="Target Python version for the test (defaults to oldest supported Python version).", diff --git a/python/helpers/typeshed/tests/typecheck_typeshed.py b/python/helpers/typeshed/tests/typecheck_typeshed.py index 90d7afcaf706..63449e4d4ee3 100644 --- a/python/helpers/typeshed/tests/typecheck_typeshed.py +++ b/python/helpers/typeshed/tests/typecheck_typeshed.py @@ -14,7 +14,7 @@ from ts_utils.utils import colored, print_error ReturnCode: TypeAlias = int SUPPORTED_PLATFORMS = ("linux", "darwin", "win32") -SUPPORTED_VERSIONS = ("3.14", "3.13", "3.12", "3.11", "3.10", "3.9") +SUPPORTED_VERSIONS = ("3.14", "3.13", "3.12", "3.11", "3.10") LOWEST_SUPPORTED_VERSION = min(SUPPORTED_VERSIONS, key=lambda x: int(x.split(".")[1])) DIRECTORIES_TO_TEST = ("scripts", "tests") EMPTY: list[str] = []