From b3bd22ebe348202e1e62e48fd42dcde39f47e8d4 Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Sat, 3 Feb 2024 09:34:25 +0100 Subject: [PATCH] add type hinting and integrate with pytest --- devenv.nix | 1 + poetry.lock | 95 ++++- pyproject.toml | 18 + pytest.ini | 2 +- src/aramaki/server/main.py | 5 +- src/aramaki/server/models/meta.py | 7 +- src/aramaki/server/models/system.py | 19 +- stubs/pkg_resources/__init__.pyi | 320 ++++++++++++++++ stubs/pkg_resources/extern/__init__.pyi | 17 + stubs/pyramid/__init__.pyi | 0 stubs/pyramid/asset.pyi | 5 + stubs/pyramid/authentication.pyi | 122 ++++++ stubs/pyramid/authorization.pyi | 27 ++ stubs/pyramid/config/__init__.pyi | 72 ++++ stubs/pyramid/config/actions.pyi | 40 ++ stubs/pyramid/config/adapters.pyi | 14 + stubs/pyramid/config/assets.pyi | 77 ++++ stubs/pyramid/config/factories.pyi | 19 + stubs/pyramid/config/i18n.pyi | 8 + stubs/pyramid/config/predicates.pyi | 34 ++ stubs/pyramid/config/rendering.pyi | 10 + stubs/pyramid/config/routes.pyi | 17 + stubs/pyramid/config/security.pyi | 27 ++ stubs/pyramid/config/settings.pyi | 8 + stubs/pyramid/config/tweens.pyi | 19 + stubs/pyramid/config/views.pyi | 79 ++++ stubs/pyramid/config/zca.pyi | 5 + stubs/pyramid/csrf.pyi | 30 ++ stubs/pyramid/decorator.pyi | 7 + stubs/pyramid/encode.pyi | 5 + stubs/pyramid/events.pyi | 41 ++ stubs/pyramid/exceptions.pyi | 27 ++ stubs/pyramid/httpexceptions.pyi | 272 +++++++++++++ stubs/pyramid/i18n.pyi | 44 +++ stubs/pyramid/interfaces.pyi | 362 ++++++++++++++++++ stubs/pyramid/location.pyi | 5 + stubs/pyramid/paster.pyi | 8 + stubs/pyramid/path.pyi | 51 +++ stubs/pyramid/predicates.pyi | 112 ++++++ stubs/pyramid/registry.pyi | 57 +++ stubs/pyramid/renderers.pyi | 59 +++ stubs/pyramid/request.pyi | 44 +++ stubs/pyramid/resource.pyi | 5 + stubs/pyramid/response.pyi | 31 ++ stubs/pyramid/router.pyi | 29 ++ stubs/pyramid/scripting.pyi | 14 + stubs/pyramid/scripts/__init__.pyi | 0 stubs/pyramid/scripts/common.pyi | 2 + stubs/pyramid/scripts/pdistreport.pyi | 3 + stubs/pyramid/scripts/prequest.pyi | 15 + stubs/pyramid/scripts/proutes.pyi | 29 ++ stubs/pyramid/scripts/pserve.pyi | 26 ++ stubs/pyramid/scripts/pshell.pyi | 37 ++ stubs/pyramid/scripts/ptweens.pyi | 20 + stubs/pyramid/scripts/pviews.pyi | 21 + stubs/pyramid/security.pyi | 64 ++++ stubs/pyramid/session.pyi | 20 + stubs/pyramid/settings.pyi | 8 + stubs/pyramid/static.pyi | 45 +++ stubs/pyramid/threadlocal.pyi | 28 ++ stubs/pyramid/traversal.pyi | 50 +++ stubs/pyramid/tweens.pyi | 8 + stubs/pyramid/url.pyi | 32 ++ stubs/pyramid/urldispatch.pyi | 32 ++ stubs/pyramid/util.pyi | 90 +++++ stubs/pyramid/view.pyi | 45 +++ stubs/pyramid/viewderivers.pyi | 37 ++ stubs/pyramid/wsgi.pyi | 4 + stubs/translationstring/__init__.pyi | 24 ++ stubs/translationstring/compat.pyi | 7 + stubs/venusian/__init__.pyi | 31 ++ stubs/venusian/advice.pyi | 1 + stubs/venusian/compat.pyi | 1 + stubs/webob/__init__.pyi | 6 + stubs/webob/acceptparse.pyi | 274 +++++++++++++ stubs/webob/byterange.pyi | 22 ++ stubs/webob/cachecontrol.pyi | 59 +++ stubs/webob/client.pyi | 14 + stubs/webob/compat.pyi | 33 ++ stubs/webob/cookies.pyi | 90 +++++ stubs/webob/datetime_utils.pyi | 26 ++ stubs/webob/dec.pyi | 37 ++ stubs/webob/descriptors.pyi | 42 ++ stubs/webob/etag.pyi | 40 ++ stubs/webob/exc.pyi | 288 ++++++++++++++ stubs/webob/headers.pyi | 28 ++ stubs/webob/multidict.pyi | 105 +++++ stubs/webob/request.pyi | 196 ++++++++++ stubs/webob/response.pyi | 99 +++++ stubs/webob/static.pyi | 26 ++ stubs/webob/util.pyi | 11 + stubs/zope/interface/__init__.pyi | 4 + stubs/zope/interface/_compat.pyi | 3 + stubs/zope/interface/_flatten.pyi | 1 + .../_zope_interface_coptimizations.pyi | 5 + stubs/zope/interface/adapter.pyi | 56 +++ stubs/zope/interface/advice.pyi | 8 + stubs/zope/interface/common/__init__.pyi | 15 + stubs/zope/interface/common/builtins.pyi | 28 ++ stubs/zope/interface/common/collections.pyi | 90 +++++ stubs/zope/interface/common/idatetime.pyi | 97 +++++ stubs/zope/interface/common/interfaces.pyi | 40 ++ stubs/zope/interface/common/io.pyi | 16 + stubs/zope/interface/common/mapping.pyi | 37 ++ stubs/zope/interface/common/numbers.pyi | 21 + stubs/zope/interface/common/sequence.pyi | 43 +++ stubs/zope/interface/declarations.pyi | 96 +++++ stubs/zope/interface/document.pyi | 4 + stubs/zope/interface/exceptions.pyi | 29 ++ stubs/zope/interface/interface.pyi | 101 +++++ stubs/zope/interface/interfaces.pyi | 154 ++++++++ stubs/zope/interface/registry.pyi | 72 ++++ stubs/zope/interface/ro.pyi | 75 ++++ stubs/zope/interface/verify.pyi | 4 + stubs/zope/sqlalchemy/__init__.pyi | 5 + stubs/zope/sqlalchemy/datamanager.pyi | 60 +++ 116 files changed, 5394 insertions(+), 16 deletions(-) create mode 100644 stubs/pkg_resources/__init__.pyi create mode 100644 stubs/pkg_resources/extern/__init__.pyi create mode 100644 stubs/pyramid/__init__.pyi create mode 100644 stubs/pyramid/asset.pyi create mode 100644 stubs/pyramid/authentication.pyi create mode 100644 stubs/pyramid/authorization.pyi create mode 100644 stubs/pyramid/config/__init__.pyi create mode 100644 stubs/pyramid/config/actions.pyi create mode 100644 stubs/pyramid/config/adapters.pyi create mode 100644 stubs/pyramid/config/assets.pyi create mode 100644 stubs/pyramid/config/factories.pyi create mode 100644 stubs/pyramid/config/i18n.pyi create mode 100644 stubs/pyramid/config/predicates.pyi create mode 100644 stubs/pyramid/config/rendering.pyi create mode 100644 stubs/pyramid/config/routes.pyi create mode 100644 stubs/pyramid/config/security.pyi create mode 100644 stubs/pyramid/config/settings.pyi create mode 100644 stubs/pyramid/config/tweens.pyi create mode 100644 stubs/pyramid/config/views.pyi create mode 100644 stubs/pyramid/config/zca.pyi create mode 100644 stubs/pyramid/csrf.pyi create mode 100644 stubs/pyramid/decorator.pyi create mode 100644 stubs/pyramid/encode.pyi create mode 100644 stubs/pyramid/events.pyi create mode 100644 stubs/pyramid/exceptions.pyi create mode 100644 stubs/pyramid/httpexceptions.pyi create mode 100644 stubs/pyramid/i18n.pyi create mode 100644 stubs/pyramid/interfaces.pyi create mode 100644 stubs/pyramid/location.pyi create mode 100644 stubs/pyramid/paster.pyi create mode 100644 stubs/pyramid/path.pyi create mode 100644 stubs/pyramid/predicates.pyi create mode 100644 stubs/pyramid/registry.pyi create mode 100644 stubs/pyramid/renderers.pyi create mode 100644 stubs/pyramid/request.pyi create mode 100644 stubs/pyramid/resource.pyi create mode 100644 stubs/pyramid/response.pyi create mode 100644 stubs/pyramid/router.pyi create mode 100644 stubs/pyramid/scripting.pyi create mode 100644 stubs/pyramid/scripts/__init__.pyi create mode 100644 stubs/pyramid/scripts/common.pyi create mode 100644 stubs/pyramid/scripts/pdistreport.pyi create mode 100644 stubs/pyramid/scripts/prequest.pyi create mode 100644 stubs/pyramid/scripts/proutes.pyi create mode 100644 stubs/pyramid/scripts/pserve.pyi create mode 100644 stubs/pyramid/scripts/pshell.pyi create mode 100644 stubs/pyramid/scripts/ptweens.pyi create mode 100644 stubs/pyramid/scripts/pviews.pyi create mode 100644 stubs/pyramid/security.pyi create mode 100644 stubs/pyramid/session.pyi create mode 100644 stubs/pyramid/settings.pyi create mode 100644 stubs/pyramid/static.pyi create mode 100644 stubs/pyramid/threadlocal.pyi create mode 100644 stubs/pyramid/traversal.pyi create mode 100644 stubs/pyramid/tweens.pyi create mode 100644 stubs/pyramid/url.pyi create mode 100644 stubs/pyramid/urldispatch.pyi create mode 100644 stubs/pyramid/util.pyi create mode 100644 stubs/pyramid/view.pyi create mode 100644 stubs/pyramid/viewderivers.pyi create mode 100644 stubs/pyramid/wsgi.pyi create mode 100644 stubs/translationstring/__init__.pyi create mode 100644 stubs/translationstring/compat.pyi create mode 100644 stubs/venusian/__init__.pyi create mode 100644 stubs/venusian/advice.pyi create mode 100644 stubs/venusian/compat.pyi create mode 100644 stubs/webob/__init__.pyi create mode 100644 stubs/webob/acceptparse.pyi create mode 100644 stubs/webob/byterange.pyi create mode 100644 stubs/webob/cachecontrol.pyi create mode 100644 stubs/webob/client.pyi create mode 100644 stubs/webob/compat.pyi create mode 100644 stubs/webob/cookies.pyi create mode 100644 stubs/webob/datetime_utils.pyi create mode 100644 stubs/webob/dec.pyi create mode 100644 stubs/webob/descriptors.pyi create mode 100644 stubs/webob/etag.pyi create mode 100644 stubs/webob/exc.pyi create mode 100644 stubs/webob/headers.pyi create mode 100644 stubs/webob/multidict.pyi create mode 100644 stubs/webob/request.pyi create mode 100644 stubs/webob/response.pyi create mode 100644 stubs/webob/static.pyi create mode 100644 stubs/webob/util.pyi create mode 100644 stubs/zope/interface/__init__.pyi create mode 100644 stubs/zope/interface/_compat.pyi create mode 100644 stubs/zope/interface/_flatten.pyi create mode 100644 stubs/zope/interface/_zope_interface_coptimizations.pyi create mode 100644 stubs/zope/interface/adapter.pyi create mode 100644 stubs/zope/interface/advice.pyi create mode 100644 stubs/zope/interface/common/__init__.pyi create mode 100644 stubs/zope/interface/common/builtins.pyi create mode 100644 stubs/zope/interface/common/collections.pyi create mode 100644 stubs/zope/interface/common/idatetime.pyi create mode 100644 stubs/zope/interface/common/interfaces.pyi create mode 100644 stubs/zope/interface/common/io.pyi create mode 100644 stubs/zope/interface/common/mapping.pyi create mode 100644 stubs/zope/interface/common/numbers.pyi create mode 100644 stubs/zope/interface/common/sequence.pyi create mode 100644 stubs/zope/interface/declarations.pyi create mode 100644 stubs/zope/interface/document.pyi create mode 100644 stubs/zope/interface/exceptions.pyi create mode 100644 stubs/zope/interface/interface.pyi create mode 100644 stubs/zope/interface/interfaces.pyi create mode 100644 stubs/zope/interface/registry.pyi create mode 100644 stubs/zope/interface/ro.pyi create mode 100644 stubs/zope/interface/verify.pyi create mode 100644 stubs/zope/sqlalchemy/__init__.pyi create mode 100644 stubs/zope/sqlalchemy/datamanager.pyi diff --git a/devenv.nix b/devenv.nix index a315b99..012c027 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,6 +4,7 @@ env.PYTHONUNBUFFERED = "true"; env.ALEMBIC_CONFIG = "development.ini"; env.PGDATABASE = "aramaki"; + env.MYPYPATH="stubs"; packages = [ pkgs.git diff --git a/poetry.lock b/poetry.lock index 642776f..15f1ddb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,6 +38,25 @@ types-python-dateutil = ">=2.8.10" doc = ["doc8", "sphinx (>=7.0.0)", "sphinx-autobuild", "sphinx-autodoc-typehints", "sphinx_rtd_theme (>=1.3.0)"] test = ["dateparser (==1.*)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (==3.*)"] +[[package]] +name = "attrs" +version = "23.2.0" +description = "Classes Without Boilerplate" +optional = false +python-versions = ">=3.7" +files = [ + {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, + {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, +] + +[package.extras] +cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] +dev = ["attrs[tests]", "pre-commit"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] +tests = ["attrs[tests-no-zope]", "zope-interface"] +tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] +tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] + [[package]] name = "babel" version = "2.14.0" @@ -583,6 +602,63 @@ files = [ {file = "msgpack-1.0.7.tar.gz", hash = "sha256:572efc93db7a4d27e404501975ca6d2d9775705c2d922390d878fcf768d92c87"}, ] +[[package]] +name = "mypy" +version = "1.8.0" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mypy-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:485a8942f671120f76afffff70f259e1cd0f0cfe08f81c05d8816d958d4577d3"}, + {file = "mypy-1.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:df9824ac11deaf007443e7ed2a4a26bebff98d2bc43c6da21b2b64185da011c4"}, + {file = "mypy-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2afecd6354bbfb6e0160f4e4ad9ba6e4e003b767dd80d85516e71f2e955ab50d"}, + {file = "mypy-1.8.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8963b83d53ee733a6e4196954502b33567ad07dfd74851f32be18eb932fb1cb9"}, + {file = "mypy-1.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:e46f44b54ebddbeedbd3d5b289a893219065ef805d95094d16a0af6630f5d410"}, + {file = "mypy-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:855fe27b80375e5c5878492f0729540db47b186509c98dae341254c8f45f42ae"}, + {file = "mypy-1.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4c886c6cce2d070bd7df4ec4a05a13ee20c0aa60cb587e8d1265b6c03cf91da3"}, + {file = "mypy-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d19c413b3c07cbecf1f991e2221746b0d2a9410b59cb3f4fb9557f0365a1a817"}, + {file = "mypy-1.8.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9261ed810972061388918c83c3f5cd46079d875026ba97380f3e3978a72f503d"}, + {file = "mypy-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:51720c776d148bad2372ca21ca29256ed483aa9a4cdefefcef49006dff2a6835"}, + {file = "mypy-1.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:52825b01f5c4c1c4eb0db253ec09c7aa17e1a7304d247c48b6f3599ef40db8bd"}, + {file = "mypy-1.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f5ac9a4eeb1ec0f1ccdc6f326bcdb464de5f80eb07fb38b5ddd7b0de6bc61e55"}, + {file = "mypy-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afe3fe972c645b4632c563d3f3eff1cdca2fa058f730df2b93a35e3b0c538218"}, + {file = "mypy-1.8.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:42c6680d256ab35637ef88891c6bd02514ccb7e1122133ac96055ff458f93fc3"}, + {file = "mypy-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:720a5ca70e136b675af3af63db533c1c8c9181314d207568bbe79051f122669e"}, + {file = "mypy-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:028cf9f2cae89e202d7b6593cd98db6759379f17a319b5faf4f9978d7084cdc6"}, + {file = "mypy-1.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4e6d97288757e1ddba10dd9549ac27982e3e74a49d8d0179fc14d4365c7add66"}, + {file = "mypy-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f1478736fcebb90f97e40aff11a5f253af890c845ee0c850fe80aa060a267c6"}, + {file = "mypy-1.8.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42419861b43e6962a649068a61f4a4839205a3ef525b858377a960b9e2de6e0d"}, + {file = "mypy-1.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:2b5b6c721bd4aabaadead3a5e6fa85c11c6c795e0c81a7215776ef8afc66de02"}, + {file = "mypy-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c1538c38584029352878a0466f03a8ee7547d7bd9f641f57a0f3017a7c905b8"}, + {file = "mypy-1.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ef4be7baf08a203170f29e89d79064463b7fc7a0908b9d0d5114e8009c3a259"}, + {file = "mypy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7178def594014aa6c35a8ff411cf37d682f428b3b5617ca79029d8ae72f5402b"}, + {file = "mypy-1.8.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ab3c84fa13c04aeeeabb2a7f67a25ef5d77ac9d6486ff33ded762ef353aa5592"}, + {file = "mypy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:99b00bc72855812a60d253420d8a2eae839b0afa4938f09f4d2aa9bb4654263a"}, + {file = "mypy-1.8.0-py3-none-any.whl", hash = "sha256:538fd81bb5e430cc1381a443971c0475582ff9f434c16cd46d2c66763ce85d9d"}, + {file = "mypy-1.8.0.tar.gz", hash = "sha256:6ff8b244d7085a0b425b56d327b480c3b29cafbd2eff27316a004f9a7391ae07"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +typing-extensions = ">=4.1.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + [[package]] name = "packaging" version = "23.2" @@ -945,6 +1021,23 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +[[package]] +name = "pytest-mypy" +version = "0.10.3" +description = "Mypy static type checker plugin for Pytest" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pytest-mypy-0.10.3.tar.gz", hash = "sha256:f8458f642323f13a2ca3e2e61509f7767966b527b4d8adccd5032c3e7b4fd3db"}, + {file = "pytest_mypy-0.10.3-py3-none-any.whl", hash = "sha256:7638d0d3906848fc1810cb2f5cc7fceb4cc5c98524aafcac58f28620e3102053"}, +] + +[package.dependencies] +attrs = ">=19.0" +filelock = ">=3.0" +mypy = {version = ">=0.900", markers = "python_version >= \"3.11\""} +pytest = {version = ">=6.2", markers = "python_version >= \"3.10\""} + [[package]] name = "pytest-timeout" version = "2.2.0" @@ -1443,4 +1536,4 @@ test = ["zope.testing"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "48b8b18805ab9c7fd38dc0a00915946e0eba04d3e096e9dd0401012d10a5eba2" +content-hash = "fef075cc4cfc520f6671af0cd669502ab6c6ae8b459cc590d20df7116fcafe89" diff --git a/pyproject.toml b/pyproject.toml index d594ccc..aa61433 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ pytest = ">=7.4" pytest-cov = ">=4.1" pytest-cache = ">=1.0" pytest-timeout = ">=2.2" +pytest-mypy = ">=0.10" [tool.poetry.plugins."paste.app_factory"] main = "aramaki.server.web.main:main" @@ -62,3 +63,20 @@ Issues = "https://github.com/flyingcircusio/aramaki/issues" [tool.black] line-length = 79 + + +[[tool.mypy.overrides]] +module = "webob.*" +ignore_errors = true + +[[tool.mypy.overrides]] +module = "zope.*" +ignore_errors = true + +[[tool.mypy.overrides]] +module = "pkg_resources.*" +ignore_errors = true + +[[tool.mypy.overrides]] +module = "pyramid.*" +ignore_errors = true diff --git a/pytest.ini b/pytest.ini index 50f661a..dff5503 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,3 @@ [pytest] -addopts = --timeout=30 --cov=src --cov-report=html --ignore lib --ignore lib64 --strict-markers +addopts = --timeout=30 --mypy --cov=src --cov-report=html --ignore lib --ignore lib64 --strict-markers testpaths = src/aramaki diff --git a/src/aramaki/server/main.py b/src/aramaki/server/main.py index c76b71a..5ee797b 100644 --- a/src/aramaki/server/main.py +++ b/src/aramaki/server/main.py @@ -4,7 +4,8 @@ def main(): parser = argparse.ArgumentParser( prog="aramaki-server", - description="Server implementation of Aramaki, the federated DevOps control plane.", + description="Server implementation of Aramaki, the federated DevOps " + "control plane.", epilog="Text at the bottom of help", ) @@ -12,7 +13,7 @@ def main(): args = parser.parse_args() if args.subsystem == "ui": - from .ui.main import main as real_main + from .web.main import main as real_main elif args.subsystem == "processing": from .processing.main import main as real_main elif args.subsystem == "federation": diff --git a/src/aramaki/server/models/meta.py b/src/aramaki/server/models/meta.py index c4663fe..7a1f5e1 100644 --- a/src/aramaki/server/models/meta.py +++ b/src/aramaki/server/models/meta.py @@ -1,4 +1,4 @@ -from sqlalchemy.orm import declarative_base +from sqlalchemy.orm import DeclarativeBase from sqlalchemy.schema import MetaData # Recommended naming convention used by Alembic, as various different database @@ -13,4 +13,7 @@ } metadata = MetaData(naming_convention=NAMING_CONVENTION) -Base = declarative_base(metadata=metadata) + + +class Base(DeclarativeBase): + metadata = metadata diff --git a/src/aramaki/server/models/system.py b/src/aramaki/server/models/system.py index 73e7937..445d92f 100644 --- a/src/aramaki/server/models/system.py +++ b/src/aramaki/server/models/system.py @@ -1,25 +1,24 @@ import uuid -from sqlalchemy import Column, String, func -from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy import func +from sqlalchemy.orm import Mapped, mapped_column -from .meta import Base +from . import meta -class System(Base): +class System(meta.Base): __tablename__ = "system" - id = Column( - UUID(as_uuid=True), + id: Mapped[uuid.UUID] = mapped_column( primary_key=True, default=uuid.uuid4, server_default=func.gen_random_uuid(), ) - title = Column(String, nullable=False) + title: Mapped[str] - # Make this a dictionary. - type_ = Column(String, nullable=False) + # Make this a dictionary, use references + type_: Mapped[str] # XXX Turn into relationship - primary_instance = Column(UUID(as_uuid=True)) + primary_instance: Mapped[uuid.UUID] diff --git a/stubs/pkg_resources/__init__.pyi b/stubs/pkg_resources/__init__.pyi new file mode 100644 index 0000000..8475dcb --- /dev/null +++ b/stubs/pkg_resources/__init__.pyi @@ -0,0 +1,320 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from pkg_resources.extern import packaging +from pkg_resources.extern.jaraco.text import yield_lines as yield_lines +from pkgutil import get_importer as get_importer +from typing import NamedTuple + +__all__ = ['require', 'run_script', 'get_provider', 'get_distribution', 'load_entry_point', 'get_entry_map', 'get_entry_info', 'iter_entry_points', 'resource_string', 'resource_stream', 'resource_filename', 'resource_listdir', 'resource_exists', 'resource_isdir', 'declare_namespace', 'working_set', 'add_activation_listener', 'find_distributions', 'set_extraction_path', 'cleanup_resources', 'get_default_cache', 'Environment', 'WorkingSet', 'ResourceManager', 'Distribution', 'Requirement', 'EntryPoint', 'ResolutionError', 'VersionConflict', 'DistributionNotFound', 'UnknownExtra', 'ExtractionError', 'PEP440Warning', 'parse_requirements', 'parse_version', 'safe_name', 'safe_version', 'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections', 'safe_extra', 'to_filename', 'invalid_marker', 'evaluate_marker', 'ensure_directory', 'normalize_path', 'EGG_DIST', 'BINARY_DIST', 'SOURCE_DIST', 'CHECKOUT_DIST', 'DEVELOP_DIST', 'IMetadataProvider', 'IResourceProvider', 'FileMetadata', 'PathMetadata', 'EggMetadata', 'EmptyProvider', 'empty_provider', 'NullProvider', 'EggProvider', 'DefaultProvider', 'ZipProvider', 'register_finder', 'register_namespace_handler', 'register_loader_type', 'fixup_namespace_packages', 'get_importer', 'PkgResourcesDeprecationWarning', 'run_main', 'AvailableDistributions'] + +FileExistsError = OSError +require: Incomplete +working_set: Incomplete +add_activation_listener: Incomplete +cleanup_resources: Incomplete +resource_stream: Incomplete +set_extraction_path: Incomplete +resource_isdir: Incomplete +resource_string: Incomplete +iter_entry_points: Incomplete +resource_listdir: Incomplete +resource_filename: Incomplete +resource_exists: Incomplete + +class PEP440Warning(RuntimeWarning): ... + +parse_version: Incomplete + +class ResolutionError(Exception): ... + +class VersionConflict(ResolutionError): + @property + def dist(self): ... + @property + def req(self): ... + def report(self): ... + def with_context(self, required_by): ... + +class ContextualVersionConflict(VersionConflict): + @property + def required_by(self): ... + +class DistributionNotFound(ResolutionError): + @property + def req(self): ... + @property + def requirers(self): ... + @property + def requirers_str(self): ... + def report(self): ... + +class UnknownExtra(ResolutionError): ... + +EGG_DIST: int +BINARY_DIST: int +SOURCE_DIST: int +CHECKOUT_DIST: int +DEVELOP_DIST: int + +def register_loader_type(loader_type, provider_factory) -> None: ... +def get_provider(moduleOrReq): ... +get_platform = get_build_platform + +def compatible_platforms(provided, required): ... +def run_script(dist_spec, script_name) -> None: ... +run_main = run_script + +def get_distribution(dist): ... +def load_entry_point(dist, group, name): ... +def get_entry_map(dist, group: Incomplete | None = None): ... +def get_entry_info(dist, group, name): ... + +class IMetadataProvider: + def has_metadata(name) -> None: ... + def get_metadata(name) -> None: ... + def get_metadata_lines(name) -> None: ... + def metadata_isdir(name) -> None: ... + def metadata_listdir(name) -> None: ... + def run_script(script_name, namespace) -> None: ... + +class IResourceProvider(IMetadataProvider): + def get_resource_filename(manager, resource_name) -> None: ... + def get_resource_stream(manager, resource_name) -> None: ... + def get_resource_string(manager, resource_name) -> None: ... + def has_resource(resource_name) -> None: ... + def resource_isdir(resource_name) -> None: ... + def resource_listdir(resource_name) -> None: ... + +class WorkingSet: + entries: Incomplete + entry_keys: Incomplete + by_key: Incomplete + normalized_to_canonical_keys: Incomplete + callbacks: Incomplete + def __init__(self, entries: Incomplete | None = None) -> None: ... + def add_entry(self, entry) -> None: ... + def __contains__(self, dist) -> bool: ... + def find(self, req): ... + def iter_entry_points(self, group, name: Incomplete | None = None): ... + def run_script(self, requires, script_name) -> None: ... + def __iter__(self): ... + def add(self, dist, entry: Incomplete | None = None, insert: bool = True, replace: bool = False) -> None: ... + def resolve(self, requirements, env: Incomplete | None = None, installer: Incomplete | None = None, replace_conflicting: bool = False, extras: Incomplete | None = None): ... + def find_plugins(self, plugin_env, full_env: Incomplete | None = None, installer: Incomplete | None = None, fallback: bool = True): ... + def require(self, *requirements): ... + def subscribe(self, callback, existing: bool = True) -> None: ... + +class _ReqExtras(dict): + def markers_pass(self, req, extras: Incomplete | None = None): ... + +class Environment: + platform: Incomplete + python: Incomplete + def __init__(self, search_path: Incomplete | None = None, platform=..., python=...) -> None: ... + def can_add(self, dist): ... + def remove(self, dist) -> None: ... + def scan(self, search_path: Incomplete | None = None) -> None: ... + def __getitem__(self, project_name): ... + def add(self, dist) -> None: ... + def best_match(self, req, working_set, installer: Incomplete | None = None, replace_conflicting: bool = False): ... + def obtain(self, requirement, installer: Incomplete | None = None): ... + def __iter__(self): ... + def __iadd__(self, other): ... + def __add__(self, other): ... +AvailableDistributions = Environment + +class ExtractionError(RuntimeError): ... + +class ResourceManager: + extraction_path: Incomplete + cached_files: Incomplete + def __init__(self) -> None: ... + def resource_exists(self, package_or_requirement, resource_name): ... + def resource_isdir(self, package_or_requirement, resource_name): ... + def resource_filename(self, package_or_requirement, resource_name): ... + def resource_stream(self, package_or_requirement, resource_name): ... + def resource_string(self, package_or_requirement, resource_name): ... + def resource_listdir(self, package_or_requirement, resource_name): ... + def extraction_error(self) -> None: ... + def get_cache_path(self, archive_name, names=()): ... + def postprocess(self, tempname, filename) -> None: ... + def set_extraction_path(self, path) -> None: ... + def cleanup_resources(self, force: bool = False) -> None: ... + +def get_default_cache(): ... +def safe_name(name): ... +def safe_version(version): ... +def safe_extra(extra): ... +def to_filename(name): ... +def invalid_marker(text): ... +def evaluate_marker(text, extra: Incomplete | None = None): ... + +class NullProvider: + egg_name: Incomplete + egg_info: Incomplete + loader: Incomplete + module_path: Incomplete + def __init__(self, module) -> None: ... + def get_resource_filename(self, manager, resource_name): ... + def get_resource_stream(self, manager, resource_name): ... + def get_resource_string(self, manager, resource_name): ... + def has_resource(self, resource_name): ... + def has_metadata(self, name): ... + def get_metadata(self, name): ... + def get_metadata_lines(self, name): ... + def resource_isdir(self, resource_name): ... + def metadata_isdir(self, name): ... + def resource_listdir(self, resource_name): ... + def metadata_listdir(self, name): ... + def run_script(self, script_name, namespace) -> None: ... + +class EggProvider(NullProvider): + def __init__(self, module) -> None: ... + +class DefaultProvider(EggProvider): + def get_resource_stream(self, manager, resource_name): ... + +class EmptyProvider(NullProvider): + module_path: Incomplete + def __init__(self) -> None: ... + +empty_provider: Incomplete + +class ZipManifests(dict): + @classmethod + def build(cls, path): ... + load = build + +class MemoizedZipManifests(ZipManifests): + + class manifest_mod(NamedTuple): + manifest: Incomplete + mtime: Incomplete + def load(self, path): ... + +class ZipProvider(EggProvider): + eagers: Incomplete + zip_pre: Incomplete + def __init__(self, module) -> None: ... + @property + def zipinfo(self): ... + def get_resource_filename(self, manager, resource_name): ... + +class FileMetadata(EmptyProvider): + path: Incomplete + def __init__(self, path) -> None: ... + def has_metadata(self, name): ... + def get_metadata(self, name): ... + def get_metadata_lines(self, name): ... + +class PathMetadata(DefaultProvider): + module_path: Incomplete + egg_info: Incomplete + def __init__(self, path, egg_info) -> None: ... + +class EggMetadata(ZipProvider): + zip_pre: Incomplete + loader: Incomplete + module_path: Incomplete + def __init__(self, importer) -> None: ... + +def register_finder(importer_type, distribution_finder) -> None: ... +def find_distributions(path_item, only: bool = False): ... + +class NoDists: + def __bool__(self) -> bool: ... + def __call__(self, fullpath): ... + +def register_namespace_handler(importer_type, namespace_handler) -> None: ... +def declare_namespace(packageName) -> None: ... +def fixup_namespace_packages(path_item, parent: Incomplete | None = None) -> None: ... +def normalize_path(filename): ... + +class EntryPoint: + name: Incomplete + module_name: Incomplete + attrs: Incomplete + extras: Incomplete + dist: Incomplete + def __init__(self, name, module_name, attrs=(), extras=(), dist: Incomplete | None = None) -> None: ... + def load(self, require: bool = True, *args, **kwargs): ... + def resolve(self): ... + def require(self, env: Incomplete | None = None, installer: Incomplete | None = None) -> None: ... + pattern: Incomplete + @classmethod + def parse(cls, src, dist: Incomplete | None = None): ... + @classmethod + def parse_group(cls, group, lines, dist: Incomplete | None = None): ... + @classmethod + def parse_map(cls, data, dist: Incomplete | None = None): ... + +class Distribution: + PKG_INFO: str + project_name: Incomplete + py_version: Incomplete + platform: Incomplete + location: Incomplete + precedence: Incomplete + def __init__(self, location: Incomplete | None = None, metadata: Incomplete | None = None, project_name: Incomplete | None = None, version: Incomplete | None = None, py_version=..., platform: Incomplete | None = None, precedence=...) -> None: ... + @classmethod + def from_location(cls, location, basename, metadata: Incomplete | None = None, **kw): ... + @property + def hashcmp(self): ... + def __hash__(self): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + @property + def key(self): ... + @property + def parsed_version(self): ... + @property + def version(self): ... + def requires(self, extras=()): ... + def activate(self, path: Incomplete | None = None, replace: bool = False) -> None: ... + def egg_name(self): ... + def __getattr__(self, attr): ... + def __dir__(self): ... + @classmethod + def from_filename(cls, filename, metadata: Incomplete | None = None, **kw): ... + def as_requirement(self): ... + def load_entry_point(self, group, name): ... + def get_entry_map(self, group: Incomplete | None = None): ... + def get_entry_info(self, group, name): ... + def insert_on(self, path, loc: Incomplete | None = None, replace: bool = False) -> None: ... + def check_version_conflict(self) -> None: ... + def has_version(self): ... + def clone(self, **kw): ... + @property + def extras(self): ... + +class EggInfoDistribution(Distribution): ... + +class DistInfoDistribution(Distribution): + PKG_INFO: str + EQEQ: Incomplete + +def parse_requirements(strs): ... + +class RequirementParseError(packaging.requirements.InvalidRequirement): ... + +class Requirement(packaging.requirements.Requirement): + unsafe_name: Incomplete + specs: Incomplete + extras: Incomplete + hashCmp: Incomplete + def __init__(self, requirement_string) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __contains__(self, item) -> bool: ... + def __hash__(self): ... + @staticmethod + def parse(s): ... + +def ensure_directory(path) -> None: ... +def split_sections(s) -> Generator[Incomplete, None, None]: ... + +class PkgResourcesDeprecationWarning(Warning): ... diff --git a/stubs/pkg_resources/extern/__init__.pyi b/stubs/pkg_resources/extern/__init__.pyi new file mode 100644 index 0000000..663a01e --- /dev/null +++ b/stubs/pkg_resources/extern/__init__.pyi @@ -0,0 +1,17 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +class VendorImporter: + root_name: Incomplete + vendored_names: Incomplete + vendor_pkg: Incomplete + def __init__(self, root_name, vendored_names=(), vendor_pkg: Incomplete | None = None) -> None: ... + @property + def search_path(self) -> Generator[Incomplete, None, None]: ... + def load_module(self, fullname): ... + def create_module(self, spec): ... + def exec_module(self, module) -> None: ... + def find_spec(self, fullname, path: Incomplete | None = None, target: Incomplete | None = None): ... + def install(self) -> None: ... + +names: Incomplete diff --git a/stubs/pyramid/__init__.pyi b/stubs/pyramid/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pyramid/asset.pyi b/stubs/pyramid/asset.pyi new file mode 100644 index 0000000..e2038a1 --- /dev/null +++ b/stubs/pyramid/asset.pyi @@ -0,0 +1,5 @@ +from pyramid.path import package_name as package_name, package_path as package_path + +def resolve_asset_spec(spec, pname: str = '__main__'): ... +def asset_spec_from_abspath(abspath, package): ... +def abspath_from_asset_spec(spec, pname: str = '__main__'): ... diff --git a/stubs/pyramid/authentication.pyi b/stubs/pyramid/authentication.pyi new file mode 100644 index 0000000..55f7dcb --- /dev/null +++ b/stubs/pyramid/authentication.pyi @@ -0,0 +1,122 @@ +from _typeshed import Incomplete +from pyramid.authorization import Authenticated as Authenticated, Everyone as Everyone +from pyramid.interfaces import IAuthenticationPolicy as IAuthenticationPolicy, IDebugLogger as IDebugLogger +from pyramid.util import SimpleSerializer as SimpleSerializer, ascii_ as ascii_, bytes_ as bytes_, strings_differ as strings_differ, text_ as text_ +from typing import NamedTuple + +VALID_TOKEN: Incomplete + +class CallbackAuthenticationPolicy: + debug: bool + callback: Incomplete + def authenticated_userid(self, request): ... + def effective_principals(self, request): ... + +class RepozeWho1AuthenticationPolicy(CallbackAuthenticationPolicy): + identifier_name: Incomplete + callback: Incomplete + def __init__(self, identifier_name: str = 'auth_tkt', callback: Incomplete | None = None) -> None: ... + def authenticated_userid(self, request): ... + def unauthenticated_userid(self, request): ... + def effective_principals(self, request): ... + def remember(self, request, userid, **kw): ... + def forget(self, request): ... + +class RemoteUserAuthenticationPolicy(CallbackAuthenticationPolicy): + environ_key: Incomplete + callback: Incomplete + debug: Incomplete + def __init__(self, environ_key: str = 'REMOTE_USER', callback: Incomplete | None = None, debug: bool = False) -> None: ... + def unauthenticated_userid(self, request): ... + def remember(self, request, userid, **kw): ... + def forget(self, request): ... + +class AuthTktAuthenticationPolicy(CallbackAuthenticationPolicy): + cookie: Incomplete + callback: Incomplete + debug: Incomplete + def __init__(self, secret, callback: Incomplete | None = None, cookie_name: str = 'auth_tkt', secure: bool = False, include_ip: bool = False, timeout: Incomplete | None = None, reissue_time: Incomplete | None = None, max_age: Incomplete | None = None, path: str = '/', http_only: bool = False, wild_domain: bool = True, debug: bool = False, hashalg: str = 'sha512', parent_domain: bool = False, domain: Incomplete | None = None, samesite: str = 'Lax') -> None: ... + def unauthenticated_userid(self, request): ... + def remember(self, request, userid, **kw): ... + def forget(self, request): ... + +def b64encode(v): ... +def b64decode(v): ... + +class AuthTicket: + secret: Incomplete + userid: Incomplete + ip: Incomplete + tokens: Incomplete + user_data: Incomplete + time: Incomplete + cookie_name: Incomplete + secure: Incomplete + hashalg: Incomplete + def __init__(self, secret, userid, ip, tokens=(), user_data: str = '', time: Incomplete | None = None, cookie_name: str = 'auth_tkt', secure: bool = False, hashalg: str = 'md5') -> None: ... + def digest(self): ... + def cookie_value(self): ... + +class BadTicket(Exception): + expected: Incomplete + def __init__(self, msg, expected: Incomplete | None = None) -> None: ... + +def parse_ticket(secret, ticket, ip, hashalg: str = 'md5'): ... +def calculate_digest(ip, timestamp, secret, userid, tokens, user_data, hashalg: str = 'md5'): ... +def encode_ip_timestamp(ip, timestamp): ... + +class AuthTktCookieHelper: + parse_ticket: Incomplete + AuthTicket = AuthTicket + BadTicket = BadTicket + now: Incomplete + userid_type_decoders: Incomplete + userid_type_encoders: Incomplete + cookie_profile: Incomplete + secret: Incomplete + cookie_name: Incomplete + secure: Incomplete + include_ip: Incomplete + timeout: Incomplete + reissue_time: Incomplete + max_age: Incomplete + wild_domain: Incomplete + parent_domain: Incomplete + domain: Incomplete + hashalg: Incomplete + def __init__(self, secret, cookie_name: str = 'auth_tkt', secure: bool = False, include_ip: bool = False, timeout: Incomplete | None = None, reissue_time: Incomplete | None = None, max_age: Incomplete | None = None, http_only: bool = False, path: str = '/', wild_domain: bool = True, hashalg: str = 'sha512', parent_domain: bool = False, domain: Incomplete | None = None, samesite: str = 'Lax') -> None: ... + def identify(self, request): ... + def forget(self, request): ... + def remember(self, request, userid, max_age: Incomplete | None = None, tokens=()): ... + +class SessionAuthenticationPolicy(CallbackAuthenticationPolicy): + callback: Incomplete + debug: Incomplete + helper: Incomplete + def __init__(self, prefix: str = 'auth.', callback: Incomplete | None = None, debug: bool = False) -> None: ... + def remember(self, request, userid, **kw): ... + def forget(self, request): ... + def unauthenticated_userid(self, request): ... + +class SessionAuthenticationHelper: + userid_key: Incomplete + def __init__(self, prefix: str = 'auth.') -> None: ... + def remember(self, request, userid, **kw): ... + def forget(self, request, **kw): ... + def authenticated_userid(self, request): ... + +class BasicAuthAuthenticationPolicy(CallbackAuthenticationPolicy): + check: Incomplete + realm: Incomplete + debug: Incomplete + def __init__(self, check, realm: str = 'Realm', debug: bool = False) -> None: ... + def unauthenticated_userid(self, request): ... + def remember(self, request, userid, **kw): ... + def forget(self, request): ... + def callback(self, username, request): ... + +class HTTPBasicCredentials(NamedTuple): + username: Incomplete + password: Incomplete + +def extract_http_basic_credentials(request): ... diff --git a/stubs/pyramid/authorization.pyi b/stubs/pyramid/authorization.pyi new file mode 100644 index 0000000..4585e43 --- /dev/null +++ b/stubs/pyramid/authorization.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete +from pyramid.interfaces import IAuthorizationPolicy as IAuthorizationPolicy +from pyramid.location import lineage as lineage +from pyramid.security import ACLAllowed as _ACLAllowed, ACLDenied as _ACLDenied, AllPermissionsList as _AllPermissionsList, Allow as Allow, Authenticated as Authenticated, Deny as Deny, Everyone as Everyone +from pyramid.util import is_nonstr_iter as is_nonstr_iter + +Everyone = Everyone +Authenticated = Authenticated +Allow = Allow +Deny = Deny + +class AllPermissionsList(_AllPermissionsList): ... +class ACLAllowed(_ACLAllowed): ... +class ACLDenied(_ACLDenied): ... + +ALL_PERMISSIONS: Incomplete +DENY_ALL: Incomplete + +class ACLAuthorizationPolicy: + helper: Incomplete + def __init__(self) -> None: ... + def permits(self, context, principals, permission): ... + def principals_allowed_by_permission(self, context, permission): ... + +class ACLHelper: + def permits(self, context, principals, permission): ... + def principals_allowed_by_permission(self, context, permission): ... diff --git a/stubs/pyramid/config/__init__.pyi b/stubs/pyramid/config/__init__.pyi new file mode 100644 index 0000000..1918b4f --- /dev/null +++ b/stubs/pyramid/config/__init__.pyi @@ -0,0 +1,72 @@ +import inspect +import venusian +from _typeshed import Incomplete +from pyramid.asset import resolve_asset_spec as resolve_asset_spec +from pyramid.authorization import ACLAuthorizationPolicy as ACLAuthorizationPolicy +from pyramid.config.actions import ActionConfiguratorMixin as ActionConfiguratorMixin, ActionState as ActionState, action_method as action_method +from pyramid.config.adapters import AdaptersConfiguratorMixin as AdaptersConfiguratorMixin +from pyramid.config.assets import AssetsConfiguratorMixin as AssetsConfiguratorMixin +from pyramid.config.factories import FactoriesConfiguratorMixin as FactoriesConfiguratorMixin +from pyramid.config.i18n import I18NConfiguratorMixin as I18NConfiguratorMixin +from pyramid.config.predicates import PredicateConfiguratorMixin as PredicateConfiguratorMixin, not_ as not_ +from pyramid.config.rendering import RenderingConfiguratorMixin as RenderingConfiguratorMixin +from pyramid.config.routes import RoutesConfiguratorMixin as RoutesConfiguratorMixin +from pyramid.config.security import SecurityConfiguratorMixin as SecurityConfiguratorMixin +from pyramid.config.settings import SettingsConfiguratorMixin as SettingsConfiguratorMixin +from pyramid.config.testing import TestingConfiguratorMixin as TestingConfiguratorMixin +from pyramid.config.tweens import TweensConfiguratorMixin as TweensConfiguratorMixin +from pyramid.config.views import ViewsConfiguratorMixin as ViewsConfiguratorMixin +from pyramid.config.zca import ZCAConfiguratorMixin as ZCAConfiguratorMixin +from pyramid.events import ApplicationCreated as ApplicationCreated +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.httpexceptions import default_exceptionresponse_view as default_exceptionresponse_view +from pyramid.interfaces import IDebugLogger as IDebugLogger, IExceptionResponse as IExceptionResponse, PHASE0_CONFIG as PHASE0_CONFIG, PHASE1_CONFIG as PHASE1_CONFIG, PHASE2_CONFIG as PHASE2_CONFIG, PHASE3_CONFIG as PHASE3_CONFIG +from pyramid.path import DottedNameResolver as DottedNameResolver, caller_package as caller_package, package_of as package_of +from pyramid.registry import Introspectable as Introspectable, Introspector as Introspector, Registry as Registry +from pyramid.router import Router as Router +from pyramid.settings import aslist as aslist +from pyramid.threadlocal import manager as manager +from pyramid.util import WeakOrderedSet as WeakOrderedSet, get_callable_name as get_callable_name, object_description as object_description + +not_ = not_ +PHASE0_CONFIG = PHASE0_CONFIG +PHASE1_CONFIG = PHASE1_CONFIG +PHASE2_CONFIG = PHASE2_CONFIG +PHASE3_CONFIG = PHASE3_CONFIG +ActionState = ActionState + +class Configurator(ActionConfiguratorMixin, PredicateConfiguratorMixin, TestingConfiguratorMixin, TweensConfiguratorMixin, SecurityConfiguratorMixin, ViewsConfiguratorMixin, RoutesConfiguratorMixin, ZCAConfiguratorMixin, I18NConfiguratorMixin, RenderingConfiguratorMixin, AssetsConfiguratorMixin, SettingsConfiguratorMixin, FactoriesConfiguratorMixin, AdaptersConfiguratorMixin): + manager = manager + venusian = venusian + basepath: Incomplete + includepath: Incomplete + info: str + object_description: Incomplete + introspectable = Introspectable + inspect = inspect + name_resolver: Incomplete + package_name: Incomplete + package: Incomplete + root_package: Incomplete + registry: Incomplete + autocommit: Incomplete + route_prefix: Incomplete + introspection: Incomplete + def __init__(self, registry: Incomplete | None = None, package: Incomplete | None = None, settings: Incomplete | None = None, root_factory: Incomplete | None = None, security_policy: Incomplete | None = None, authentication_policy: Incomplete | None = None, authorization_policy: Incomplete | None = None, renderers: Incomplete | None = None, debug_logger: Incomplete | None = None, locale_negotiator: Incomplete | None = None, request_factory: Incomplete | None = None, response_factory: Incomplete | None = None, default_permission: Incomplete | None = None, session_factory: Incomplete | None = None, default_view_mapper: Incomplete | None = None, autocommit: bool = False, exceptionresponse_view=..., route_prefix: Incomplete | None = None, introspection: bool = True, root_package: Incomplete | None = None) -> None: ... + def setup_registry(self, settings: Incomplete | None = None, root_factory: Incomplete | None = None, security_policy: Incomplete | None = None, authentication_policy: Incomplete | None = None, authorization_policy: Incomplete | None = None, renderers: Incomplete | None = None, debug_logger: Incomplete | None = None, locale_negotiator: Incomplete | None = None, request_factory: Incomplete | None = None, response_factory: Incomplete | None = None, default_permission: Incomplete | None = None, session_factory: Incomplete | None = None, default_view_mapper: Incomplete | None = None, exceptionresponse_view=...) -> None: ... + introspector: Incomplete + def include(self, callable, route_prefix: Incomplete | None = None) -> None: ... + def add_directive(self, name, directive, action_wrap: bool = True) -> None: ... + def __getattr__(self, name): ... + def with_package(self, package): ... + def maybe_dotted(self, dotted): ... + def absolute_asset_spec(self, relative_spec): ... + absolute_resource_spec = absolute_asset_spec + def begin(self, request=...) -> None: ... + def end(self): ... + def __enter__(self): ... + def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_traceback: types.TracebackType | None) -> None: ... + def scan(self, package: Incomplete | None = None, categories=('pyramid',), onerror: Incomplete | None = None, ignore: Incomplete | None = None, **kw) -> None: ... + def make_wsgi_app(self): ... + +global_registries: Incomplete diff --git a/stubs/pyramid/config/actions.pyi b/stubs/pyramid/config/actions.pyi new file mode 100644 index 0000000..0411004 --- /dev/null +++ b/stubs/pyramid/config/actions.pyi @@ -0,0 +1,40 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from pyramid.exceptions import ConfigurationConflictError as ConfigurationConflictError, ConfigurationError as ConfigurationError, ConfigurationExecutionError as ConfigurationExecutionError +from pyramid.interfaces import IActionInfo as IActionInfo +from pyramid.registry import undefer as undefer +from pyramid.util import is_nonstr_iter as is_nonstr_iter, reraise as reraise + +class ActionConfiguratorMixin: + @property + def action_info(self): ... + def action(self, discriminator, callable: Incomplete | None = None, args=(), kw: Incomplete | None = None, order: int = 0, introspectables=(), **extra) -> None: ... + action_state: Incomplete + def commit(self) -> None: ... + +class ActionState: + actions: Incomplete + def __init__(self) -> None: ... + def processSpec(self, spec): ... + def action(self, discriminator, callable: Incomplete | None = None, args=(), kw: Incomplete | None = None, order: int = 0, includepath=(), info: Incomplete | None = None, introspectables=(), **extra) -> None: ... + def execute_actions(self, clear: bool = True, introspector: Incomplete | None = None): ... + +class ConflictResolverState: + resolved_ainfos: Incomplete + remaining_actions: Incomplete + min_order: Incomplete + start: int + def __init__(self) -> None: ... + +def resolveConflicts(actions, state: Incomplete | None = None) -> Generator[Incomplete, None, Incomplete]: ... +def normalize_actions(actions): ... +def expand_action_tuple(discriminator, callable: Incomplete | None = None, args=(), kw: Incomplete | None = None, includepath=(), info: Incomplete | None = None, order: int = 0, introspectables=()): ... + +class ActionInfo: + file: Incomplete + line: Incomplete + function: Incomplete + src: Incomplete + def __init__(self, file, line, function, src) -> None: ... + +def action_method(wrapped): ... diff --git a/stubs/pyramid/config/adapters.pyi b/stubs/pyramid/config/adapters.pyi new file mode 100644 index 0000000..65de9e7 --- /dev/null +++ b/stubs/pyramid/config/adapters.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete +from pyramid.config.actions import action_method as action_method +from pyramid.interfaces import IResourceURL as IResourceURL, IResponse as IResponse, ITraverser as ITraverser +from pyramid.util import takes_one_arg as takes_one_arg + +class AdaptersConfiguratorMixin: + def add_subscriber(self, subscriber, iface: Incomplete | None = None, **predicates): ... + def add_subscriber_predicate(self, name, factory, weighs_more_than: Incomplete | None = None, weighs_less_than: Incomplete | None = None) -> None: ... + def add_response_adapter(self, adapter, type_or_iface) -> None: ... + def add_default_response_adapters(self) -> None: ... + def add_traverser(self, adapter, iface: Incomplete | None = None) -> None: ... + def add_resource_url_adapter(self, adapter, resource_iface: Incomplete | None = None) -> None: ... + +def eventonly(callee): ... diff --git a/stubs/pyramid/config/assets.pyi b/stubs/pyramid/config/assets.pyi new file mode 100644 index 0000000..3d4d867 --- /dev/null +++ b/stubs/pyramid/config/assets.pyi @@ -0,0 +1,77 @@ +import pkg_resources +from _typeshed import Incomplete +from collections.abc import Generator +from pyramid.config.actions import action_method as action_method +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import IPackageOverrides as IPackageOverrides, PHASE1_CONFIG as PHASE1_CONFIG +from pyramid.threadlocal import get_current_registry as get_current_registry + +class OverrideProvider(pkg_resources.DefaultProvider): + module_name: Incomplete + def __init__(self, module) -> None: ... + def get_resource_filename(self, manager, resource_name): ... + def get_resource_stream(self, manager, resource_name): ... + def get_resource_string(self, manager, resource_name): ... + def has_resource(self, resource_name): ... + def resource_isdir(self, resource_name): ... + def resource_listdir(self, resource_name): ... + +class PackageOverrides: + overrides: Incomplete + overridden_package_name: Incomplete + def __init__(self, package, pkg_resources=...) -> None: ... + def insert(self, path, source): ... + def filtered_sources(self, resource_name) -> Generator[Incomplete, None, None]: ... + def get_filename(self, resource_name): ... + def get_stream(self, resource_name): ... + def get_string(self, resource_name): ... + def has_resource(self, resource_name): ... + def isdir(self, resource_name): ... + def listdir(self, resource_name): ... + @property + def real_loader(self): ... + def get_data(self, path): ... + def is_package(self, fullname): ... + def get_code(self, fullname): ... + def get_source(self, fullname): ... + +class DirectoryOverride: + path: Incomplete + pathlen: Incomplete + source: Incomplete + def __init__(self, path, source) -> None: ... + def __call__(self, resource_name): ... + +class FileOverride: + path: Incomplete + source: Incomplete + def __init__(self, path, source) -> None: ... + def __call__(self, resource_name): ... + +class PackageAssetSource: + package: Incomplete + pkg_name: Incomplete + prefix: Incomplete + def __init__(self, package, prefix) -> None: ... + def get_path(self, resource_name): ... + def get_filename(self, resource_name): ... + def get_stream(self, resource_name): ... + def get_string(self, resource_name): ... + def exists(self, resource_name): ... + def isdir(self, resource_name): ... + def listdir(self, resource_name): ... + +class FSAssetSource: + prefix: Incomplete + def __init__(self, prefix) -> None: ... + def get_path(self, resource_name): ... + def get_filename(self, resource_name): ... + def get_stream(self, resource_name): ... + def get_string(self, resource_name): ... + def exists(self, resource_name): ... + def isdir(self, resource_name): ... + def listdir(self, resource_name): ... + +class AssetsConfiguratorMixin: + def override_asset(self, to_override, override_with, _override: Incomplete | None = None) -> None: ... + override_resource = override_asset diff --git a/stubs/pyramid/config/factories.pyi b/stubs/pyramid/config/factories.pyi new file mode 100644 index 0000000..9b3f836 --- /dev/null +++ b/stubs/pyramid/config/factories.pyi @@ -0,0 +1,19 @@ +from _typeshed import Incomplete +from pyramid.config.actions import action_method as action_method +from pyramid.interfaces import IDefaultRootFactory as IDefaultRootFactory, IExecutionPolicy as IExecutionPolicy, IRequestExtensions as IRequestExtensions, IRequestFactory as IRequestFactory, IResponseFactory as IResponseFactory, IRootFactory as IRootFactory, ISessionFactory as ISessionFactory +from pyramid.router import default_execution_policy as default_execution_policy +from pyramid.traversal import DefaultRootFactory as DefaultRootFactory +from pyramid.util import InstancePropertyHelper as InstancePropertyHelper, get_callable_name as get_callable_name + +class FactoriesConfiguratorMixin: + def set_root_factory(self, factory) -> None: ... + def set_session_factory(self, factory) -> None: ... + def set_request_factory(self, factory) -> None: ... + def set_response_factory(self, factory) -> None: ... + def add_request_method(self, callable: Incomplete | None = None, name: Incomplete | None = None, property: bool = False, reify: bool = False) -> None: ... + def set_execution_policy(self, policy) -> None: ... + +class _RequestExtensions: + descriptors: Incomplete + methods: Incomplete + def __init__(self) -> None: ... diff --git a/stubs/pyramid/config/i18n.pyi b/stubs/pyramid/config/i18n.pyi new file mode 100644 index 0000000..fa80f86 --- /dev/null +++ b/stubs/pyramid/config/i18n.pyi @@ -0,0 +1,8 @@ +from pyramid.config.actions import action_method as action_method +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import ILocaleNegotiator as ILocaleNegotiator, ITranslationDirectories as ITranslationDirectories +from pyramid.path import AssetResolver as AssetResolver + +class I18NConfiguratorMixin: + def set_locale_negotiator(self, negotiator) -> None: ... + def add_translation_dirs(self, *specs, **kw) -> None: ... diff --git a/stubs/pyramid/config/predicates.pyi b/stubs/pyramid/config/predicates.pyi new file mode 100644 index 0000000..f86e92c --- /dev/null +++ b/stubs/pyramid/config/predicates.pyi @@ -0,0 +1,34 @@ +from _typeshed import Incomplete +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import IPredicateList as IPredicateList, PHASE1_CONFIG as PHASE1_CONFIG +from pyramid.predicates import Notted as Notted +from pyramid.registry import predvalseq as predvalseq +from pyramid.util import TopologicalSorter as TopologicalSorter, bytes_ as bytes_, is_nonstr_iter as is_nonstr_iter + +MAX_ORDER: Incomplete +DEFAULT_PHASH: Incomplete + +class PredicateConfiguratorMixin: + def get_predlist(self, name): ... + +class not_: + value: Incomplete + def __init__(self, value) -> None: ... + +class PredicateInfo: + package: Incomplete + registry: Incomplete + settings: Incomplete + maybe_dotted: Incomplete + def __init__(self, package, registry, settings, maybe_dotted) -> None: ... + +class PredicateList: + sorter: Incomplete + last_added: Incomplete + def __init__(self) -> None: ... + def add(self, name, factory, weighs_more_than: Incomplete | None = None, weighs_less_than: Incomplete | None = None) -> None: ... + def names(self): ... + def make(self, config, **kw): ... + +def normalize_accept_offer(offer): ... +def sort_accept_offers(offers, order: Incomplete | None = None): ... diff --git a/stubs/pyramid/config/rendering.pyi b/stubs/pyramid/config/rendering.pyi new file mode 100644 index 0000000..a36b2cc --- /dev/null +++ b/stubs/pyramid/config/rendering.pyi @@ -0,0 +1,10 @@ +from _typeshed import Incomplete +from pyramid import renderers as renderers +from pyramid.config.actions import action_method as action_method +from pyramid.interfaces import IRendererFactory as IRendererFactory, PHASE1_CONFIG as PHASE1_CONFIG + +DEFAULT_RENDERERS: Incomplete + +class RenderingConfiguratorMixin: + def add_default_renderers(self) -> None: ... + def add_renderer(self, name, factory) -> None: ... diff --git a/stubs/pyramid/config/routes.pyi b/stubs/pyramid/config/routes.pyi new file mode 100644 index 0000000..2bd98f2 --- /dev/null +++ b/stubs/pyramid/config/routes.pyi @@ -0,0 +1,17 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from pyramid.config.actions import action_method as action_method +from pyramid.config.predicates import normalize_accept_offer as normalize_accept_offer, predvalseq as predvalseq +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import IRequest as IRequest, IRouteRequest as IRouteRequest, IRoutesMapper as IRoutesMapper, PHASE2_CONFIG as PHASE2_CONFIG +from pyramid.request import route_request_iface as route_request_iface +from pyramid.urldispatch import RoutesMapper as RoutesMapper +from pyramid.util import as_sorted_tuple as as_sorted_tuple, is_nonstr_iter as is_nonstr_iter + +class RoutesConfiguratorMixin: + def add_route(self, name, pattern: Incomplete | None = None, factory: Incomplete | None = None, for_: Incomplete | None = None, header: Incomplete | None = None, xhr: Incomplete | None = None, accept: Incomplete | None = None, path_info: Incomplete | None = None, request_method: Incomplete | None = None, request_param: Incomplete | None = None, traverse: Incomplete | None = None, custom_predicates=(), use_global_views: bool = False, path: Incomplete | None = None, pregenerator: Incomplete | None = None, static: bool = False, inherit_slash: Incomplete | None = None, **predicates): ... + def add_route_predicate(self, name, factory, weighs_more_than: Incomplete | None = None, weighs_less_than: Incomplete | None = None) -> None: ... + def add_default_route_predicates(self) -> None: ... + def get_routes_mapper(self): ... + route_prefix: Incomplete + def route_prefix_context(self, route_prefix) -> Generator[None, None, None]: ... diff --git a/stubs/pyramid/config/security.pyi b/stubs/pyramid/config/security.pyi new file mode 100644 index 0000000..e6371a6 --- /dev/null +++ b/stubs/pyramid/config/security.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete +from pyramid.config.actions import action_method as action_method +from pyramid.csrf import LegacySessionCSRFStoragePolicy as LegacySessionCSRFStoragePolicy +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import IAuthenticationPolicy as IAuthenticationPolicy, IAuthorizationPolicy as IAuthorizationPolicy, ICSRFStoragePolicy as ICSRFStoragePolicy, IDefaultCSRFOptions as IDefaultCSRFOptions, IDefaultPermission as IDefaultPermission, ISecurityPolicy as ISecurityPolicy, PHASE1_CONFIG as PHASE1_CONFIG, PHASE2_CONFIG as PHASE2_CONFIG +from pyramid.security import LegacySecurityPolicy as LegacySecurityPolicy +from pyramid.util import as_sorted_tuple as as_sorted_tuple + +class SecurityConfiguratorMixin: + def add_default_security(self) -> None: ... + def set_security_policy(self, policy) -> None: ... + def set_authentication_policy(self, policy) -> None: ... + def set_authorization_policy(self, policy) -> None: ... + def set_default_permission(self, permission) -> None: ... + def add_permission(self, permission_name) -> None: ... + def set_default_csrf_options(self, require_csrf: bool = True, token: str = 'csrf_token', header: str = 'X-CSRF-Token', safe_methods=('GET', 'HEAD', 'OPTIONS', 'TRACE'), check_origin: bool = True, allow_no_origin: bool = False, callback: Incomplete | None = None) -> None: ... + def set_csrf_storage_policy(self, policy) -> None: ... + +class DefaultCSRFOptions: + require_csrf: Incomplete + token: Incomplete + header: Incomplete + safe_methods: Incomplete + check_origin: Incomplete + allow_no_origin: Incomplete + callback: Incomplete + def __init__(self, require_csrf, token, header, safe_methods, check_origin, allow_no_origin, callback) -> None: ... diff --git a/stubs/pyramid/config/settings.pyi b/stubs/pyramid/config/settings.pyi new file mode 100644 index 0000000..c1e2d03 --- /dev/null +++ b/stubs/pyramid/config/settings.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete +from pyramid.settings import asbool as asbool, aslist as aslist + +class SettingsConfiguratorMixin: + def add_settings(self, settings: Incomplete | None = None, **kw) -> None: ... + def get_settings(self): ... + +def Settings(d: Incomplete | None = None, _environ_=..., **kw): ... diff --git a/stubs/pyramid/config/tweens.pyi b/stubs/pyramid/config/tweens.pyi new file mode 100644 index 0000000..17d19e2 --- /dev/null +++ b/stubs/pyramid/config/tweens.pyi @@ -0,0 +1,19 @@ +from _typeshed import Incomplete +from pyramid.config.actions import action_method as action_method +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import ITweens as ITweens +from pyramid.tweens import EXCVIEW as EXCVIEW, INGRESS as INGRESS, MAIN as MAIN +from pyramid.util import TopologicalSorter as TopologicalSorter, is_nonstr_iter as is_nonstr_iter, is_string_or_iterable as is_string_or_iterable + +class TweensConfiguratorMixin: + def add_tween(self, tween_factory, under: Incomplete | None = None, over: Incomplete | None = None): ... + def add_default_tweens(self) -> None: ... + +class Tweens: + sorter: Incomplete + explicit: Incomplete + def __init__(self) -> None: ... + def add_explicit(self, name, factory) -> None: ... + def add_implicit(self, name, factory, under: Incomplete | None = None, over: Incomplete | None = None) -> None: ... + def implicit(self): ... + def __call__(self, handler, registry): ... diff --git a/stubs/pyramid/config/views.pyi b/stubs/pyramid/config/views.pyi new file mode 100644 index 0000000..cfe03d3 --- /dev/null +++ b/stubs/pyramid/config/views.pyi @@ -0,0 +1,79 @@ +from _typeshed import Incomplete +from pyramid import renderers as renderers +from pyramid.asset import resolve_asset_spec as resolve_asset_spec +from pyramid.config.actions import action_method as action_method +from pyramid.config.predicates import DEFAULT_PHASH as DEFAULT_PHASH, MAX_ORDER as MAX_ORDER, normalize_accept_offer as normalize_accept_offer, predvalseq as predvalseq, sort_accept_offers as sort_accept_offers +from pyramid.decorator import reify as reify +from pyramid.exceptions import ConfigurationError as ConfigurationError, PredicateMismatch as PredicateMismatch +from pyramid.httpexceptions import HTTPForbidden as HTTPForbidden, HTTPNotFound as HTTPNotFound, default_exceptionresponse_view as default_exceptionresponse_view +from pyramid.interfaces import IAcceptOrder as IAcceptOrder, IException as IException, IExceptionViewClassifier as IExceptionViewClassifier, IMultiView as IMultiView, IPackageOverrides as IPackageOverrides, IRendererFactory as IRendererFactory, IRequest as IRequest, IResponse as IResponse, IRouteRequest as IRouteRequest, ISecuredView as ISecuredView, IStaticURLInfo as IStaticURLInfo, IView as IView, IViewClassifier as IViewClassifier, IViewDeriverInfo as IViewDeriverInfo, IViewDerivers as IViewDerivers, IViewMapperFactory as IViewMapperFactory, PHASE1_CONFIG as PHASE1_CONFIG +from pyramid.registry import Deferred as Deferred +from pyramid.security import NO_PERMISSION_REQUIRED as NO_PERMISSION_REQUIRED +from pyramid.static import static_view as static_view +from pyramid.url import parse_url_overrides as parse_url_overrides +from pyramid.util import TopologicalSorter as TopologicalSorter, WIN as WIN, as_sorted_tuple as as_sorted_tuple, is_nonstr_iter as is_nonstr_iter +from pyramid.view import AppendSlashNotFoundViewFactory as AppendSlashNotFoundViewFactory +from pyramid.viewderivers import DefaultViewMapper as DefaultViewMapper, INGRESS as INGRESS, VIEW as VIEW, preserve_view_attrs as preserve_view_attrs, requestonly as requestonly, view_description as view_description, wraps_view as wraps_view + +DefaultViewMapper = DefaultViewMapper +preserve_view_attrs = preserve_view_attrs +requestonly = requestonly +view_description = view_description + +class MultiView: + name: Incomplete + media_views: Incomplete + views: Incomplete + accepts: Incomplete + def __init__(self, name) -> None: ... + def __discriminator__(self, context, request): ... + def add(self, view, order, phash: Incomplete | None = None, accept: Incomplete | None = None, accept_order: Incomplete | None = None) -> None: ... + def get_views(self, request): ... + def match(self, context, request): ... + def __permitted__(self, context, request): ... + def __call_permissive__(self, context, request): ... + def __call__(self, context, request): ... + +def attr_wrapped_view(view, info): ... +def predicated_view(view, info): ... +def viewdefaults(wrapped): ... +def combine_decorators(*decorators): ... + +class ViewsConfiguratorMixin: + def add_view(self, view: Incomplete | None = None, name: str = '', for_: Incomplete | None = None, permission: Incomplete | None = None, request_type: Incomplete | None = None, route_name: Incomplete | None = None, request_method: Incomplete | None = None, request_param: Incomplete | None = None, containment: Incomplete | None = None, attr: Incomplete | None = None, renderer: Incomplete | None = None, wrapper: Incomplete | None = None, xhr: Incomplete | None = None, accept: Incomplete | None = None, header: Incomplete | None = None, path_info: Incomplete | None = None, custom_predicates=(), context: Incomplete | None = None, decorator: Incomplete | None = None, mapper: Incomplete | None = None, http_cache: Incomplete | None = None, match_param: Incomplete | None = None, require_csrf: Incomplete | None = None, exception_only: bool = False, **view_options): ... + def add_view_predicate(self, name, factory, weighs_more_than: Incomplete | None = None, weighs_less_than: Incomplete | None = None) -> None: ... + def add_default_view_predicates(self) -> None: ... + def add_default_accept_view_order(self) -> None: ... + def add_accept_view_order(self, value, weighs_more_than: Incomplete | None = None, weighs_less_than: Incomplete | None = None): ... + def add_view_deriver(self, deriver, name: Incomplete | None = None, under: Incomplete | None = None, over: Incomplete | None = None) -> None: ... + def add_default_view_derivers(self) -> None: ... + def derive_view(self, view, attr: Incomplete | None = None, renderer: Incomplete | None = None): ... + def add_forbidden_view(self, view: Incomplete | None = None, attr: Incomplete | None = None, renderer: Incomplete | None = None, wrapper: Incomplete | None = None, route_name: Incomplete | None = None, request_type: Incomplete | None = None, request_method: Incomplete | None = None, request_param: Incomplete | None = None, containment: Incomplete | None = None, xhr: Incomplete | None = None, accept: Incomplete | None = None, header: Incomplete | None = None, path_info: Incomplete | None = None, custom_predicates=(), decorator: Incomplete | None = None, mapper: Incomplete | None = None, match_param: Incomplete | None = None, **view_options): ... + set_forbidden_view = add_forbidden_view + def add_notfound_view(self, view: Incomplete | None = None, attr: Incomplete | None = None, renderer: Incomplete | None = None, wrapper: Incomplete | None = None, route_name: Incomplete | None = None, request_type: Incomplete | None = None, request_method: Incomplete | None = None, request_param: Incomplete | None = None, containment: Incomplete | None = None, xhr: Incomplete | None = None, accept: Incomplete | None = None, header: Incomplete | None = None, path_info: Incomplete | None = None, custom_predicates=(), decorator: Incomplete | None = None, mapper: Incomplete | None = None, match_param: Incomplete | None = None, append_slash: bool = False, **view_options): ... + set_notfound_view = add_notfound_view + def add_exception_view(self, view: Incomplete | None = None, context: Incomplete | None = None, **view_options): ... + def set_view_mapper(self, mapper) -> None: ... + def add_static_view(self, name, path, **kw) -> None: ... + def add_cache_buster(self, path, cachebust, explicit: bool = False) -> None: ... + +def isexception(o): ... +def runtime_exc_view(view, excview): ... + +class ViewDeriverInfo: + original_view: Incomplete + registry: Incomplete + package: Incomplete + predicates: Incomplete + options: Incomplete + exception_only: Incomplete + def __init__(self, view, registry, package, predicates, exception_only, options) -> None: ... + def settings(self): ... + +class StaticURLInfo: + registrations: Incomplete + cache_busters: Incomplete + def __init__(self) -> None: ... + def generate(self, path, request, **kw): ... + def add(self, config, name, spec, **extra) -> None: ... + def add_cache_buster(self, config, spec, cachebust, explicit: bool = False) -> None: ... diff --git a/stubs/pyramid/config/zca.pyi b/stubs/pyramid/config/zca.pyi new file mode 100644 index 0000000..3de1671 --- /dev/null +++ b/stubs/pyramid/config/zca.pyi @@ -0,0 +1,5 @@ +from pyramid.threadlocal import get_current_registry as get_current_registry + +class ZCAConfiguratorMixin: + def hook_zca(self) -> None: ... + def unhook_zca(self) -> None: ... diff --git a/stubs/pyramid/csrf.pyi b/stubs/pyramid/csrf.pyi new file mode 100644 index 0000000..83351af --- /dev/null +++ b/stubs/pyramid/csrf.pyi @@ -0,0 +1,30 @@ +from _typeshed import Incomplete +from pyramid.exceptions import BadCSRFOrigin as BadCSRFOrigin, BadCSRFToken as BadCSRFToken +from pyramid.interfaces import ICSRFStoragePolicy as ICSRFStoragePolicy +from pyramid.settings import aslist as aslist +from pyramid.util import SimpleSerializer as SimpleSerializer, bytes_ as bytes_, is_same_domain as is_same_domain, strings_differ as strings_differ, text_ as text_ + +class LegacySessionCSRFStoragePolicy: + def new_csrf_token(self, request): ... + def get_csrf_token(self, request): ... + def check_csrf_token(self, request, supplied_token): ... + +class SessionCSRFStoragePolicy: + key: Incomplete + def __init__(self, key: str = '_csrft_') -> None: ... + def new_csrf_token(self, request): ... + def get_csrf_token(self, request): ... + def check_csrf_token(self, request, supplied_token): ... + +class CookieCSRFStoragePolicy: + cookie_profile: Incomplete + cookie_name: Incomplete + def __init__(self, cookie_name: str = 'csrf_token', secure: bool = False, httponly: bool = False, domain: Incomplete | None = None, max_age: Incomplete | None = None, path: str = '/', samesite: str = 'Lax') -> None: ... + def new_csrf_token(self, request): ... + def get_csrf_token(self, request): ... + def check_csrf_token(self, request, supplied_token): ... + +def get_csrf_token(request): ... +def new_csrf_token(request): ... +def check_csrf_token(request, token: str = 'csrf_token', header: str = 'X-CSRF-Token', raises: bool = True): ... +def check_csrf_origin(request, *, trusted_origins: Incomplete | None = None, allow_no_origin: bool = False, raises: bool = True): ... diff --git a/stubs/pyramid/decorator.pyi b/stubs/pyramid/decorator.pyi new file mode 100644 index 0000000..f9fd953 --- /dev/null +++ b/stubs/pyramid/decorator.pyi @@ -0,0 +1,7 @@ +from _typeshed import Incomplete + +class reify: + wrapped: Incomplete + __doc__: Incomplete + def __init__(self, wrapped) -> None: ... + def __get__(self, inst, objtype: Incomplete | None = None): ... diff --git a/stubs/pyramid/encode.pyi b/stubs/pyramid/encode.pyi new file mode 100644 index 0000000..e008a23 --- /dev/null +++ b/stubs/pyramid/encode.pyi @@ -0,0 +1,5 @@ +from pyramid.util import is_nonstr_iter as is_nonstr_iter + +def url_quote(val, safe: str = ''): ... +def quote_plus(val, safe: str = ''): ... +def urlencode(query, doseq: bool = True, quote_via=...): ... diff --git a/stubs/pyramid/events.pyi b/stubs/pyramid/events.pyi new file mode 100644 index 0000000..744c871 --- /dev/null +++ b/stubs/pyramid/events.pyi @@ -0,0 +1,41 @@ +import venusian +from _typeshed import Incomplete +from pyramid.interfaces import IApplicationCreated as IApplicationCreated, IBeforeRender as IBeforeRender, IBeforeTraversal as IBeforeTraversal, IContextFound as IContextFound, INewRequest as INewRequest, INewResponse as INewResponse + +class subscriber: + venusian = venusian + ifaces: Incomplete + predicates: Incomplete + depth: Incomplete + category: Incomplete + def __init__(self, *ifaces, **predicates) -> None: ... + def register(self, scanner, name, wrapped) -> None: ... + def __call__(self, wrapped): ... + +class NewRequest: + request: Incomplete + def __init__(self, request) -> None: ... + +class NewResponse: + request: Incomplete + response: Incomplete + def __init__(self, request, response) -> None: ... + +class BeforeTraversal: + request: Incomplete + def __init__(self, request) -> None: ... + +class ContextFound: + request: Incomplete + def __init__(self, request) -> None: ... +AfterTraversal = ContextFound + +class ApplicationCreated: + app: Incomplete + object: Incomplete + def __init__(self, app) -> None: ... +WSGIApplicationCreatedEvent = ApplicationCreated + +class BeforeRender(dict): + rendering_val: Incomplete + def __init__(self, system, rendering_val: Incomplete | None = None) -> None: ... diff --git a/stubs/pyramid/exceptions.pyi b/stubs/pyramid/exceptions.pyi new file mode 100644 index 0000000..037b961 --- /dev/null +++ b/stubs/pyramid/exceptions.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete +from pyramid.httpexceptions import HTTPBadRequest as HTTPBadRequest, HTTPForbidden as HTTPForbidden, HTTPNotFound as HTTPNotFound + +NotFound = HTTPNotFound +Forbidden = HTTPForbidden + +class BadCSRFOrigin(HTTPBadRequest): + title: str + explanation: str + +class BadCSRFToken(HTTPBadRequest): + title: str + explanation: str + +class PredicateMismatch(HTTPNotFound): ... +class URLDecodeError(UnicodeDecodeError): ... +class ConfigurationError(Exception): ... + +class ConfigurationConflictError(ConfigurationError): + def __init__(self, conflicts) -> None: ... + +class ConfigurationExecutionError(ConfigurationError): + def __init__(self, etype, evalue, info) -> None: ... + +class CyclicDependencyError(Exception): + cycles: Incomplete + def __init__(self, cycles) -> None: ... diff --git a/stubs/pyramid/httpexceptions.pyi b/stubs/pyramid/httpexceptions.pyi new file mode 100644 index 0000000..83fecdd --- /dev/null +++ b/stubs/pyramid/httpexceptions.pyi @@ -0,0 +1,272 @@ +from _typeshed import Incomplete +from pyramid.interfaces import IExceptionResponse as IExceptionResponse +from pyramid.response import Response as Response +from pyramid.util import text_ as text_ + +class HTTPException(Response, Exception): + code: int + title: str + explanation: str + body_template_obj: Incomplete + plain_template_obj: Incomplete + html_template_obj: Incomplete + empty_body: bool + detail: Incomplete + comment: Incomplete + body_template: Incomplete + def __init__(self, detail: Incomplete | None = None, headers: Incomplete | None = None, comment: Incomplete | None = None, body_template: Incomplete | None = None, json_formatter: Incomplete | None = None, **kw) -> None: ... + content_type: str + charset: Incomplete + excobj: Incomplete + app_iter: Incomplete + body: Incomplete + def prepare(self, environ): ... + @property + def wsgi_response(self): ... + exception = wsgi_response + def __call__(self, environ, start_response): ... +WSGIHTTPException = HTTPException + +class HTTPError(HTTPException): ... +class HTTPRedirection(HTTPException): ... +class HTTPSuccessful(HTTPException): ... + +class HTTPOk(HTTPSuccessful): + code: int + title: str + +class HTTPCreated(HTTPSuccessful): + code: int + title: str + +class HTTPAccepted(HTTPSuccessful): + code: int + title: str + explanation: str + +class HTTPNonAuthoritativeInformation(HTTPSuccessful): + code: int + title: str + +class HTTPNoContent(HTTPSuccessful): + code: int + title: str + empty_body: bool + +class HTTPResetContent(HTTPSuccessful): + code: int + title: str + empty_body: bool + +class HTTPPartialContent(HTTPSuccessful): + code: int + title: str + +class _HTTPMove(HTTPRedirection): + explanation: str + body_template_obj: Incomplete + def __init__(self, location: str = '', detail: Incomplete | None = None, headers: Incomplete | None = None, comment: Incomplete | None = None, body_template: Incomplete | None = None, **kw) -> None: ... + +class HTTPMultipleChoices(_HTTPMove): + code: int + title: str + +class HTTPMovedPermanently(_HTTPMove): + code: int + title: str + +class HTTPFound(_HTTPMove): + code: int + title: str + explanation: str + +class HTTPSeeOther(_HTTPMove): + code: int + title: str + +class HTTPNotModified(HTTPRedirection): + code: int + title: str + empty_body: bool + +class HTTPUseProxy(_HTTPMove): + code: int + title: str + explanation: str + +class HTTPTemporaryRedirect(_HTTPMove): + code: int + title: str + +class HTTPPermanentRedirect(_HTTPMove): + code: int + title: str + +class HTTPClientError(HTTPError): + code: int + title: str + +class HTTPBadRequest(HTTPClientError): + explanation: str + +class HTTPUnauthorized(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPaymentRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPForbidden(HTTPClientError): + code: int + title: str + explanation: str + result: Incomplete + def __init__(self, detail: Incomplete | None = None, headers: Incomplete | None = None, comment: Incomplete | None = None, body_template: Incomplete | None = None, result: Incomplete | None = None, **kw) -> None: ... + +class HTTPNotFound(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPMethodNotAllowed(HTTPClientError): + code: int + title: str + body_template_obj: Incomplete + +class HTTPNotAcceptable(HTTPClientError): + code: int + title: str + +class HTTPProxyAuthenticationRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestTimeout(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPConflict(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPGone(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPLengthRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPreconditionFailed(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestEntityTooLarge(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestURITooLong(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPUnsupportedMediaType(HTTPClientError): + code: int + title: str + +class HTTPRequestRangeNotSatisfiable(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPExpectationFailed(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPImATeapot(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPUnprocessableEntity(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPLocked(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPFailedDependency(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPreconditionRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPTooManyRequests(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPServerError(HTTPError): + code: int + title: str + +class HTTPInternalServerError(HTTPServerError): + explanation: str + +class HTTPNotImplemented(HTTPServerError): + code: int + title: str + +class HTTPBadGateway(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPServiceUnavailable(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPGatewayTimeout(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPVersionNotSupported(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPInsufficientStorage(HTTPServerError): + code: int + title: str + explanation: str + +def exception_response(status_code, **kw): ... +def default_exceptionresponse_view(context, request): ... + +status_map: Incomplete +code: Incomplete diff --git a/stubs/pyramid/i18n.pyi b/stubs/pyramid/i18n.pyi new file mode 100644 index 0000000..0b1750c --- /dev/null +++ b/stubs/pyramid/i18n.pyi @@ -0,0 +1,44 @@ +import gettext +from _typeshed import Incomplete +from pyramid.decorator import reify as reify +from pyramid.interfaces import ILocaleNegotiator as ILocaleNegotiator, ILocalizer as ILocalizer, ITranslationDirectories as ITranslationDirectories +from pyramid.threadlocal import get_current_registry as get_current_registry +from translationstring import TranslationString, TranslationStringFactory + +TranslationString = TranslationString +TranslationStringFactory = TranslationStringFactory +DEFAULT_PLURAL: Incomplete + +class Localizer: + locale_name: Incomplete + translations: Incomplete + pluralizer: Incomplete + translator: Incomplete + def __init__(self, locale_name, translations) -> None: ... + def translate(self, tstring, domain: Incomplete | None = None, mapping: Incomplete | None = None): ... + def pluralize(self, singular, plural, n, domain: Incomplete | None = None, mapping: Incomplete | None = None): ... + +def default_locale_negotiator(request): ... +def negotiate_locale_name(request): ... +def get_locale_name(request): ... +def make_localizer(current_locale_name, translation_directories): ... +def get_localizer(request): ... + +class Translations(gettext.GNUTranslations): + DEFAULT_DOMAIN: str + plural: Incomplete + files: Incomplete + domain: Incomplete + def __init__(self, fileobj: Incomplete | None = None, domain=...) -> None: ... + @classmethod + def load(cls, dirname: Incomplete | None = None, locales: Incomplete | None = None, domain=...): ... + def add(self, translations, merge: bool = True): ... + def merge(self, translations): ... + def dgettext(self, domain, message): ... + def dugettext(self, domain, message): ... + def dngettext(self, domain, singular, plural, num): ... + def dungettext(self, domain, singular, plural, num): ... + +class LocalizerRequestMixin: + def localizer(self): ... + def locale_name(self): ... diff --git a/stubs/pyramid/interfaces.pyi b/stubs/pyramid/interfaces.pyi new file mode 100644 index 0000000..9397604 --- /dev/null +++ b/stubs/pyramid/interfaces.pyi @@ -0,0 +1,362 @@ +from _typeshed import Incomplete +from zope.interface import Interface + +class IContextFound(Interface): + request: Incomplete +IAfterTraversal = IContextFound + +class IBeforeTraversal(Interface): + request: Incomplete + +class INewRequest(Interface): + request: Incomplete + +class INewResponse(Interface): + request: Incomplete + response: Incomplete + +class IApplicationCreated(Interface): + app: Incomplete +IWSGIApplicationCreatedEvent = IApplicationCreated + +class IResponse(Interface): + RequestClass: Incomplete + def __call__(environ, start_response) -> None: ... + accept_ranges: Incomplete + age: Incomplete + allow: Incomplete + app_iter: Incomplete + def app_iter_range(start, stop) -> None: ... + identity: Incomplete + authenticated_userid: Incomplete + body: Incomplete + body_file: Incomplete + cache_control: Incomplete + cache_expires: Incomplete + charset: Incomplete + def conditional_response_app(environ, start_response) -> None: ... + content_disposition: Incomplete + content_encoding: Incomplete + content_language: Incomplete + content_length: Incomplete + content_location: Incomplete + content_md5: Incomplete + content_range: Incomplete + content_type: Incomplete + content_type_params: Incomplete + def copy() -> None: ... + date: Incomplete + def delete_cookie(name, path: str = '/', domain: Incomplete | None = None) -> None: ... + def encode_content(encoding: str = 'gzip', lazy: bool = False) -> None: ... + environ: Incomplete + etag: Incomplete + expires: Incomplete + headerlist: Incomplete + headers: Incomplete + is_authenticated: Incomplete + last_modified: Incomplete + location: Incomplete + def md5_etag(body: Incomplete | None = None, set_content_md5: bool = False) -> None: ... + def merge_cookies(resp) -> None: ... + pragma: Incomplete + request: Incomplete + retry_after: Incomplete + server: Incomplete + def set_cookie(name, value: str = '', max_age: Incomplete | None = None, path: str = '/', domain: Incomplete | None = None, secure: bool = False, httponly: bool = False, comment: Incomplete | None = None, expires: Incomplete | None = None, overwrite: bool = False) -> None: ... + status: Incomplete + status_int: Incomplete + unicode_body: Incomplete + def unset_cookie(name, strict: bool = True) -> None: ... + vary: Incomplete + www_authenticate: Incomplete + +class IException(Interface): ... + +class IExceptionResponse(IException, IResponse): + def prepare(environ) -> None: ... + +class IDict(Interface): + def __contains__(k) -> bool: ... + def __setitem__(k, value) -> None: ... + def __delitem__(k) -> None: ... + def __getitem__(k) -> None: ... + def __iter__(): ... + def get(k, default: Incomplete | None = None) -> None: ... + def items() -> None: ... + def keys() -> None: ... + def values() -> None: ... + def pop(k, default: Incomplete | None = None) -> None: ... + def popitem() -> None: ... + def setdefault(k, default: Incomplete | None = None) -> None: ... + def update(d) -> None: ... + def clear() -> None: ... + +class IBeforeRender(IDict): + rendering_val: Incomplete + +class IRendererInfo(Interface): + name: Incomplete + package: Incomplete + type: Incomplete + registry: Incomplete + settings: Incomplete + def clone() -> None: ... + +class IRendererFactory(Interface): + def __call__(info) -> None: ... + +class IRenderer(Interface): + def __call__(value, system) -> None: ... + +class IViewMapper(Interface): + def __call__(self, object) -> None: ... + +class IViewMapperFactory(Interface): + def __call__(self, **kw) -> None: ... + +class ISecurityPolicy(Interface): + def identity(request) -> None: ... + def authenticated_userid(request) -> None: ... + def permits(request, context, permission) -> None: ... + def remember(request, userid, **kw) -> None: ... + def forget(request, **kw) -> None: ... + +class IAuthenticationPolicy(Interface): + def authenticated_userid(request) -> None: ... + def unauthenticated_userid(request) -> None: ... + def effective_principals(request) -> None: ... + def remember(request, userid, **kw) -> None: ... + def forget(request) -> None: ... + +class IAuthorizationPolicy(Interface): + def permits(context, principals, permission) -> None: ... + def principals_allowed_by_permission(context, permission) -> None: ... + +class IMultiDict(IDict): + def add(key, value) -> None: ... + def dict_of_lists() -> None: ... + def extend(other: Incomplete | None = None, **kwargs) -> None: ... + def getall(key) -> None: ... + def getone(key) -> None: ... + def mixed() -> None: ... + +class IRequest(Interface): ... +class ITweens(Interface): ... + +class IRequestHandler(Interface): + def __call__(self, request) -> None: ... + +class IRequestExtensions(Interface): + descriptors: Incomplete + methods: Incomplete + +class IRouteRequest(Interface): ... +class IAcceptOrder(Interface): ... + +class IStaticURLInfo(Interface): + def add(config, name, spec, **extra) -> None: ... + def generate(path, request, **kw) -> None: ... + def add_cache_buster(config, spec, cache_buster) -> None: ... + +class IResponseFactory(Interface): + def __call__(request) -> None: ... + +class IRequestFactory(Interface): + def __call__(environ) -> None: ... + def blank(path) -> None: ... + +class IViewClassifier(Interface): ... +class IExceptionViewClassifier(Interface): ... + +class IView(Interface): + def __call__(context, request) -> None: ... + +class ISecuredView(IView): + def __call_permissive__(context, request) -> None: ... + def __permitted__(context, request) -> None: ... + +class IMultiView(ISecuredView): + def add(view, predicates, order, accept: Incomplete | None = None, phash: Incomplete | None = None) -> None: ... + +class IRootFactory(Interface): + def __call__(request) -> None: ... + +class IDefaultRootFactory(Interface): + def __call__(request) -> None: ... + +class ITraverser(Interface): + def __call__(request) -> None: ... +ITraverserFactory = ITraverser + +class IViewPermission(Interface): + def __call__(context, request) -> None: ... + +class IRouter(Interface): + registry: Incomplete + def request_context(environ) -> None: ... + def invoke_request(request) -> None: ... + +class IExecutionPolicy(Interface): + def __call__(environ, router) -> None: ... + +class ISettings(IDict): ... + +class ILocation(Interface): + __parent__: Incomplete + +class IDebugLogger(Interface): ... +ILogger = IDebugLogger + +class IRoutePregenerator(Interface): + def __call__(request, elements, kw) -> None: ... + +class IRoute(Interface): + name: Incomplete + pattern: Incomplete + factory: Incomplete + predicates: Incomplete + pregenerator: Incomplete + def match(path) -> None: ... + def generate(kw) -> None: ... + +class IRoutesMapper(Interface): + def get_routes() -> None: ... + def has_routes() -> None: ... + def get_route(name) -> None: ... + def connect(name, pattern, factory: Incomplete | None = None, predicates=(), pregenerator: Incomplete | None = None, static: bool = True) -> None: ... + def generate(name, kw) -> None: ... + def __call__(request) -> None: ... + +class IResourceURL(Interface): + virtual_path: Incomplete + physical_path: Incomplete + virtual_path_tuple: Incomplete + physical_path_tuple: Incomplete + +class IPEP302Loader(Interface): + def get_data(path) -> None: ... + def is_package(fullname) -> None: ... + def get_code(fullname) -> None: ... + def get_source(fullname) -> None: ... + def get_filename(fullname) -> None: ... + +class IPackageOverrides(IPEP302Loader): ... + +VH_ROOT_KEY: str + +class ILocalizer(Interface): ... + +class ILocaleNegotiator(Interface): + def __call__(request) -> None: ... + +class ITranslationDirectories(Interface): ... +class IDefaultPermission(Interface): ... + +class IDefaultCSRFOptions(Interface): + require_csrf: Incomplete + token: Incomplete + header: Incomplete + safe_methods: Incomplete + callback: Incomplete + allow_no_origin: Incomplete + +class ISessionFactory(Interface): + def __call__(request) -> None: ... + +class ISession(IDict): + created: Incomplete + new: Incomplete + def invalidate() -> None: ... + def changed() -> None: ... + def flash(msg, queue: str = '', allow_duplicate: bool = True) -> None: ... + def pop_flash(queue: str = '') -> None: ... + def peek_flash(queue: str = '') -> None: ... + +class ICSRFStoragePolicy(Interface): + def new_csrf_token(request) -> None: ... + def get_csrf_token(request) -> None: ... + def check_csrf_token(request, token) -> None: ... + +class IIntrospector(Interface): + def get(category_name, discriminator, default: Incomplete | None = None) -> None: ... + def get_category(category_name, default: Incomplete | None = None, sort_key: Incomplete | None = None) -> None: ... + def categories() -> None: ... + def categorized(sort_key: Incomplete | None = None) -> None: ... + def remove(category_name, discriminator) -> None: ... + def related(intr) -> None: ... + def add(intr) -> None: ... + def relate(*pairs) -> None: ... + def unrelate(*pairs) -> None: ... + +class IIntrospectable(Interface): + title: Incomplete + type_name: Incomplete + order: Incomplete + category_name: Incomplete + discriminator: Incomplete + discriminator_hash: Incomplete + action_info: Incomplete + def relate(category_name, discriminator) -> None: ... + def unrelate(category_name, discriminator) -> None: ... + def register(introspector, action_info) -> None: ... + def __hash__(): ... + +class IActionInfo(Interface): + file: Incomplete + line: Incomplete + +class IAssetDescriptor(Interface): + def absspec() -> None: ... + def abspath() -> None: ... + def stream() -> None: ... + def isdir() -> None: ... + def listdir() -> None: ... + def exists() -> None: ... + +class IJSONAdapter(Interface): ... +class IPredicateList(Interface): ... + +class IPredicateInfo(Interface): + package: Incomplete + registry: Incomplete + settings: Incomplete + def maybe_dotted(value) -> None: ... + +class IPredicateFactory(Interface): + def __call__(value, info) -> None: ... + +class IPredicate(Interface): + def text() -> None: ... + def phash() -> None: ... + +class IRoutePredicate(IPredicate): + def __call__(info, request) -> None: ... + +class ISubscriberPredicate(IPredicate): + def __call__(*args) -> None: ... + +class IViewPredicate(IPredicate): + def __call__(context, request) -> None: ... + +class IViewDeriver(Interface): + options: Incomplete + def __call__(view, info) -> None: ... + +class IViewDeriverInfo(Interface): + registry: Incomplete + package: Incomplete + settings: Incomplete + options: Incomplete + predicates: Incomplete + original_view: Incomplete + exception_only: Incomplete + +class IViewDerivers(Interface): ... + +class ICacheBuster(Interface): + def __call__(request, subpath, kw) -> None: ... + +PHASE0_CONFIG: int +PHASE1_CONFIG: int +PHASE2_CONFIG: int +PHASE3_CONFIG: int diff --git a/stubs/pyramid/location.pyi b/stubs/pyramid/location.pyi new file mode 100644 index 0000000..b98ae5f --- /dev/null +++ b/stubs/pyramid/location.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +def inside(resource1, resource2): ... +def lineage(resource) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/pyramid/paster.pyi b/stubs/pyramid/paster.pyi new file mode 100644 index 0000000..dc1f8b0 --- /dev/null +++ b/stubs/pyramid/paster.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete +from pyramid.scripting import prepare as prepare +from pyramid.scripts.common import get_config_loader as get_config_loader + +def setup_logging(config_uri, global_conf: Incomplete | None = None) -> None: ... +def get_app(config_uri, name: Incomplete | None = None, options: Incomplete | None = None): ... +def get_appsettings(config_uri, name: Incomplete | None = None, options: Incomplete | None = None): ... +def bootstrap(config_uri, request: Incomplete | None = None, options: Incomplete | None = None): ... diff --git a/stubs/pyramid/path.pyi b/stubs/pyramid/path.pyi new file mode 100644 index 0000000..ec37669 --- /dev/null +++ b/stubs/pyramid/path.pyi @@ -0,0 +1,51 @@ +import pkg_resources +from _typeshed import Incomplete +from pyramid.interfaces import IAssetDescriptor as IAssetDescriptor + +init_names: Incomplete + +def caller_path(path, level: int = 2): ... +def caller_module(level: int = 2, sys=...): ... +def package_name(pkg_or_module): ... +def package_of(pkg_or_module): ... +def caller_package(level: int = 2, caller_module=...): ... +def package_path(package): ... + +class _CALLER_PACKAGE: ... + +CALLER_PACKAGE: Incomplete + +class Resolver: + package: Incomplete + def __init__(self, package=...) -> None: ... + def get_package_name(self): ... + def get_package(self): ... + +class AssetResolver(Resolver): + def resolve(self, spec): ... + +class DottedNameResolver(Resolver): + def resolve(self, dotted): ... + def maybe_resolve(self, dotted): ... + +class PkgResourcesAssetDescriptor: + pkg_resources = pkg_resources + pkg_name: Incomplete + path: Incomplete + def __init__(self, pkg_name, path) -> None: ... + def absspec(self): ... + def abspath(self): ... + def stream(self): ... + def isdir(self): ... + def listdir(self): ... + def exists(self): ... + +class FSAssetDescriptor: + path: Incomplete + def __init__(self, path) -> None: ... + def absspec(self) -> None: ... + def abspath(self): ... + def stream(self): ... + def isdir(self): ... + def listdir(self): ... + def exists(self): ... diff --git a/stubs/pyramid/predicates.pyi b/stubs/pyramid/predicates.pyi new file mode 100644 index 0000000..2163376 --- /dev/null +++ b/stubs/pyramid/predicates.pyi @@ -0,0 +1,112 @@ +from _typeshed import Incomplete +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.traversal import find_interface as find_interface, resource_path_tuple as resource_path_tuple, traversal_path as traversal_path +from pyramid.util import as_sorted_tuple as as_sorted_tuple, is_nonstr_iter as is_nonstr_iter, object_description as object_description + +class XHRPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class RequestMethodPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class PathInfoPredicate: + orig: Incomplete + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class RequestParamPredicate: + val: Incomplete + reqs: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class HeaderPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class AcceptPredicate: + values: Incomplete + def __init__(self, values, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class ContainmentPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class RequestTypePredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class MatchParamPredicate: + val: Incomplete + reqs: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class CustomPredicate: + func: Incomplete + def __init__(self, func, config) -> None: ... + def text(self): ... + def phash(self): ... + def __call__(self, context, request): ... + +class TraversePredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + def phash(self): ... + def __call__(self, context, request): ... + +class PhysicalPathPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class IsAuthenticatedPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class EffectivePrincipalsPredicate: + val: Incomplete + def __init__(self, val, config) -> None: ... + def text(self): ... + phash = text + def __call__(self, context, request): ... + +class Notted: + predicate: Incomplete + def __init__(self, predicate) -> None: ... + def text(self): ... + def phash(self): ... + def __call__(self, context, request): ... diff --git a/stubs/pyramid/registry.pyi b/stubs/pyramid/registry.pyi new file mode 100644 index 0000000..d1ee93f --- /dev/null +++ b/stubs/pyramid/registry.pyi @@ -0,0 +1,57 @@ +from _typeshed import Incomplete +from pyramid.decorator import reify as reify +from pyramid.interfaces import IIntrospectable as IIntrospectable, IIntrospector as IIntrospector, ISettings as ISettings +from pyramid.path import CALLER_PACKAGE as CALLER_PACKAGE, caller_package as caller_package +from zope.interface.registry import Components + +class Registry(Components, dict): + has_listeners: bool + def __init__(self, package_name=..., *args, **kw) -> None: ... + def __bool__(self) -> bool: ... + def package_name(self): ... + def registerSubscriptionAdapter(self, *arg, **kw): ... + def registerSelfAdapter(self, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '', event: bool = True): ... + def queryAdapterOrSelf(self, object, interface, default: Incomplete | None = None): ... + def registerHandler(self, *arg, **kw): ... + def notify(self, *events) -> None: ... + settings: Incomplete + +class Introspector: + def __init__(self) -> None: ... + def add(self, intr) -> None: ... + def get(self, category_name, discriminator, default: Incomplete | None = None): ... + def get_category(self, category_name, default: Incomplete | None = None, sort_key: Incomplete | None = None): ... + def categorized(self, sort_key: Incomplete | None = None): ... + def categories(self): ... + def remove(self, category_name, discriminator) -> None: ... + def relate(self, *pairs) -> None: ... + def unrelate(self, *pairs) -> None: ... + def related(self, intr): ... + +class Introspectable(dict): + order: int + action_info: Incomplete + category_name: Incomplete + discriminator: Incomplete + title: Incomplete + type_name: Incomplete + def __init__(self, category_name, discriminator, title, type_name) -> None: ... + def relate(self, category_name, discriminator) -> None: ... + def unrelate(self, category_name, discriminator) -> None: ... + @property + def discriminator_hash(self): ... + def __hash__(self): ... + def __bool__(self) -> bool: ... + def register(self, introspector, action_info) -> None: ... + +class Deferred: + func: Incomplete + def __init__(self, func) -> None: ... + def value(self): ... + def resolve(self): ... + +def undefer(v): ... + +class predvalseq(tuple): ... + +global_registry: Incomplete diff --git a/stubs/pyramid/renderers.pyi b/stubs/pyramid/renderers.pyi new file mode 100644 index 0000000..f1d4b54 --- /dev/null +++ b/stubs/pyramid/renderers.pyi @@ -0,0 +1,59 @@ +from _typeshed import Incomplete +from pyramid.csrf import get_csrf_token as get_csrf_token +from pyramid.decorator import reify as reify +from pyramid.events import BeforeRender as BeforeRender +from pyramid.httpexceptions import HTTPBadRequest as HTTPBadRequest +from pyramid.interfaces import IJSONAdapter as IJSONAdapter, IRendererFactory as IRendererFactory, IRendererInfo as IRendererInfo +from pyramid.path import caller_package as caller_package +from pyramid.threadlocal import get_current_registry as get_current_registry +from pyramid.util import hide_attrs as hide_attrs + +def render(renderer_name, value, request: Incomplete | None = None, package: Incomplete | None = None): ... +def render_to_response(renderer_name, value, request: Incomplete | None = None, package: Incomplete | None = None, response: Incomplete | None = None): ... +def get_renderer(renderer_name, package: Incomplete | None = None, registry: Incomplete | None = None): ... +def string_renderer_factory(info): ... + +class JSON: + serializer: Incomplete + kw: Incomplete + components: Incomplete + def __init__(self, serializer=..., adapters=(), **kw) -> None: ... + def add_adapter(self, type_or_iface, adapter) -> None: ... + def __call__(self, info): ... + +json_renderer_factory: Incomplete +JSONP_VALID_CALLBACK: Incomplete + +class JSONP(JSON): + param_name: Incomplete + def __init__(self, param_name: str = 'callback', **kw) -> None: ... + def __call__(self, info): ... + +class RendererHelper: + name: Incomplete + package: Incomplete + type: Incomplete + registry: Incomplete + def __init__(self, name: Incomplete | None = None, package: Incomplete | None = None, registry: Incomplete | None = None) -> None: ... + def settings(self): ... + def renderer(self): ... + def get_renderer(self): ... + def render_view(self, request, response, view, context): ... + def render(self, value, system_values, request: Incomplete | None = None): ... + def render_to_response(self, value, system_values, request: Incomplete | None = None): ... + def clone(self, name: Incomplete | None = None, package: Incomplete | None = None, registry: Incomplete | None = None): ... + +class NullRendererHelper(RendererHelper): + name: Incomplete + package: Incomplete + type: str + registry: Incomplete + def __init__(self, name: Incomplete | None = None, package: Incomplete | None = None, registry: Incomplete | None = None) -> None: ... + @property + def settings(self): ... + def render_view(self, request, value, view, context): ... + def render(self, value, system_values, request: Incomplete | None = None): ... + def render_to_response(self, value, system_values, request: Incomplete | None = None): ... + def clone(self, name: Incomplete | None = None, package: Incomplete | None = None, registry: Incomplete | None = None): ... + +null_renderer: Incomplete diff --git a/stubs/pyramid/request.pyi b/stubs/pyramid/request.pyi new file mode 100644 index 0000000..c31fae3 --- /dev/null +++ b/stubs/pyramid/request.pyi @@ -0,0 +1,44 @@ +from _typeshed import Incomplete +from pyramid.decorator import reify as reify +from pyramid.i18n import LocalizerRequestMixin as LocalizerRequestMixin +from pyramid.interfaces import IRequest as IRequest, IRequestExtensions as IRequestExtensions, IResponse as IResponse, ISessionFactory as ISessionFactory +from pyramid.response import Response as Response +from pyramid.security import AuthenticationAPIMixin as AuthenticationAPIMixin, SecurityAPIMixin as SecurityAPIMixin +from pyramid.url import URLMethodsMixin as URLMethodsMixin +from pyramid.util import InstancePropertyHelper as InstancePropertyHelper, InstancePropertyMixin as InstancePropertyMixin, Sentinel as Sentinel, bytes_ as bytes_, text_ as text_ +from pyramid.view import ViewMethodsMixin as ViewMethodsMixin +from webob import BaseRequest + +class TemplateContext: ... + +class CallbackMethodsMixin: + def finished_callbacks(self): ... + def response_callbacks(self): ... + def add_response_callback(self, callback) -> None: ... + def add_finished_callback(self, callback) -> None: ... + +class Request(BaseRequest, URLMethodsMixin, CallbackMethodsMixin, InstancePropertyMixin, LocalizerRequestMixin, SecurityAPIMixin, AuthenticationAPIMixin, ViewMethodsMixin): + exception: Incomplete + exc_info: Incomplete + matchdict: Incomplete + matched_route: Incomplete + request_iface = IRequest + ResponseClass = Response + def tmpl_context(self): ... + def session(self): ... + def response(self): ... + def is_response(self, ob): ... + +def route_request_iface(name, bases=()): ... +def add_global_response_headers(request, headerlist) -> None: ... +def call_app_with_subpath_as_path_info(request, app): ... +def apply_request_extensions(request, extensions: Incomplete | None = None) -> None: ... + +class RequestLocalCache: + NO_VALUE: Incomplete + def __init__(self, creator: Incomplete | None = None) -> None: ... + def __call__(self, fn): ... + def get_or_create(self, request, creator: Incomplete | None = None): ... + def get(self, request, default=...): ... + def set(self, request, value) -> None: ... + def clear(self, request): ... diff --git a/stubs/pyramid/resource.pyi b/stubs/pyramid/resource.pyi new file mode 100644 index 0000000..ec81313 --- /dev/null +++ b/stubs/pyramid/resource.pyi @@ -0,0 +1,5 @@ +from pyramid.asset import * + +resolve_resource_spec = resolve_asset_spec +resource_spec_from_abspath = asset_spec_from_abspath +abspath_from_resource_spec = abspath_from_asset_spec diff --git a/stubs/pyramid/response.pyi b/stubs/pyramid/response.pyi new file mode 100644 index 0000000..3686caf --- /dev/null +++ b/stubs/pyramid/response.pyi @@ -0,0 +1,31 @@ +import venusian +from _typeshed import Incomplete +from pyramid.interfaces import IResponse as IResponse, IResponseFactory as IResponseFactory +from webob import Response as _Response + +class Response(_Response): ... + +class FileResponse(Response): + last_modified: Incomplete + app_iter: Incomplete + content_length: Incomplete + cache_expires: Incomplete + def __init__(self, path, request: Incomplete | None = None, cache_max_age: Incomplete | None = None, content_type: Incomplete | None = None, content_encoding: Incomplete | None = None) -> None: ... + +class FileIter: + file: Incomplete + block_size: Incomplete + def __init__(self, file, block_size=...) -> None: ... + def __iter__(self): ... + def __next__(self): ... + def close(self) -> None: ... + +class response_adapter: + venusian = venusian + types_or_ifaces: Incomplete + depth: Incomplete + category: Incomplete + kwargs: Incomplete + def __init__(self, *types_or_ifaces, **kwargs) -> None: ... + def register(self, scanner, name, wrapped) -> None: ... + def __call__(self, wrapped): ... diff --git a/stubs/pyramid/router.pyi b/stubs/pyramid/router.pyi new file mode 100644 index 0000000..b6a7ee5 --- /dev/null +++ b/stubs/pyramid/router.pyi @@ -0,0 +1,29 @@ +from _typeshed import Incomplete +from pyramid.events import BeforeTraversal as BeforeTraversal, ContextFound as ContextFound, NewRequest as NewRequest, NewResponse as NewResponse +from pyramid.httpexceptions import HTTPNotFound as HTTPNotFound +from pyramid.interfaces import IDebugLogger as IDebugLogger, IExecutionPolicy as IExecutionPolicy, IRequest as IRequest, IRequestExtensions as IRequestExtensions, IRequestFactory as IRequestFactory, IRootFactory as IRootFactory, IRouteRequest as IRouteRequest, IRouter as IRouter, IRoutesMapper as IRoutesMapper, ITraverser as ITraverser, ITweens as ITweens +from pyramid.request import Request as Request, apply_request_extensions as apply_request_extensions +from pyramid.threadlocal import RequestContext as RequestContext +from pyramid.traversal import DefaultRootFactory as DefaultRootFactory, ResourceTreeTraverser as ResourceTreeTraverser + +class Router: + debug_notfound: bool + debug_routematch: bool + logger: Incomplete + root_factory: Incomplete + routes_mapper: Incomplete + request_factory: Incomplete + request_extensions: Incomplete + execution_policy: Incomplete + orig_handle_request: Incomplete + root_policy: Incomplete + registry: Incomplete + def __init__(self, registry) -> None: ... + def handle_request(self, request): ... + def invoke_subrequest(self, request, use_tweens: bool = False): ... + def request_context(self, environ): ... + def invoke_request(self, request, _use_tweens: bool = True): ... + def finish_request(self, request) -> None: ... + def __call__(self, environ, start_response): ... + +def default_execution_policy(environ, router): ... diff --git a/stubs/pyramid/scripting.pyi b/stubs/pyramid/scripting.pyi new file mode 100644 index 0000000..b9b764f --- /dev/null +++ b/stubs/pyramid/scripting.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete +from pyramid.config import global_registries as global_registries +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.interfaces import IRequestFactory as IRequestFactory, IRootFactory as IRootFactory +from pyramid.request import Request as Request, apply_request_extensions as apply_request_extensions +from pyramid.threadlocal import RequestContext as RequestContext +from pyramid.traversal import DefaultRootFactory as DefaultRootFactory + +def get_root(app, request: Incomplete | None = None): ... +def prepare(request: Incomplete | None = None, registry: Incomplete | None = None): ... + +class AppEnvironment(dict): + def __enter__(self): ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None) -> None: ... diff --git a/stubs/pyramid/scripts/__init__.pyi b/stubs/pyramid/scripts/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pyramid/scripts/common.pyi b/stubs/pyramid/scripts/common.pyi new file mode 100644 index 0000000..1f73fc2 --- /dev/null +++ b/stubs/pyramid/scripts/common.pyi @@ -0,0 +1,2 @@ +def parse_vars(args): ... +def get_config_loader(config_uri): ... diff --git a/stubs/pyramid/scripts/pdistreport.pyi b/stubs/pyramid/scripts/pdistreport.pyi new file mode 100644 index 0000000..7f02939 --- /dev/null +++ b/stubs/pyramid/scripts/pdistreport.pyi @@ -0,0 +1,3 @@ +def out(*args) -> None: ... +def get_parser(): ... +def main(argv=..., pkg_resources=..., platform=..., out=...) -> None: ... diff --git a/stubs/pyramid/scripts/prequest.pyi b/stubs/pyramid/scripts/prequest.pyi new file mode 100644 index 0000000..687741f --- /dev/null +++ b/stubs/pyramid/scripts/prequest.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete +from pyramid.request import Request as Request +from pyramid.scripts.common import get_config_loader as get_config_loader, parse_vars as parse_vars + +def main(argv=..., quiet: bool = False): ... + +class PRequestCommand: + description: str + parser: Incomplete + stdin: Incomplete + quiet: Incomplete + args: Incomplete + def __init__(self, argv, quiet: bool = False) -> None: ... + def out(self, msg) -> None: ... + def run(self): ... diff --git a/stubs/pyramid/scripts/proutes.pyi b/stubs/pyramid/scripts/proutes.pyi new file mode 100644 index 0000000..b9aae5c --- /dev/null +++ b/stubs/pyramid/scripts/proutes.pyi @@ -0,0 +1,29 @@ +from _typeshed import Incomplete +from pyramid.config import not_ as not_ +from pyramid.interfaces import IRouteRequest as IRouteRequest +from pyramid.paster import bootstrap as bootstrap +from pyramid.scripts.common import get_config_loader as get_config_loader, parse_vars as parse_vars +from pyramid.static import static_view as static_view + +PAD: int +ANY_KEY: str +UNKNOWN_KEY: str + +def main(argv=..., quiet: bool = False): ... +def get_route_data(route, registry): ... + +class PRoutesCommand: + description: str + bootstrap: Incomplete + get_config_loader: Incomplete + stdout: Incomplete + parser: Incomplete + args: Incomplete + quiet: Incomplete + available_formats: Incomplete + column_format: Incomplete + def __init__(self, argv, quiet: bool = False) -> None: ... + def validate_formats(self, formats): ... + def proutes_file_config(self, loader, global_conf: Incomplete | None = None) -> None: ... + def out(self, msg) -> None: ... + def run(self, quiet: bool = False): ... diff --git a/stubs/pyramid/scripts/pserve.pyi b/stubs/pyramid/scripts/pserve.pyi new file mode 100644 index 0000000..95f95f6 --- /dev/null +++ b/stubs/pyramid/scripts/pserve.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete +from pyramid.path import AssetResolver as AssetResolver +from pyramid.scripts.common import get_config_loader as get_config_loader, parse_vars as parse_vars +from pyramid.settings import aslist as aslist + +def main(argv=..., quiet: bool = False, original_ignore_files: Incomplete | None = None): ... + +class PServeCommand: + description: str + default_verbosity: int + parser: Incomplete + open_url: Incomplete + args: Incomplete + worker_kwargs: Incomplete + watch_files: Incomplete + ignore_files: Incomplete + original_ignore_files: Incomplete + def __init__(self, argv, quiet: bool = False, original_ignore_files: Incomplete | None = None) -> None: ... + def out(self, msg) -> None: ... + def get_config_path(self, loader): ... + def pserve_file_config(self, loader, global_conf: Incomplete | None = None) -> None: ... + def guess_server_url(self, loader, server_name, global_conf: Incomplete | None = None): ... + def run(self): ... + +def wsgiref_server_runner(wsgi_app, global_conf, **kw) -> None: ... +def cherrypy_server_runner(app, global_conf: Incomplete | None = None, host: str = '127.0.0.1', port: Incomplete | None = None, ssl_pem: Incomplete | None = None, protocol_version: Incomplete | None = None, numthreads: Incomplete | None = None, server_name: Incomplete | None = None, max: Incomplete | None = None, request_queue_size: Incomplete | None = None, timeout: Incomplete | None = None): ... diff --git a/stubs/pyramid/scripts/pshell.pyi b/stubs/pyramid/scripts/pshell.pyi new file mode 100644 index 0000000..04454ab --- /dev/null +++ b/stubs/pyramid/scripts/pshell.pyi @@ -0,0 +1,37 @@ +import pkg_resources +from _typeshed import Incomplete +from collections.abc import Generator +from pyramid.paster import bootstrap as bootstrap +from pyramid.scripts.common import get_config_loader as get_config_loader, parse_vars as parse_vars +from pyramid.settings import aslist as aslist +from pyramid.util import DottedNameResolver as DottedNameResolver, make_contextmanager as make_contextmanager + +def main(argv=..., quiet: bool = False): ... +def python_shell_runner(env, help, interact=...) -> None: ... + +class PShellCommand: + description: str + bootstrap: Incomplete + get_config_loader: Incomplete + pkg_resources = pkg_resources + parser: Incomplete + default_runner = python_shell_runner + loaded_objects: Incomplete + object_help: Incomplete + preferred_shells: Incomplete + setup: Incomplete + pystartup: Incomplete + resolver: Incomplete + quiet: Incomplete + args: Incomplete + def __init__(self, argv, quiet: bool = False) -> None: ... + def pshell_file_config(self, loader, defaults) -> None: ... + def out(self, msg) -> None: ... + env: Incomplete + closer: Incomplete + def run(self, shell: Incomplete | None = None): ... + help: Incomplete + def setup_env(self) -> Generator[None, None, None]: ... + def show_shells(self): ... + def find_all_shells(self): ... + def make_shell(self): ... diff --git a/stubs/pyramid/scripts/ptweens.pyi b/stubs/pyramid/scripts/ptweens.pyi new file mode 100644 index 0000000..15bcec4 --- /dev/null +++ b/stubs/pyramid/scripts/ptweens.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete +from pyramid.interfaces import ITweens as ITweens +from pyramid.paster import bootstrap as bootstrap, setup_logging as setup_logging +from pyramid.scripts.common import parse_vars as parse_vars +from pyramid.tweens import INGRESS as INGRESS, MAIN as MAIN + +def main(argv=..., quiet: bool = False): ... + +class PTweensCommand: + description: str + parser: Incomplete + stdout: Incomplete + bootstrap: Incomplete + setup_logging: Incomplete + quiet: Incomplete + args: Incomplete + def __init__(self, argv, quiet: bool = False) -> None: ... + def out(self, msg) -> None: ... + def show_chain(self, chain) -> None: ... + def run(self): ... diff --git a/stubs/pyramid/scripts/pviews.pyi b/stubs/pyramid/scripts/pviews.pyi new file mode 100644 index 0000000..9a3370c --- /dev/null +++ b/stubs/pyramid/scripts/pviews.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete +from pyramid.interfaces import IMultiView as IMultiView +from pyramid.paster import bootstrap as bootstrap, setup_logging as setup_logging +from pyramid.request import Request as Request +from pyramid.scripts.common import parse_vars as parse_vars + +def main(argv=..., quiet: bool = False): ... + +class PViewsCommand: + description: str + stdout: Incomplete + parser: Incomplete + bootstrap: Incomplete + setup_logging: Incomplete + quiet: Incomplete + args: Incomplete + def __init__(self, argv, quiet: bool = False) -> None: ... + def out(self, msg) -> None: ... + def output_route_attrs(self, attrs, indent) -> None: ... + def output_view_info(self, view_wrapper, level: int = 1) -> None: ... + def run(self): ... diff --git a/stubs/pyramid/security.pyi b/stubs/pyramid/security.pyi new file mode 100644 index 0000000..9faa3ac --- /dev/null +++ b/stubs/pyramid/security.pyi @@ -0,0 +1,64 @@ +from _typeshed import Incomplete +from pyramid.interfaces import IAuthenticationPolicy as IAuthenticationPolicy, IAuthorizationPolicy as IAuthorizationPolicy, ISecuredView as ISecuredView, ISecurityPolicy as ISecurityPolicy, IView as IView, IViewClassifier as IViewClassifier +from pyramid.threadlocal import get_current_registry as get_current_registry + +NO_PERMISSION_REQUIRED: str + +def remember(request, userid, **kw): ... +def forget(request, **kw): ... +def principals_allowed_by_permission(context, permission): ... +def view_execution_permitted(context, request, name: str = ''): ... + +class PermitsResult(int): + def __new__(cls, s, *args): ... + @property + def msg(self): ... + +class Denied(PermitsResult): + boolval: int + +class Allowed(PermitsResult): + boolval: int + +class SecurityAPIMixin: + @property + def identity(self): ... + @property + def authenticated_userid(self): ... + @property + def is_authenticated(self): ... + def has_permission(self, permission, context: Incomplete | None = None): ... + +class AuthenticationAPIMixin: + @property + def unauthenticated_userid(self): ... + unauthenticated_userid: Incomplete + @property + def effective_principals(self): ... + effective_principals: Incomplete + +class LegacySecurityPolicy: + def identity(self, request): ... + def authenticated_userid(self, request): ... + def remember(self, request, userid, **kw): ... + def forget(self, request, **kw): ... + def permits(self, request, context, permission): ... + +Everyone: str +Authenticated: str +Allow: str +Deny: str + +class AllPermissionsList: + def __iter__(self): ... + def __contains__(self, other) -> bool: ... + def __eq__(self, other): ... + +ALL_PERMISSIONS: Incomplete +DENY_ALL: Incomplete + +class ACLPermitsResult(PermitsResult): + def __new__(cls, ace, acl, permission, principals, context): ... + +class ACLDenied(ACLPermitsResult, Denied): ... +class ACLAllowed(ACLPermitsResult, Allowed): ... diff --git a/stubs/pyramid/session.pyi b/stubs/pyramid/session.pyi new file mode 100644 index 0000000..bfc7616 --- /dev/null +++ b/stubs/pyramid/session.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete +from pyramid.csrf import check_csrf_origin as check_csrf_origin, check_csrf_token as check_csrf_token +from pyramid.interfaces import ISession as ISession +from pyramid.util import bytes_ as bytes_, text_ as text_ +from webob.cookies import JSONSerializer + +def manage_accessed(wrapped): ... +def manage_changed(wrapped): ... + +class PickleSerializer: + protocol: Incomplete + def __init__(self, protocol=...) -> None: ... + def loads(self, bstruct): ... + def dumps(self, appstruct): ... +JSONSerializer = JSONSerializer + +def BaseCookieSessionFactory(serializer, cookie_name: str = 'session', max_age: Incomplete | None = None, path: str = '/', domain: Incomplete | None = None, secure: bool = False, httponly: bool = False, samesite: str = 'Lax', timeout: int = 1200, reissue_time: int = 0, set_on_exception: bool = True): ... +def SignedCookieSessionFactory(secret, cookie_name: str = 'session', max_age: Incomplete | None = None, path: str = '/', domain: Incomplete | None = None, secure: bool = False, httponly: bool = False, samesite: str = 'Lax', set_on_exception: bool = True, timeout: int = 1200, reissue_time: int = 0, hashalg: str = 'sha512', salt: str = 'pyramid.session.', serializer: Incomplete | None = None): ... +check_csrf_origin = check_csrf_origin +check_csrf_token = check_csrf_token diff --git a/stubs/pyramid/settings.pyi b/stubs/pyramid/settings.pyi new file mode 100644 index 0000000..2d439f8 --- /dev/null +++ b/stubs/pyramid/settings.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete + +truthy: Incomplete +falsey: Incomplete + +def asbool(s): ... +def aslist_cronly(value): ... +def aslist(value, flatten: bool = True): ... diff --git a/stubs/pyramid/static.pyi b/stubs/pyramid/static.pyi new file mode 100644 index 0000000..320dc9f --- /dev/null +++ b/stubs/pyramid/static.pyi @@ -0,0 +1,45 @@ +from _typeshed import Incomplete +from pyramid.asset import abspath_from_asset_spec as abspath_from_asset_spec, resolve_asset_spec as resolve_asset_spec +from pyramid.httpexceptions import HTTPMovedPermanently as HTTPMovedPermanently, HTTPNotFound as HTTPNotFound +from pyramid.path import caller_package as caller_package +from pyramid.response import FileResponse as FileResponse +from pyramid.traversal import traversal_path_info as traversal_path_info + +class static_view: + cache_max_age: Incomplete + use_subpath: Incomplete + package_name: Incomplete + docroot: Incomplete + norm_docroot: Incomplete + index: Incomplete + reload: Incomplete + content_encodings: Incomplete + filemap: Incomplete + def __init__(self, root_dir, cache_max_age: int = 3600, package_name: Incomplete | None = None, use_subpath: bool = False, index: str = 'index.html', reload: bool = False, content_encodings=()) -> None: ... + def __call__(self, context, request): ... + def get_resource_name(self, request): ... + def find_resource_path(self, name): ... + def get_possible_files(self, resource_name): ... + def find_best_match(self, request, files): ... + def add_slash_redirect(self, request): ... + +class QueryStringCacheBuster: + param: Incomplete + def __init__(self, param: str = 'x') -> None: ... + def __call__(self, request, subpath, kw): ... + +class QueryStringConstantCacheBuster(QueryStringCacheBuster): + def __init__(self, token, param: str = 'x') -> None: ... + def tokenize(self, request, subpath, kw): ... + +class ManifestCacheBuster: + exists: Incomplete + getmtime: Incomplete + manifest_path: Incomplete + reload: Incomplete + def __init__(self, manifest_spec, reload: bool = False) -> None: ... + def get_manifest(self): ... + def parse_manifest(self, content): ... + @property + def manifest(self): ... + def __call__(self, request, subpath, kw): ... diff --git a/stubs/pyramid/threadlocal.pyi b/stubs/pyramid/threadlocal.pyi new file mode 100644 index 0000000..6be9609 --- /dev/null +++ b/stubs/pyramid/threadlocal.pyi @@ -0,0 +1,28 @@ +import threading +from _typeshed import Incomplete +from pyramid.registry import global_registry as global_registry + +class ThreadLocalManager(threading.local): + stack: Incomplete + default: Incomplete + def __init__(self, default: Incomplete | None = None) -> None: ... + def push(self, info) -> None: ... + set = push + def pop(self): ... + def get(self): ... + def clear(self) -> None: ... + +def defaults(): ... + +manager: Incomplete + +def get_current_request(): ... +def get_current_registry(context: Incomplete | None = None): ... + +class RequestContext: + request: Incomplete + def __init__(self, request) -> None: ... + def begin(self): ... + def end(self) -> None: ... + def __enter__(self): ... + def __exit__(self, *args) -> None: ... diff --git a/stubs/pyramid/traversal.pyi b/stubs/pyramid/traversal.pyi new file mode 100644 index 0000000..d321f7e --- /dev/null +++ b/stubs/pyramid/traversal.pyi @@ -0,0 +1,50 @@ +from _typeshed import Incomplete +from pyramid.encode import url_quote as url_quote +from pyramid.exceptions import URLDecodeError as URLDecodeError +from pyramid.interfaces import IRequestFactory as IRequestFactory, IResourceURL as IResourceURL, ITraverser as ITraverser, VH_ROOT_KEY as VH_ROOT_KEY +from pyramid.location import lineage as lineage +from pyramid.threadlocal import get_current_registry as get_current_registry +from pyramid.util import ascii_ as ascii_, is_nonstr_iter as is_nonstr_iter, text_ as text_ + +PATH_SEGMENT_SAFE: str +PATH_SAFE: Incomplete + +def find_root(resource): ... +def find_resource(resource, path): ... +find_model = find_resource + +def find_interface(resource, class_or_interface): ... +def resource_path(resource, *elements): ... +model_path = resource_path + +def traverse(resource, path): ... +def resource_path_tuple(resource, *elements): ... +model_path_tuple = resource_path_tuple + +def virtual_root(resource, request): ... +def traversal_path(path): ... +def traversal_path_info(path): ... +def split_path_info(path): ... +def decode_path_info(path): ... +def unquote_bytes_to_wsgi(bytestring): ... +def quote_path_segment(segment, safe=...): ... + +class ResourceTreeTraverser: + VH_ROOT_KEY = VH_ROOT_KEY + VIEW_SELECTOR: str + root: Incomplete + def __init__(self, root) -> None: ... + def __call__(self, request): ... +ModelGraphTraverser = ResourceTreeTraverser + +class ResourceURL: + VH_ROOT_KEY = VH_ROOT_KEY + virtual_path: Incomplete + physical_path: Incomplete + virtual_path_tuple: Incomplete + physical_path_tuple: Incomplete + def __init__(self, resource, request) -> None: ... + +class DefaultRootFactory: + __parent__: Incomplete + def __init__(self, request) -> None: ... diff --git a/stubs/pyramid/tweens.pyi b/stubs/pyramid/tweens.pyi new file mode 100644 index 0000000..7d41c32 --- /dev/null +++ b/stubs/pyramid/tweens.pyi @@ -0,0 +1,8 @@ +from pyramid.httpexceptions import HTTPNotFound as HTTPNotFound +from pyramid.util import reraise as reraise + +def excview_tween_factory(handler, registry): ... + +MAIN: str +INGRESS: str +EXCVIEW: str diff --git a/stubs/pyramid/url.pyi b/stubs/pyramid/url.pyi new file mode 100644 index 0000000..9c43c98 --- /dev/null +++ b/stubs/pyramid/url.pyi @@ -0,0 +1,32 @@ +from pyramid.encode import url_quote as url_quote, urlencode as urlencode +from pyramid.interfaces import IResourceURL as IResourceURL, IRoutesMapper as IRoutesMapper, IStaticURLInfo as IStaticURLInfo +from pyramid.path import caller_package as caller_package +from pyramid.threadlocal import get_current_registry as get_current_registry +from pyramid.traversal import PATH_SAFE as PATH_SAFE, PATH_SEGMENT_SAFE as PATH_SEGMENT_SAFE, ResourceURL as ResourceURL, quote_path_segment as quote_path_segment +from pyramid.util import bytes_ as bytes_ + +QUERY_SAFE: str +ANCHOR_SAFE = QUERY_SAFE + +def parse_url_overrides(request, kw): ... + +class URLMethodsMixin: + def route_url(self, route_name, *elements, **kw): ... + def route_path(self, route_name, *elements, **kw): ... + def resource_url(self, resource, *elements, **kw): ... + model_url = resource_url + def resource_path(self, resource, *elements, **kw): ... + def static_url(self, path, **kw): ... + def static_path(self, path, **kw): ... + def current_route_url(self, *elements, **kw): ... + def current_route_path(self, *elements, **kw): ... + +def route_url(route_name, request, *elements, **kw): ... +def route_path(route_name, request, *elements, **kw): ... +def resource_url(resource, request, *elements, **kw): ... +model_url = resource_url + +def static_url(path, request, **kw): ... +def static_path(path, request, **kw): ... +def current_route_url(request, *elements, **kw): ... +def current_route_path(request, *elements, **kw): ... diff --git a/stubs/pyramid/urldispatch.pyi b/stubs/pyramid/urldispatch.pyi new file mode 100644 index 0000000..86edcd8 --- /dev/null +++ b/stubs/pyramid/urldispatch.pyi @@ -0,0 +1,32 @@ +from _typeshed import Incomplete +from pyramid.exceptions import URLDecodeError as URLDecodeError +from pyramid.interfaces import IRoute as IRoute, IRoutesMapper as IRoutesMapper +from pyramid.traversal import PATH_SAFE as PATH_SAFE, quote_path_segment as quote_path_segment, split_path_info as split_path_info +from pyramid.util import is_nonstr_iter as is_nonstr_iter, text_ as text_ + +class Route: + pattern: Incomplete + path: Incomplete + name: Incomplete + factory: Incomplete + predicates: Incomplete + pregenerator: Incomplete + def __init__(self, name, pattern, factory: Incomplete | None = None, predicates=(), pregenerator: Incomplete | None = None) -> None: ... + +class RoutesMapper: + routelist: Incomplete + static_routes: Incomplete + routes: Incomplete + def __init__(self) -> None: ... + def has_routes(self): ... + def get_routes(self, include_static: bool = False): ... + def get_route(self, name): ... + def connect(self, name, pattern, factory: Incomplete | None = None, predicates=(), pregenerator: Incomplete | None = None, static: bool = False): ... + def generate(self, name, kw): ... + def __call__(self, request): ... + +old_route_re: Incomplete +star_at_end: Incomplete +route_re: Incomplete + +def update_pattern(matchobj): ... diff --git a/stubs/pyramid/util.pyi b/stubs/pyramid/util.pyi new file mode 100644 index 0000000..5331780 --- /dev/null +++ b/stubs/pyramid/util.pyi @@ -0,0 +1,90 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from pyramid.path import DottedNameResolver as _DottedNameResolver + +WIN: Incomplete +PYPY: bool + +class DottedNameResolver(_DottedNameResolver): + def __init__(self, package: Incomplete | None = None) -> None: ... + +def text_(s, encoding: str = 'latin-1', errors: str = 'strict'): ... +def bytes_(s, encoding: str = 'latin-1', errors: str = 'strict'): ... +def ascii_(s): ... +def is_nonstr_iter(v): ... +def is_string_or_iterable(v): ... +def as_sorted_tuple(val): ... + +class SettableProperty: + wrapped: Incomplete + def __init__(self, wrapped) -> None: ... + def __get__(self, obj, type: Incomplete | None = None): ... + +class InstancePropertyHelper: + properties: Incomplete + def __init__(self) -> None: ... + @classmethod + def make_property(cls, callable, name: Incomplete | None = None, reify: bool = False): ... + @classmethod + def apply_properties(cls, target, properties) -> None: ... + @classmethod + def set_property(cls, target, callable, name: Incomplete | None = None, reify: bool = False) -> None: ... + def add_property(self, callable, name: Incomplete | None = None, reify: bool = False) -> None: ... + def apply(self, target) -> None: ... + +class InstancePropertyMixin: + def set_property(self, callable, name: Incomplete | None = None, reify: bool = False) -> None: ... + +class WeakOrderedSet: + def __init__(self) -> None: ... + def add(self, item): ... + def remove(self, item) -> None: ... + def empty(self) -> None: ... + def __len__(self) -> int: ... + def __contains__(self, item) -> bool: ... + def __iter__(self): ... + @property + def last(self): ... + +def strings_differ(string1, string2): ... +def object_description(object): ... +def shortrepr(object, closer): ... + +class Sentinel: + repr: Incomplete + def __init__(self, repr) -> None: ... + +FIRST: Incomplete +LAST: Incomplete + +class TopologicalSorter: + names: Incomplete + req_before: Incomplete + req_after: Incomplete + name2before: Incomplete + name2after: Incomplete + name2val: Incomplete + order: Incomplete + default_before: Incomplete + default_after: Incomplete + first: Incomplete + last: Incomplete + def __init__(self, default_before=..., default_after: Incomplete | None = None, first=..., last=...) -> None: ... + def values(self): ... + def remove(self, name) -> None: ... + def add(self, name, val, after: Incomplete | None = None, before: Incomplete | None = None) -> None: ... + def sorted(self): ... + +def get_callable_name(name): ... +def hide_attrs(obj, *attrs) -> Generator[None, None, None]: ... +def is_same_domain(host, pattern): ... +def make_contextmanager(fn): ... +def takes_one_arg(callee, attr: Incomplete | None = None, argname: Incomplete | None = None): ... + +class SimpleSerializer: + def loads(self, bstruct): ... + def dumps(self, appstruct): ... + +def is_bound_method(ob): ... +def is_unbound_method(fn): ... +def reraise(tp, value, tb: Incomplete | None = None) -> None: ... diff --git a/stubs/pyramid/view.pyi b/stubs/pyramid/view.pyi new file mode 100644 index 0000000..9a891b6 --- /dev/null +++ b/stubs/pyramid/view.pyi @@ -0,0 +1,45 @@ +import venusian +from _typeshed import Incomplete +from pyramid.exceptions import ConfigurationError as ConfigurationError, PredicateMismatch as PredicateMismatch +from pyramid.httpexceptions import HTTPNotFound as HTTPNotFound, HTTPTemporaryRedirect as HTTPTemporaryRedirect, default_exceptionresponse_view as default_exceptionresponse_view +from pyramid.interfaces import IExceptionViewClassifier as IExceptionViewClassifier, IMultiView as IMultiView, IRequest as IRequest, IRoutesMapper as IRoutesMapper, ISecuredView as ISecuredView, IView as IView, IViewClassifier as IViewClassifier +from pyramid.threadlocal import get_current_registry as get_current_registry, manager as manager +from pyramid.util import hide_attrs as hide_attrs + +def render_view_to_response(context, request, name: str = '', secure: bool = True): ... +def render_view_to_iterable(context, request, name: str = '', secure: bool = True): ... +def render_view(context, request, name: str = '', secure: bool = True): ... + +class view_config: + venusian = venusian + def __init__(self, **settings) -> None: ... + def __call__(self, wrapped): ... +bfg_view = view_config + +def view_defaults(**settings): ... + +class AppendSlashNotFoundViewFactory: + notfound_view: Incomplete + redirect_class: Incomplete + def __init__(self, notfound_view: Incomplete | None = None, redirect_class=...) -> None: ... + def __call__(self, context, request): ... + +append_slash_notfound_view: Incomplete + +class notfound_view_config: + venusian = venusian + def __init__(self, **settings) -> None: ... + def __call__(self, wrapped): ... + +class forbidden_view_config: + venusian = venusian + def __init__(self, **settings) -> None: ... + def __call__(self, wrapped): ... + +class exception_view_config: + venusian = venusian + def __init__(self, *args, **settings) -> None: ... + def __call__(self, wrapped): ... + +class ViewMethodsMixin: + def invoke_exception_view(self, exc_info: Incomplete | None = None, request: Incomplete | None = None, secure: bool = True, reraise: bool = False): ... diff --git a/stubs/pyramid/viewderivers.pyi b/stubs/pyramid/viewderivers.pyi new file mode 100644 index 0000000..7af082d --- /dev/null +++ b/stubs/pyramid/viewderivers.pyi @@ -0,0 +1,37 @@ +from _typeshed import Incomplete +from pyramid import renderers as renderers +from pyramid.csrf import check_csrf_origin as check_csrf_origin, check_csrf_token as check_csrf_token +from pyramid.exceptions import ConfigurationError as ConfigurationError +from pyramid.httpexceptions import HTTPForbidden as HTTPForbidden +from pyramid.interfaces import IDebugLogger as IDebugLogger, IDefaultCSRFOptions as IDefaultCSRFOptions, IDefaultPermission as IDefaultPermission, IResponse as IResponse, ISecurityPolicy as ISecurityPolicy, IViewMapper as IViewMapper, IViewMapperFactory as IViewMapperFactory +from pyramid.response import Response as Response +from pyramid.security import NO_PERMISSION_REQUIRED as NO_PERMISSION_REQUIRED +from pyramid.util import is_bound_method as is_bound_method, is_unbound_method as is_unbound_method, object_description as object_description, takes_one_arg as takes_one_arg +from pyramid.view import render_view_to_response as render_view_to_response + +def view_description(view): ... +def requestonly(view, attr: Incomplete | None = None): ... + +class DefaultViewMapper: + attr: Incomplete + def __init__(self, **kw) -> None: ... + def __call__(self, view): ... + def map_class(self, view): ... + def map_nonclass(self, view): ... + def map_class_requestonly(self, view): ... + def map_class_native(self, view): ... + def map_nonclass_requestonly(self, view): ... + def map_nonclass_attr(self, view): ... + +def wraps_view(wrapper): ... +def preserve_view_attrs(view, wrapper): ... +def mapped_view(view, info): ... +def owrapped_view(view, info): ... +def http_cached_view(view, info): ... +def secured_view(view, info): ... +def rendered_view(view, info): ... +def decorated_view(view, info): ... +def csrf_view(view, info): ... + +VIEW: str +INGRESS: str diff --git a/stubs/pyramid/wsgi.pyi b/stubs/pyramid/wsgi.pyi new file mode 100644 index 0000000..a511424 --- /dev/null +++ b/stubs/pyramid/wsgi.pyi @@ -0,0 +1,4 @@ +from pyramid.request import call_app_with_subpath_as_path_info as call_app_with_subpath_as_path_info + +def wsgiapp(wrapped): ... +def wsgiapp2(wrapped): ... diff --git a/stubs/translationstring/__init__.pyi b/stubs/translationstring/__init__.pyi new file mode 100644 index 0000000..a9ab5b4 --- /dev/null +++ b/stubs/translationstring/__init__.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete +from translationstring.compat import PY3 as PY3, string_types as string_types, text_type as text_type + +NAME_RE: str +CONTEXT_MASK: Incomplete + +class TranslationString(text_type): + domain: Incomplete + context: Incomplete + default: Incomplete + mapping: Incomplete + def __new__(self, msgid, domain: Incomplete | None = None, default: Incomplete | None = None, mapping: Incomplete | None = None, context: Incomplete | None = None): ... + def __mod__(self, options): ... + def interpolate(self, translated: Incomplete | None = None): ... + def __reduce__(self): ... + +def TranslationStringFactory(factory_domain): ... +def ChameleonTranslate(translator): ... +def ugettext_policy(translations, tstring, domain, context): ... +def dugettext_policy(translations, tstring, domain, context): ... +def Translator(translations: Incomplete | None = None, policy: Incomplete | None = None): ... +def ungettext_policy(translations, singular, plural, n, domain, context): ... +def dungettext_policy(translations, singular, plural, n, domain, context): ... +def Pluralizer(translations: Incomplete | None = None, policy: Incomplete | None = None): ... diff --git a/stubs/translationstring/compat.pyi b/stubs/translationstring/compat.pyi new file mode 100644 index 0000000..f00c905 --- /dev/null +++ b/stubs/translationstring/compat.pyi @@ -0,0 +1,7 @@ +from _typeshed import Incomplete + +PY3: Incomplete +string_types: Incomplete +text_type = str + +def u(s): ... diff --git a/stubs/venusian/__init__.pyi b/stubs/venusian/__init__.pyi new file mode 100644 index 0000000..0a01703 --- /dev/null +++ b/stubs/venusian/__init__.pyi @@ -0,0 +1,31 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from venusian.advice import getFrameInfo as getFrameInfo +from venusian.compat import compat_find_loader as compat_find_loader + +ATTACH_ATTR: str +LIFTONLY_ATTR: str + +class Scanner: + def __init__(self, **kw) -> None: ... + def scan(self, package, categories: Incomplete | None = None, onerror: Incomplete | None = None, ignore: Incomplete | None = None): ... + +class AttachInfo: + def __init__(self, **kw) -> None: ... + +class Categories(dict): + attached_id: Incomplete + lifted: bool + def __init__(self, attached_to) -> None: ... + def attached_to(self, mod_name, name, obj): ... + +def attach(wrapped, callback, category: Incomplete | None = None, depth: int = 1, name: Incomplete | None = None): ... +def walk_packages(path: Incomplete | None = None, prefix: str = '', onerror: Incomplete | None = None, ignore: Incomplete | None = None) -> Generator[Incomplete, None, Incomplete]: ... + +class lift: + categories: Incomplete + def __init__(self, categories: Incomplete | None = None) -> None: ... + def __call__(self, wrapped): ... + +class onlyliftedfrom: + def __call__(self, wrapped): ... diff --git a/stubs/venusian/advice.pyi b/stubs/venusian/advice.pyi new file mode 100644 index 0000000..03c0bbc --- /dev/null +++ b/stubs/venusian/advice.pyi @@ -0,0 +1 @@ +def getFrameInfo(frame): ... diff --git a/stubs/venusian/compat.pyi b/stubs/venusian/compat.pyi new file mode 100644 index 0000000..b9f6eaf --- /dev/null +++ b/stubs/venusian/compat.pyi @@ -0,0 +1 @@ +def compat_find_loader(importer, modname): ... diff --git a/stubs/webob/__init__.pyi b/stubs/webob/__init__.pyi new file mode 100644 index 0000000..64b1aa8 --- /dev/null +++ b/stubs/webob/__init__.pyi @@ -0,0 +1,6 @@ +from webob.datetime_utils import UTC as UTC, day as day, hour as hour, minute as minute, month as month, second as second, week as week, year as year +from webob.request import LegacyRequest as LegacyRequest, Request as Request +from webob.response import Response as Response +from webob.util import html_escape as html_escape + +__all__ = ['Request', 'LegacyRequest', 'Response', 'UTC', 'day', 'week', 'hour', 'minute', 'second', 'month', 'year', 'html_escape'] diff --git a/stubs/webob/acceptparse.pyi b/stubs/webob/acceptparse.pyi new file mode 100644 index 0000000..2a72808 --- /dev/null +++ b/stubs/webob/acceptparse.pyi @@ -0,0 +1,274 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from typing import NamedTuple + +OWS_re: str +tchar_re: str +token_re: Incomplete +token_compiled_re: Incomplete +qvalue_re: str +weight_re: Incomplete + +class AcceptOffer(NamedTuple('AcceptOffer', [('type', Incomplete), ('subtype', Incomplete), ('params', Incomplete)])): ... + +class Accept: + vchar_re: str + obs_text_re: str + qdtext_re: Incomplete + quoted_pair_re: Incomplete + quoted_string_re: Incomplete + type_re = token_re + subtype_re = token_re + parameter_re: Incomplete + media_range_re: Incomplete + accept_ext_re: Incomplete + accept_params_re: Incomplete + media_range_n_accept_params_re: Incomplete + media_range_n_accept_params_compiled_re: Incomplete + accept_compiled_re: Incomplete + parameters_compiled_re: Incomplete + accept_ext_compiled_re: Incomplete + media_type_re = media_range_re + media_type_compiled_re: Incomplete + @classmethod + def parse(cls, value): ... + @classmethod + def parse_offer(cls, offer): ... + +class AcceptValidHeader(Accept): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def __radd__(self, other): ... + def accept_html(self): ... + accepts_html: Incomplete + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class MIMEAccept(Accept): + def __init__(self, header_value) -> None: ... + @staticmethod + def parse(value) -> Generator[Incomplete, None, None]: ... + def __iter__(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + def __contains__(self, offer) -> bool: ... + def quality(self, offer): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def accept_html(self): ... + +class _AcceptInvalidOrNoHeader(Accept): + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def accept_html(self): ... + accepts_html: Incomplete + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class AcceptNoHeader(_AcceptInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +class AcceptInvalidHeader(_AcceptInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +def create_accept_header(header_value): ... +def accept_property(): ... + +class AcceptCharset: + charset_re = token_re + charset_n_weight_re: Incomplete + charset_n_weight_compiled_re: Incomplete + accept_charset_compiled_re: Incomplete + @classmethod + def parse(cls, value): ... + +class AcceptCharsetValidHeader(AcceptCharset): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def __radd__(self, other): ... + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class _AcceptCharsetInvalidOrNoHeader(AcceptCharset): + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class AcceptCharsetNoHeader(_AcceptCharsetInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +class AcceptCharsetInvalidHeader(_AcceptCharsetInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +def create_accept_charset_header(header_value): ... +def accept_charset_property(): ... + +class AcceptEncoding: + codings_re = token_re + codings_n_weight_re: Incomplete + codings_n_weight_compiled_re: Incomplete + accept_encoding_compiled_re: Incomplete + @classmethod + def parse(cls, value): ... + +class AcceptEncodingValidHeader(AcceptEncoding): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def __radd__(self, other): ... + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class _AcceptEncodingInvalidOrNoHeader(AcceptEncoding): + def __bool__(self) -> bool: ... + __nonzero__ = __bool__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def acceptable_offers(self, offers): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def quality(self, offer): ... + +class AcceptEncodingNoHeader(_AcceptEncodingInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +class AcceptEncodingInvalidHeader(_AcceptEncodingInvalidOrNoHeader): + @property + def header_value(self): ... + @property + def parsed(self): ... + def __init__(self, header_value) -> None: ... + def copy(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +def create_accept_encoding_header(header_value): ... +def accept_encoding_property(): ... + +class AcceptLanguage: + lang_range_re: str + lang_range_n_weight_re: Incomplete + lang_range_n_weight_compiled_re: Incomplete + accept_language_compiled_re: Incomplete + @classmethod + def parse(cls, value): ... + +class AcceptLanguageValidHeader(AcceptLanguage): + def __init__(self, header_value) -> None: ... + def copy(self): ... + @property + def header_value(self): ... + @property + def parsed(self): ... + def __add__(self, other): ... + def __nonzero__(self): ... + __bool__ = __nonzero__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def __radd__(self, other): ... + def basic_filtering(self, language_tags): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def lookup(self, language_tags, default_range: Incomplete | None = None, default_tag: Incomplete | None = None, default: Incomplete | None = None): ... + def quality(self, offer): ... + +class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage): + def __nonzero__(self): ... + __bool__ = __nonzero__ + def __contains__(self, offer) -> bool: ... + def __iter__(self): ... + def basic_filtering(self, language_tags): ... + def best_match(self, offers, default_match: Incomplete | None = None): ... + def lookup(self, language_tags: Incomplete | None = None, default_range: Incomplete | None = None, default_tag: Incomplete | None = None, default: Incomplete | None = None): ... + def quality(self, offer): ... + +class AcceptLanguageNoHeader(_AcceptLanguageInvalidOrNoHeader): + def __init__(self) -> None: ... + def copy(self): ... + @property + def header_value(self): ... + @property + def parsed(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +class AcceptLanguageInvalidHeader(_AcceptLanguageInvalidOrNoHeader): + def __init__(self, header_value) -> None: ... + def copy(self): ... + @property + def header_value(self): ... + @property + def parsed(self): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +def create_accept_language_header(header_value): ... +def accept_language_property(): ... diff --git a/stubs/webob/byterange.pyi b/stubs/webob/byterange.pyi new file mode 100644 index 0000000..11947e4 --- /dev/null +++ b/stubs/webob/byterange.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +__all__ = ['Range', 'ContentRange'] + +class Range: + start: Incomplete + end: Incomplete + def __init__(self, start, end) -> None: ... + def range_for_length(self, length): ... + def content_range(self, length): ... + def __iter__(self): ... + @classmethod + def parse(cls, header): ... + +class ContentRange: + start: Incomplete + stop: Incomplete + length: Incomplete + def __init__(self, start, stop, length) -> None: ... + def __iter__(self): ... + @classmethod + def parse(cls, value): ... diff --git a/stubs/webob/cachecontrol.pyi b/stubs/webob/cachecontrol.pyi new file mode 100644 index 0000000..f0587cb --- /dev/null +++ b/stubs/webob/cachecontrol.pyi @@ -0,0 +1,59 @@ +from _typeshed import Incomplete + +class UpdateDict(dict): + updated: Incomplete + updated_args: Incomplete + def __setitem__(self, key, item) -> None: ... + def __delitem__(self, key) -> None: ... + def clear(self) -> None: ... + def update(self, *args, **kw) -> None: ... + def setdefault(self, key, value: Incomplete | None = None): ... + def pop(self, *args): ... + def popitem(self): ... + +token_re: Incomplete +need_quote_re: Incomplete + +class exists_property: + prop: Incomplete + type: Incomplete + def __init__(self, prop, type: Incomplete | None = None) -> None: ... + def __get__(self, obj, type: Incomplete | None = None): ... + def __set__(self, obj, value) -> None: ... + def __delete__(self, obj) -> None: ... + +class value_property: + prop: Incomplete + default: Incomplete + none: Incomplete + type: Incomplete + def __init__(self, prop, default: Incomplete | None = None, none: Incomplete | None = None, type: Incomplete | None = None) -> None: ... + def __get__(self, obj, type: Incomplete | None = None): ... + def __set__(self, obj, value) -> None: ... + def __delete__(self, obj) -> None: ... + +class CacheControl: + update_dict = UpdateDict + properties: Incomplete + type: Incomplete + def __init__(self, properties, type) -> None: ... + @classmethod + def parse(cls, header, updates_to: Incomplete | None = None, type: Incomplete | None = None): ... + max_stale: Incomplete + min_fresh: Incomplete + only_if_cached: Incomplete + public: Incomplete + private: Incomplete + no_cache: Incomplete + no_store: Incomplete + no_transform: Incomplete + must_revalidate: Incomplete + proxy_revalidate: Incomplete + max_age: Incomplete + s_maxage: Incomplete + s_max_age = s_maxage + stale_while_revalidate: Incomplete + stale_if_error: Incomplete + def copy(self): ... + +def serialize_cache_control(properties): ... diff --git a/stubs/webob/client.pyi b/stubs/webob/client.pyi new file mode 100644 index 0000000..99fceed --- /dev/null +++ b/stubs/webob/client.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +__all__ = ['send_request_app', 'SendRequest'] + +class SendRequest: + HTTPConnection: Incomplete + HTTPSConnection: Incomplete + def __init__(self, HTTPConnection=..., HTTPSConnection=...) -> None: ... + def __call__(self, environ, start_response): ... + filtered_headers: Incomplete + MULTILINE_RE: Incomplete + def parse_headers(self, message): ... + +send_request_app: Incomplete diff --git a/stubs/webob/compat.pyi b/stubs/webob/compat.pyi new file mode 100644 index 0000000..761ad2c --- /dev/null +++ b/stubs/webob/compat.pyi @@ -0,0 +1,33 @@ +from Queue import Empty as Empty, Queue as Queue +from _typeshed import Incomplete +from cgi import FieldStorage as _cgi_FieldStorage +from collections import Iterable as Iterable, MutableMapping as MutableMapping +from collections.abc import Generator +from html import escape as escape +from urllib import parse +from urllib.parse import quote_plus as quote_plus + +PY3: Incomplete +PY2: Incomplete +string_types: Incomplete +integer_types: Incomplete +class_types: Incomplete +text_type = str +long = int + +def text_(s, encoding: str = 'latin-1', errors: str = 'strict'): ... +def bytes_(s, encoding: str = 'latin-1', errors: str = 'strict'): ... +def native_(s, encoding: str = 'latin-1', errors: str = 'strict'): ... +urlparse = parse + +def reraise(exc_info) -> None: ... +def iteritems_(d): ... +def itervalues_(d): ... +def unquote(string): ... +def url_unquote(s): ... +def parse_qsl_text(qs, encoding: str = 'utf-8') -> Generator[Incomplete, None, None]: ... + +class cgi_FieldStorage(_cgi_FieldStorage): + def make_file(self): ... + list: Incomplete + def read_multi(self, environ, keep_blank_values, strict_parsing) -> None: ... diff --git a/stubs/webob/cookies.pyi b/stubs/webob/cookies.pyi new file mode 100644 index 0000000..fbc294c --- /dev/null +++ b/stubs/webob/cookies.pyi @@ -0,0 +1,90 @@ +from _typeshed import Incomplete +from webob.compat import MutableMapping + +__all__ = ['Cookie', 'CookieProfile', 'SignedCookieProfile', 'SignedSerializer', 'JSONSerializer', 'Base64Serializer', 'make_cookie'] + +class RequestCookies(MutableMapping): + def __init__(self, environ) -> None: ... + def __setitem__(self, name, value) -> None: ... + def __getitem__(self, name): ... + def get(self, name, default: Incomplete | None = None): ... + def __delitem__(self, name) -> None: ... + def keys(self): ... + def values(self): ... + def items(self): ... + def __contains__(self, name) -> bool: ... + def __iter__(self): ... + def __len__(self) -> int: ... + def clear(self) -> None: ... + +class Cookie(dict): + def __init__(self, input: Incomplete | None = None) -> None: ... + def load(self, data) -> None: ... + def add(self, key, val): ... + __setitem__ = add + def serialize(self, full: bool = True): ... + def values(self): ... + +class Morsel(dict): + name: Incomplete + value: Incomplete + def __init__(self, name, value) -> None: ... + path: Incomplete + domain: Incomplete + comment: Incomplete + expires: Incomplete + max_age: Incomplete + httponly: Incomplete + secure: Incomplete + samesite: Incomplete + def __setitem__(self, k, v) -> None: ... + def serialize(self, full: bool = True): ... + +def make_cookie(name, value, max_age: Incomplete | None = None, path: str = '/', domain: Incomplete | None = None, secure: bool = False, httponly: bool = False, comment: Incomplete | None = None, samesite: Incomplete | None = None): ... + +class JSONSerializer: + def dumps(self, appstruct): ... + def loads(self, bstruct): ... + +class Base64Serializer: + serializer: Incomplete + def __init__(self, serializer: Incomplete | None = None) -> None: ... + def dumps(self, appstruct): ... + def loads(self, bstruct): ... + +class SignedSerializer: + salt: Incomplete + secret: Incomplete + hashalg: Incomplete + salted_secret: Incomplete + digestmod: Incomplete + digest_size: Incomplete + serializer: Incomplete + def __init__(self, secret, salt, hashalg: str = 'sha512', serializer: Incomplete | None = None) -> None: ... + def dumps(self, appstruct): ... + def loads(self, bstruct): ... + +class CookieProfile: + cookie_name: Incomplete + secure: Incomplete + max_age: Incomplete + httponly: Incomplete + samesite: Incomplete + path: Incomplete + domains: Incomplete + serializer: Incomplete + request: Incomplete + def __init__(self, cookie_name, secure: bool = False, max_age: Incomplete | None = None, httponly: Incomplete | None = None, samesite: Incomplete | None = None, path: str = '/', domains: Incomplete | None = None, serializer: Incomplete | None = None) -> None: ... + def __call__(self, request): ... + def bind(self, request): ... + def get_value(self): ... + def set_cookies(self, response, value, domains=..., max_age=..., path=..., secure=..., httponly=..., samesite=...): ... + def get_headers(self, value, domains=..., max_age=..., path=..., secure=..., httponly=..., samesite=...): ... + +class SignedCookieProfile(CookieProfile): + secret: Incomplete + salt: Incomplete + hashalg: Incomplete + original_serializer: Incomplete + def __init__(self, secret, salt, cookie_name, secure: bool = False, max_age: Incomplete | None = None, httponly: bool = False, samesite: Incomplete | None = None, path: str = '/', domains: Incomplete | None = None, hashalg: str = 'sha512', serializer: Incomplete | None = None) -> None: ... + def bind(self, request): ... diff --git a/stubs/webob/datetime_utils.pyi b/stubs/webob/datetime_utils.pyi new file mode 100644 index 0000000..6aa8e34 --- /dev/null +++ b/stubs/webob/datetime_utils.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete +from datetime import tzinfo + +__all__ = ['UTC', 'timedelta_to_seconds', 'year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'parse_date', 'serialize_date', 'parse_date_delta', 'serialize_date_delta'] + +class _UTC(tzinfo): + def dst(self, dt): ... + def utcoffset(self, dt): ... + def tzname(self, dt): ... + +UTC: Incomplete + +def timedelta_to_seconds(td): ... + +day: Incomplete +week: Incomplete +hour: Incomplete +minute: Incomplete +second: Incomplete +month: Incomplete +year: Incomplete + +def parse_date(value): ... +def serialize_date(dt): ... +def parse_date_delta(value): ... +def serialize_date_delta(value): ... diff --git a/stubs/webob/dec.pyi b/stubs/webob/dec.pyi new file mode 100644 index 0000000..a043981 --- /dev/null +++ b/stubs/webob/dec.pyi @@ -0,0 +1,37 @@ +from _typeshed import Incomplete +from webob.request import Request + +__all__ = ['wsgify'] + +class wsgify: + RequestClass = Request + func: Incomplete + args: Incomplete + kwargs: Incomplete + middleware_wraps: Incomplete + def __init__(self, func: Incomplete | None = None, RequestClass: Incomplete | None = None, args=(), kwargs: Incomplete | None = None, middleware_wraps: Incomplete | None = None) -> None: ... + def __get__(self, obj, type: Incomplete | None = None): ... + def __call__(self, req, *args, **kw): ... + def get(self, url, **kw): ... + def post(self, url, POST: Incomplete | None = None, **kw): ... + def request(self, url, **kw): ... + def call_func(self, req, *args, **kwargs): ... + def clone(self, func: Incomplete | None = None, **kw): ... + @property + def undecorated(self): ... + @classmethod + def middleware(cls, middle_func: Incomplete | None = None, app: Incomplete | None = None, **kw): ... + +class _UnboundMiddleware: + wrapper_class: Incomplete + app: Incomplete + kw: Incomplete + def __init__(self, wrapper_class, app, kw) -> None: ... + def __call__(self, func, app: Incomplete | None = None): ... + +class _MiddlewareFactory: + wrapper_class: Incomplete + middleware: Incomplete + kw: Incomplete + def __init__(self, wrapper_class, middleware, kw) -> None: ... + def __call__(self, app: Incomplete | None = None, **config): ... diff --git a/stubs/webob/descriptors.pyi b/stubs/webob/descriptors.pyi new file mode 100644 index 0000000..db8a0c2 --- /dev/null +++ b/stubs/webob/descriptors.pyi @@ -0,0 +1,42 @@ +from _typeshed import Incomplete +from typing import NamedTuple +from webob.byterange import ContentRange as ContentRange, Range as Range +from webob.compat import PY2 as PY2, text_type as text_type +from webob.datetime_utils import parse_date as parse_date, serialize_date as serialize_date +from webob.util import header_docstring as header_docstring, warn_deprecation as warn_deprecation + +CHARSET_RE: Incomplete +SCHEME_RE: Incomplete + +def environ_getter(key, default=..., rfc_section: Incomplete | None = None): ... +def environ_decoder(key, default=..., rfc_section: Incomplete | None = None, encattr: Incomplete | None = None): ... +def upath_property(key): ... +def deprecated_property(attr, name, text, version): ... +def header_getter(header, rfc_section): ... +def converter(prop, parse, serialize, convert_name: Incomplete | None = None): ... +def list_header(header, rfc_section): ... +def parse_list(value): ... +def serialize_list(value): ... +def converter_date(prop): ... +def date_header(header, rfc_section): ... +def parse_etag_response(value, strong: bool = False): ... +def serialize_etag_response(value): ... +def serialize_if_range(value): ... +def parse_range(value): ... +def serialize_range(value): ... +def parse_int(value): ... +def parse_int_safe(value): ... +serialize_int = str + +def parse_content_range(value): ... +def serialize_content_range(value): ... +def parse_auth_params(params): ... + +known_auth_schemes: Incomplete + +class _authorization(NamedTuple): + authtype: Incomplete + params: Incomplete + +def parse_auth(val): ... +def serialize_auth(val): ... diff --git a/stubs/webob/etag.pyi b/stubs/webob/etag.pyi new file mode 100644 index 0000000..15ecfdc --- /dev/null +++ b/stubs/webob/etag.pyi @@ -0,0 +1,40 @@ +from _typeshed import Incomplete + +__all__ = ['AnyETag', 'NoETag', 'ETagMatcher', 'IfRange', 'etag_property'] + +def etag_property(key, default, rfc_section, strong: bool = True): ... + +class _AnyETag: + def __nonzero__(self): ... + __bool__ = __nonzero__ + def __contains__(self, other) -> bool: ... + +AnyETag: Incomplete + +class _NoETag: + def __nonzero__(self): ... + __bool__ = __nonzero__ + def __contains__(self, other) -> bool: ... + +NoETag: Incomplete + +class ETagMatcher: + etags: Incomplete + def __init__(self, etags) -> None: ... + def __contains__(self, other) -> bool: ... + @classmethod + def parse(cls, value, strong: bool = True): ... + +class IfRange: + etag: Incomplete + def __init__(self, etag) -> None: ... + @classmethod + def parse(cls, value): ... + def __contains__(self, resp) -> bool: ... + def __nonzero__(self): ... + __bool__ = __nonzero__ + +class IfRangeDate: + date: Incomplete + def __init__(self, date) -> None: ... + def __contains__(self, resp) -> bool: ... diff --git a/stubs/webob/exc.pyi b/stubs/webob/exc.pyi new file mode 100644 index 0000000..f1ed995 --- /dev/null +++ b/stubs/webob/exc.pyi @@ -0,0 +1,288 @@ +from _typeshed import Incomplete +from webob.response import Response + +__all__ = ['HTTPExceptionMiddleware', 'status_map', 'HTTPException', 'WSGIHTTPException', 'HTTPError', 'HTTPRedirection', 'HTTPOk', 'HTTPCreated', 'HTTPAccepted', 'HTTPNonAuthoritativeInformation', 'HTTPNoContent', 'HTTPResetContent', 'HTTPPartialContent', 'HTTPMultipleChoices', 'HTTPMovedPermanently', 'HTTPFound', 'HTTPSeeOther', 'HTTPNotModified', 'HTTPUseProxy', 'HTTPTemporaryRedirect', 'HTTPPermanentRedirect', 'HTTPClientError', 'HTTPBadRequest', 'HTTPUnauthorized', 'HTTPPaymentRequired', 'HTTPForbidden', 'HTTPNotFound', 'HTTPMethodNotAllowed', 'HTTPNotAcceptable', 'HTTPProxyAuthenticationRequired', 'HTTPRequestTimeout', 'HTTPConflict', 'HTTPGone', 'HTTPLengthRequired', 'HTTPPreconditionFailed', 'HTTPRequestEntityTooLarge', 'HTTPRequestURITooLong', 'HTTPUnsupportedMediaType', 'HTTPRequestRangeNotSatisfiable', 'HTTPExpectationFailed', 'HTTPUnprocessableEntity', 'HTTPLocked', 'HTTPFailedDependency', 'HTTPPreconditionRequired', 'HTTPTooManyRequests', 'HTTPRequestHeaderFieldsTooLarge', 'HTTPUnavailableForLegalReasons', 'HTTPServerError', 'HTTPInternalServerError', 'HTTPNotImplemented', 'HTTPBadGateway', 'HTTPServiceUnavailable', 'HTTPGatewayTimeout', 'HTTPVersionNotSupported', 'HTTPInsufficientStorage', 'HTTPNetworkAuthenticationRequired'] + +class _lazified: + func: Incomplete + value: Incomplete + def __init__(self, func, value) -> None: ... + +class HTTPException(Exception): + wsgi_response: Incomplete + def __init__(self, message, wsgi_response) -> None: ... + def __call__(self, environ, start_response): ... + +class WSGIHTTPException(Response, HTTPException): + code: int + title: str + explanation: str + body_template_obj: Incomplete + plain_template_obj: Incomplete + html_template_obj: Incomplete + empty_body: bool + detail: Incomplete + comment: Incomplete + body_template: Incomplete + def __init__(self, detail: Incomplete | None = None, headers: Incomplete | None = None, comment: Incomplete | None = None, body_template: Incomplete | None = None, json_formatter: Incomplete | None = None, **kw) -> None: ... + def plain_body(self, environ): ... + def html_body(self, environ): ... + def json_formatter(self, body, status, title, environ): ... + def json_body(self, environ): ... + def generate_response(self, environ, start_response): ... + def __call__(self, environ, start_response): ... + @property + def wsgi_response(self): ... + +class HTTPError(WSGIHTTPException): ... +class HTTPRedirection(WSGIHTTPException): ... + +class HTTPOk(WSGIHTTPException): + code: int + title: str + +class HTTPCreated(HTTPOk): + code: int + title: str + +class HTTPAccepted(HTTPOk): + code: int + title: str + explanation: str + +class HTTPNonAuthoritativeInformation(HTTPOk): + code: int + title: str + +class HTTPNoContent(HTTPOk): + code: int + title: str + empty_body: bool + +class HTTPResetContent(HTTPOk): + code: int + title: str + empty_body: bool + +class HTTPPartialContent(HTTPOk): + code: int + title: str + +class _HTTPMove(HTTPRedirection): + explanation: str + body_template_obj: Incomplete + location: Incomplete + add_slash: Incomplete + def __init__(self, detail: Incomplete | None = None, headers: Incomplete | None = None, comment: Incomplete | None = None, body_template: Incomplete | None = None, location: Incomplete | None = None, add_slash: bool = False) -> None: ... + def __call__(self, environ, start_response): ... + +class HTTPMultipleChoices(_HTTPMove): + code: int + title: str + +class HTTPMovedPermanently(_HTTPMove): + code: int + title: str + +class HTTPFound(_HTTPMove): + code: int + title: str + explanation: str + +class HTTPSeeOther(_HTTPMove): + code: int + title: str + +class HTTPNotModified(HTTPRedirection): + code: int + title: str + empty_body: bool + +class HTTPUseProxy(_HTTPMove): + code: int + title: str + explanation: str + +class HTTPTemporaryRedirect(_HTTPMove): + code: int + title: str + +class HTTPPermanentRedirect(_HTTPMove): + code: int + title: str + +class HTTPClientError(HTTPError): + code: int + title: str + explanation: str + +class HTTPBadRequest(HTTPClientError): ... + +class HTTPUnauthorized(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPaymentRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPForbidden(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPNotFound(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPMethodNotAllowed(HTTPClientError): + code: int + title: str + body_template_obj: Incomplete + +class HTTPNotAcceptable(HTTPClientError): + code: int + title: str + body_template_obj: Incomplete + +class HTTPProxyAuthenticationRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestTimeout(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPConflict(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPGone(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPLengthRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPreconditionFailed(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestEntityTooLarge(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestURITooLong(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPUnsupportedMediaType(HTTPClientError): + code: int + title: str + body_template_obj: Incomplete + +class HTTPRequestRangeNotSatisfiable(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPExpectationFailed(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPUnprocessableEntity(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPLocked(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPFailedDependency(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPPreconditionRequired(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPTooManyRequests(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPUnavailableForLegalReasons(HTTPClientError): + code: int + title: str + explanation: str + +class HTTPServerError(HTTPError): + code: int + title: str + explanation: str + +class HTTPInternalServerError(HTTPServerError): ... + +class HTTPNotImplemented(HTTPServerError): + code: int + title: str + body_template_obj: Incomplete + +class HTTPBadGateway(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPServiceUnavailable(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPGatewayTimeout(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPVersionNotSupported(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPInsufficientStorage(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPNetworkAuthenticationRequired(HTTPServerError): + code: int + title: str + explanation: str + +class HTTPExceptionMiddleware: + application: Incomplete + def __init__(self, application) -> None: ... + def __call__(self, environ, start_response): ... + +status_map: Incomplete diff --git a/stubs/webob/headers.pyi b/stubs/webob/headers.pyi new file mode 100644 index 0000000..26cab71 --- /dev/null +++ b/stubs/webob/headers.pyi @@ -0,0 +1,28 @@ +from _typeshed import Incomplete +from webob.compat import MutableMapping +from webob.multidict import MultiDict + +__all__ = ['ResponseHeaders', 'EnvironHeaders'] + +class ResponseHeaders(MultiDict): + def __getitem__(self, key): ... + def getall(self, key): ... + def mixed(self): ... + def dict_of_lists(self): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __contains__(self, key) -> bool: ... + has_key = __contains__ + def setdefault(self, key, default: Incomplete | None = None): ... + def pop(self, key, *args): ... + +class EnvironHeaders(MutableMapping): + environ: Incomplete + def __init__(self, environ) -> None: ... + def __getitem__(self, hname): ... + def __setitem__(self, hname, value) -> None: ... + def __delitem__(self, hname) -> None: ... + def keys(self): ... + def __contains__(self, hname) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self): ... diff --git a/stubs/webob/multidict.pyi b/stubs/webob/multidict.pyi new file mode 100644 index 0000000..47900cd --- /dev/null +++ b/stubs/webob/multidict.pyi @@ -0,0 +1,105 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from webob.compat import MutableMapping + +__all__ = ['MultiDict', 'NestedMultiDict', 'NoVars', 'GetDict'] + +class MultiDict(MutableMapping): + def __init__(self, *args, **kw) -> None: ... + @classmethod + def view_list(cls, lst): ... + @classmethod + def from_fieldstorage(cls, fs): ... + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def add(self, key, value) -> None: ... + def getall(self, key): ... + def getone(self, key): ... + def mixed(self): ... + def dict_of_lists(self): ... + def __delitem__(self, key) -> None: ... + def __contains__(self, key) -> bool: ... + has_key = __contains__ + def clear(self) -> None: ... + def copy(self): ... + def setdefault(self, key, default: Incomplete | None = None): ... + def pop(self, key, *args): ... + def popitem(self): ... + def update(self, *args, **kw) -> None: ... + def extend(self, other: Incomplete | None = None, **kwargs) -> None: ... + def __len__(self) -> int: ... + def iterkeys(self) -> Generator[Incomplete, None, None]: ... + keys = iterkeys + __iter__ = iterkeys + def iteritems(self): ... + items = iteritems + def itervalues(self) -> Generator[Incomplete, None, None]: ... + values = itervalues + +class GetDict(MultiDict): + env: Incomplete + def __init__(self, data, env) -> None: ... + def on_change(self): ... + def __setitem__(self, key, value) -> None: ... + def add(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def clear(self) -> None: ... + def setdefault(self, key, default: Incomplete | None = None): ... + def pop(self, key, *args): ... + def popitem(self): ... + def update(self, *args, **kwargs) -> None: ... + def extend(self, *args, **kwargs) -> None: ... + def copy(self): ... + +class NestedMultiDict(MultiDict): + dicts: Incomplete + def __init__(self, *dicts) -> None: ... + def __getitem__(self, key): ... + __setitem__: Incomplete + add: Incomplete + __delitem__: Incomplete + clear: Incomplete + setdefault: Incomplete + pop: Incomplete + popitem: Incomplete + update: Incomplete + def getall(self, key): ... + def copy(self): ... + def __contains__(self, key) -> bool: ... + has_key = __contains__ + def __len__(self) -> int: ... + def __nonzero__(self): ... + def iteritems(self) -> Generator[Incomplete, None, None]: ... + items = iteritems + def itervalues(self) -> Generator[Incomplete, None, None]: ... + values = itervalues + def __iter__(self): ... + iterkeys = __iter__ + keys = iterkeys + +class NoVars: + reason: Incomplete + def __init__(self, reason: Incomplete | None = None) -> None: ... + def __getitem__(self, key) -> None: ... + def __setitem__(self, *args, **kw) -> None: ... + add = __setitem__ + setdefault = __setitem__ + update = __setitem__ + def __delitem__(self, *args, **kw) -> None: ... + clear = __delitem__ + pop = __delitem__ + popitem = __delitem__ + def get(self, key, default: Incomplete | None = None): ... + def getall(self, key): ... + def getone(self, key): ... + def mixed(self): ... + dict_of_lists = mixed + def __contains__(self, key) -> bool: ... + has_key = __contains__ + def copy(self): ... + def __len__(self) -> int: ... + def iterkeys(self): ... + keys = iterkeys + items = iterkeys + values = iterkeys + __iter__ = iterkeys diff --git a/stubs/webob/request.pyi b/stubs/webob/request.pyi new file mode 100644 index 0000000..53b3ffa --- /dev/null +++ b/stubs/webob/request.pyi @@ -0,0 +1,196 @@ +import io +from _typeshed import Incomplete + +__all__ = ["BaseRequest", "Request", "LegacyRequest"] + +class _NoDefault: ... + +class BaseRequest: + request_body_tempfile_limit: Incomplete + method: Incomplete + def __init__( + self, + environ, + charset: Incomplete | None = None, + unicode_errors: Incomplete | None = None, + decode_param_names: Incomplete | None = None, + **kw + ) -> None: ... + def encget(self, key, default=..., encattr: Incomplete | None = None): ... + def encset(self, key, val, encattr: Incomplete | None = None) -> None: ... + @property + def charset(self): ... + @charset.setter + def charset(self, charset) -> None: ... + def decode( + self, charset: Incomplete | None = None, errors: str = "strict" + ): ... + @property + def body_file(self): ... + content_length: Incomplete + body_file_raw: Incomplete + is_body_seekable: bool + @body_file.setter + def body_file(self, value) -> None: ... + @property + def body_file_seekable(self): ... + url_encoding: Incomplete + scheme: Incomplete + http_version: Incomplete + remote_user: Incomplete + remote_host: Incomplete + remote_addr: Incomplete + query_string: Incomplete + server_name: Incomplete + server_port: Incomplete + script_name: Incomplete + path_info: Incomplete + uscript_name = script_name + upath_info = path_info + content_type: Incomplete + headers: Incomplete + @property + def client_addr(self): ... + @property + def host_port(self): ... + @property + def host_url(self): ... + @property + def application_url(self): ... + @property + def path_url(self): ... + @property + def path(self): ... + @property + def path_qs(self): ... + @property + def url(self): ... + def relative_url(self, other_url, to_application: bool = False): ... + def path_info_pop(self, pattern: Incomplete | None = None): ... + def path_info_peek(self): ... + urlvars: Incomplete + urlargs: Incomplete + @property + def is_xhr(self): ... + host: Incomplete + @property + def domain(self): ... + @property + def body(self): ... + @body.setter + def body(self, value) -> None: ... + def body(self) -> None: ... + json: Incomplete + json_body: Incomplete + text: Incomplete + @property + def POST(self): ... + @property + def GET(self): ... + @property + def params(self): ... + @property + def cookies(self): ... + @cookies.setter + def cookies(self, val) -> None: ... + def copy(self): ... + def copy_get(self): ... + @property + def is_body_readable(self): ... + @is_body_readable.setter + def is_body_readable(self, flag) -> None: ... + def make_body_seekable(self) -> None: ... + def copy_body(self) -> None: ... + def make_tempfile(self): ... + def remove_conditional_headers( + self, + remove_encoding: bool = True, + remove_range: bool = True, + remove_match: bool = True, + remove_modified: bool = True, + ) -> None: ... + accept: Incomplete + accept_charset: Incomplete + accept_encoding: Incomplete + accept_language: Incomplete + authorization: Incomplete + cache_control: Incomplete + if_match: Incomplete + if_none_match: Incomplete + date: Incomplete + if_modified_since: Incomplete + if_unmodified_since: Incomplete + if_range: Incomplete + max_forwards: Incomplete + pragma: Incomplete + range: Incomplete + referer: Incomplete + referrer = referer + user_agent: Incomplete + def as_bytes(self, skip_body: bool = False): ... + def as_text(self): ... + @classmethod + def from_bytes(cls, b): ... + @classmethod + def from_text(cls, s): ... + @classmethod + def from_file(cls, fp): ... + def call_application(self, application, catch_exc_info: bool = False): ... + ResponseClass: Incomplete + def send( + self, + application: Incomplete | None = None, + catch_exc_info: bool = False, + ): ... + get_response = send + def make_default_send_app(self): ... + @classmethod + def blank( + cls, + path, + environ: Incomplete | None = None, + base_url: Incomplete | None = None, + headers: Incomplete | None = None, + POST: Incomplete | None = None, + **kw + ): ... + +class LegacyRequest(BaseRequest): + uscript_name: Incomplete + upath_info: Incomplete + def encget(self, key, default=..., encattr: Incomplete | None = None): ... + +class AdhocAttrMixin: + def __setattr__(self, attr, value, DEFAULT=...) -> None: ... + def __getattr__(self, attr, DEFAULT=...): ... + def __delattr__(self, attr, DEFAULT=...): ... + +class Request(AdhocAttrMixin, BaseRequest): ... +class DisconnectionError(IOError): ... + +class LimitedLengthFile(io.RawIOBase): + file: Incomplete + maxlen: Incomplete + remaining: Incomplete + def __init__(self, file, maxlen) -> None: ... + def fileno(self): ... + @staticmethod + def readable(): ... + def readinto(self, buff): ... + +class FakeCGIBody(io.RawIOBase): + vars: Incomplete + content_type: Incomplete + file: Incomplete + def __init__(self, vars, content_type) -> None: ... + def fileno(self) -> None: ... + @staticmethod + def readable(): ... + def readinto(self, buff): ... + +class Transcoder: + charset: Incomplete + errors: Incomplete + def __init__(self, charset, errors: str = "strict") -> None: ... + def transcode_query(self, q): ... + def transcode_fs(self, fs, content_type): ... diff --git a/stubs/webob/response.pyi b/stubs/webob/response.pyi new file mode 100644 index 0000000..9245fd9 --- /dev/null +++ b/stubs/webob/response.pyi @@ -0,0 +1,99 @@ +from _typeshed import Incomplete + +__all__ = ['Response'] + +class Response: + default_content_type: str + default_charset: str + unicode_errors: str + default_conditional_response: bool + default_body_encoding: str + request: Incomplete + environ: Incomplete + status: Incomplete + conditional_response: Incomplete + def __init__(self, body: Incomplete | None = None, status: Incomplete | None = None, headerlist: Incomplete | None = None, app_iter: Incomplete | None = None, content_type: Incomplete | None = None, conditional_response: Incomplete | None = None, charset=..., **kw) -> None: ... + @classmethod + def from_file(cls, fp): ... + def copy(self): ... + status_code: Incomplete + status_int: Incomplete + headerlist: Incomplete + headers: Incomplete + body: Incomplete + json: Incomplete + json_body: Incomplete + has_body: Incomplete + text: Incomplete + unicode_body: Incomplete + ubody: Incomplete + body_file: Incomplete + content_length: Incomplete + def write(self, text) -> None: ... + app_iter: Incomplete + allow: Incomplete + vary: Incomplete + content_encoding: Incomplete + content_language: Incomplete + content_location: Incomplete + content_md5: Incomplete + content_disposition: Incomplete + accept_ranges: Incomplete + content_range: Incomplete + date: Incomplete + expires: Incomplete + last_modified: Incomplete + etag: Incomplete + @property + def etag_strong(self): ... + location: Incomplete + pragma: Incomplete + age: Incomplete + retry_after: Incomplete + server: Incomplete + www_authenticate: Incomplete + charset: Incomplete + content_type: Incomplete + content_type_params: Incomplete + def set_cookie(self, name, value: str = '', max_age: Incomplete | None = None, path: str = '/', domain: Incomplete | None = None, secure: bool = False, httponly: bool = False, comment: Incomplete | None = None, expires: Incomplete | None = None, overwrite: bool = False, samesite: Incomplete | None = None) -> None: ... + def delete_cookie(self, name, path: str = '/', domain: Incomplete | None = None) -> None: ... + def unset_cookie(self, name, strict: bool = True) -> None: ... + def merge_cookies(self, resp): ... + cache_control: Incomplete + cache_expires: Incomplete + def encode_content(self, encoding: str = 'gzip', lazy: bool = False) -> None: ... + def decode_content(self) -> None: ... + def md5_etag(self, body: Incomplete | None = None, set_content_md5: bool = False) -> None: ... + def __call__(self, environ, start_response): ... + def conditional_response_app(self, environ, start_response): ... + def app_iter_range(self, start, stop): ... + +class ResponseBodyFile: + mode: str + closed: bool + response: Incomplete + write: Incomplete + def __init__(self, response) -> None: ... + encoding: Incomplete + def writelines(self, seq) -> None: ... + def close(self) -> None: ... + def flush(self) -> None: ... + def tell(self): ... + +class AppIterRange: + app_iter: Incomplete + start: Incomplete + stop: Incomplete + def __init__(self, app_iter, start, stop) -> None: ... + def __iter__(self): ... + def next(self): ... + __next__ = next + def close(self) -> None: ... + +class EmptyResponse: + close: Incomplete + def __init__(self, app_iter: Incomplete | None = None) -> None: ... + def __iter__(self): ... + def __len__(self) -> int: ... + def next(self) -> None: ... + __next__ = next diff --git a/stubs/webob/static.pyi b/stubs/webob/static.pyi new file mode 100644 index 0000000..68061f3 --- /dev/null +++ b/stubs/webob/static.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +__all__ = ['FileApp', 'DirectoryApp'] + +class FileApp: + filename: Incomplete + kw: Incomplete + def __init__(self, filename, **kw) -> None: ... + def __call__(self, req): ... + +class FileIter: + file: Incomplete + def __init__(self, file) -> None: ... + def app_iter_range(self, seek: Incomplete | None = None, limit: Incomplete | None = None, block_size: Incomplete | None = None) -> Generator[Incomplete, None, None]: ... + __iter__ = app_iter_range + +class DirectoryApp: + path: Incomplete + index_page: Incomplete + hide_index_with_redirect: Incomplete + fileapp_kw: Incomplete + def __init__(self, path, index_page: str = 'index.html', hide_index_with_redirect: bool = False, **kw) -> None: ... + def make_fileapp(self, path): ... + def __call__(self, req): ... + def index(self, req, path): ... diff --git a/stubs/webob/util.pyi b/stubs/webob/util.pyi new file mode 100644 index 0000000..3e24268 --- /dev/null +++ b/stubs/webob/util.pyi @@ -0,0 +1,11 @@ +from _typeshed import Incomplete +from webob.compat import escape as escape, string_types as string_types, text_ as text_, text_type as text_type + +def html_escape(s): ... +def header_docstring(header, rfc_section): ... +def warn_deprecation(text, version, stacklevel) -> None: ... + +status_reasons: Incomplete +status_generic_reasons: Incomplete + +def strings_differ(string1, string2, compare_digest=...): ... diff --git a/stubs/zope/interface/__init__.pyi b/stubs/zope/interface/__init__.pyi new file mode 100644 index 0000000..6f89bf4 --- /dev/null +++ b/stubs/zope/interface/__init__.pyi @@ -0,0 +1,4 @@ +from zope.interface.declarations import Declaration as Declaration, alsoProvides as alsoProvides, classImplements as classImplements, classImplementsFirst as classImplementsFirst, classImplementsOnly as classImplementsOnly, directlyProvidedBy as directlyProvidedBy, directlyProvides as directlyProvides, implementedBy as implementedBy, implementer as implementer, implementer_only as implementer_only, moduleProvides as moduleProvides, noLongerProvides as noLongerProvides, providedBy as providedBy, provider as provider +from zope.interface.interface import Attribute as Attribute, Interface as Interface, interfacemethod as interfacemethod, invariant as invariant, taggedValue as taggedValue + +__all__ = ['Interface', 'Attribute', 'Interface', 'taggedValue', 'invariant', 'interfacemethod', 'providedBy', 'implementedBy', 'classImplements', 'classImplementsFirst', 'implementer', 'classImplementsOnly', 'implementer_only', 'directlyProvidedBy', 'directlyProvides', 'alsoProvides', 'noLongerProvides', 'provider', 'moduleProvides', 'Declaration'] diff --git a/stubs/zope/interface/_compat.pyi b/stubs/zope/interface/_compat.pyi new file mode 100644 index 0000000..06bb0df --- /dev/null +++ b/stubs/zope/interface/_compat.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +PYPY: Incomplete diff --git a/stubs/zope/interface/_flatten.pyi b/stubs/zope/interface/_flatten.pyi new file mode 100644 index 0000000..a0d939b --- /dev/null +++ b/stubs/zope/interface/_flatten.pyi @@ -0,0 +1 @@ +from zope.interface import Declaration as Declaration diff --git a/stubs/zope/interface/_zope_interface_coptimizations.pyi b/stubs/zope/interface/_zope_interface_coptimizations.pyi new file mode 100644 index 0000000..a2ccb0a --- /dev/null +++ b/stubs/zope/interface/_zope_interface_coptimizations.pyi @@ -0,0 +1,5 @@ +adapter_hooks: list + +def getObjectSpecification(*args, **kwargs): ... +def implementedBy(*args, **kwargs): ... +def providedBy(*args, **kwargs): ... diff --git a/stubs/zope/interface/adapter.pyi b/stubs/zope/interface/adapter.pyi new file mode 100644 index 0000000..17fbdbc --- /dev/null +++ b/stubs/zope/interface/adapter.pyi @@ -0,0 +1,56 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +__all__ = ['AdapterRegistry', 'VerifyingAdapterRegistry'] + +class BaseAdapterRegistry: + __bases__: Incomplete + def __init__(self, bases=()) -> None: ... + def changed(self, originally_changed) -> None: ... + def register(self, required, provided, name, value) -> None: ... + def registered(self, required, provided, name: str = ''): ... + def allRegistrations(self) -> Generator[Incomplete, Incomplete, None]: ... + def unregister(self, required, provided, name, value: Incomplete | None = None): ... + def subscribe(self, required, provided, value) -> None: ... + def subscribed(self, required, provided, subscriber): ... + def allSubscriptions(self) -> Generator[Incomplete, None, None]: ... + def unsubscribe(self, required, provided, value: Incomplete | None = None) -> None: ... + def rebuild(self): ... + def get(self, _): ... + +class LookupBase: + def __init__(self) -> None: ... + def changed(self, ignored: Incomplete | None = None) -> None: ... + def lookup(self, required, provided, name: str = '', default: Incomplete | None = None): ... + def lookup1(self, required, provided, name: str = '', default: Incomplete | None = None): ... + def queryAdapter(self, object, provided, name: str = '', default: Incomplete | None = None): ... + def adapter_hook(self, provided, object, name: str = '', default: Incomplete | None = None): ... + def lookupAll(self, required, provided): ... + def subscriptions(self, required, provided): ... + +class VerifyingBase(LookupBaseFallback): + def changed(self, originally_changed) -> None: ... + def lookupAll(self, required, provided): ... + def subscriptions(self, required, provided): ... + +class AdapterLookupBase: + def __init__(self, registry) -> None: ... + def changed(self, ignored: Incomplete | None = None) -> None: ... + def init_extendors(self) -> None: ... + def add_extendor(self, provided) -> None: ... + def remove_extendor(self, provided) -> None: ... + def queryMultiAdapter(self, objects, provided, name: str = '', default: Incomplete | None = None): ... + def names(self, required, provided): ... + def subscribers(self, objects, provided): ... + +class AdapterLookup(AdapterLookupBase, LookupBase): ... + +class AdapterRegistry(BaseAdapterRegistry): + LookupClass = AdapterLookup + def __init__(self, bases=()) -> None: ... + def changed(self, originally_changed) -> None: ... + +class VerifyingAdapterLookup(AdapterLookupBase, VerifyingBase): ... + +class VerifyingAdapterRegistry(BaseAdapterRegistry): + LookupClass = VerifyingAdapterLookup diff --git a/stubs/zope/interface/advice.pyi b/stubs/zope/interface/advice.pyi new file mode 100644 index 0000000..7bfb531 --- /dev/null +++ b/stubs/zope/interface/advice.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete + +__all__ = ['determineMetaclass', 'getFrameInfo', 'isClassAdvisor', 'minimalBases'] + +def getFrameInfo(frame): ... +def isClassAdvisor(ob): ... +def determineMetaclass(bases, explicit_mc: Incomplete | None = None): ... +def minimalBases(classes): ... diff --git a/stubs/zope/interface/common/__init__.pyi b/stubs/zope/interface/common/__init__.pyi new file mode 100644 index 0000000..109be01 --- /dev/null +++ b/stubs/zope/interface/common/__init__.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete +from zope.interface import Interface as Interface, classImplements as classImplements +from zope.interface.interface import InterfaceClass as InterfaceClass, fromFunction as fromFunction + +class optional: + __doc__: Incomplete + def __init__(self, method) -> None: ... + +class ABCInterfaceClass(InterfaceClass): + __class__: Incomplete + def __init__(self, name, bases, attrs) -> None: ... + def getABC(self): ... + def getRegisteredConformers(self): ... + +ABCInterface: Incomplete diff --git a/stubs/zope/interface/common/builtins.pyi b/stubs/zope/interface/common/builtins.pyi new file mode 100644 index 0000000..ae0b976 --- /dev/null +++ b/stubs/zope/interface/common/builtins.pyi @@ -0,0 +1,28 @@ +from _typeshed import Incomplete +from zope.interface.common import collections, io, numbers + +__all__ = ['IList', 'ITuple', 'ITextString', 'IByteString', 'INativeString', 'IBool', 'IDict', 'IFile'] + +class IList(collections.IMutableSequence): + extra_classes: Incomplete + def sort(key: Incomplete | None = None, reverse: bool = False) -> None: ... + +class ITuple(collections.ISequence): + extra_classes: Incomplete + +class ITextString(collections.ISequence): + extra_classes: Incomplete + +class IByteString(collections.IByteString): + extra_classes: Incomplete + +class INativeString(ITextString): ... + +class IBool(numbers.IIntegral): + extra_classes: Incomplete + +class IDict(collections.IMutableMapping): + extra_classes: Incomplete + +class IFile(io.IIOBase): + extra_classes: Incomplete diff --git a/stubs/zope/interface/common/collections.pyi b/stubs/zope/interface/common/collections.pyi new file mode 100644 index 0000000..26af0e8 --- /dev/null +++ b/stubs/zope/interface/common/collections.pyi @@ -0,0 +1,90 @@ +from _typeshed import Incomplete +from collections import abc +from zope.interface.common import ABCInterface + +__all__ = ['IAsyncGenerator', 'IAsyncIterable', 'IAsyncIterator', 'IAwaitable', 'ICollection', 'IContainer', 'ICoroutine', 'IGenerator', 'IHashable', 'IItemsView', 'IIterable', 'IIterator', 'IKeysView', 'IMapping', 'IMappingView', 'IMutableMapping', 'IMutableSequence', 'IMutableSet', 'IReversible', 'ISequence', 'ISet', 'ISized', 'IValuesView'] + +class IContainer(ABCInterface): + abc = abc.Container + def __contains__(other) -> bool: ... + +class IHashable(ABCInterface): + abc = abc.Hashable + +class IIterable(ABCInterface): + abc = abc.Iterable + def __iter__(): ... + +class IIterator(IIterable): + abc = abc.Iterator + +class IReversible(IIterable): + abc: Incomplete + def __reversed__() -> None: ... + +class IGenerator(IIterator): + abc: Incomplete + +class ISized(ABCInterface): + abc = abc.Sized + +class ICollection(ISized, IIterable, IContainer): + abc: Incomplete + +class ISequence(IReversible, ICollection): + abc = abc.Sequence + extra_classes: Incomplete + ignored_classes: Incomplete + def __reversed__() -> None: ... + def __iter__(): ... + +class IMutableSequence(ISequence): + abc = abc.MutableSequence + extra_classes: Incomplete + +class IByteString(ISequence): + abc: Incomplete + +class ISet(ICollection): + abc = abc.Set + +class IMutableSet(ISet): + abc = abc.MutableSet + +class IMapping(ICollection): + abc = abc.Mapping + extra_classes: Incomplete + ignored_classes: Incomplete + +class IMutableMapping(IMapping): + abc = abc.MutableMapping + extra_classes: Incomplete + ignored_classes: Incomplete + +class IMappingView(ISized): + abc = abc.MappingView + +class IItemsView(IMappingView, ISet): + abc = abc.ItemsView + +class IKeysView(IMappingView, ISet): + abc = abc.KeysView + +class IValuesView(IMappingView, ICollection): + abc = abc.ValuesView + def __contains__(other) -> bool: ... + +class IAwaitable(ABCInterface): + abc: Incomplete + +class ICoroutine(IAwaitable): + abc: Incomplete + +class IAsyncIterable(ABCInterface): + abc: Incomplete + +class IAsyncIterator(IAsyncIterable): + abc: Incomplete + +class IAsyncGenerator(IAsyncIterator): + abc: Incomplete diff --git a/stubs/zope/interface/common/idatetime.pyi b/stubs/zope/interface/common/idatetime.pyi new file mode 100644 index 0000000..06ee9b8 --- /dev/null +++ b/stubs/zope/interface/common/idatetime.pyi @@ -0,0 +1,97 @@ +from _typeshed import Incomplete +from zope.interface import Attribute as Attribute, Interface as Interface, classImplements as classImplements + +class ITimeDeltaClass(Interface): + min: Incomplete + max: Incomplete + resolution: Incomplete + +class ITimeDelta(ITimeDeltaClass): + days: Incomplete + seconds: Incomplete + microseconds: Incomplete + +class IDateClass(Interface): + min: Incomplete + max: Incomplete + resolution: Incomplete + def today() -> None: ... + def fromtimestamp(timestamp) -> None: ... + def fromordinal(ordinal) -> None: ... + +class IDate(IDateClass): + year: Incomplete + month: Incomplete + day: Incomplete + def replace(year, month, day) -> None: ... + def timetuple() -> None: ... + def toordinal() -> None: ... + def weekday() -> None: ... + def isoweekday() -> None: ... + def isocalendar() -> None: ... + def isoformat() -> None: ... + def ctime() -> None: ... + def strftime(format) -> None: ... + +class IDateTimeClass(Interface): + min: Incomplete + max: Incomplete + resolution: Incomplete + def today() -> None: ... + def now(tz: Incomplete | None = None) -> None: ... + def utcnow() -> None: ... + def fromtimestamp(timestamp, tz: Incomplete | None = None) -> None: ... + def utcfromtimestamp(timestamp) -> None: ... + def fromordinal(ordinal) -> None: ... + def combine(date, time) -> None: ... + +class IDateTime(IDate, IDateTimeClass): + year: Incomplete + month: Incomplete + day: Incomplete + hour: Incomplete + minute: Incomplete + second: Incomplete + microsecond: Incomplete + tzinfo: Incomplete + def date() -> None: ... + def time() -> None: ... + def timetz() -> None: ... + def replace(year, month, day, hour, minute, second, microsecond, tzinfo) -> None: ... + def astimezone(tz) -> None: ... + def utcoffset() -> None: ... + def dst() -> None: ... + def tzname() -> None: ... + def timetuple() -> None: ... + def utctimetuple() -> None: ... + def toordinal() -> None: ... + def weekday() -> None: ... + def isoweekday() -> None: ... + def isocalendar() -> None: ... + def isoformat(sep: str = 'T') -> None: ... + def ctime() -> None: ... + def strftime(format) -> None: ... + +class ITimeClass(Interface): + min: Incomplete + max: Incomplete + resolution: Incomplete + +class ITime(ITimeClass): + hour: Incomplete + minute: Incomplete + second: Incomplete + microsecond: Incomplete + tzinfo: Incomplete + def replace(hour, minute, second, microsecond, tzinfo) -> None: ... + def isoformat() -> None: ... + def strftime(format) -> None: ... + def utcoffset() -> None: ... + def dst() -> None: ... + def tzname() -> None: ... + +class ITZInfo(Interface): + def utcoffset(dt) -> None: ... + def dst(dt) -> None: ... + def tzname(dt) -> None: ... + def fromutc(dt) -> None: ... diff --git a/stubs/zope/interface/common/interfaces.pyi b/stubs/zope/interface/common/interfaces.pyi new file mode 100644 index 0000000..48991d7 --- /dev/null +++ b/stubs/zope/interface/common/interfaces.pyi @@ -0,0 +1,40 @@ +from zope.interface import Interface as Interface, classImplements as classImplements + +class IException(Interface): ... +class IStandardError(IException): ... +class IWarning(IException): ... +class ISyntaxError(IStandardError): ... +class ILookupError(IStandardError): ... +class IValueError(IStandardError): ... +class IRuntimeError(IStandardError): ... +class IArithmeticError(IStandardError): ... +class IAssertionError(IStandardError): ... +class IAttributeError(IStandardError): ... +class IDeprecationWarning(IWarning): ... +class IEOFError(IStandardError): ... +class IEnvironmentError(IStandardError): ... +class IFloatingPointError(IArithmeticError): ... +class IIOError(IEnvironmentError): ... +class IImportError(IStandardError): ... +class IIndentationError(ISyntaxError): ... +class IIndexError(ILookupError): ... +class IKeyError(ILookupError): ... +class IKeyboardInterrupt(IStandardError): ... +class IMemoryError(IStandardError): ... +class INameError(IStandardError): ... +class INotImplementedError(IRuntimeError): ... +class IOSError(IEnvironmentError): ... +class IOverflowError(IArithmeticError): ... +class IOverflowWarning(IWarning): ... +class IReferenceError(IStandardError): ... +class IRuntimeWarning(IWarning): ... +class IStopIteration(IException): ... +class ISyntaxWarning(IWarning): ... +class ISystemError(IStandardError): ... +class ISystemExit(IException): ... +class ITabError(IIndentationError): ... +class ITypeError(IStandardError): ... +class IUnboundLocalError(INameError): ... +class IUnicodeError(IValueError): ... +class IUserWarning(IWarning): ... +class IZeroDivisionError(IArithmeticError): ... diff --git a/stubs/zope/interface/common/io.pyi b/stubs/zope/interface/common/io.pyi new file mode 100644 index 0000000..a201175 --- /dev/null +++ b/stubs/zope/interface/common/io.pyi @@ -0,0 +1,16 @@ +import io as abc +from _typeshed import Incomplete +from zope.interface.common import ABCInterface as ABCInterface + +class IIOBase(ABCInterface): + abc = abc.IOBase + +class IRawIOBase(IIOBase): + abc = abc.RawIOBase + +class IBufferedIOBase(IIOBase): + abc = abc.BufferedIOBase + extra_classes: Incomplete + +class ITextIOBase(IIOBase): + abc = abc.TextIOBase diff --git a/stubs/zope/interface/common/mapping.pyi b/stubs/zope/interface/common/mapping.pyi new file mode 100644 index 0000000..8ce7b1a --- /dev/null +++ b/stubs/zope/interface/common/mapping.pyi @@ -0,0 +1,37 @@ +from _typeshed import Incomplete +from zope.interface import Interface as Interface +from zope.interface.common import collections as collections + +class IItemMapping(Interface): + def __getitem__(key) -> None: ... + +class IReadMapping(collections.IContainer, IItemMapping): + def get(key, default: Incomplete | None = None) -> None: ... + def __contains__(key) -> bool: ... + +class IWriteMapping(Interface): + def __delitem__(key) -> None: ... + def __setitem__(key, value) -> None: ... + +class IEnumerableMapping(collections.ISized, IReadMapping): + def keys() -> None: ... + def __iter__(): ... + def values() -> None: ... + def items() -> None: ... + +class IMapping(IWriteMapping, IEnumerableMapping): ... +class IIterableMapping(IEnumerableMapping): ... + +class IClonableMapping(Interface): + def copy() -> None: ... + +class IExtendedReadMapping(IIterableMapping): ... + +class IExtendedWriteMapping(IWriteMapping): + def clear() -> None: ... + def update(d) -> None: ... + def setdefault(key, default: Incomplete | None = None) -> None: ... + def pop(k, default: Incomplete | None = None) -> None: ... + def popitem() -> None: ... + +class IFullMapping(collections.IMutableMapping, IExtendedReadMapping, IExtendedWriteMapping, IClonableMapping, IMapping): ... diff --git a/stubs/zope/interface/common/numbers.pyi b/stubs/zope/interface/common/numbers.pyi new file mode 100644 index 0000000..f4f6932 --- /dev/null +++ b/stubs/zope/interface/common/numbers.pyi @@ -0,0 +1,21 @@ +import numbers as abc +from zope.interface.common import ABCInterface as ABCInterface, optional as optional + +class INumber(ABCInterface): + abc = abc.Number + +class IComplex(INumber): + abc = abc.Complex + def __complex__() -> complex: ... + +class IReal(IComplex): + abc = abc.Real + def __complex__() -> complex: ... + __floor__ = __complex__ + __ceil__ = __complex__ + +class IRational(IReal): + abc = abc.Rational + +class IIntegral(IRational): + abc = abc.Integral diff --git a/stubs/zope/interface/common/sequence.pyi b/stubs/zope/interface/common/sequence.pyi new file mode 100644 index 0000000..ac78143 --- /dev/null +++ b/stubs/zope/interface/common/sequence.pyi @@ -0,0 +1,43 @@ +from _typeshed import Incomplete +from zope.interface import Interface as Interface +from zope.interface.common import collections as collections + +__docformat__: str + +class IMinimalSequence(collections.IIterable): + def __getitem__(index) -> None: ... + +class IFiniteSequence(collections.ISized, IMinimalSequence): ... + +class IReadSequence(collections.IContainer, IFiniteSequence): + def __contains__(item) -> bool: ... + def __lt__(other): ... + def __le__(other): ... + def __eq__(other): ... + def __ne__(other): ... + def __gt__(other): ... + def __ge__(other): ... + def __add__(other) -> None: ... + def __mul__(n) -> None: ... + def __rmul__(n) -> None: ... + +class IExtendedReadSequence(IReadSequence): + def count(item) -> None: ... + def index(item, *args) -> None: ... + +class IUniqueMemberWriteSequence(Interface): + def __setitem__(index, item) -> None: ... + def __delitem__(index) -> None: ... + def __iadd__(y) -> None: ... + def append(item) -> None: ... + def insert(index, item) -> None: ... + def pop(index: int = -1) -> None: ... + def remove(item) -> None: ... + def reverse() -> None: ... + def sort(cmpfunc: Incomplete | None = None) -> None: ... + def extend(iterable) -> None: ... + +class IWriteSequence(IUniqueMemberWriteSequence): + def __imul__(n) -> None: ... + +class ISequence(IReadSequence, IWriteSequence): ... diff --git a/stubs/zope/interface/declarations.pyi b/stubs/zope/interface/declarations.pyi new file mode 100644 index 0000000..5417f49 --- /dev/null +++ b/stubs/zope/interface/declarations.pyi @@ -0,0 +1,96 @@ +from _typeshed import Incomplete +from zope.interface.interface import Interface as Interface, InterfaceClass as InterfaceClass, NameAndModuleComparisonMixin as NameAndModuleComparisonMixin, Specification as Specification, SpecificationBase as SpecificationBase + +__docformat__: str +BuiltinImplementationSpecifications: Incomplete + +class named: + name: Incomplete + def __init__(self, name) -> None: ... + def __call__(self, ob): ... + +class Declaration(Specification): + def __init__(self, *bases) -> None: ... + def __contains__(self, interface) -> bool: ... + def __iter__(self): ... + def flattened(self): ... + def __sub__(self, other): ... + def __add__(self, other): ... + __radd__ = __add__ + +class _ImmutableDeclaration(Declaration): + def __new__(cls): ... + def __reduce__(self): ... + @property + def __bases__(self): ... + @__bases__.setter + def __bases__(self, new_bases) -> None: ... + @property + def dependents(self): ... + changed: Incomplete + subscribe: Incomplete + unsubscribe: Incomplete + def interfaces(self): ... + def extends(self, interface, strict: bool = True): ... + def get(self, name, default: Incomplete | None = None): ... + def weakref(self, callback: Incomplete | None = None): ... + +class Implements(NameAndModuleComparisonMixin, Declaration): + inherit: Incomplete + declared: Incomplete + @classmethod + def named(cls, name, *bases): ... + def changed(self, originally_changed): ... + def __reduce__(self): ... + +def implementedBy(cls): ... +def classImplementsOnly(cls, *interfaces) -> None: ... +def classImplements(cls, *interfaces) -> None: ... +def classImplementsFirst(cls, iface) -> None: ... + +class implementer: + interfaces: Incomplete + def __init__(self, *interfaces) -> None: ... + def __call__(self, ob): ... + +class implementer_only: + interfaces: Incomplete + def __init__(self, *interfaces) -> None: ... + def __call__(self, ob): ... + +class Provides(Declaration): + def __init__(self, cls, *interfaces) -> None: ... + def __reduce__(self): ... + __module__: str + def __get__(self, inst, cls): ... +ProvidesClass = Provides +InstanceDeclarations: Incomplete + +def directlyProvides(object, *interfaces) -> None: ... +def alsoProvides(object, *interfaces) -> None: ... +def noLongerProvides(object, interface) -> None: ... + +class ClassProvidesBase(SpecificationBase): + def __get__(self, inst, cls): ... + +class ClassProvides(Declaration, ClassProvidesBase): + def __init__(self, cls, metacls, *interfaces) -> None: ... + def __reduce__(self): ... + __get__: Incomplete + +def directlyProvidedBy(object): ... + +class provider: + interfaces: Incomplete + def __init__(self, *interfaces) -> None: ... + def __call__(self, ob): ... + +def moduleProvides(*interfaces) -> None: ... +def ObjectSpecification(direct, cls): ... +def getObjectSpecification(ob): ... +def providedBy(ob): ... + +class ObjectSpecificationDescriptor: + def __get__(self, inst, cls): ... + +objectSpecificationDescriptor: Incomplete diff --git a/stubs/zope/interface/document.pyi b/stubs/zope/interface/document.pyi new file mode 100644 index 0000000..e0cf2fb --- /dev/null +++ b/stubs/zope/interface/document.pyi @@ -0,0 +1,4 @@ +__all__ = ['asReStructuredText', 'asStructuredText'] + +def asStructuredText(I, munge: int = 0, rst: bool = False): ... +def asReStructuredText(I, munge: int = 0): ... diff --git a/stubs/zope/interface/exceptions.pyi b/stubs/zope/interface/exceptions.pyi new file mode 100644 index 0000000..ee536d1 --- /dev/null +++ b/stubs/zope/interface/exceptions.pyi @@ -0,0 +1,29 @@ +__all__ = ['Invalid', 'DoesNotImplement', 'BrokenImplementation', 'BrokenMethodImplementation', 'MultipleInvalid', 'BadImplements', 'InvalidInterface'] + +class Invalid(Exception): ... + +class _TargetInvalid(Invalid): + @property + def interface(self): ... + @property + def target(self): ... + +class DoesNotImplement(_TargetInvalid): ... + +class BrokenImplementation(_TargetInvalid): + @property + def name(self): ... + +class BrokenMethodImplementation(_TargetInvalid): + @property + def method(self): ... + @property + def mess(self): ... + +class MultipleInvalid(_TargetInvalid): + def __init__(self, interface, target, exceptions) -> None: ... + @property + def exceptions(self): ... + +class InvalidInterface(Exception): ... +class BadImplements(TypeError): ... diff --git a/stubs/zope/interface/interface.pyi b/stubs/zope/interface/interface.pyi new file mode 100644 index 0000000..dc07ccc --- /dev/null +++ b/stubs/zope/interface/interface.pyi @@ -0,0 +1,101 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +__all__ = ['InterfaceClass', 'Specification', 'adapter_hooks'] + +class Element: + __doc__: Incomplete + def __init__(self, __name__, __doc__: str = '') -> None: ... + def getName(self): ... + def getDoc(self): ... + def getTaggedValue(self, tag): ... + def queryTaggedValue(self, tag, default: Incomplete | None = None): ... + def getTaggedValueTags(self): ... + def setTaggedValue(self, tag, value) -> None: ... + queryDirectTaggedValue = queryTaggedValue + getDirectTaggedValue = getTaggedValue + getDirectTaggedValueTags = getTaggedValueTags +SpecificationBasePy = object + +class SpecificationBase: + def providedBy(self, ob): ... + def implementedBy(self, cls): ... + def isOrExtends(self, interface): ... + __call__ = isOrExtends + +class NameAndModuleComparisonMixin: + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + +class InterfaceBase(NameAndModuleComparisonMixin, SpecificationBasePy): + __ibmodule__: Incomplete + def __init__(self, name: Incomplete | None = None, module: Incomplete | None = None) -> None: ... + @property + def __module_property__(self): ... + def __call__(self, obj, alternate=...): ... + def __adapt__(self, obj): ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +adapter_hooks: Incomplete + +class Specification(SpecificationBase): + isOrExtends: Incomplete + providedBy: Incomplete + __iro__: Incomplete + __sro__: Incomplete + __bases__: Incomplete + def __init__(self, bases=()) -> None: ... + @property + def dependents(self): ... + def subscribe(self, dependent) -> None: ... + def unsubscribe(self, dependent) -> None: ... + def changed(self, originally_changed) -> None: ... + def interfaces(self) -> Generator[Incomplete, None, None]: ... + def extends(self, interface, strict: bool = True): ... + def weakref(self, callback: Incomplete | None = None): ... + def get(self, name, default: Incomplete | None = None): ... + +class _InterfaceMetaClass(type): + def __new__(cls, name, bases, attrs): ... + @property + def __module__(cls): ... + +class InterfaceClass(_InterfaceClassBase): + def __new__(cls, name: Incomplete | None = None, bases=(), attrs: Incomplete | None = None, __doc__: Incomplete | None = None, __module__: Incomplete | None = None): ... + __identifier__: Incomplete + def __init__(self, name, bases=(), attrs: Incomplete | None = None, __doc__: Incomplete | None = None, __module__: Incomplete | None = None) -> None: ... + def interfaces(self) -> Generator[Incomplete, None, None]: ... + def getBases(self): ... + def isEqualOrExtendedBy(self, other): ... + def names(self, all: bool = False): ... + def __iter__(self): ... + def namesAndDescriptions(self, all: bool = False): ... + def getDescriptionFor(self, name): ... + __getitem__ = getDescriptionFor + def __contains__(self, name) -> bool: ... + def direct(self, name): ... + def queryDescriptionFor(self, name, default: Incomplete | None = None): ... + def validateInvariants(self, obj, errors: Incomplete | None = None) -> None: ... + def queryTaggedValue(self, tag, default: Incomplete | None = None): ... + def getTaggedValue(self, tag): ... + def getTaggedValueTags(self): ... + def __reduce__(self): ... + +class _InterfaceClassWithCustomMethods(InterfaceClass): ... + +class Attribute(Element): + interface: Incomplete + +class Method(Attribute): + positional: Incomplete + required: Incomplete + varargs: Incomplete + kwargs: Incomplete + optional: Incomplete + def __call__(self, *args, **kw) -> None: ... + def getSignatureInfo(self): ... + def getSignatureString(self): ... diff --git a/stubs/zope/interface/interfaces.pyi b/stubs/zope/interface/interfaces.pyi new file mode 100644 index 0000000..7d27fa7 --- /dev/null +++ b/stubs/zope/interface/interfaces.pyi @@ -0,0 +1,154 @@ +from _typeshed import Incomplete +from zope.interface.interface import Interface + +__all__ = ['ComponentLookupError', 'IAdapterRegistration', 'IAdapterRegistry', 'IAttribute', 'IComponentLookup', 'IComponentRegistry', 'IComponents', 'IDeclaration', 'IElement', 'IHandlerRegistration', 'IInterface', 'IInterfaceDeclaration', 'IMethod', 'Invalid', 'IObjectEvent', 'IRegistered', 'IRegistration', 'IRegistrationEvent', 'ISpecification', 'ISubscriptionAdapterRegistration', 'IUnregistered', 'IUtilityRegistration', 'ObjectEvent', 'Registered', 'Unregistered'] + +class IElement(Interface): + __doc__: Incomplete + def getTaggedValue(tag) -> None: ... + def queryTaggedValue(tag, default: Incomplete | None = None) -> None: ... + def getTaggedValueTags() -> None: ... + def setTaggedValue(tag, value) -> None: ... + def getDirectTaggedValue(tag) -> None: ... + def queryDirectTaggedValue(tag, default: Incomplete | None = None) -> None: ... + def getDirectTaggedValueTags() -> None: ... + +class IAttribute(IElement): + interface: Incomplete + +class IMethod(IAttribute): + def getSignatureInfo() -> None: ... + def getSignatureString() -> None: ... + +class ISpecification(Interface): + def providedBy(object) -> None: ... + def implementedBy(class_) -> None: ... + def isOrExtends(other) -> None: ... + def extends(other, strict: bool = True) -> None: ... + def weakref(callback: Incomplete | None = None) -> None: ... + __bases__: Incomplete + __sro__: Incomplete + __iro__: Incomplete + def get(name, default: Incomplete | None = None) -> None: ... + +class IInterface(ISpecification, IElement): + def names(all: bool = False) -> None: ... + def namesAndDescriptions(all: bool = False) -> None: ... + def __getitem__(name) -> None: ... + def direct(name) -> None: ... + def validateInvariants(obj, errors: Incomplete | None = None) -> None: ... + def __contains__(name) -> bool: ... + def __iter__(): ... + __module__: Incomplete + +class IDeclaration(ISpecification): + def __contains__(interface) -> bool: ... + def __iter__(): ... + def flattened() -> None: ... + def __sub__(interfaces) -> None: ... + def __add__(interfaces) -> None: ... + def __nonzero__() -> None: ... + +class IInterfaceDeclaration(Interface): + Interface: Incomplete + def taggedValue(key, value) -> None: ... + def invariant(checker_function) -> None: ... + def interfacemethod(method) -> None: ... + def providedBy(ob) -> None: ... + def implementedBy(class_) -> None: ... + def classImplements(class_, *interfaces) -> None: ... + def classImplementsFirst(cls, interface) -> None: ... + def implementer(*interfaces) -> None: ... + def classImplementsOnly(class_, *interfaces) -> None: ... + def implementer_only(*interfaces) -> None: ... + def directlyProvidedBy(object) -> None: ... + def directlyProvides(object, *interfaces) -> None: ... + def alsoProvides(object, *interfaces) -> None: ... + def noLongerProvides(object, interface) -> None: ... + def provider(*interfaces) -> None: ... + def moduleProvides(*interfaces) -> None: ... + def Declaration(*interfaces) -> None: ... + +class IAdapterRegistry(Interface): + def register(required, provided, name, value) -> None: ... + def registered(required, provided, name: str = '') -> None: ... + def lookup(required, provided, name: str = '', default: Incomplete | None = None) -> None: ... + def queryMultiAdapter(objects, provided, name: str = '', default: Incomplete | None = None) -> None: ... + def lookup1(required, provided, name: str = '', default: Incomplete | None = None) -> None: ... + def queryAdapter(object, provided, name: str = '', default: Incomplete | None = None) -> None: ... + def adapter_hook(provided, object, name: str = '', default: Incomplete | None = None) -> None: ... + def lookupAll(required, provided) -> None: ... + def names(required, provided) -> None: ... + def subscribe(required, provided, subscriber) -> None: ... + def subscribed(required, provided, subscriber) -> None: ... + def subscriptions(required, provided) -> None: ... + def subscribers(objects, provided) -> None: ... + +class ComponentLookupError(LookupError): ... +class Invalid(Exception): ... + +class IObjectEvent(Interface): + object: Incomplete + +class ObjectEvent: + object: Incomplete + def __init__(self, object) -> None: ... + +class IComponentLookup(Interface): + adapters: Incomplete + utilities: Incomplete + def queryAdapter(object, interface, name: str = '', default: Incomplete | None = None) -> None: ... + def getAdapter(object, interface, name: str = '') -> None: ... + def queryMultiAdapter(objects, interface, name: str = '', default: Incomplete | None = None) -> None: ... + def getMultiAdapter(objects, interface, name: str = '') -> None: ... + def getAdapters(objects, provided) -> None: ... + def subscribers(objects, provided) -> None: ... + def handle(*objects) -> None: ... + def queryUtility(interface, name: str = '', default: Incomplete | None = None) -> None: ... + def getUtilitiesFor(interface) -> None: ... + def getAllUtilitiesRegisteredFor(interface) -> None: ... + +class IRegistration(Interface): + registry: Incomplete + name: Incomplete + info: Incomplete + +class IUtilityRegistration(IRegistration): + factory: Incomplete + component: Incomplete + provided: Incomplete + +class _IBaseAdapterRegistration(IRegistration): + factory: Incomplete + required: Incomplete + provided: Incomplete + +class IAdapterRegistration(_IBaseAdapterRegistration): ... +class ISubscriptionAdapterRegistration(_IBaseAdapterRegistration): ... + +class IHandlerRegistration(IRegistration): + handler: Incomplete + required: Incomplete + +class IRegistrationEvent(IObjectEvent): ... +class RegistrationEvent(ObjectEvent): ... +class IRegistered(IRegistrationEvent): ... +class Registered(RegistrationEvent): ... +class IUnregistered(IRegistrationEvent): ... +class Unregistered(RegistrationEvent): ... + +class IComponentRegistry(Interface): + def registerUtility(component: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '', factory: Incomplete | None = None) -> None: ... + def unregisterUtility(component: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', factory: Incomplete | None = None) -> None: ... + def registeredUtilities() -> None: ... + def registerAdapter(factory, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '') -> None: ... + def unregisterAdapter(factory: Incomplete | None = None, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = '') -> None: ... + def registeredAdapters() -> None: ... + def registerSubscriptionAdapter(factory, required: Incomplete | None = None, provides: Incomplete | None = None, name: str = '', info: str = '') -> None: ... + def unregisterSubscriptionAdapter(factory: Incomplete | None = None, required: Incomplete | None = None, provides: Incomplete | None = None, name: str = '') -> None: ... + def registeredSubscriptionAdapters() -> None: ... + def registerHandler(handler, required: Incomplete | None = None, name: str = '', info: str = '') -> None: ... + def unregisterHandler(handler: Incomplete | None = None, required: Incomplete | None = None, name: str = '') -> None: ... + def registeredHandlers() -> None: ... + +class IComponents(IComponentLookup, IComponentRegistry): ... diff --git a/stubs/zope/interface/registry.pyi b/stubs/zope/interface/registry.pyi new file mode 100644 index 0000000..c035792 --- /dev/null +++ b/stubs/zope/interface/registry.pyi @@ -0,0 +1,72 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +__all__ = ['Components'] + +class _UnhashableComponentCounter: + def __init__(self, otherdict) -> None: ... + def __getitem__(self, key): ... + def __setitem__(self, component, count) -> None: ... + def __delitem__(self, component) -> None: ... + +class _UtilityRegistrations: + def __init__(self, utilities, utility_registrations) -> None: ... + def registerUtility(self, provided, name, component, info, factory) -> None: ... + def unregisterUtility(self, provided, name, component) -> None: ... + +class Components: + __bases__: Incomplete + def __init__(self, name: str = '', bases=()) -> None: ... + def __reduce__(self): ... + def registerUtility(self, component: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '', event: bool = True, factory: Incomplete | None = None) -> None: ... + def unregisterUtility(self, component: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', factory: Incomplete | None = None): ... + def registeredUtilities(self) -> Generator[Incomplete, None, None]: ... + def queryUtility(self, provided, name: str = '', default: Incomplete | None = None): ... + def getUtility(self, provided, name: str = ''): ... + def getUtilitiesFor(self, interface) -> Generator[Incomplete, Incomplete, None]: ... + def getAllUtilitiesRegisteredFor(self, interface): ... + def registerAdapter(self, factory, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '', event: bool = True) -> None: ... + def unregisterAdapter(self, factory: Incomplete | None = None, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = ''): ... + def registeredAdapters(self) -> Generator[Incomplete, None, None]: ... + def queryAdapter(self, object, interface, name: str = '', default: Incomplete | None = None): ... + def getAdapter(self, object, interface, name: str = ''): ... + def queryMultiAdapter(self, objects, interface, name: str = '', default: Incomplete | None = None): ... + def getMultiAdapter(self, objects, interface, name: str = ''): ... + def getAdapters(self, objects, provided) -> Generator[Incomplete, None, None]: ... + def registerSubscriptionAdapter(self, factory, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = '', info: str = '', event: bool = True) -> None: ... + def registeredSubscriptionAdapters(self) -> Generator[Incomplete, None, None]: ... + def unregisterSubscriptionAdapter(self, factory: Incomplete | None = None, required: Incomplete | None = None, provided: Incomplete | None = None, name: str = ''): ... + def subscribers(self, objects, provided): ... + def registerHandler(self, factory, required: Incomplete | None = None, name: str = '', info: str = '', event: bool = True) -> None: ... + def registeredHandlers(self) -> Generator[Incomplete, None, None]: ... + def unregisterHandler(self, factory: Incomplete | None = None, required: Incomplete | None = None, name: str = ''): ... + def handle(self, *objects) -> None: ... + def rebuildUtilityRegistryFromLocalCache(self, rebuild: bool = False): ... + +class UtilityRegistration: + def __init__(self, registry, provided, name, component, doc, factory: Incomplete | None = None) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + +class AdapterRegistration: + def __init__(self, registry, required, provided, name, component, doc) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + +class SubscriptionRegistration(AdapterRegistration): ... + +class HandlerRegistration(AdapterRegistration): + def __init__(self, registry, required, name, handler, doc) -> None: ... + @property + def factory(self): ... + provided: Incomplete diff --git a/stubs/zope/interface/ro.pyi b/stubs/zope/interface/ro.pyi new file mode 100644 index 0000000..09b2b1b --- /dev/null +++ b/stubs/zope/interface/ro.pyi @@ -0,0 +1,75 @@ +from _typeshed import Incomplete + +__all__ = ['ro', 'InconsistentResolutionOrderError', 'InconsistentResolutionOrderWarning'] + +class InconsistentResolutionOrderWarning(PendingDeprecationWarning): ... + +class InconsistentResolutionOrderError(TypeError): + C: Incomplete + base_ros: Incomplete + base_tree_remaining: Incomplete + def __init__(self, c3, base_tree_remaining) -> None: ... + +class _NamedBool(int): + def __new__(cls, val, name): ... + +class _ClassBoolFromEnv: + def __get__(self, inst, klass): ... + +class _StaticMRO: + had_inconsistency: Incomplete + leaf: Incomplete + def __init__(self, C, mro) -> None: ... + def mro(self): ... + +class C3: + @staticmethod + def resolver(C, strict, base_mros): ... + direct_inconsistency: bool + leaf: Incomplete + memo: Incomplete + base_tree: Incomplete + bases_had_inconsistency: Incomplete + def __init__(self, C, memo) -> None: ... + @property + def had_inconsistency(self): ... + @property + def legacy_ro(self): ... + TRACK_BAD_IRO: Incomplete + STRICT_IRO: Incomplete + WARN_BAD_IRO: Incomplete + LOG_CHANGED_IRO: Incomplete + USE_LEGACY_IRO: Incomplete + BAD_IROS: Incomplete + class _UseLegacyRO(Exception): ... + def mro(self): ... + +class _StrictC3(C3): ... +class _TrackingC3(C3): ... + +class _ROComparison: + class Item: + prefix: str + item: Incomplete + def __init__(self, item) -> None: ... + class Deleted(Item): + prefix: str + class Inserted(Item): + prefix: str + Empty = str + class ReplacedBy: + prefix: str + suffix: str + chunk: Incomplete + total_count: Incomplete + def __init__(self, chunk, total_count) -> None: ... + def __iter__(self): ... + class Replacing(ReplacedBy): + prefix: str + suffix: str + c3: Incomplete + c3_ro: Incomplete + legacy_ro: Incomplete + def __init__(self, c3, c3_ro, legacy_ro) -> None: ... + +def ro(C, strict: Incomplete | None = None, base_mros: Incomplete | None = None, log_changed_ro: Incomplete | None = None, use_legacy_ro: Incomplete | None = None): ... diff --git a/stubs/zope/interface/verify.pyi b/stubs/zope/interface/verify.pyi new file mode 100644 index 0000000..8d80583 --- /dev/null +++ b/stubs/zope/interface/verify.pyi @@ -0,0 +1,4 @@ +__all__ = ['verifyObject', 'verifyClass'] + +def verifyClass(iface, candidate, tentative: bool = False): ... +def verifyObject(iface, candidate, tentative: bool = False): ... diff --git a/stubs/zope/sqlalchemy/__init__.pyi b/stubs/zope/sqlalchemy/__init__.pyi new file mode 100644 index 0000000..a593bef --- /dev/null +++ b/stubs/zope/sqlalchemy/__init__.pyi @@ -0,0 +1,5 @@ +from zope.sqlalchemy.datamanager import ZopeTransactionEvents as ZopeTransactionEvents, mark_changed as mark_changed, register as register + +__all__ = ['ZopeTransactionEvents', 'invalidate', 'mark_changed', 'register'] + +invalidate = mark_changed diff --git a/stubs/zope/sqlalchemy/datamanager.pyi b/stubs/zope/sqlalchemy/datamanager.pyi new file mode 100644 index 0000000..2f59b31 --- /dev/null +++ b/stubs/zope/sqlalchemy/datamanager.pyi @@ -0,0 +1,60 @@ +from _typeshed import Incomplete +from zope.interface import implementer as implementer + +STATUS_ACTIVE: str +STATUS_CHANGED: str +STATUS_READONLY: str +STATUS_INVALIDATED = STATUS_CHANGED +NO_SAVEPOINT_SUPPORT: Incomplete +SA_GE_14: Incomplete + +class SessionDataManager: + transaction_manager: Incomplete + tx: Incomplete + session: Incomplete + state: str + keep_session: Incomplete + def __init__(self, session, status, transaction_manager, keep_session: bool = False) -> None: ... + def abort(self, trans) -> None: ... + def tpc_begin(self, trans) -> None: ... + def commit(self, trans) -> None: ... + def tpc_vote(self, trans) -> None: ... + def tpc_finish(self, trans) -> None: ... + def tpc_abort(self, trans) -> None: ... + def sortKey(self): ... + @property + def savepoint(self): ... + def should_retry(self, error): ... + +class TwoPhaseSessionDataManager(SessionDataManager): + state: str + def tpc_vote(self, trans) -> None: ... + def tpc_finish(self, trans) -> None: ... + def tpc_abort(self, trans) -> None: ... + def sortKey(self): ... + +class SessionSavepoint: + session: Incomplete + transaction: Incomplete + def __init__(self, session) -> None: ... + def rollback(self) -> None: ... + +def join_transaction(session, initial_state=..., transaction_manager=..., keep_session: bool = False) -> None: ... +def mark_changed(session, transaction_manager=..., keep_session: bool = False) -> None: ... + +class ZopeTransactionEvents: + initial_state: Incomplete + transaction_manager: Incomplete + keep_session: Incomplete + def __init__(self, initial_state=..., transaction_manager=..., keep_session: bool = False) -> None: ... + def after_begin(self, session, transaction, connection) -> None: ... + def after_attach(self, session, instance) -> None: ... + def after_flush(self, session, flush_context) -> None: ... + def after_bulk_update(self, update_context) -> None: ... + def after_bulk_delete(self, delete_context) -> None: ... + def before_commit(self, session) -> None: ... + def do_orm_execute(self, execute_state) -> None: ... + def mark_changed(self, session) -> None: ... + def join_transaction(self, session) -> None: ... + +def register(session, initial_state=..., transaction_manager=..., keep_session: bool = False): ...