Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use Python 3.12 syntax
Patryk Zawadzki23b8d2898944
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex be028fe582..22d3070d4b 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -15,7 +15,7 @@ repos:exclude_types: [svg]- repo: https://github.com/astral-sh/ruff-pre-commit- rev: v0.8.6+ rev: v0.9.1hooks:- id: ruff- id: ruff-formatdiff --git a/README.md b/README.mdindex a308ae5139..9b103c465f 100644--- a/README.md+++ b/README.md@@ -43,8 +43,8 @@<a href="https://docs.saleor.io/"><img src="https://img.shields.io/badge/docs-docs.saleor.io-brightgreen.svg" alt="Documentation" /></a>- <a href="https://github.com/python/black">- <img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black">+ <a href="https://github.com/astral-sh/ruff">+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Linted by Ruff"></a></div>diff --git a/poetry.lock b/poetry.lockindex 63bf9cecc9..556aa94463 100644--- a/poetry.lock+++ b/poetry.lock@@ -1,4 +1,4 @@-# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.+# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand.[[package]]name = "adyen"@@ -6,6 +6,7 @@ version = "4.0.0"description = "Adyen Python Api"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "Adyen-4.0.0.tar.gz", hash = "sha256:f44007fd542d7634bee69f29572442bf9102043141a7d5822ac98539ac5e4d5b"},]@@ -16,6 +17,7 @@ version = "5.3.1"description = "Low-level AMQP client for Python (fork of amqplib)."optional = falsepython-versions = ">=3.6"+groups = ["main", "dev"]files = [{file = "amqp-5.3.1-py3-none-any.whl", hash = "sha256:43b3319e1b4e7d1251833a93d672b4af1e40f3d632d479b98661a95f117880a2"},{file = "amqp-5.3.1.tar.gz", hash = "sha256:cddc00c725449522023bad949f70fff7b48f0b1ade74d170a6f10ab044739432"},@@ -30,6 +32,7 @@ version = "7.0.0"description = "A library for parsing ISO 8601 strings."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "aniso8601-7.0.0-py2.py3-none-any.whl", hash = "sha256:d10a4bf949f619f719b227ef5386e31f49a2b6d453004b21f02661ccc8670c7b"},{file = "aniso8601-7.0.0.tar.gz", hash = "sha256:513d2b6637b7853806ae79ffaca6f3e8754bdd547048f5ccc1420aec4b714f1e"},@@ -41,6 +44,7 @@ version = "4.8.0"description = "High level compatibility layer for multiple asynchronous event loop implementations"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "anyio-4.8.0-py3-none-any.whl", hash = "sha256:b5011f270ab5eb0abf13385f851315585cc37ef330dd88e27ec3d34d651fd47a"},{file = "anyio-4.8.0.tar.gz", hash = "sha256:1d9fe889df5212298c0c0723fa20479d1b94883a2df44bd3897aa91083316f7a"},@@ -62,6 +66,7 @@ version = "3.8.1"description = "ASGI specs, helper code, and adapters"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "asgiref-3.8.1-py3-none-any.whl", hash = "sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47"},{file = "asgiref-3.8.1.tar.gz", hash = "sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590"},@@ -76,6 +81,7 @@ version = "24.3.0"description = "Classes Without Boilerplate"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "attrs-24.3.0-py3-none-any.whl", hash = "sha256:ac96cd038792094f438ad1f6ff80837353805ac950cd2aa0e0625ef19850c308"},{file = "attrs-24.3.0.tar.gz", hash = "sha256:8f5c07333d543103541ba7be0e2ce16eeee8130cb0b3f9238ab904ce1e85baff"},@@ -95,6 +101,7 @@ version = "1.4.0"description = "The ultimate Python library in building OAuth and OpenID Connect servers and clients."optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "Authlib-1.4.0-py2.py3-none-any.whl", hash = "sha256:4bb20b978c8b636222b549317c1815e1fe62234fc1c5efe8855d84aebf3a74e3"},{file = "authlib-1.4.0.tar.gz", hash = "sha256:1c1e6608b5ed3624aeeee136ca7f8c120d6f51f731aa152b153d54741840e1f2"},@@ -109,6 +116,7 @@ version = "1.1.5"description = "Authorize.Net Python SDK"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "authorizenet-1.1.5.tar.gz", hash = "sha256:ba8b538028201c01d7ed097ea0842f7732c220472006d105b4a6b948ddcaf4dc"},]@@ -124,6 +132,7 @@ version = "1.1.28"description = "Microsoft Azure Client Library for Python (Common)"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "azure-common-1.1.28.zip", hash = "sha256:4ac0cd3214e36b6a1b6a442686722a5d8cc449603aa833f3f0f40bda836704a3"},{file = "azure_common-1.1.28-py2.py3-none-any.whl", hash = "sha256:5c12d3dcf4ec20599ca6b0d3e09e86e146353d443e7fcc050c9a19c1f9df20ad"},@@ -135,6 +144,7 @@ version = "1.32.0"description = "Microsoft Azure Core Library for Python"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "azure_core-1.32.0-py3-none-any.whl", hash = "sha256:eac191a0efb23bfa83fddf321b27b122b4ec847befa3091fa736a5c32c50d7b4"},{file = "azure_core-1.32.0.tar.gz", hash = "sha256:22b3c35d6b2dae14990f6c1be2912bf23ffe50b220e708a28ab1bb92b1c730e5"},@@ -154,6 +164,7 @@ version = "12.24.0"description = "Microsoft Azure Blob Storage Client Library for Python"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "azure_storage_blob-12.24.0-py3-none-any.whl", hash = "sha256:4f0bb4592ea79a2d986063696514c781c9e62be240f09f6397986e01755bc071"},{file = "azure_storage_blob-12.24.0.tar.gz", hash = "sha256:eaaaa1507c8c363d6e1d1342bd549938fdf1adec9b1ada8658c8f5bf3aea844e"},@@ -174,6 +185,7 @@ version = "2.1.0"description = "Microsoft Azure Storage Common Client Library for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "azure-storage-common-2.1.0.tar.gz", hash = "sha256:ccedef5c67227bc4d6670ffd37cec18fb529a1b7c3a5e53e4096eb0cf23dc73f"},{file = "azure_storage_common-2.1.0-py2.py3-none-any.whl", hash = "sha256:b01a491a18839b9d05a4fe3421458a0ddb5ab9443c14e487f40d16f9a1dc2fbe"},@@ -191,6 +203,7 @@ version = "2.16.0"description = "Internationalization utilities"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "babel-2.16.0-py3-none-any.whl", hash = "sha256:368b5b98b37c06b7daf6696391c3240c938b37767d4584413e8438c5c435fa8b"},{file = "babel-2.16.0.tar.gz", hash = "sha256:d1f3554ca26605fe173f3de0c65f750f5a42f924499bf134de6423582298e316"},@@ -205,6 +218,7 @@ version = "4.2.1"description = "Modern password hashing for your software and your servers"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "bcrypt-4.2.1-cp37-abi3-macosx_10_12_universal2.whl", hash = "sha256:1340411a0894b7d3ef562fb233e4b6ed58add185228650942bdc885362f32c17"},{file = "bcrypt-4.2.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1ee315739bc8387aa36ff127afc99120ee452924e0df517a8f3e4c0187a0f5f"},@@ -243,6 +257,7 @@ version = "4.7.1"description = "Screen-scraping library"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "beautifulsoup4-4.7.1-py2-none-any.whl", hash = "sha256:ba6d5c59906a85ac23dadfe5c88deaf3e179ef565f4898671253e50a78680718"},{file = "beautifulsoup4-4.7.1-py3-none-any.whl", hash = "sha256:034740f6cb549b4e932ae1ab975581e6103ac8f942200a0e9759065984391858"},@@ -262,6 +277,7 @@ version = "0.7.0"description = "Print ASCII tables for terminals"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "beautifultable-0.7.0-py2.py3-none-any.whl", hash = "sha256:f1185c5bbb2d522a9c7dfe24cc55151f32379031d001c9731a2b55714b927089"},{file = "beautifultable-0.7.0.tar.gz", hash = "sha256:8deee768c7939578412f930c95c2ac51307fb723a6368e9e233091cdad240537"},@@ -273,6 +289,7 @@ version = "4.2.1"description = "Python multiprocessing fork with improvements and bugfixes"optional = falsepython-versions = ">=3.7"+groups = ["main", "dev"]files = [{file = "billiard-4.2.1-py3-none-any.whl", hash = "sha256:40b59a4ac8806ba2c2369ea98d876bc6108b051c227baffd928c644d15d8f3cb"},{file = "billiard-4.2.1.tar.gz", hash = "sha256:12b641b0c539073fc8d3f5b8b7be998956665c4233c7c1fcd66a7e677c4fb36f"},@@ -284,6 +301,7 @@ version = "21.0.0"description = "When they're not builtins, they're boltons."optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "boltons-21.0.0-py2.py3-none-any.whl", hash = "sha256:b9bb7b58b2b420bbe11a6025fdef6d3e5edc9f76a42fb467afe7ca212ef9948b"},{file = "boltons-21.0.0.tar.gz", hash = "sha256:65e70a79a731a7fe6e98592ecfb5ccf2115873d01dbc576079874629e5c90f13"},@@ -295,6 +313,7 @@ version = "1.35.93"description = "The AWS SDK for Python"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "boto3-1.35.93-py3-none-any.whl", hash = "sha256:7de2c44c960e486f3c57e5203ea6393c6c4f0914c5f81c789ceb8b5d2ba5d1c5"},{file = "boto3-1.35.93.tar.gz", hash = "sha256:2446e819cf4e295833474cdcf2c92bc82718ce537e9ee1f17f7e3d237f60e69b"},@@ -314,6 +333,7 @@ version = "1.35.93"description = "Low-level, data-driven core of boto 3."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "botocore-1.35.93-py3-none-any.whl", hash = "sha256:47f7161000af6036f806449e3de12acdd3ec11aac7f5578e43e96241413a0f8f"},{file = "botocore-1.35.93.tar.gz", hash = "sha256:b8d245a01e7d64c41edcf75a42be158df57b9518a83a3dbf5c7e4b8c2bc540cc"},@@ -333,6 +353,7 @@ version = "2.5.post1"description = "Bash style brace expander."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "bracex-2.5.post1-py3-none-any.whl", hash = "sha256:13e5732fec27828d6af308628285ad358047cec36801598368cb28bc631dbaf6"},{file = "bracex-2.5.post1.tar.gz", hash = "sha256:12c50952415bfa773d2d9ccb8e79651b8cdb1f31a42f6091b804f6ba2b4a66b6"},@@ -344,6 +365,7 @@ version = "4.31.0"description = "Braintree Python Library"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "braintree-4.31.0-py2.py3-none-any.whl", hash = "sha256:426011f92418703809007f387c3ce13b03535ad6f67244171ff2b417369e3693"},{file = "braintree-4.31.0.tar.gz", hash = "sha256:de383469ae0f824efba7e2d726c13927090d6a9305e1c49de1cb258b2868d43d"},@@ -358,6 +380,7 @@ version = "5.5.0"description = "Extensible memoizing collections and decorators"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "cachetools-5.5.0-py3-none-any.whl", hash = "sha256:02134e8439cdc2ffb62023ce1debca2944c3f289d66bb17ead3ab3dede74b292"},{file = "cachetools-5.5.0.tar.gz", hash = "sha256:2cc24fb4cbe39633fb7badd9db9ca6295d766d9c2995f245725a46715d050f2a"},@@ -369,6 +392,7 @@ version = "5.4.0"description = "Distributed Task Queue."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "celery-5.4.0-py3-none-any.whl", hash = "sha256:369631eb580cf8c51a82721ec538684994f8277637edde2dfc0dacd73ed97f64"},{file = "celery-5.4.0.tar.gz", hash = "sha256:504a19140e8d3029d5acad88330c541d4c3f64c789d85f94756762d8bca7e706"},@@ -426,6 +450,7 @@ version = "2024.12.14"description = "Python package for providing Mozilla's CA Bundle."optional = falsepython-versions = ">=3.6"+groups = ["main", "dev"]files = [{file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"},{file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"},@@ -437,6 +462,8 @@ version = "1.17.1"description = "Foreign Function Interface for Python calling C code."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]+markers = "platform_python_implementation != \"PyPy\""files = [{file = "cffi-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:df8b1c11f177bc2313ec4b2d46baec87a5f3e71fc8b45dab2ee7cae86d9aba14"},{file = "cffi-1.17.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f2cdc858323644ab277e9bb925ad72ae0e67f69e804f4898c070998d50b1a67"},@@ -516,6 +543,7 @@ version = "3.4.0"description = "Validate configuration and produce human readable error messages."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"},{file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"},@@ -527,6 +555,7 @@ version = "3.4.1"description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."optional = falsepython-versions = ">=3.7"+groups = ["main", "dev"]files = [{file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},@@ -628,6 +657,7 @@ version = "8.1.8"description = "Composable command line interface toolkit"optional = falsepython-versions = ">=3.7"+groups = ["main", "dev"]files = [{file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"},{file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"},@@ -642,6 +672,7 @@ version = "0.3.1"description = "Enables git-like *did-you-mean* feature in click"optional = falsepython-versions = ">=3.6.2"+groups = ["main", "dev"]files = [{file = "click_didyoumean-0.3.1-py3-none-any.whl", hash = "sha256:5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c"},{file = "click_didyoumean-0.3.1.tar.gz", hash = "sha256:4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463"},@@ -656,6 +687,7 @@ version = "0.5.6"description = "Option groups missing in Click"optional = falsepython-versions = ">=3.6,<4"+groups = ["dev"]files = [{file = "click-option-group-0.5.6.tar.gz", hash = "sha256:97d06703873518cc5038509443742b25069a3c7562d1ea72ff08bfadde1ce777"},{file = "click_option_group-0.5.6-py3-none-any.whl", hash = "sha256:38a26d963ee3ad93332ddf782f9259c5bdfe405e73408d943ef5e7d0c3767ec7"},@@ -675,6 +707,7 @@ version = "1.1.1"description = "An extension module for click to enable registering CLI commands via setuptools entry-points."optional = falsepython-versions = "*"+groups = ["main", "dev"]files = [{file = "click-plugins-1.1.1.tar.gz", hash = "sha256:46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b"},{file = "click_plugins-1.1.1-py2.py3-none-any.whl", hash = "sha256:5d262006d3222f5057fd81e1623d4443e41dcda5dc815c06b442aa3c02889fc8"},@@ -692,6 +725,7 @@ version = "0.3.0"description = "REPL plugin for Click"optional = falsepython-versions = ">=3.6"+groups = ["main", "dev"]files = [{file = "click-repl-0.3.0.tar.gz", hash = "sha256:17849c23dba3d667247dc4defe1757fff98694e90fe37474f3feebb69ced26a9"},{file = "click_repl-0.3.0-py3-none-any.whl", hash = "sha256:fb7e06deb8da8de86180a33a9da97ac316751c094c6899382da7feeeeb51b812"},@@ -710,10 +744,12 @@ version = "0.4.6"description = "Cross-platform colored terminal text."optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"+groups = ["main", "dev"]files = [{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},]+markers = {main = "platform_system == \"Windows\" or sys_platform == \"win32\""}[[package]]name = "coverage"@@ -721,6 +757,7 @@ version = "7.6.10"description = "Code coverage measurement for Python"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "coverage-7.6.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5c912978f7fbf47ef99cec50c4401340436d200d41d714c7a4766f377c5b7b78"},{file = "coverage-7.6.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a01ec4af7dfeb96ff0078ad9a48810bb0cc8abcb0115180c6013a6b26237626c"},@@ -795,6 +832,7 @@ version = "1.4.5"description = "A Python library that converts cron expressions into human readable strings."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "cron_descriptor-1.4.5-py3-none-any.whl", hash = "sha256:736b3ae9d1a99bc3dbfc5b55b5e6e7c12031e7ba5de716625772f8b02dcd6013"},{file = "cron_descriptor-1.4.5.tar.gz", hash = "sha256:f51ce4ffc1d1f2816939add8524f206c376a42c87a5fca3091ce26725b3b1bca"},@@ -809,6 +847,7 @@ version = "43.0.3"description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."optional = falsepython-versions = ">=3.7"+groups = ["main", "dev"]files = [{file = "cryptography-43.0.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:bf7a1932ac4176486eab36a19ed4c0492da5d97123f1406cf15e41b05e787d2e"},{file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63efa177ff54aec6e1c0aefaa1a241232dcd37413835a9b674b6e3f0ae2bfd3e"},@@ -858,6 +897,7 @@ version = "1.8.11"description = "An implementation of the Debug Adapter Protocol for Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "debugpy-1.8.11-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:2b26fefc4e31ff85593d68b9022e35e8925714a10ab4858fb1b577a8a48cb8cd"},{file = "debugpy-1.8.11-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61bc8b3b265e6949855300e84dc93d02d7a3a637f2aec6d382afd4ceb9120c9f"},@@ -893,6 +933,7 @@ version = "0.7.1"description = "XML bomb protection for Python stdlib modules"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"+groups = ["dev"]files = [{file = "defusedxml-0.7.1-py2.py3-none-any.whl", hash = "sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61"},{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},@@ -904,6 +945,7 @@ version = "1.2.15"description = "Python @deprecated decorator to deprecate old python classes, functions or methods."optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"+groups = ["main"]files = [{file = "Deprecated-1.2.15-py2.py3-none-any.whl", hash = "sha256:353bc4a8ac4bfc96800ddab349d89c25dec1079f65fd53acdcc1e0b975b21320"},{file = "deprecated-1.2.15.tar.gz", hash = "sha256:683e561a90de76239796e6b6feac66b99030d2dd3fcf61ef996330f14bbb9b0d"},@@ -921,6 +963,7 @@ version = "0.21.2"description = "A command line utility to check for unused, missing and transitive dependencies in a Python project."optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "deptry-0.21.2-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:e3b9e0c5ee437240b65e61107b5777a12064f78f604bf9f181a96c9b56eb896d"},{file = "deptry-0.21.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:d76bbf48bd62ecc44ca3d414769bd4b7956598d23d9ccb42fd359b831a31cab2"},@@ -952,6 +995,7 @@ version = "0.3.9"description = "Distribution utilities"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"},{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},@@ -963,6 +1007,7 @@ version = "2.3.0"description = "Use Database URLs in your Django Application."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "dj_database_url-2.3.0-py3-none-any.whl", hash = "sha256:bb0d414ba0ac5cd62773ec7f86f8cc378a9dbb00a80884c2fc08cc570452521e"},{file = "dj_database_url-2.3.0.tar.gz", hash = "sha256:ae52e8e634186b57e5a45e445da5dc407a819c2ceed8a53d1fac004cc5288787"},@@ -978,6 +1023,7 @@ version = "1.0.6"description = "Use an URL to configure email backend settings in your Django Application."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "dj-email-url-1.0.6.tar.gz", hash = "sha256:55ffe3329e48f54f8a75aa36ece08f365e09d61f8a209773ef09a1d4760e699a"},{file = "dj_email_url-1.0.6-py2.py3-none-any.whl", hash = "sha256:cbd08327fbb08b104eac160fb4703f375532e4c0243eb230f5b960daee7a96db"},@@ -989,6 +1035,7 @@ version = "4.2.17"description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "Django-4.2.17-py3-none-any.whl", hash = "sha256:3a93350214ba25f178d4045c0786c61573e7dbfa3c509b3551374f1e11ba8de0"},{file = "Django-4.2.17.tar.gz", hash = "sha256:6b56d834cc94c8b21a8f4e775064896be3b4a4ca387f2612d4406a5927cd2fdc"},@@ -1010,6 +1057,7 @@ version = "1.0.6"description = "A helper class for handling configuration defaults of packaged apps gracefully."optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "django-appconf-1.0.6.tar.gz", hash = "sha256:cfe87ea827c4ee04b9a70fab90b86d704cb02f2981f89da8423cb0fabf88efbf"},{file = "django_appconf-1.0.6-py3-none-any.whl", hash = "sha256:c3ae442fba1ff7ec830412c5184b17169a7a1e71cf0864a4c3f93cf4c98a1993"},@@ -1024,6 +1072,7 @@ version = "3.4.5"description = "Use Cache URLs in your Django application."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "django-cache-url-3.4.5.tar.gz", hash = "sha256:eb9fb194717524348c95cad9905b70b647452741c1d9e481fac6d2125f0ad917"},{file = "django_cache_url-3.4.5-py2.py3-none-any.whl", hash = "sha256:5f350759978483ab85dc0e3e17b3d53eed3394a28148f6bf0f53d11d0feb5b3c"},@@ -1035,6 +1084,7 @@ version = "2.7.0"description = "Database-backed Periodic Tasks."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "django_celery_beat-2.7.0-py3-none-any.whl", hash = "sha256:851c680d8fbf608ca5fecd5836622beea89fa017bc2b3f94a5b8c648c32d84b1"},{file = "django_celery_beat-2.7.0.tar.gz", hash = "sha256:8482034925e09b698c05ad61c36ed2a8dbc436724a3fe119215193a4ca6dc967"},@@ -1054,6 +1104,7 @@ version = "7.6.1"description = "Provides a country field for Django models."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "django-countries-7.6.1.tar.gz", hash = "sha256:c772d4e3e54afcc5f97a018544e96f246c6d9f1db51898ab0c15cd57e19437cf"},{file = "django_countries-7.6.1-py3-none-any.whl", hash = "sha256:1ed20842fe0f6194f91faca21076649513846a8787c9eb5aeec3cbe1656b8acc"},@@ -1075,6 +1126,7 @@ version = "3.2.3"description = "Extensions for Django"optional = falsepython-versions = ">=3.6"+groups = ["dev"]files = [{file = "django-extensions-3.2.3.tar.gz", hash = "sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a"},{file = "django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401"},@@ -1089,6 +1141,7 @@ version = "24.3"description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "django_filter-24.3-py3-none-any.whl", hash = "sha256:c4852822928ce17fb699bcfccd644b3574f1a2d80aeb2b4ff4f16b02dd49dc64"},{file = "django_filter-24.3.tar.gz", hash = "sha256:d8ccaf6732afd21ca0542f6733b11591030fa98669f8d15599b358e24a2cd9c3"},@@ -1103,6 +1156,7 @@ version = "3.0.1"description = "script tag with additional attributes for django.forms.Media"optional = falsepython-versions = ">=3.10"+groups = ["main"]files = [{file = "django_js_asset-3.0.1-py3-none-any.whl", hash = "sha256:0b7ee73c45ca65cccbcc2f60cbe8fbc87ff133b543c282cb64fe6c13d7ca4c10"},{file = "django_js_asset-3.0.1.tar.gz", hash = "sha256:5ad51814edf38d28e6280e6ecad50ee40551363a2f6a6bfe93577dee793dc378"},@@ -1120,6 +1174,7 @@ version = "3.2.4"description = "Convenient fields and classes for handling measurements"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "django-measurement-3.2.4.tar.gz", hash = "sha256:db1279b04bacf3b48259312adaaefcfe55ca30b1e0933fa37d6c387c156834d5"},{file = "django_measurement-3.2.4-py2.py3-none-any.whl", hash = "sha256:b2d40b8b56b4e8277130a2a8cbc1f01f597589a636e0ea7dfbc4e4c05d458cef"},@@ -1136,6 +1191,7 @@ version = "0.16.0"description = "Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances."optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "django_mptt-0.16.0-py3-none-any.whl", hash = "sha256:8716849ba3318d94e2e100ed0923a05c1ffdf8195f8472b690dbaf737d2af3b5"},{file = "django_mptt-0.16.0.tar.gz", hash = "sha256:56c9606bf0b329b5f5afd55dd8bfd073612ea1d5999b10903b09de62bee84c8e"},@@ -1153,6 +1209,7 @@ version = "8.0.0"description = "An international phone number field for django models."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "django_phonenumber_field-8.0.0-py3-none-any.whl", hash = "sha256:196c917b70c01a98e327f482eb8a4a4a55a29891db551f99078585397370b3ba"},{file = "django_phonenumber_field-8.0.0.tar.gz", hash = "sha256:8a560fe1b01b94c9de8cde22bc373b695f023cc6df4baba00264cb079da9f631"},@@ -1171,6 +1228,7 @@ version = "2.3.0"description = "Django fields for the prices module"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "django-prices-2.3.0.tar.gz", hash = "sha256:dc2ba039fcdeeffbcb8ba41e46821d509af4d50cca36f527990ed319ff83fed9"},{file = "django_prices-2.3.0-py3-none-any.whl", hash = "sha256:b72ec33ac9475b8a2a8fff1414427b17fd6df58d8dfde4d257f7d58fd7251b80"},@@ -1188,6 +1246,7 @@ version = "1.14.4"description = "Support for many storage backends in Django"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "django-storages-1.14.4.tar.gz", hash = "sha256:69aca94d26e6714d14ad63f33d13619e697508ee33ede184e462ed766dc2a73f"},{file = "django_storages-1.14.4-py3-none-any.whl", hash = "sha256:d61930acb4a25e3aebebc6addaf946a3b1df31c803a6bf1af2f31c9047febaa3"},@@ -1212,6 +1271,7 @@ version = "4.2.7"description = "Mypy stubs for Django"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "django-stubs-4.2.7.tar.gz", hash = "sha256:8ccd2ff4ee5adf22b9e3b7b1a516d2e1c2191e9d94e672c35cc2bc3dd61e0f6b"},{file = "django_stubs-4.2.7-py3-none-any.whl", hash = "sha256:4cf4de258fa71adc6f2799e983091b9d46cfc67c6eebc68fe111218c9a62b3b8"},@@ -1234,6 +1294,7 @@ version = "5.1.1"description = "Monkey-patching and extensions for django-stubs"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "django_stubs_ext-5.1.1-py3-none-any.whl", hash = "sha256:3907f99e178c93323e2ce908aef8352adb8c047605161f8d9e5e7b4efb5a6a9c"},{file = "django_stubs_ext-5.1.1.tar.gz", hash = "sha256:db7364e4f50ae7e5360993dbd58a3a57ea4b2e7e5bab0fbd525ccdb3e7975d1c"},@@ -1249,6 +1310,7 @@ version = "7.0"description = "A Django app providing DB, form, and REST framework fields for zoneinfo and pytz timezone objects."optional = falsepython-versions = "<4.0,>=3.8"+groups = ["main"]files = [{file = "django_timezone_field-7.0-py3-none-any.whl", hash = "sha256:3232e7ecde66ba4464abb6f9e6b8cc739b914efb9b29dc2cf2eee451f7cc2acb"},{file = "django_timezone_field-7.0.tar.gz", hash = "sha256:aa6f4965838484317b7f08d22c0d91a53d64e7bbbd34264468ae83d4023898a7"},@@ -1263,6 +1325,7 @@ version = "7.1.0"description = "A Python library for the Docker Engine API."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "docker-7.1.0-py3-none-any.whl", hash = "sha256:c96b93b7f0a746f9e77d325bcfb87422a3d8bd4f03136ae8a85b37f1898d5fc0"},{file = "docker-7.1.0.tar.gz", hash = "sha256:ad8c70e6e3f8926cb8a92619b832b4ea5299e2831c14284663184e200546fa6c"},@@ -1285,6 +1348,7 @@ version = "1.0.0"description = "Convert basic HTML into DraftJS JSON format."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "draftjs-sanitizer-1.0.0.tar.gz", hash = "sha256:4603a9296153cd06d5a1d76a45a1ff0295363516af983d8dde28cafc5cd67583"},]@@ -1301,6 +1365,7 @@ version = "0.7.1"description = "Utilities for using Babel in Django"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "enmerkar-0.7.1-py3-none-any.whl", hash = "sha256:ba5a79e022963580c994ce8f4fe8477d574159adbe86e5271b1a3d4127b8794d"},{file = "enmerkar-0.7.1.tar.gz", hash = "sha256:a4a6c859b4ed293deee40ff61d6695b3ff7bc153770a1799f2be872181282e00"},@@ -1316,6 +1381,7 @@ version = "2.0.0"description = "An implementation of lxml.xmlfile for the standard library"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "et_xmlfile-2.0.0-py3-none-any.whl", hash = "sha256:7a91720bc756843502c3b7504c77b8fe44217c85c537d85037f0f536151b2caa"},{file = "et_xmlfile-2.0.0.tar.gz", hash = "sha256:dab3f4764309081ce75662649be815c4c9081e88f0837825f90fd28317d4da54"},@@ -1327,6 +1393,7 @@ version = "2.1.1"description = "execnet: rapid multi-Python deployment"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "execnet-2.1.1-py3-none-any.whl", hash = "sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc"},{file = "execnet-2.1.1.tar.gz", hash = "sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3"},@@ -1341,6 +1408,7 @@ version = "24.0.0"description = "A command-line application framework (and CLI parser). Friendly for users, full-featured for developers."optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "face-24.0.0-py3-none-any.whl", hash = "sha256:0e2c17b426fa4639a4e77d1de9580f74a98f4869ba4c7c8c175b810611622cd3"},{file = "face-24.0.0.tar.gz", hash = "sha256:611e29a01ac5970f0077f9c577e746d48c082588b411b33a0dd55c4d872949f6"},@@ -1355,6 +1423,7 @@ version = "26.3.0"description = "Faker is a Python package that generates fake data for you."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "Faker-26.3.0-py3-none-any.whl", hash = "sha256:97fe1e7e953dd640ca2cd4dfac4db7c4d2432dd1b7a244a3313517707f3b54e9"},{file = "Faker-26.3.0.tar.gz", hash = "sha256:7c10ebdf74aaa0cc4fe6ec6db5a71e8598ec33503524bd4b5f4494785a5670dd"},@@ -1369,6 +1438,7 @@ version = "2.26.2"description = "Python implementation of redis API, can be used for testing purposes."optional = falsepython-versions = "<4.0,>=3.7"+groups = ["dev"]files = [{file = "fakeredis-2.26.2-py3-none-any.whl", hash = "sha256:86d4129df001efc25793cb334008160fccc98425d9f94de47884a92b63988c14"},{file = "fakeredis-2.26.2.tar.gz", hash = "sha256:3ee5003a314954032b96b1365290541346c9cc24aab071b52cc983bb99ecafbf"},@@ -1391,6 +1461,7 @@ version = "3.16.1"description = "A platform independent file lock."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"},{file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"},@@ -1407,6 +1478,7 @@ version = "1.5.1"description = "Let your Python tests travel through time"optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "freezegun-1.5.1-py3-none-any.whl", hash = "sha256:bf111d7138a8abe55ab48a71755673dbaa4ab87f4cff5634a4442dfec34c15f1"},{file = "freezegun-1.5.1.tar.gz", hash = "sha256:b29dedfcda6d5e8e083ce71b2b542753ad48cfec44037b3fc79702e2980a89e9"},@@ -1421,6 +1493,7 @@ version = "22.1.0"description = "A declarative object transformer and formatter, for conglomerating nested data."optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "glom-22.1.0-py2.py3-none-any.whl", hash = "sha256:5339da206bf3532e01a83a35aca202960ea885156986d190574b779598e9e772"},{file = "glom-22.1.0.tar.gz", hash = "sha256:1510c6587a8f9c64a246641b70033cbc5ebde99f02ad245693678038e821aeb5"},@@ -1440,6 +1513,7 @@ version = "2.24.0"description = "Google API client core library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google_api_core-2.24.0-py3-none-any.whl", hash = "sha256:10d82ac0fca69c82a25b3efdeefccf6f28e02ebb97925a8cce8edbfe379929d9"},{file = "google_api_core-2.24.0.tar.gz", hash = "sha256:e255640547a597a4da010876d333208ddac417d60add22b6851a0c66a831fcaf"},@@ -1466,6 +1540,7 @@ version = "2.37.0"description = "Google Authentication Library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google_auth-2.37.0-py2.py3-none-any.whl", hash = "sha256:42664f18290a6be591be5329a96fe30184be1a1badb7292a7f686a9659de9ca0"},{file = "google_auth-2.37.0.tar.gz", hash = "sha256:0054623abf1f9c83492c63d3f47e77f0a544caa3d40b2d98e099a611c2dd5d00"},@@ -1490,6 +1565,7 @@ version = "2.4.1"description = "Google Cloud API client core library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google-cloud-core-2.4.1.tar.gz", hash = "sha256:9b7749272a812bde58fff28868d0c5e2f585b82f37e09a1f6ed2d4d10f134073"},{file = "google_cloud_core-2.4.1-py2.py3-none-any.whl", hash = "sha256:a9e6a4422b9ac5c29f79a0ede9485473338e2ce78d91f2370c01e730eab22e61"},@@ -1508,6 +1584,7 @@ version = "2.27.2"description = "Google Cloud Pub/Sub API client library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google_cloud_pubsub-2.27.2-py2.py3-none-any.whl", hash = "sha256:a919f84fdea683b0a02464e38dd32332edbcbc8e85da82070079a57791119fd6"},{file = "google_cloud_pubsub-2.27.2.tar.gz", hash = "sha256:d92c156c7ddd0e5125008f977898198d7b1ae766026056497271bec4909647fe"},@@ -1533,6 +1610,7 @@ version = "2.19.0"description = "Google Cloud Storage API client library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google_cloud_storage-2.19.0-py2.py3-none-any.whl", hash = "sha256:aeb971b5c29cf8ab98445082cbfe7b161a1f48ed275822f59ed3f1524ea54fba"},{file = "google_cloud_storage-2.19.0.tar.gz", hash = "sha256:cd05e9e7191ba6cb68934d8eb76054d9be4562aa89dbc4236feee4d7d51342b2"},@@ -1556,6 +1634,7 @@ version = "1.6.0"description = "A python wrapper of the C library 'Google CRC32C'"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "google_crc32c-1.6.0-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:5bcc90b34df28a4b38653c36bb5ada35671ad105c99cfe915fb5bed7ad6924aa"},{file = "google_crc32c-1.6.0-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:d9e9913f7bd69e093b81da4535ce27af842e7bf371cde42d1ae9e9bd382dc0e9"},@@ -1595,6 +1674,7 @@ version = "3.1.1"description = "Address validation helpers for Google's i18n address database"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "google_i18n_address-3.1.1-py2.py3-none-any.whl", hash = "sha256:f66f4fd2b75d1cd371fc0a7678a1d656da4aa3b32932279e78dd6cae776fc23d"},{file = "google_i18n_address-3.1.1.tar.gz", hash = "sha256:c9ea70e35cb312948651fbbbe4ad4ba97781e129096502fab6ed4e94f629ab0e"},@@ -1613,6 +1693,7 @@ version = "2.7.2"description = "Utilities for Google Media Downloads and Resumable Uploads"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "google_resumable_media-2.7.2-py2.py3-none-any.whl", hash = "sha256:3ce7551e9fe6d99e9a126101d2536612bb73486721951e9562fee0f90c6ababa"},{file = "google_resumable_media-2.7.2.tar.gz", hash = "sha256:5280aed4629f2b60b847b0d42f9857fd4935c11af266744df33d8074cae92fe0"},@@ -1631,6 +1712,7 @@ version = "1.66.0"description = "Common protobufs used in Google APIs"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "googleapis_common_protos-1.66.0-py2.py3-none-any.whl", hash = "sha256:d7abcd75fabb2e0ec9f74466401f6c119a0b498e27370e9be4c94cb7e382b8ed"},{file = "googleapis_common_protos-1.66.0.tar.gz", hash = "sha256:c3e7b33d15fdca5374cc0a7346dd92ffa847425cc4ea941d970f13680052ec8c"},@@ -1649,6 +1731,7 @@ version = "2.1.9"description = "GraphQL Framework for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "graphene-2.1.9-py2.py3-none-any.whl", hash = "sha256:3d446eb1237c551052bc31155cf1a3a607053e4f58c9172b83a1b597beaa0868"},{file = "graphene-2.1.9.tar.gz", hash = "sha256:b9f2850e064eebfee9a3ef4a1f8aa0742848d97652173ab44c82cc8a62b9ed93"},@@ -1671,6 +1754,7 @@ version = "2.3.2"description = "GraphQL implementation for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "graphql-core-2.3.2.tar.gz", hash = "sha256:aac46a9ac524c9855910c14c48fc5d60474def7f99fd10245e76608eba7af746"},{file = "graphql_core-2.3.2-py2.py3-none-any.whl", hash = "sha256:44c9bac4514e5e30c5a595fac8e3c76c1975cae14db215e8174c7fe995825bad"},@@ -1691,6 +1775,7 @@ version = "2.0.1"description = "Relay implementation for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "graphql-relay-2.0.1.tar.gz", hash = "sha256:870b6b5304123a38a0b215a79eace021acce5a466bf40cd39fa18cb8528afabb"},{file = "graphql_relay-2.0.1-py3-none-any.whl", hash = "sha256:ac514cb86db9a43014d7e73511d521137ac12cf0101b2eaa5f0a3da2e10d913d"},@@ -1707,6 +1792,7 @@ version = "0.14.0"description = "IAM API client library"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "grpc_google_iam_v1-0.14.0-py2.py3-none-any.whl", hash = "sha256:fb4a084b30099ba3ab07d61d620a0d4429570b13ff53bd37bac75235f98b7da4"},{file = "grpc_google_iam_v1-0.14.0.tar.gz", hash = "sha256:c66e07aa642e39bb37950f9e7f491f70dad150ac9801263b42b2814307c2df99"},@@ -1723,6 +1809,7 @@ version = "1.69.0"description = "HTTP/2-based RPC framework"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "grpcio-1.69.0-cp310-cp310-linux_armv7l.whl", hash = "sha256:2060ca95a8db295ae828d0fc1c7f38fb26ccd5edf9aa51a0f44251f5da332e97"},{file = "grpcio-1.69.0-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:2e52e107261fd8fa8fa457fe44bfadb904ae869d87c1280bf60f93ecd3e79278"},@@ -1790,6 +1877,7 @@ version = "1.69.0"description = "Status proto mapping for gRPC"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "grpcio_status-1.69.0-py3-none-any.whl", hash = "sha256:d6b2a3c9562c03a817c628d7ba9a925e209c228762d6d7677ae5c9401a542853"},{file = "grpcio_status-1.69.0.tar.gz", hash = "sha256:595ef84e5178d6281caa732ccf68ff83259241608d26b0e9c40a5e66eee2a2d2"},@@ -1806,6 +1894,7 @@ version = "22.0.0"description = "WSGI HTTP Server for UNIX"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "gunicorn-22.0.0-py3-none-any.whl", hash = "sha256:350679f91b24062c86e386e198a15438d53a7a8207235a78ba1b53df4c4378d9"},{file = "gunicorn-22.0.0.tar.gz", hash = "sha256:4a0b436239ff76fb33f11c07a16482c521a7e09c1ce3cc293c2330afe01bec63"},@@ -1827,6 +1916,7 @@ version = "0.14.0"description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},@@ -1838,6 +1928,7 @@ version = "1.0.1"description = "Convert basic HTML into DraftJS JSON format."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "html-to-draftjs-1.0.1.tar.gz", hash = "sha256:2212acf3b063c17b6dc91875f474159e1f730c1a4e5fbf74f9a66250f7040e9a"},]@@ -1855,6 +1946,7 @@ version = "0.6.4"description = "A collection of framework independent HTTP protocol utils."optional = falsepython-versions = ">=3.8.0"+groups = ["main"]files = [{file = "httptools-0.6.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3c73ce323711a6ffb0d247dcd5a550b8babf0f757e86a52558fe5b86d6fefcc0"},{file = "httptools-0.6.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:345c288418f0944a6fe67be8e6afa9262b18c7626c3ef3c28adc5eabc06a68da"},@@ -1910,6 +2002,7 @@ version = "2.6.5"description = "File identification library for Python"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "identify-2.6.5-py2.py3-none-any.whl", hash = "sha256:14181a47091eb75b337af4c23078c9d09225cd4c48929f521f3bf16b09d02566"},{file = "identify-2.6.5.tar.gz", hash = "sha256:c10b33f250e5bba374fae86fb57f3adcebf1161bce7cdf92031915fd480c13bc"},@@ -1924,6 +2017,7 @@ version = "3.10"description = "Internationalized Domain Names in Applications (IDNA)"optional = falsepython-versions = ">=3.6"+groups = ["main", "dev"]files = [{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},@@ -1938,6 +2032,7 @@ version = "8.5.0"description = "Read metadata from Python packages"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "importlib_metadata-8.5.0-py3-none-any.whl", hash = "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b"},{file = "importlib_metadata-8.5.0.tar.gz", hash = "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7"},@@ -1961,6 +2056,7 @@ version = "2.0.0"description = "brain-dead simple config-ini parsing"optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},@@ -1972,6 +2068,7 @@ version = "0.7.2"description = "An ISO 8601 date/time/duration parser and formatter"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "isodate-0.7.2-py3-none-any.whl", hash = "sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15"},{file = "isodate-0.7.2.tar.gz", hash = "sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6"},@@ -1983,6 +2080,7 @@ version = "4.8.0"description = "Jaeger Python OpenTracing Tracer implementation"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "jaeger-client-4.8.0.tar.gz", hash = "sha256:3157836edab8e2c209bd2d6ae61113db36f7ee399e66b1dcbb715d87ab49bfe0"},]@@ -2002,6 +2100,7 @@ version = "3.1.5"description = "A very fast and expressive template engine."optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "jinja2-3.1.5-py3-none-any.whl", hash = "sha256:aba0f4dc9ed8013c424088f68a5c226f7d6097ed89b246d7749c2ec4175c6adb"},{file = "jinja2-3.1.5.tar.gz", hash = "sha256:8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb"},@@ -2019,6 +2118,7 @@ version = "1.0.1"description = "JSON Matching Expressions"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980"},{file = "jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"},@@ -2030,6 +2130,7 @@ version = "4.23.0"description = "An implementation of JSON Schema validation for Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "jsonschema-4.23.0-py3-none-any.whl", hash = "sha256:fbadb6f8b144a8f8cf9f0b89ba94501d143e50411a1278633f56a7acf7fd5566"},{file = "jsonschema-4.23.0.tar.gz", hash = "sha256:d71497fef26351a33265337fa77ffeb82423f3ea21283cd9467bb03999266bc4"},@@ -2051,6 +2152,7 @@ version = "2024.10.1"description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "jsonschema_specifications-2024.10.1-py3-none-any.whl", hash = "sha256:a09a0680616357d9a0ecf05c12ad234479f549239d0f5b55f3deea67475da9bf"},{file = "jsonschema_specifications-2024.10.1.tar.gz", hash = "sha256:0f38b83639958ce1152d02a7f062902c41c8fd20d558b0c34344292d417ae272"},@@ -2065,6 +2167,7 @@ version = "5.4.2"description = "Messaging library for Python."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "kombu-5.4.2-py3-none-any.whl", hash = "sha256:14212f5ccf022fc0a70453bb025a1dcc32782a588c49ea866884047d66e14763"},{file = "kombu-5.4.2.tar.gz", hash = "sha256:eef572dd2fd9fc614b37580e3caeafdd5af46c1eff31e7fba89138cdb406f2cf"},@@ -2098,6 +2201,7 @@ version = "2.0.3"description = "Links recognition library with FULL unicode support."optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "linkify-it-py-2.0.3.tar.gz", hash = "sha256:68cda27e162e9215c17d786649d1da0021a451bdc436ef9e0fa0ba5234b9b048"},{file = "linkify_it_py-2.0.3-py3-none-any.whl", hash = "sha256:6bcbc417b0ac14323382aef5c5192c0075bf8a9d6b41820a2b66371eac6b6d79"},@@ -2118,6 +2222,7 @@ version = "4.9.4"description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*"+groups = ["main"]files = [{file = "lxml-4.9.4-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e214025e23db238805a600f1f37bf9f9a15413c7bf5f9d6ae194f84980c78722"},{file = "lxml-4.9.4-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:ec53a09aee61d45e7dbe7e91252ff0491b6b5fee3d85b2d45b173d8ab453efc1"},@@ -2226,6 +2331,7 @@ version = "3.7"description = "Python implementation of John Gruber's Markdown."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803"},{file = "markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2"},@@ -2241,6 +2347,7 @@ version = "3.0.0"description = "Python port of markdown-it. Markdown parsing, done right!"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"},{file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"},@@ -2267,6 +2374,7 @@ version = "3.0.2"description = "Safely add untrusted strings to HTML/XML markup."optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"},{file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"},@@ -2337,6 +2445,7 @@ version = "0.4.2"description = "Collection of plugins for markdown-it-py"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "mdit_py_plugins-0.4.2-py3-none-any.whl", hash = "sha256:0c673c3f889399a33b95e88d2f0d111b4447bdfea7f237dab2d488f459835636"},{file = "mdit_py_plugins-0.4.2.tar.gz", hash = "sha256:5f2cd1fdb606ddf152d37ec30e46101a60512bc0e5fa1a7002c36647b09e26b5"},@@ -2356,6 +2465,7 @@ version = "0.1.2"description = "Markdown URL utilities"optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},@@ -2367,6 +2477,7 @@ version = "3.2.2"description = "Easily use and manipulate unit-aware measurements in Python."optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "measurement-3.2.2-py3-none-any.whl", hash = "sha256:9e51ed130bd077f3bfe563959e1b1d7d5f2f4a51055c94625418db47464ffd78"},{file = "measurement-3.2.2.tar.gz", hash = "sha256:a16fe5a8bd72f3682285e87a0abe880d647bcf6e3bf9cc727eeb261d6163c07e"},@@ -2385,6 +2496,7 @@ version = "1.15.0"description = "A memory profiler for Python applications"optional = falsepython-versions = ">=3.7.0"+groups = ["dev"]files = [{file = "memray-1.15.0-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:9b623c0c651d611dd068236566a8a202250e3d59307c3a3f241acc47835e73eb"},{file = "memray-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:74765f92887b7eed152e3b9f14c147c43bf0247417b18c7ea0dec173cd01633c"},@@ -2449,6 +2561,7 @@ version = "0.5.6"description = "a small library for extracting rich content from urls"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "micawber-0.5.6.tar.gz", hash = "sha256:20dc4e074c17a741880b489cf2558845c050987f5b796c8ff07ea2ff011a8c8d"},]@@ -2459,6 +2572,7 @@ version = "1.3.0"description = "Python library for arbitrary-precision floating-point arithmetic"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c"},{file = "mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f"},@@ -2476,6 +2590,7 @@ version = "6.1.0"description = "multidict implementation"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "multidict-6.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3380252550e372e8511d49481bd836264c009adb826b23fefcc5dd3c69692f60"},{file = "multidict-6.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:99f826cbf970077383d7de805c0681799491cb939c25450b9b5b3ced03ca99f1"},@@ -2577,6 +2692,7 @@ version = "1.7.1"description = "Optional static typing for Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "mypy-1.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:12cce78e329838d70a204293e7b29af9faa3ab14899aec397798a4b41be7f340"},{file = "mypy-1.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1484b8fa2c10adf4474f016e09d7a159602f3239075c7bf9f1627f5acf40ad49"},@@ -2623,6 +2739,7 @@ version = "1.0.0"description = "Type system extensions for programs checked with the mypy type checker."optional = falsepython-versions = ">=3.5"+groups = ["dev"]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"},@@ -2634,6 +2751,7 @@ version = "1.9.1"description = "Node.js virtual environment builder"optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"+groups = ["dev"]files = [{file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"},{file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"},@@ -2645,6 +2763,7 @@ version = "3.2.2"description = "A generic, spec-compliant, thorough implementation of the OAuth request-signing logic"optional = falsepython-versions = ">=3.6"+groups = ["main"]files = [{file = "oauthlib-3.2.2-py3-none-any.whl", hash = "sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca"},{file = "oauthlib-3.2.2.tar.gz", hash = "sha256:9859c40929662bec5d64f34d01c99e093149682a3f38915dc0655d5a633dd918"},@@ -2661,6 +2780,7 @@ version = "3.1.5"description = "A Python library to read/write Excel 2010 xlsx/xlsm files"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "openpyxl-3.1.5-py2.py3-none-any.whl", hash = "sha256:5282c12b107bffeef825f4617dc029afaf41d0ea60823bbb665ef3079dc79de2"},{file = "openpyxl-3.1.5.tar.gz", hash = "sha256:cf0e3cf56142039133628b5acffe8ef0c12bc902d2aadd3e0fe5878dc08d1050"},@@ -2675,6 +2795,7 @@ version = "1.29.0"description = "OpenTelemetry Python API"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "opentelemetry_api-1.29.0-py3-none-any.whl", hash = "sha256:5fcd94c4141cc49c736271f3e1efb777bebe9cc535759c54c936cca4f1b312b8"},{file = "opentelemetry_api-1.29.0.tar.gz", hash = "sha256:d04a6cf78aad09614f52964ecb38021e248f5714dc32c2e0d8fd99517b4d69cf"},@@ -2690,6 +2811,7 @@ version = "1.29.0"description = "OpenTelemetry Python SDK"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "opentelemetry_sdk-1.29.0-py3-none-any.whl", hash = "sha256:173be3b5d3f8f7d671f20ea37056710217959e774e2749d984355d1f9391a30a"},{file = "opentelemetry_sdk-1.29.0.tar.gz", hash = "sha256:b0787ce6aade6ab84315302e72bd7a7f2f014b0fb1b7c3295b88afe014ed0643"},@@ -2706,6 +2828,7 @@ version = "0.50b0"description = "OpenTelemetry Semantic Conventions"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "opentelemetry_semantic_conventions-0.50b0-py3-none-any.whl", hash = "sha256:e87efba8fdb67fb38113efea6a349531e75ed7ffc01562f65b802fcecb5e115e"},{file = "opentelemetry_semantic_conventions-0.50b0.tar.gz", hash = "sha256:02dc6dbcb62f082de9b877ff19a3f1ffaa3c306300fa53bfac761c4567c83d38"},@@ -2721,6 +2844,7 @@ version = "2.4.0"description = "OpenTracing API for Python. See documentation at http://opentracing.io"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "opentracing-2.4.0.tar.gz", hash = "sha256:a173117e6ef580d55874734d1fa7ecb6f3655160b8b8974a2a1e98e5ec9c840d"},]@@ -2734,6 +2858,7 @@ version = "24.2"description = "Core utilities for Python packages"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},{file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},@@ -2745,6 +2870,7 @@ version = "3.17.8"description = "a little orm"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "peewee-3.17.8.tar.gz", hash = "sha256:ce1d05db3438830b989a1b9d0d0aa4e7f6134d5f6fd57686eeaa26a3e6485a8c"},]@@ -2755,6 +2881,7 @@ version = "1.7.15"description = "A Python package for extracting, transforming and loading tables of data."optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"+groups = ["main"]files = [{file = "petl-1.7.15.tar.gz", hash = "sha256:8e31438380ad51552539865ad3b1ab655de1b531bd03980c871ec2cff4a8c414"},]@@ -2781,6 +2908,7 @@ version = "8.13.52"description = "Python version of Google's common library for parsing, formatting, storing and validating international phone numbers."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "phonenumberslite-8.13.52-py2.py3-none-any.whl", hash = "sha256:02da5e78c67b213bae95afd6289f40486c93e302e518769911dfa5e7287ddeee"},{file = "phonenumberslite-8.13.52.tar.gz", hash = "sha256:dfa44a4bae2e46d737ae5301cb96b14cdcbf45063236c74c6ddb08f5fd471b0d"},@@ -2792,6 +2920,7 @@ version = "11.1.0"description = "Python Imaging Library (Fork)"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "pillow-11.1.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:e1abe69aca89514737465752b4bcaf8016de61b3be1397a8fc260ba33321b3a8"},{file = "pillow-11.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c640e5a06869c75994624551f45e5506e4256562ead981cce820d5ab39ae2192"},@@ -2880,6 +3009,7 @@ version = "1.4.6"description = "A pillow plugin that adds avif support via libavif"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "pillow-avif-plugin-1.4.6.tar.gz", hash = "sha256:855cf50d03f6fc16e1fd5e364b3cea0b79f4bf90d39ff2123969735d851e08ba"},{file = "pillow_avif_plugin-1.4.6-cp27-cp27m-macosx_10_10_x86_64.whl", hash = "sha256:07372b7740439cc26346d8e3995de1fd5c49a92ab307321b74b3e6305a7e0e49"},@@ -2927,6 +3057,7 @@ version = "4.3.6"description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},@@ -2943,6 +3074,7 @@ version = "1.5.0"description = "plugin and hook calling mechanisms for python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},{file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},@@ -2958,6 +3090,7 @@ version = "2025.1.0"description = "Japanese Postal Code Data"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "posuto-2025.1.0-py3-none-any.whl", hash = "sha256:bec87a6d5444702594a7675bd068b290252e5107e5e33391455ac06f64d5f86c"},{file = "posuto-2025.1.0.tar.gz", hash = "sha256:64fbf77dd8f363b757a9523d58d2407df53ae0371892130de3162f381e991bb8"},@@ -2969,6 +3102,7 @@ version = "4.0.1"description = "A framework for managing and maintaining multi-language pre-commit hooks."optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"},{file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"},@@ -2987,6 +3121,7 @@ version = "1.1.1"description = "Python price handling for humans"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "prices-1.1.1-py3-none-any.whl", hash = "sha256:75975b59a5ec1014e3cea5599e13313a24fa858149047353e30efd55dfe04b5c"},{file = "prices-1.1.1.tar.gz", hash = "sha256:53bf5d7b5991cf9fde6a4d10e0551b4658584c46c40a9fd18a65646b1040d12f"},@@ -3001,6 +3136,7 @@ version = "2.3"description = "Promises/A+ implementation for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "promise-2.3.tar.gz", hash = "sha256:dfd18337c523ba4b6a58801c164c1904a9d4d1b1747c7d5dbf45b693a49d93d0"},]@@ -3017,6 +3153,7 @@ version = "3.0.48"description = "Library for building powerful interactive command lines in Python"optional = falsepython-versions = ">=3.7.0"+groups = ["main", "dev"]files = [{file = "prompt_toolkit-3.0.48-py3-none-any.whl", hash = "sha256:f49a827f90062e411f1ce1f854f2aedb3c23353244f8108b89283587397ac10e"},{file = "prompt_toolkit-3.0.48.tar.gz", hash = "sha256:d6623ab0477a80df74e646bdbc93621143f5caf104206aa29294d53de1a03d90"},@@ -3031,6 +3168,7 @@ version = "0.2.1"description = "Accelerated property cache"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "propcache-0.2.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6b3f39a85d671436ee3d12c017f8fdea38509e4f25b28eb25877293c98c243f6"},{file = "propcache-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:39d51fbe4285d5db5d92a929e3e21536ea3dd43732c5b177c7ef03f918dff9f2"},@@ -3122,6 +3260,7 @@ version = "1.25.0"description = "Beautiful, Pythonic protocol buffers."optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "proto_plus-1.25.0-py3-none-any.whl", hash = "sha256:c91fc4a65074ade8e458e95ef8bac34d4008daa7cce4a12d6707066fca648961"},{file = "proto_plus-1.25.0.tar.gz", hash = "sha256:fbb17f57f7bd05a68b7707e745e26528b0b3c34e378db91eef93912c54982d91"},@@ -3139,6 +3278,7 @@ version = "5.29.2"description = ""optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "protobuf-5.29.2-cp310-abi3-win32.whl", hash = "sha256:c12ba8249f5624300cf51c3d0bfe5be71a60c63e4dcf51ffe9a68771d958c851"},{file = "protobuf-5.29.2-cp310-abi3-win_amd64.whl", hash = "sha256:842de6d9241134a973aab719ab42b008a18a90f9f07f06ba480df268f86432f9"},@@ -3159,6 +3299,7 @@ version = "6.1.1"description = "Cross-platform lib for process and system monitoring in Python."optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"+groups = ["dev"]files = [{file = "psutil-6.1.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:9ccc4316f24409159897799b83004cb1e24f9819b0dcf9c0b68bdcb6cefee6a8"},{file = "psutil-6.1.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:ca9609c77ea3b8481ab005da74ed894035936223422dc591d6772b147421f777"},@@ -3189,6 +3330,7 @@ version = "3.2.3"description = "PostgreSQL database adapter for Python"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "psycopg-3.2.3-py3-none-any.whl", hash = "sha256:644d3973fe26908c73d4be746074f6e5224b03c1101d302d9a53bf565ad64907"},{file = "psycopg-3.2.3.tar.gz", hash = "sha256:a5764f67c27bec8bfac85764d23c534af2c27b893550377e37ce59c12aac47a2"},@@ -3213,6 +3355,8 @@ version = "3.2.3"description = "PostgreSQL database adapter for Python -- C optimisation distribution"optional = falsepython-versions = ">=3.8"+groups = ["main"]+markers = "implementation_name != \"pypy\""files = [{file = "psycopg_binary-3.2.3-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:965455eac8547f32b3181d5ec9ad8b9be500c10fe06193543efaaebe3e4ce70c"},{file = "psycopg_binary-3.2.3-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:71adcc8bc80a65b776510bc39992edf942ace35b153ed7a9c6c573a6849ce308"},@@ -3286,6 +3430,7 @@ version = "0.6.1"description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "pyasn1-0.6.1-py3-none-any.whl", hash = "sha256:0d632f46f2ba09143da3a8afe9e33fb6f92fa2320ab7e886e2d0f7672af84629"},{file = "pyasn1-0.6.1.tar.gz", hash = "sha256:6f580d2bdd84365380830acf45550f2511469f673cb4a5ae3857a3170128b034"},@@ -3297,6 +3442,7 @@ version = "0.4.1"description = "A collection of ASN.1-based protocols modules"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "pyasn1_modules-0.4.1-py3-none-any.whl", hash = "sha256:49bfa96b45a292b711e986f222502c1c9a5e1f4e568fc30e2574a6c7d07838fd"},{file = "pyasn1_modules-0.4.1.tar.gz", hash = "sha256:c28e2dbf9c06ad61c71a075c7e0f9fd0f1b0bb2d2ad4377f240d33ac2ab60a7c"},@@ -3311,6 +3457,7 @@ version = "0.9.7"description = "Handlebars.js templating for Python 3 and 2"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "pybars3-0.9.7.tar.gz", hash = "sha256:6ac847e905e53b9c5b936af112c910475e27bf767f79f4528c16f9af1ec0e252"},]@@ -3324,6 +3471,8 @@ version = "2.22"description = "C parser in Python"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]+markers = "platform_python_implementation != \"PyPy\""files = [{file = "pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc"},{file = "pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"},@@ -3335,6 +3484,7 @@ version = "2.19.1"description = "Pygments is a syntax highlighting package written in Python."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},{file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},@@ -3349,6 +3499,7 @@ version = "2.10.1"description = "JSON Web Token implementation in Python"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "PyJWT-2.10.1-py3-none-any.whl", hash = "sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb"},{file = "pyjwt-2.10.1.tar.gz", hash = "sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953"},@@ -3366,6 +3517,7 @@ version = "0.5.1"description = "Pattern-matching language based on OMeta for Python 3 and 2"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "PyMeta3-0.5.1.tar.gz", hash = "sha256:18bda326d9a9bbf587bfc0ee0bc96864964d78b067288bcf55d4d98681d05bcb"},]@@ -3376,6 +3528,7 @@ version = "8.3.4"description = "pytest: simple powerful testing with Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"},{file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"},@@ -3396,6 +3549,7 @@ version = "0.25.1"description = "Pytest support for asyncio"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "pytest_asyncio-0.25.1-py3-none-any.whl", hash = "sha256:c84878849ec63ff2ca509423616e071ef9cd8cc93c053aa33b5b8fb70a990671"},{file = "pytest_asyncio-0.25.1.tar.gz", hash = "sha256:79be8a72384b0c917677e00daa711e07db15259f4d23203c59012bcd989d4aee"},@@ -3414,6 +3568,7 @@ version = "1.1.3"description = "Pytest plugin for Celery"optional = falsepython-versions = "<4.0,>=3.8"+groups = ["dev"]files = [{file = "pytest_celery-1.1.3-py3-none-any.whl", hash = "sha256:4cdb5f658dc472509e8be71f745d26bcb8246397661534f5709d2a55edc43286"},{file = "pytest_celery-1.1.3.tar.gz", hash = "sha256:ac7eee546b4d9fb5c742eaaece98187f1f5e5f5622fbaa8e7729bb46923c54fc"},@@ -3440,6 +3595,7 @@ version = "6.0.0"description = "Pytest plugin for measuring coverage."optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0"},{file = "pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35"},@@ -3458,6 +3614,7 @@ version = "4.9.0"description = "A Django plugin for pytest."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pytest_django-4.9.0-py3-none-any.whl", hash = "sha256:1d83692cb39188682dbb419ff0393867e9904094a549a7d38a3154d5731b2b99"},{file = "pytest_django-4.9.0.tar.gz", hash = "sha256:8bf7bc358c9ae6f6fc51b6cebb190fe20212196e6807121f11bd6a3b03428314"},@@ -3476,6 +3633,7 @@ version = "1.2.0"description = "Generate performance reports from your django database performance tests."optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "pytest-django-queries-1.2.0.tar.gz", hash = "sha256:7d683d06af711c4f3ac049b3a7035070ce3888a3575ce8ae4b8a41b7b7869f1c"},]@@ -3498,6 +3656,7 @@ version = "3.1.3"description = "Docker integration tests for pytest"optional = falsepython-versions = ">=3.7.0,<4.0.0"+groups = ["dev"]files = [{file = "pytest_docker_tools-3.1.3-py3-none-any.whl", hash = "sha256:63e659043160f41d89f94ea42616102594bcc85682aac394fcbc14f14cd1b189"},{file = "pytest_docker_tools-3.1.3.tar.gz", hash = "sha256:c7e28841839d67b3ac80ad7b345b953701d5ae61ffda97586114244292aeacc0"},@@ -3513,6 +3672,7 @@ version = "1.7.0"description = "A simple plugin to use with pytest"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pytest_memray-1.7.0-py3-none-any.whl", hash = "sha256:b896718c1adf6d0cd339dfaaaa5620f035c9919e1199a79b3453804a1254306f"},{file = "pytest_memray-1.7.0.tar.gz", hash = "sha256:c18fa907d2210b42f4096c093e2d3416dfc002dcaa450ef3f9ba819bc3dd8f5f"},@@ -3533,6 +3693,7 @@ version = "3.14.0"description = "Thin-wrapper around the mock package for easier use with pytest"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pytest-mock-3.14.0.tar.gz", hash = "sha256:2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0"},{file = "pytest_mock-3.14.0-py3-none-any.whl", hash = "sha256:0b72c38033392a5f4621342fe11e9219ac11ec9d375f8e2a0c164539e0d70f6f"},@@ -3550,6 +3711,7 @@ version = "0.13.2"description = "A pytest plugin that allows you recording of network interactions via VCR.py"optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "pytest_recording-0.13.2-py3-none-any.whl", hash = "sha256:3820fe5743d1ac46e807989e11d073cb776a60bdc544cf43ebca454051b22d13"},{file = "pytest_recording-0.13.2.tar.gz", hash = "sha256:000c3babbb466681457fd65b723427c1779a0c6c17d9e381c3142a701e124877"},@@ -3569,6 +3731,7 @@ version = "0.7.0"description = "Pytest Plugin to disable socket calls during tests"optional = falsepython-versions = ">=3.8,<4.0"+groups = ["dev"]files = [{file = "pytest_socket-0.7.0-py3-none-any.whl", hash = "sha256:7e0f4642177d55d317bbd58fc68c6bd9048d6eadb2d46a89307fa9221336ce45"},{file = "pytest_socket-0.7.0.tar.gz", hash = "sha256:71ab048cbbcb085c15a4423b73b619a8b35d6a307f46f78ea46be51b1b7e11b3"},@@ -3583,6 +3746,7 @@ version = "3.6.1"description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"},{file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"},@@ -3603,6 +3767,7 @@ version = "3.2.0"description = "Python Crontab API"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "python_crontab-3.2.0-py3-none-any.whl", hash = "sha256:82cb9b6a312d41ff66fd3caf3eed7115c28c195bfb50711bc2b4b9592feb9fe5"},{file = "python_crontab-3.2.0.tar.gz", hash = "sha256:40067d1dd39ade3460b2ad8557c7651514cd3851deffff61c5c60e1227c5c36b"},@@ -3621,6 +3786,7 @@ version = "2.9.0.post0"description = "Extensions to the standard Python datetime module"optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"+groups = ["main", "dev"]files = [{file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"},{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},@@ -3635,6 +3801,7 @@ version = "1.0.1"description = "Read key-value pairs from a .env file and set them as environment variables"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"},{file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"},@@ -3649,6 +3816,7 @@ version = "3.3.7"description = "HTTP REST client, simplified for Python"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"+groups = ["main"]files = [{file = "python_http_client-3.3.7-py3-none-any.whl", hash = "sha256:ad371d2bbedc6ea15c26179c6222a78bc9308d272435ddf1d5c84f068f249a36"},{file = "python_http_client-3.3.7.tar.gz", hash = "sha256:bf841ee45262747e00dec7ee9971dfb8c7d83083f5713596488d67739170cea0"},@@ -3660,6 +3828,7 @@ version = "3.2.1"description = "JSON Log Formatter for the Python Logging Package"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "python_json_logger-3.2.1-py3-none-any.whl", hash = "sha256:cdc17047eb5374bd311e748b42f99d71223f3b0e186f4206cc5d52aefe85b090"},{file = "python_json_logger-3.2.1.tar.gz", hash = "sha256:8eb0554ea17cb75b05d2848bc14fb02fbdbd9d6972120781b974380bfa162008"},@@ -3674,6 +3843,8 @@ version = "0.4.27"description = "File type identification using libmagic"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"+groups = ["main"]+markers = "sys_platform != \"win32\""files = [{file = "python-magic-0.4.27.tar.gz", hash = "sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b"},{file = "python_magic-0.4.27-py2.py3-none-any.whl", hash = "sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3"},@@ -3685,6 +3856,8 @@ version = "0.4.14"description = "File type identification using libmagic binary package"optional = falsepython-versions = "*"+groups = ["main"]+markers = "sys_platform == \"win32\""files = [{file = "python_magic_bin-0.4.14-py2.py3-none-macosx_10_6_intel.whl", hash = "sha256:7b1743b3dbf16601d6eedf4e7c2c9a637901b0faaf24ad4df4d4527e7d8f66a4"},{file = "python_magic_bin-0.4.14-py2.py3-none-win32.whl", hash = "sha256:34a788c03adde7608028203e2dbb208f1f62225ad91518787ae26d603ae68892"},@@ -3697,6 +3870,7 @@ version = "1.1.8"description = "Time expression parser"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "pytimeparse-1.1.8-py2.py3-none-any.whl", hash = "sha256:04b7be6cc8bd9f5647a6325444926c3ac34ee6bc7e69da4367ba282f076036bd"},{file = "pytimeparse-1.1.8.tar.gz", hash = "sha256:e86136477be924d7e670646a98561957e8ca7308d44841e21f5ddea757556a0a"},@@ -3708,6 +3882,7 @@ version = "2.0.0"description = "Watchman client for Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "pywatchman-2.0.0-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:a8b531a9276c1dc8897510824cbb3290e4a5775793889758020593aedb97015b"},{file = "pywatchman-2.0.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:44217f0a38f40e64f975bd13eed91c73a076c0fb7e9e9908b96917389f53371e"},@@ -3723,6 +3898,8 @@ version = "308"description = "Python for Window Extensions"optional = falsepython-versions = "*"+groups = ["dev"]+markers = "sys_platform == \"win32\""files = [{file = "pywin32-308-cp310-cp310-win32.whl", hash = "sha256:796ff4426437896550d2981b9c2ac0ffd75238ad9ea2d3bfa67a1abd546d262e"},{file = "pywin32-308-cp310-cp310-win_amd64.whl", hash = "sha256:4fc888c59b3c0bef905ce7eb7e2106a07712015ea1c8234b703a088d46110e8e"},@@ -3750,6 +3927,7 @@ version = "1.2.6.2"description = "PyXB-X (\"pixbix\") is a pure Python package that generates Python source code for classes that correspond to data structures defined by XMLSchema."optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "PyXB-X-1.2.6.2.tar.gz", hash = "sha256:3bebab03b5020bd31be4f5e8439f44600b3ba10e45580d01d631029c3c531c9e"},{file = "PyXB_X-1.2.6.2-py3-none-any.whl", hash = "sha256:7d130e824c9e08acc3d43a0b454a48613588b27cee09d9f34d947081a92691e2"},@@ -3761,6 +3939,7 @@ version = "6.0.2"description = "YAML parser and emitter for Python"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"},{file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"},@@ -3823,6 +4002,7 @@ version = "1.4.2"description = "Razorpay Python Client"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "razorpay-1.4.2-py3-none-any.whl", hash = "sha256:aaf525baebc5001e5c54ae317a372c3c17c81314cedcbbf71aa0a2d3419a9757"},{file = "razorpay-1.4.2.tar.gz", hash = "sha256:0d812030ba29e776e66d1ceaacc31635810fde18b66ff2591e582eb651bb5131"},@@ -3837,6 +4017,7 @@ version = "5.2.1"description = "Python client for Redis database and key-value store"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "redis-5.2.1-py3-none-any.whl", hash = "sha256:ee7e1056b9aea0f04c6c2ed59452947f34c4940ee025f5dd83e6a6418b6989e4"},{file = "redis-5.2.1.tar.gz", hash = "sha256:16f2e22dff21d5125e8481515e386711a34cbec50f0e44413dd7d9c060a54e0f"},@@ -3852,6 +4033,7 @@ version = "0.35.1"description = "JSON Referencing + Python"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "referencing-0.35.1-py3-none-any.whl", hash = "sha256:eda6d3234d62814d1c64e305c1331c9a3a6132da475ab6382eaa997b21ee75de"},{file = "referencing-0.35.1.tar.gz", hash = "sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c"},@@ -3867,6 +4049,7 @@ version = "2.32.3"description = "Python HTTP for Humans."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},{file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},@@ -3888,6 +4071,7 @@ version = "1.0.0"description = "A library that overrides the default behaviors of the requests library, and adds new security features."optional = falsepython-versions = "<4.0,>=3.9"+groups = ["main"]files = [{file = "requests_hardened-1.0.0.tar.gz", hash = "sha256:28af548131883526e9c3047f86e56526d545140befa91be8bd678c5490cc9d79"},]@@ -3901,6 +4085,7 @@ version = "0.11.0"description = "This is a small Python module for parsing Pip requirement files."optional = falsepython-versions = "<4.0,>=3.8"+groups = ["dev"]files = [{file = "requirements_parser-0.11.0-py3-none-any.whl", hash = "sha256:50379eb50311834386c2568263ae5225d7b9d0867fb55cf4ecc93959de2c2684"},{file = "requirements_parser-0.11.0.tar.gz", hash = "sha256:35f36dc969d14830bf459803da84f314dc3d17c802592e9e970f63d0359e5920"},@@ -3916,6 +4101,7 @@ version = "13.9.4"description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"optional = falsepython-versions = ">=3.8.0"+groups = ["dev"]files = [{file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"},{file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"},@@ -3934,6 +4120,7 @@ version = "0.22.3"description = "Python bindings to Rust's persistent data structures (rpds)"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "rpds_py-0.22.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:6c7b99ca52c2c1752b544e310101b98a659b720b21db00e65edca34483259967"},{file = "rpds_py-0.22.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:be2eb3f2495ba669d2a985f9b426c1797b7d48d6963899276d22f23e33d47e37"},@@ -4046,6 +4233,7 @@ version = "4.9"description = "Pure-Python RSA implementation"optional = falsepython-versions = ">=3.6,<4"+groups = ["main"]files = [{file = "rsa-4.9-py3-none-any.whl", hash = "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7"},{file = "rsa-4.9.tar.gz", hash = "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21"},@@ -4060,6 +4248,7 @@ version = "0.17.40"description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order"optional = falsepython-versions = ">=3"+groups = ["dev"]files = [{file = "ruamel.yaml-0.17.40-py3-none-any.whl", hash = "sha256:b16b6c3816dff0a93dca12acf5e70afd089fa5acb80604afd1ffa8b465b7722c"},{file = "ruamel.yaml-0.17.40.tar.gz", hash = "sha256:6024b986f06765d482b5b07e086cc4b4cd05dd22ddcbc758fa23d54873cf313d"},@@ -4078,6 +4267,8 @@ version = "0.2.12"description = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml"optional = falsepython-versions = ">=3.9"+groups = ["dev"]+markers = "platform_python_implementation == \"CPython\""files = [{file = "ruamel.yaml.clib-0.2.12-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5"},{file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a606ef75a60ecf3d924613892cc603b154178ee25abb3055db5062da811fd969"},@@ -4129,29 +4320,30 @@ files = [[[package]]name = "ruff"-version = "0.8.6"+version = "0.9.1"description = "An extremely fast Python linter and code formatter, written in Rust."optional = falsepython-versions = ">=3.7"-files = [- {file = "ruff-0.8.6-py3-none-linux_armv6l.whl", hash = "sha256:defed167955d42c68b407e8f2e6f56ba52520e790aba4ca707a9c88619e580e3"},- {file = "ruff-0.8.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:54799ca3d67ae5e0b7a7ac234baa657a9c1784b48ec954a094da7c206e0365b1"},- {file = "ruff-0.8.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e88b8f6d901477c41559ba540beeb5a671e14cd29ebd5683903572f4b40a9807"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0509e8da430228236a18a677fcdb0c1f102dd26d5520f71f79b094963322ed25"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:91a7ddb221779871cf226100e677b5ea38c2d54e9e2c8ed847450ebbdf99b32d"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:248b1fb3f739d01d528cc50b35ee9c4812aa58cc5935998e776bf8ed5b251e75"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:bc3c083c50390cf69e7e1b5a5a7303898966be973664ec0c4a4acea82c1d4315"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:52d587092ab8df308635762386f45f4638badb0866355b2b86760f6d3c076188"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:61323159cf21bc3897674e5adb27cd9e7700bab6b84de40d7be28c3d46dc67cf"},- {file = "ruff-0.8.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ae4478b1471fc0c44ed52a6fb787e641a2ac58b1c1f91763bafbc2faddc5117"},- {file = "ruff-0.8.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0c000a471d519b3e6cfc9c6680025d923b4ca140ce3e4612d1a2ef58e11f11fe"},- {file = "ruff-0.8.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9257aa841e9e8d9b727423086f0fa9a86b6b420fbf4bf9e1465d1250ce8e4d8d"},- {file = "ruff-0.8.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:45a56f61b24682f6f6709636949ae8cc82ae229d8d773b4c76c09ec83964a95a"},- {file = "ruff-0.8.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:496dd38a53aa173481a7d8866bcd6451bd934d06976a2505028a50583e001b76"},- {file = "ruff-0.8.6-py3-none-win32.whl", hash = "sha256:e169ea1b9eae61c99b257dc83b9ee6c76f89042752cb2d83486a7d6e48e8f764"},- {file = "ruff-0.8.6-py3-none-win_amd64.whl", hash = "sha256:f1d70bef3d16fdc897ee290d7d20da3cbe4e26349f62e8a0274e7a3f4ce7a905"},- {file = "ruff-0.8.6-py3-none-win_arm64.whl", hash = "sha256:7d7fc2377a04b6e04ffe588caad613d0c460eb2ecba4c0ccbbfe2bc973cbc162"},- {file = "ruff-0.8.6.tar.gz", hash = "sha256:dcad24b81b62650b0eb8814f576fc65cfee8674772a6e24c9b747911801eeaa5"},+groups = ["dev"]+files = [+ {file = "ruff-0.9.1-py3-none-linux_armv6l.whl", hash = "sha256:84330dda7abcc270e6055551aca93fdde1b0685fc4fd358f26410f9349cf1743"},+ {file = "ruff-0.9.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3cae39ba5d137054b0e5b472aee3b78a7c884e61591b100aeb544bcd1fc38d4f"},+ {file = "ruff-0.9.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:50c647ff96f4ba288db0ad87048257753733763b409b2faf2ea78b45c8bb7fcb"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0c8b149e9c7353cace7d698e1656ffcf1e36e50f8ea3b5d5f7f87ff9986a7ca"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:beb3298604540c884d8b282fe7625651378e1986c25df51dec5b2f60cafc31ce"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:39d0174ccc45c439093971cc06ed3ac4dc545f5e8bdacf9f067adf879544d969"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:69572926c0f0c9912288915214ca9b2809525ea263603370b9e00bed2ba56dbd"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:937267afce0c9170d6d29f01fcd1f4378172dec6760a9f4dface48cdabf9610a"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:186c2313de946f2c22bdf5954b8dd083e124bcfb685732cfb0beae0c47233d9b"},+ {file = "ruff-0.9.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f94942a3bb767675d9a051867c036655fe9f6c8a491539156a6f7e6b5f31831"},+ {file = "ruff-0.9.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:728d791b769cc28c05f12c280f99e8896932e9833fef1dd8756a6af2261fd1ab"},+ {file = "ruff-0.9.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2f312c86fb40c5c02b44a29a750ee3b21002bd813b5233facdaf63a51d9a85e1"},+ {file = "ruff-0.9.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ae017c3a29bee341ba584f3823f805abbe5fe9cd97f87ed07ecbf533c4c88366"},+ {file = "ruff-0.9.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5dc40a378a0e21b4cfe2b8a0f1812a6572fc7b230ef12cd9fac9161aa91d807f"},+ {file = "ruff-0.9.1-py3-none-win32.whl", hash = "sha256:46ebf5cc106cf7e7378ca3c28ce4293b61b449cd121b98699be727d40b79ba72"},+ {file = "ruff-0.9.1-py3-none-win_amd64.whl", hash = "sha256:342a824b46ddbcdddd3abfbb332fa7fcaac5488bf18073e841236aadf4ad5c19"},+ {file = "ruff-0.9.1-py3-none-win_arm64.whl", hash = "sha256:1cd76c7f9c679e6e8f2af8f778367dca82b95009bc7b1a85a47f1521ae524fa7"},+ {file = "ruff-0.9.1.tar.gz", hash = "sha256:fd2b25ecaf907d6458fa842675382c8597b3c746a2dde6717fe3415425df0c17"},][[package]]@@ -4160,6 +4352,7 @@ version = "1.6.3"description = "Reactive Extensions (Rx) for Python"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "Rx-1.6.3.tar.gz", hash = "sha256:ca71b65d0fc0603a3b5cfaa9e33f5ba81e4aae10a58491133595088d7734b2da"},]@@ -4170,6 +4363,7 @@ version = "0.10.4"description = "An Amazon S3 Transfer Manager"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "s3transfer-0.10.4-py3-none-any.whl", hash = "sha256:244a76a24355363a68164241438de1b72f8781664920260c48465896b712a41e"},{file = "s3transfer-0.10.4.tar.gz", hash = "sha256:29edc09801743c21eb5ecbc617a152df41d3c287f67b615f73e5f750583666a7"},@@ -4187,6 +4381,7 @@ version = "2.10.0"description = "A library implementing the 'SemVer' scheme."optional = falsepython-versions = ">=2.7"+groups = ["main"]files = [{file = "semantic_version-2.10.0-py2.py3-none-any.whl", hash = "sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177"},{file = "semantic_version-2.10.0.tar.gz", hash = "sha256:bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c"},@@ -4202,6 +4397,7 @@ version = "1.52.0"description = "Lightweight static analysis for many languages. Find bug variants with patterns that look like source code."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "semgrep-1.52.0-cp38.cp39.cp310.cp311.py37.py38.py39.py310.py311-none-any.whl", hash = "sha256:c6f342cfeddfb0655ed40e1776b73cbb7df9f47964b79de0399cf67a596e0ece"},{file = "semgrep-1.52.0-cp38.cp39.cp310.cp311.py37.py38.py39.py310.py311-none-macosx_10_14_x86_64.whl", hash = "sha256:1bf77f060dfac5c9a2585c2d9c0f6ce46bdf0fe5c06b8aacd1a4facdf530341e"},@@ -4238,6 +4434,7 @@ version = "6.11.0"description = "Twilio SendGrid library for Python"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"+groups = ["main"]files = [{file = "sendgrid-6.11.0-py3-none-any.whl", hash = "sha256:43ecf5bb742ea5850c7cfe68f5e7d9948772352306d4e83e119899959538b884"},{file = "sendgrid-6.11.0.tar.gz", hash = "sha256:71424b2a97f5a034121ea3b2666c653ba0ed315982f0d57b7851c0c9503dc5ab"},@@ -4253,6 +4450,7 @@ version = "2.19.2"description = "Python client for Sentry (https://sentry.io)"optional = falsepython-versions = ">=3.6"+groups = ["main"]files = [{file = "sentry_sdk-2.19.2-py2.py3-none-any.whl", hash = "sha256:ebdc08228b4d131128e568d696c210d846e5b9d70aa0327dec6b1272d9d40b84"},{file = "sentry_sdk-2.19.2.tar.gz", hash = "sha256:467df6e126ba242d39952375dd816fbee0f217d119bf454a8ce74cf1e7909e8d"},@@ -4307,6 +4505,7 @@ version = "75.7.0"description = "Easily download, build, install, upgrade, and uninstall Python packages"optional = falsepython-versions = ">=3.9"+groups = ["main", "dev"]files = [{file = "setuptools-75.7.0-py3-none-any.whl", hash = "sha256:84fb203f278ebcf5cd08f97d3fb96d3fbed4b629d500b29ad60d11e00769b183"},{file = "setuptools-75.7.0.tar.gz", hash = "sha256:886ff7b16cd342f1d1defc16fc98c9ce3fde69e087a4e1983d7ab634e5f41f4f"},@@ -4327,6 +4526,7 @@ version = "1.17.0"description = "Python 2 and 3 compatibility utilities"optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"+groups = ["main", "dev"]files = [{file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"},{file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"},@@ -4338,6 +4538,7 @@ version = "1.3.1"description = "Sniff out which async library your code is running under"optional = falsepython-versions = ">=3.7"+groups = ["main"]files = [{file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"},{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},@@ -4349,6 +4550,7 @@ version = "2.4.0"description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"},{file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"},@@ -4360,6 +4562,7 @@ version = "2.6"description = "A modern CSS selector implementation for Beautiful Soup."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "soupsieve-2.6-py3-none-any.whl", hash = "sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9"},{file = "soupsieve-2.6.tar.gz", hash = "sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb"},@@ -4371,6 +4574,7 @@ version = "0.5.3"description = "A non-validating SQL parser."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "sqlparse-0.5.3-py3-none-any.whl", hash = "sha256:cf2196ed3418f3ba5de6af7e82c694a9fbdbfecccdfc72e281548517081f16ca"},{file = "sqlparse-0.5.3.tar.gz", hash = "sha256:09f67787f56a0b16ecdbde1bfc7f5d9c3371ca683cfeaa8e6ff60b4807ec9272"},@@ -4386,6 +4590,7 @@ version = "2.2.0"description = "A lightweight and fast pure python ECDSA library"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "starkbank-ecdsa-2.2.0.tar.gz", hash = "sha256:9399c3371b899d4a235b68a1ed7919d202fbf024bd2c863ae8ebdad343c2a63a"},]@@ -4396,6 +4601,7 @@ version = "3.5.0"description = "Python bindings for the Stripe API"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"+groups = ["main"]files = [{file = "stripe-3.5.0-py2.py3-none-any.whl", hash = "sha256:69d5bf4611624a503bcec84a61b1f2a2b874bfc828432e4fd75cd120bcc3efef"},{file = "stripe-3.5.0.tar.gz", hash = "sha256:08f74cae6619d4a7d78f8162ff72bc3e9c913f53ec96ecd5ddc7d823c2e79ddd"},@@ -4410,6 +4616,7 @@ version = "1.13.3"description = "Computer algebra system (CAS) in Python"optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "sympy-1.13.3-py3-none-any.whl", hash = "sha256:54612cf55a62755ee71824ce692986f23c88ffa77207b30c1368eda4a7060f73"},{file = "sympy-1.13.3.tar.gz", hash = "sha256:b27fd2c6530e0ab39e275fc9b683895367e51d5da91baa8d3d64db2565fec4d9"},@@ -4427,6 +4634,7 @@ version = "9.0.0"description = "Retry code until it succeeds"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "tenacity-9.0.0-py3-none-any.whl", hash = "sha256:93de0c98785b27fcf659856aa9f54bfbd399e29969b0621bc7f762bd441b4539"},{file = "tenacity-9.0.0.tar.gz", hash = "sha256:807f37ca97d62aa361264d497b0e31e92b8027044942bfa756160d908320d73b"},@@ -4442,6 +4650,7 @@ version = "1.3"description = "The most basic Text::Unidecode port"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "text-unidecode-1.3.tar.gz", hash = "sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93"},{file = "text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8"},@@ -4453,6 +4662,7 @@ version = "1.0.0"description = "Modern Text User Interface framework"optional = falsepython-versions = "<4.0.0,>=3.8.1"+groups = ["dev"]files = [{file = "textual-1.0.0-py3-none-any.whl", hash = "sha256:2d4a701781c05104925e463ae370c630567c70c2880e92ab838052e3e23c986f"},{file = "textual-1.0.0.tar.gz", hash = "sha256:bec9fe63547c1c552569d1b75d309038b7d456c03f86dfa3706ddb099b151399"},@@ -4473,6 +4683,7 @@ version = "1.0.2"description = "Tornado IOLoop Backed Concurrent Futures"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "threadloop-1.0.2-py2-none-any.whl", hash = "sha256:5c90dbefab6ffbdba26afb4829d2a9df8275d13ac7dc58dccb0e279992679599"},{file = "threadloop-1.0.2.tar.gz", hash = "sha256:8b180aac31013de13c2ad5c834819771992d350267bddb854613ae77ef571944"},@@ -4487,6 +4698,7 @@ version = "0.21.0"description = "Python bindings for the Apache Thrift RPC system"optional = falsepython-versions = "*"+groups = ["main"]files = [{file = "thrift-0.21.0.tar.gz", hash = "sha256:5e6f7c50f936ebfa23e924229afc95eb219f8c8e5a83202dd4a391244803e402"},]@@ -4505,6 +4717,7 @@ version = "2.0.2"description = "A lil' TOML parser"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"},{file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"},@@ -4516,6 +4729,7 @@ version = "6.4.2"description = "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "tornado-6.4.2-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:e828cce1123e9e44ae2a50a9de3055497ab1d0aeb440c5ac23064d9e44880da1"},{file = "tornado-6.4.2-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:072ce12ada169c5b00b7d92a99ba089447ccc993ea2143c9ede887e0937aa803"},@@ -4536,6 +4750,7 @@ version = "2021.10.8.3"description = "Typing stubs for certifi"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "types-certifi-2021.10.8.3.tar.gz", hash = "sha256:72cf7798d165bc0b76e1c10dd1ea3097c7063c42c21d664523b928e88b554a4f"},{file = "types_certifi-2021.10.8.3-py3-none-any.whl", hash = "sha256:b2d1e325e69f71f7c78e5943d410e650b4707bb0ef32e4ddf3da37f54176e88a"},@@ -4547,6 +4762,7 @@ version = "1.16.0.20241221"description = "Typing stubs for cffi"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_cffi-1.16.0.20241221-py3-none-any.whl", hash = "sha256:e5b76b4211d7a9185f6ab8d06a106d56c7eb80af7cdb8bfcb4186ade10fb112f"},{file = "types_cffi-1.16.0.20241221.tar.gz", hash = "sha256:1c96649618f4b6145f58231acb976e0b448be6b847f7ab733dabe62dfbff6591"},@@ -4561,6 +4777,7 @@ version = "1.1.10"description = "Typing stubs for freezegun"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "types-freezegun-1.1.10.tar.gz", hash = "sha256:cb3a2d2eee950eacbaac0673ab50499823365ceb8c655babb1544a41446409ec"},{file = "types_freezegun-1.1.10-py3-none-any.whl", hash = "sha256:fadebe72213e0674036153366205038e1f95c8ca96deb4ef9b71ddc15413543e"},@@ -4572,6 +4789,7 @@ version = "5.1.0.20240425"description = "Typing stubs for mock"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types-mock-5.1.0.20240425.tar.gz", hash = "sha256:5281a645d72e827d70043e3cc144fe33b1c003db084f789dc203aa90e812a5a4"},{file = "types_mock-5.1.0.20240425-py3-none-any.whl", hash = "sha256:d586a01d39ad919d3ddcd73de6cde73ca7f3c69707219f722d1b8d7733641ad7"},@@ -4583,6 +4801,7 @@ version = "24.1.0.20240722"description = "Typing stubs for pyOpenSSL"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types-pyOpenSSL-24.1.0.20240722.tar.gz", hash = "sha256:47913b4678a01d879f503a12044468221ed8576263c1540dcb0484ca21b08c39"},{file = "types_pyOpenSSL-24.1.0.20240722-py3-none-any.whl", hash = "sha256:6a7a5d2ec042537934cfb4c9d4deb0e16c4c6250b09358df1f083682fe6fda54"},@@ -4598,6 +4817,7 @@ version = "2.9.0.20241206"description = "Typing stubs for python-dateutil"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53"},{file = "types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb"},@@ -4609,6 +4829,7 @@ version = "2024.2.0.20241221"description = "Typing stubs for pytz"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_pytz-2024.2.0.20241221-py3-none-any.whl", hash = "sha256:8fc03195329c43637ed4f593663df721fef919b60a969066e22606edf0b53ad5"},{file = "types_pytz-2024.2.0.20241221.tar.gz", hash = "sha256:06d7cde9613e9f7504766a0554a270c369434b50e00975b3a4a0f6eed0f2c1a9"},@@ -4620,6 +4841,7 @@ version = "6.0.12.20241230"description = "Typing stubs for PyYAML"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_PyYAML-6.0.12.20241230-py3-none-any.whl", hash = "sha256:fa4d32565219b68e6dee5f67534c722e53c00d1cfc09c435ef04d7353e1e96e6"},{file = "types_pyyaml-6.0.12.20241230.tar.gz", hash = "sha256:7f07622dbd34bb9c8b264fe860a17e0efcad00d50b5f27e93984909d9363498c"},@@ -4631,6 +4853,7 @@ version = "4.6.0.20241004"description = "Typing stubs for redis"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types-redis-4.6.0.20241004.tar.gz", hash = "sha256:5f17d2b3f9091ab75384153bfa276619ffa1cf6a38da60e10d5e6749cc5b902e"},{file = "types_redis-4.6.0.20241004-py3-none-any.whl", hash = "sha256:ef5da68cb827e5f606c8f9c0b49eeee4c2669d6d97122f301d3a55dc6a63f6ed"},@@ -4646,6 +4869,7 @@ version = "2.31.0.6"description = "Typing stubs for requests"optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "types-requests-2.31.0.6.tar.gz", hash = "sha256:cd74ce3b53c461f1228a9b783929ac73a666658f223e28ed29753771477b3bd0"},{file = "types_requests-2.31.0.6-py3-none-any.whl", hash = "sha256:a2db9cb228a81da8348b49ad6db3f5519452dd20a9c1e1a868c83c5fe88fd1a9"},@@ -4660,6 +4884,7 @@ version = "75.6.0.20241223"description = "Typing stubs for setuptools"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_setuptools-75.6.0.20241223-py3-none-any.whl", hash = "sha256:7cbfd3bf2944f88bbcdd321b86ddd878232a277be95d44c78a53585d78ebc2f6"},{file = "types_setuptools-75.6.0.20241223.tar.gz", hash = "sha256:d9478a985057ed48a994c707f548e55aababa85fe1c9b212f43ab5a1fffd3211"},@@ -4671,6 +4896,7 @@ version = "1.17.0.20241205"description = "Typing stubs for six"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "types_six-1.17.0.20241205-py3-none-any.whl", hash = "sha256:a4947c2bdcd9ab69d44466a533a15839ff48ddc27223615cb8145d73ab805bc2"},{file = "types_six-1.17.0.20241205.tar.gz", hash = "sha256:1f662347a8f3b2bf30517d629d82f591420df29811794b0bf3804e14d716f6e0"},@@ -4682,6 +4908,7 @@ version = "1.26.25.14"description = "Typing stubs for urllib3"optional = falsepython-versions = "*"+groups = ["dev"]files = [{file = "types-urllib3-1.26.25.14.tar.gz", hash = "sha256:229b7f577c951b8c1b92c1bc2b2fdb0b49847bd2af6d1cc2a2e3dd340f3bda8f"},{file = "types_urllib3-1.26.25.14-py3-none-any.whl", hash = "sha256:9683bbb7fb72e32bfe9d2be6e04875fbe1b3eeec3cbb4ea231435aa7fd6b4f0e"},@@ -4693,6 +4920,7 @@ version = "4.12.2"description = "Backported and Experimental Type Hints for Python 3.8+"optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"},{file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"},@@ -4704,6 +4932,7 @@ version = "2024.2"description = "Provider of IANA time zone data"optional = falsepython-versions = ">=2"+groups = ["main", "dev"]files = [{file = "tzdata-2024.2-py2.py3-none-any.whl", hash = "sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd"},{file = "tzdata-2024.2.tar.gz", hash = "sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc"},@@ -4715,6 +4944,7 @@ version = "1.0.3"description = "Micro subset of unicode data files for linkify-it-py projects."optional = falsepython-versions = ">=3.7"+groups = ["dev"]files = [{file = "uc-micro-py-1.0.3.tar.gz", hash = "sha256:d321b92cff673ec58027c04015fcaa8bb1e005478643ff4a500882eaab88c48a"},{file = "uc_micro_py-1.0.3-py3-none-any.whl", hash = "sha256:db1dffff340817673d7b466ec86114a9dc0e9d4d9b5ba229d9d60e5c12600cd5"},@@ -4729,6 +4959,7 @@ version = "1.26.20"description = "HTTP library with thread-safe connection pooling, file post, and more."optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"+groups = ["main", "dev"]files = [{file = "urllib3-1.26.20-py2.py3-none-any.whl", hash = "sha256:0ed14ccfbf1c30a9072c7ca157e4319b70d65f623e91e7b32fadb2853431016e"},{file = "urllib3-1.26.20.tar.gz", hash = "sha256:40c2dc0c681e47eb8f90e7e27bf6ff7df2e677421fd46756da1161c39ca70d32"},@@ -4745,6 +4976,7 @@ version = "0.32.1"description = "The lightning-fast ASGI server."optional = falsepython-versions = ">=3.8"+groups = ["main"]files = [{file = "uvicorn-0.32.1-py3-none-any.whl", hash = "sha256:82ad92fd58da0d12af7482ecdb5f2470a04c9c9a53ced65b9bbb4a205377602e"},{file = "uvicorn-0.32.1.tar.gz", hash = "sha256:ee9519c246a72b1c084cea8d3b44ed6026e78a4a309cbedae9c37e4cb9fbb175"},@@ -4770,6 +5002,8 @@ version = "0.21.0"description = "Fast implementation of asyncio event loop on top of libuv"optional = falsepython-versions = ">=3.8.0"+groups = ["main"]+markers = "platform_python_implementation != \"PyPy\" and (sys_platform != \"win32\" and sys_platform != \"cygwin\")"files = [{file = "uvloop-0.21.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ec7e6b09a6fdded42403182ab6b832b71f4edaf7f37a9a0e371a01db5f0cb45f"},{file = "uvloop-0.21.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:196274f2adb9689a289ad7d65700d37df0c0930fd8e4e743fa4834e850d7719d"},@@ -4821,6 +5055,7 @@ version = "6.0.2"description = "Automatically mock your HTTP interactions to simplify and speed up testing"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "vcrpy-6.0.2-py2.py3-none-any.whl", hash = "sha256:40370223861181bc76a5e5d4b743a95058bb1ad516c3c08570316ab592f56cad"},{file = "vcrpy-6.0.2.tar.gz", hash = "sha256:88e13d9111846745898411dbc74a75ce85870af96dd320d75f1ee33158addc09"},@@ -4844,6 +5079,7 @@ version = "5.1.0"description = "Python promises."optional = falsepython-versions = ">=3.6"+groups = ["main", "dev"]files = [{file = "vine-5.1.0-py3-none-any.whl", hash = "sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc"},{file = "vine-5.1.0.tar.gz", hash = "sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0"},@@ -4855,6 +5091,7 @@ version = "20.28.1"description = "Virtual Python Environment builder"optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "virtualenv-20.28.1-py3-none-any.whl", hash = "sha256:412773c85d4dab0409b83ec36f7a6499e72eaf08c80e81e9576bca61831c71cb"},{file = "virtualenv-20.28.1.tar.gz", hash = "sha256:5d34ab240fdb5d21549b76f9e8ff3af28252f5499fb6d6f031adac4e5a8c5329"},@@ -4875,6 +5112,7 @@ version = "1.0.3"description = "Simple, modern and high performance file watching and code reload in python."optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "watchfiles-1.0.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:1da46bb1eefb5a37a8fb6fd52ad5d14822d67c498d99bda8754222396164ae42"},{file = "watchfiles-1.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2b961b86cd3973f5822826017cad7f5a75795168cb645c3a6b30c349094e02e3"},@@ -4958,6 +5196,7 @@ version = "8.5.2"description = "Wildcard/glob file name matcher."optional = falsepython-versions = ">=3.8"+groups = ["dev"]files = [{file = "wcmatch-8.5.2-py3-none-any.whl", hash = "sha256:17d3ad3758f9d0b5b4dedc770b65420d4dac62e680229c287bf24c9db856a478"},{file = "wcmatch-8.5.2.tar.gz", hash = "sha256:a70222b86dea82fb382dd87b73278c10756c138bd6f8f714e2183128887b9eb2"},@@ -4972,6 +5211,7 @@ version = "0.2.13"description = "Measures the displayed width of unicode strings in a terminal"optional = falsepython-versions = "*"+groups = ["main", "dev"]files = [{file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"},{file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"},@@ -4983,6 +5223,7 @@ version = "14.1"description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "websockets-14.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a0adf84bc2e7c86e8a202537b4fd50e6f7f0e4a6b6bf64d7ccb96c4cd3330b29"},{file = "websockets-14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:90b5d9dfbb6d07a84ed3e696012610b6da074d97453bd01e0e30744b472c8179"},@@ -5061,6 +5302,7 @@ version = "1.17.0"description = "Module for decorators, wrappers and monkey patching."optional = falsepython-versions = ">=3.8"+groups = ["main", "dev"]files = [{file = "wrapt-1.17.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2a0c23b8319848426f305f9cb0c98a6e32ee68a36264f45948ccf8e7d2b941f8"},{file = "wrapt-1.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1ca5f060e205f72bec57faae5bd817a1560fcfc4af03f414b08fa29106b7e2d"},@@ -5135,6 +5377,7 @@ version = "1.18.3"description = "Yet another URL library"optional = falsepython-versions = ">=3.9"+groups = ["dev"]files = [{file = "yarl-1.18.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7df647e8edd71f000a5208fe6ff8c382a1de8edfbccdbbfe649d263de07d8c34"},{file = "yarl-1.18.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c69697d3adff5aa4f874b19c0e4ed65180ceed6318ec856ebc423aa5850d84f7"},@@ -5231,6 +5474,7 @@ version = "3.21.0"description = "Backport of pathlib-compatible object wrapper for zip files"optional = falsepython-versions = ">=3.9"+groups = ["main"]files = [{file = "zipp-3.21.0-py3-none-any.whl", hash = "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931"},{file = "zipp-3.21.0.tar.gz", hash = "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4"},@@ -5245,6 +5489,6 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools",type = ["pytest-mypy"][metadata]-lock-version = "2.0"+lock-version = "2.1"python-versions = "~3.12"-content-hash = "03f7ae23c7ede67ac22dbeb5c96c71c7e42f1f091a8df544a786146bb36d42ea"+content-hash = "60972ad2e3c62a44d33c8d9032ed2eb051cb723677da242c5270c40acf8f74ea"diff --git a/pyproject.toml b/pyproject.tomlindex 7483c89db3..c6a461cce0 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -123,7 +123,7 @@ package-mode = falsepytest-socket = "^0.7.0"pytest-xdist = "^3.0.2"pywatchman = "^2.0.0"- ruff = "^0.8.4"+ ruff = "^0.9.1"semgrep = ">=1.34.0"types-certifi = "^2021.10.8"types-freezegun = "^1.1.7"@@ -177,7 +177,7 @@ exclude = [[tool.ruff]-target-version = "py39"+target-version = "py312"[tool.ruff.lint]select = [diff --git a/saleor/account/events.py b/saleor/account/events.pyindex b3e81bd214..e44a4b73ec 100644--- a/saleor/account/events.py+++ b/saleor/account/events.py@@ -1,18 +1,16 @@-from typing import Optional-from ..app.models import Appfrom ..order.models import Order, OrderLinefrom . import CustomerEventsfrom .models import CustomerEvent, User-def customer_account_created_event(*, user: User) -> Optional[CustomerEvent]:+def customer_account_created_event(*, user: User) -> CustomerEvent | None:return CustomerEvent.objects.create(user=user, type=CustomerEvents.ACCOUNT_CREATED)def customer_account_activated_event(- *, staff_user: Optional[User], app: Optional[App], account_id: int-) -> Optional[CustomerEvent]:+ *, staff_user: User | None, app: App | None, account_id: int+) -> CustomerEvent | None:return CustomerEvent.objects.create(user=staff_user,app=app,@@ -22,8 +20,8 @@ def customer_account_activated_event(def customer_account_deactivated_event(- *, staff_user: Optional[User], app: Optional[App], account_id: int-) -> Optional[CustomerEvent]:+ *, staff_user: User | None, app: App | None, account_id: int+) -> CustomerEvent | None:return CustomerEvent.objects.create(user=staff_user,app=app,@@ -32,23 +30,23 @@ def customer_account_deactivated_event()-def customer_password_reset_link_sent_event(*, user_id: int) -> Optional[CustomerEvent]:+def customer_password_reset_link_sent_event(*, user_id: int) -> CustomerEvent | None:return CustomerEvent.objects.create(user_id=user_id, type=CustomerEvents.PASSWORD_RESET_LINK_SENT)-def customer_password_reset_event(*, user: User) -> Optional[CustomerEvent]:+def customer_password_reset_event(*, user: User) -> CustomerEvent | None:return CustomerEvent.objects.create(user=user, type=CustomerEvents.PASSWORD_RESET)-def customer_password_changed_event(*, user: User) -> Optional[CustomerEvent]:+def customer_password_changed_event(*, user: User) -> CustomerEvent | None:return CustomerEvent.objects.create(user=user, type=CustomerEvents.PASSWORD_CHANGED)def customer_email_change_request_event(*, user_id: int, parameters: dict-) -> Optional[CustomerEvent]:+) -> CustomerEvent | None:return CustomerEvent.objects.create(user_id=user_id, type=CustomerEvents.EMAIL_CHANGE_REQUEST, parameters=parameters)@@ -56,20 +54,20 @@ def customer_email_change_request_event(def customer_email_changed_event(*, user_id: int, parameters: dict-) -> Optional[CustomerEvent]:+) -> CustomerEvent | None:return CustomerEvent.objects.create(user_id=user_id, type=CustomerEvents.EMAIL_CHANGED, parameters=parameters)-def customer_placed_order_event(*, user: User, order: Order) -> Optional[CustomerEvent]:+def customer_placed_order_event(*, user: User, order: Order) -> CustomerEvent | None:return CustomerEvent.objects.create(user=user, order=order, type=CustomerEvents.PLACED_ORDER)def customer_added_to_note_order_event(- *, user: Optional[User], order: Order, message: str+ *, user: User | None, order: Order, message: str) -> CustomerEvent:return CustomerEvent.objects.create(user=user,@@ -91,7 +89,7 @@ def customer_downloaded_a_digital_link_event(def customer_deleted_event(- *, staff_user: Optional[User], app: Optional[App], deleted_count: int = 1+ *, staff_user: User | None, app: App | None, deleted_count: int = 1) -> CustomerEvent:return CustomerEvent.objects.create(user=staff_user,@@ -103,7 +101,7 @@ def customer_deleted_event(def assigned_email_to_a_customer_event(- *, staff_user: Optional[User], app: Optional[App], new_email: str+ *, staff_user: User | None, app: App | None, new_email: str) -> CustomerEvent:return CustomerEvent.objects.create(user=staff_user,@@ -115,7 +113,7 @@ def assigned_email_to_a_customer_event(def assigned_name_to_a_customer_event(- *, staff_user: Optional[User], app: Optional[App], new_name: str+ *, staff_user: User | None, app: App | None, new_name: str) -> CustomerEvent:return CustomerEvent.objects.create(user=staff_user,diff --git a/saleor/account/models.py b/saleor/account/models.pyindex 5bea13f5d2..e3c8ba861d 100644--- a/saleor/account/models.py+++ b/saleor/account/models.py@@ -1,6 +1,5 @@from collections.abc import Iterablefrom functools import partial-from typing import Unionfrom uuid import uuid4from django.conf import settings@@ -301,7 +300,7 @@ class User(def get_short_name(self):return self.email- def has_perm(self, perm: Union[BasePermissionEnum, str], obj=None) -> bool:+ def has_perm(self, perm: BasePermissionEnum | str, obj=None) -> bool:# This method is overridden to accept perm as BasePermissionEnumperm = perm.value if isinstance(perm, BasePermissionEnum) else perm@@ -311,7 +310,7 @@ class User(return _user_has_perm(self, perm, obj)def has_perms(- self, perm_list: Iterable[Union[BasePermissionEnum, str]], obj=None+ self, perm_list: Iterable[BasePermissionEnum | str], obj=None) -> bool:# This method is overridden to accept perm as BasePermissionEnumperm_list = [diff --git a/saleor/account/notifications.py b/saleor/account/notifications.pyindex 1fb2167174..1b3e2bfb20 100644--- a/saleor/account/notifications.py+++ b/saleor/account/notifications.py@@ -1,4 +1,3 @@-from typing import Optionalfrom urllib.parse import urlencodefrom django.contrib.auth.tokens import default_token_generator@@ -39,7 +38,7 @@ def get_user_custom_payload(user: User):def send_password_reset_notification(- redirect_url, user, manager, channel_slug: Optional[str], staff=False+ redirect_url, user, manager, channel_slug: str | None, staff=False):"""Trigger sending a password reset notification for the given customer/staff."""diff --git a/saleor/account/throttling.py b/saleor/account/throttling.pyindex 7a392f1c99..6b9edf3c95 100644--- a/saleor/account/throttling.py+++ b/saleor/account/throttling.py@@ -1,7 +1,6 @@import datetimeimport loggingfrom math import ceil-from typing import Optionalfrom django.core.cache import cachefrom django.core.exceptions import ValidationError@@ -19,7 +18,7 @@ ATTEMPT_COUNTER_EXPIRE_TIME = 7200logger = logging.getLogger(__name__)-def authenticate_with_throttling(request, email, password) -> Optional[models.User]:+def authenticate_with_throttling(request, email, password) -> models.User | None:ip = get_client_ip(request)if not ip:logger.warning("Unknown request's IP address.")diff --git a/saleor/account/utils.py b/saleor/account/utils.pyindex e0d1451ca7..353a3eca92 100644--- a/saleor/account/utils.py+++ b/saleor/account/utils.py@@ -1,5 +1,5 @@from dataclasses import dataclass-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom django.db.models import Exists, OuterRef@@ -19,8 +19,8 @@ if TYPE_CHECKING:@dataclassclass RequestorAwareContext:allow_replica: bool- user: Optional[User] = None- app: Optional[App] = None+ user: User | None = None+ app: App | None = None@propertydef META(self):diff --git a/saleor/app/installation_utils.py b/saleor/app/installation_utils.pyindex c18bba8cee..0651209bcd 100644--- a/saleor/app/installation_utils.py+++ b/saleor/app/installation_utils.py@@ -1,7 +1,6 @@import loggingimport timefrom io import BytesIO-from typing import Optional, Unionimport requestsfrom celery.exceptions import MaxRetriesExceededError@@ -134,7 +133,7 @@ def fetch_brand_data(manifest_data, timeout=settings.COMMON_REQUESTS_TIMEOUT):return brand_data-def _set_brand_data(brand_obj: Optional[Union[App, AppInstallation]], logo: File):+def _set_brand_data(brand_obj: App | AppInstallation | None, logo: File):if not brand_obj:returntry:@@ -183,8 +182,8 @@ def fetch_brand_data_task(def fetch_brand_data_async(manifest_data: dict,*,- app_installation: Optional[AppInstallation] = None,- app: Optional[App] = None,+ app_installation: AppInstallation | None = None,+ app: App | None = None,):if brand_data := manifest_data.get("brand"):app_id = app.pk if app else None@@ -255,7 +254,7 @@ def install_app(app_installation: AppInstallation, activate: bool = False):webhook_events = []for db_webhook, manifest_webhook in zip(- webhooks, manifest_data.get("webhooks", [])+ webhooks, manifest_data.get("webhooks", []), strict=False):for event_type in manifest_webhook["events"]:webhook_events.append(diff --git a/saleor/app/management/commands/create_app.py b/saleor/app/management/commands/create_app.pyindex e7b3b7fc9d..7bb8b6a35a 100644--- a/saleor/app/management/commands/create_app.py+++ b/saleor/app/management/commands/create_app.py@@ -1,5 +1,5 @@import json-from typing import Any, Optional+from typing import Anyimport graphenefrom django.core.management import BaseCommand, CommandError@@ -72,7 +72,7 @@ class Command(BaseCommand):raise CommandError(f"Request failed. Exception: {e}") from eresponse.raise_for_status()- def handle(self, *args: Any, **options: Any) -> Optional[str]:+ def handle(self, *args: Any, **options: Any) -> str | None:name = options["name"]is_active = options["activate"]target_url = options["target_url"]diff --git a/saleor/app/management/commands/install_app.py b/saleor/app/management/commands/install_app.pyindex 98f2010460..47ea295ad8 100644--- a/saleor/app/management/commands/install_app.py+++ b/saleor/app/management/commands/install_app.py@@ -1,5 +1,5 @@import json-from typing import Any, Optional+from typing import Anyfrom django.core.exceptions import ValidationErrorfrom django.core.management import BaseCommand, CommandError@@ -33,7 +33,7 @@ class Command(BaseCommand):f"Incorrect format of manifest-url: {manifest_url}") from e- def handle(self, *args: Any, **options: Any) -> Optional[str]:+ def handle(self, *args: Any, **options: Any) -> str | None:activate = options["activate"]manifest_url = options["manifest-url"]diff --git a/saleor/app/manifest_validations.py b/saleor/app/manifest_validations.pyindex e269895bd0..4b0277b5a5 100644--- a/saleor/app/manifest_validations.py+++ b/saleor/app/manifest_validations.py@@ -1,7 +1,6 @@import loggingfrom collections import defaultdictfrom collections.abc import Iterable-from typing import Optionalfrom django.core.exceptions import ValidationErrorfrom django.db.models import Value@@ -324,7 +323,7 @@ def validate_required_fields(manifest_data, errors):errors["extensions"].append(ValidationError("Missing required fields for app extension: "- f'{", ".join(missing_fields)}.',+ f"{', '.join(missing_fields)}.",code=AppErrorCode.REQUIRED.value,))@@ -336,7 +335,7 @@ def validate_required_fields(manifest_data, errors):errors["webhooks"].append(ValidationError(f"Missing required fields for webhook: "- f'{", ".join(missing_fields)}.',+ f"{', '.join(missing_fields)}.",code=AppErrorCode.REQUIRED.value,))@@ -350,7 +349,7 @@ def clean_required_saleor_version(required_version,raise_for_saleor_version: bool,saleor_version=__version__,-) -> Optional[dict]:+) -> dict | None:if not required_version:return Nonetry:@@ -366,7 +365,7 @@ def clean_required_saleor_version(return {"constraint": required_version, "satisfied": satisfied}-def clean_author(author) -> Optional[str]:+def clean_author(author) -> str | None:if author is None:return Noneif isinstance(author, str):diff --git a/saleor/app/models.py b/saleor/app/models.pyindex f853bee322..e375d1dd65 100644--- a/saleor/app/models.py+++ b/saleor/app/models.py@@ -1,5 +1,5 @@from collections.abc import Iterable-from typing import Union, cast+from typing import castfrom uuid import uuid4from django.contrib.auth.hashers import make_password@@ -102,7 +102,7 @@ class App(ModelWithMetadata):setattr(self, perm_cache_name, {f"{ct}.{name}" for ct, name in perms})return getattr(self, perm_cache_name)- def has_perms(self, perm_list: Iterable[Union[BasePermissionEnum, str]]) -> bool:+ def has_perms(self, perm_list: Iterable[BasePermissionEnum | str]) -> bool:"""Return True if the app has each of the specified permissions."""if not self.is_active:return False@@ -115,7 +115,7 @@ class App(ModelWithMetadata):return (wanted_perms & actual_perms) == wanted_perms- def has_perm(self, perm: Union[BasePermissionEnum, str]) -> bool:+ def has_perm(self, perm: BasePermissionEnum | str) -> bool:"""Return True if the app has the specified permission."""if not self.is_active:return Falsediff --git a/saleor/app/utils.py b/saleor/app/utils.pyindex e00b9eac5e..c8957285f7 100644--- a/saleor/app/utils.py+++ b/saleor/app/utils.py@@ -1,10 +1,8 @@-from typing import Optional-from ..webhook.event_types import WebhookEventSyncTypefrom ..webhook.utils import get_webhooks_for_event-def get_active_tax_apps(identifiers: Optional[list[str]] = None):+def get_active_tax_apps(identifiers: list[str] | None = None):checkout_webhooks = get_webhooks_for_event(event_type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,apps_identifier=identifiers,diff --git a/saleor/asgi/gzip_compression.py b/saleor/asgi/gzip_compression.pyindex 96fb1a43f7..e9cd558ca6 100644--- a/saleor/asgi/gzip_compression.py+++ b/saleor/asgi/gzip_compression.py@@ -3,7 +3,6 @@import gzipimport io-from typing import Optionalfrom asgiref.typing import (ASGI3Application,@@ -31,7 +30,7 @@ def gzip_compression(b"",)if b"gzip" in accepted_encoding:- start_message: Optional[HTTPResponseStartEvent] = None+ start_message: HTTPResponseStartEvent | None = Nonecontent_encoding_set = Falsestarted = Falsegzip_buffer = io.BytesIO()diff --git a/saleor/attribute/migrations/0022_attribute_value_translations_propagate_names.py b/saleor/attribute/migrations/0022_attribute_value_translations_propagate_names.pyindex 476451494f..7713a64395 100644--- a/saleor/attribute/migrations/0022_attribute_value_translations_propagate_names.py+++ b/saleor/attribute/migrations/0022_attribute_value_translations_propagate_names.py@@ -2,7 +2,6 @@import reimport warnings-from typing import Optionalfrom django.db import migrationsfrom django.template.defaultfilters import truncatechars@@ -14,7 +13,7 @@ BLACKLISTED_URL_SCHEMES = ("javascript",)HYPERLINK_TAG_WITH_URL_PATTERN = r"(.*?<a\s+href=\\?\")(\w+://\S+[^\\])(\\?\">)"-def clean_editor_js(definitions: Optional[dict], *, to_string: bool = False):+def clean_editor_js(definitions: dict | None, *, to_string: bool = False):"""Sanitize a given EditorJS JSON definitions.Look for not allowed URLs, replaced them with `invalid` value, and clean valid ones.diff --git a/saleor/attribute/migrations/0025_attribute_value_translations_propagate_names.py b/saleor/attribute/migrations/0025_attribute_value_translations_propagate_names.pyindex 11327ee726..9ac1adce73 100644--- a/saleor/attribute/migrations/0025_attribute_value_translations_propagate_names.py+++ b/saleor/attribute/migrations/0025_attribute_value_translations_propagate_names.py@@ -2,7 +2,6 @@import reimport warnings-from typing import Optionalfrom django.db import migrationsfrom django.template.defaultfilters import truncatechars@@ -14,7 +13,7 @@ BLACKLISTED_URL_SCHEMES = ("javascript",)HYPERLINK_TAG_WITH_URL_PATTERN = r"(.*?<a\s+href=\\?\")(\w+://\S+[^\\])(\\?\">)"-def clean_editor_js(definitions: Optional[dict], *, to_string: bool = False):+def clean_editor_js(definitions: dict | None, *, to_string: bool = False):"""Sanitize a given EditorJS JSON definitions.Look for not allowed URLs, replaced them with `invalid` value, and clean valid ones.diff --git a/saleor/attribute/models/base.py b/saleor/attribute/models/base.pyindex 161a5f4662..650d11db28 100644--- a/saleor/attribute/models/base.py+++ b/saleor/attribute/models/base.py@@ -90,7 +90,7 @@ class AttributeQuerySet(BaseAttributeQuerySet[T]):id_field = F(f"{m2m_field_name}__id")if asc:sort_method = sort_order_field.asc(nulls_last=True)- id_sort: Union[OrderBy, F] = id_field+ id_sort: OrderBy | F = id_fieldelse:sort_method = sort_order_field.desc(nulls_first=True)id_sort = id_field.desc()diff --git a/saleor/attribute/tests/fixtures/attribute.py b/saleor/attribute/tests/fixtures/attribute.pyindex 6258d6fe85..4dcc2738f9 100644--- a/saleor/attribute/tests/fixtures/attribute.py+++ b/saleor/attribute/tests/fixtures/attribute.py@@ -96,7 +96,7 @@ def attribute_values_generator(attribute_generator):value=value,)for slug, name, ext_ref, value in zip(- slugs, names, external_references, values+ slugs, names, external_references, values, strict=False)],ignore_conflicts=True,diff --git a/saleor/attribute/utils.py b/saleor/attribute/utils.pyindex fc787a358f..934539acac 100644--- a/saleor/attribute/utils.py+++ b/saleor/attribute/utils.py@@ -1,6 +1,5 @@from collections import defaultdictfrom functools import reduce-from typing import Unionfrom django.db.models import Exists, OuterRef, Q@@ -17,7 +16,7 @@ from .models import (AttributeVariant,)-T_INSTANCE = Union[Product, ProductVariant, Page]+T_INSTANCE = Product | ProductVariant | Pageinstance_to_function_variables_mapping = {@@ -102,7 +101,7 @@ def _associate_attribute_to_instance(assignments = []if isinstance(instance, ProductVariant):prod_type_id = instance.product.product_type_id- attribute_filter: dict[str, Union[int, list[int]]] = {+ attribute_filter: dict[str, int | list[int]] = {"attribute_id__in": list(attr_val_map.keys()),"product_type_id": prod_type_id,}diff --git a/saleor/channel/tests/fixtures/channel.py b/saleor/channel/tests/fixtures/channel.pyindex a8c502081f..5b6df27037 100644--- a/saleor/channel/tests/fixtures/channel.py+++ b/saleor/channel/tests/fixtures/channel.py@@ -87,7 +87,7 @@ def channels_for_benchmark(address):]created_channels = Channel.objects.bulk_create(channels)- for channel, warehouse in zip(created_channels, created_warehouses):+ for channel, warehouse in zip(created_channels, created_warehouses, strict=False):channel.warehouses.add(warehouse)return created_channelsdiff --git a/saleor/checkout/actions.py b/saleor/checkout/actions.pyindex 8a9160cce4..7e465f7341 100644--- a/saleor/checkout/actions.py+++ b/saleor/checkout/actions.py@@ -152,7 +152,7 @@ def call_checkout_info_event(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"] = None,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,) -> None:checkout = checkout_info.checkoutif webhook_event_map is None:diff --git a/saleor/checkout/base_calculations.py b/saleor/checkout/base_calculations.pyindex 7da5159c23..dbbe8a68db 100644--- a/saleor/checkout/base_calculations.py+++ b/saleor/checkout/base_calculations.py@@ -6,7 +6,7 @@ taxes (Money instead of TaxedMoney). If you don't need pre-taxed prices use funcfrom calculations.py."""-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom prices import Money@@ -87,7 +87,7 @@ def calculate_undiscounted_base_line_unit_price(def base_checkout_delivery_price(checkout_info: "CheckoutInfo",- lines: Optional[list["CheckoutLineInfo"]] = None,+ lines: list["CheckoutLineInfo"] | None = None,include_voucher: bool = True,) -> Money:"""Calculate base (untaxed) price for any kind of delivery method."""@@ -113,7 +113,7 @@ def base_checkout_delivery_price(def base_checkout_undiscounted_delivery_price(checkout_info: "CheckoutInfo",- lines: Optional[list["CheckoutLineInfo"]] = None,+ lines: list["CheckoutLineInfo"] | None = None,) -> Money:"""Calculate base (untaxed) undiscounted price for any kind of delivery method."""from .fetch import ShippingMethodInfo@@ -132,7 +132,7 @@ def base_checkout_undiscounted_delivery_price(def calculate_base_price_for_shipping_method(checkout_info: "CheckoutInfo",shipping_method_info: "ShippingMethodInfo",- lines: Optional[list["CheckoutLineInfo"]] = None,+ lines: list["CheckoutLineInfo"] | None = None,) -> Money:"""Return checkout shipping price."""from .fetch import CheckoutLineInfodiff --git a/saleor/checkout/calculations.py b/saleor/checkout/calculations.pyindex cca51ad220..272599da92 100644--- a/saleor/checkout/calculations.py+++ b/saleor/checkout/calculations.py@@ -51,7 +51,7 @@ def checkout_shipping_price(lines: list["CheckoutLineInfo"],address: Optional["Address"],database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> "TaxedMoney":"""Return checkout shipping price.@@ -100,7 +100,7 @@ def checkout_subtotal(lines: list["CheckoutLineInfo"],address: Optional["Address"],database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> "TaxedMoney":"""Return the total cost of all the checkout lines, taxes included.@@ -126,7 +126,7 @@ def calculate_checkout_total_with_gift_cards(lines: list["CheckoutLineInfo"],address: Optional["Address"],database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> "TaxedMoney":if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -149,7 +149,7 @@ def checkout_total(lines: list["CheckoutLineInfo"],address: Optional["Address"],database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> "TaxedMoney":"""Return the total cost of the checkout.@@ -179,7 +179,7 @@ def checkout_line_total(lines: list["CheckoutLineInfo"],checkout_line_info: "CheckoutLineInfo",database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> TaxedMoney:"""Return the total price of provided line, taxes included.@@ -208,7 +208,7 @@ def checkout_line_unit_price(lines: list["CheckoutLineInfo"],checkout_line_info: "CheckoutLineInfo",database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> TaxedMoney:"""Return the unit price of provided line, taxes included.@@ -301,7 +301,7 @@ def _fetch_checkout_prices_if_expired(address: Optional["Address"] = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> tuple["CheckoutInfo", list["CheckoutLineInfo"]]:"""Fetch checkout prices with taxes.@@ -442,7 +442,7 @@ def _fetch_checkout_prices_if_expired(def _calculate_and_add_tax(tax_calculation_strategy: str,- tax_app_identifier: Optional[str],+ tax_app_identifier: str | None,checkout: "Checkout",manager: "PluginsManager",checkout_info: "CheckoutInfo",@@ -450,7 +450,7 @@ def _calculate_and_add_tax(prices_entered_with_tax: bool,address: Optional["Address"] = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,):from .utils import log_address_if_validation_skipped_for_checkout@@ -505,7 +505,7 @@ def _call_plugin_or_tax_app(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"] = None,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,):from .utils import log_address_if_validation_skipped_for_checkout@@ -576,13 +576,13 @@ def _calculate_checkout_subtotal(lines, currency):def _apply_tax_data(checkout: "Checkout",lines: list["CheckoutLineInfo"],- tax_data: Optional[TaxData],+ tax_data: TaxData | None,) -> None:if not tax_data:returncurrency = checkout.currency- for line_info, tax_line_data in zip(lines, tax_data.lines):+ for line_info, tax_line_data in zip(lines, tax_data.lines, strict=False):line = line_info.lineline.total_price = quantize_price(@@ -612,7 +612,7 @@ def _apply_tax_data_from_plugins(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> None:for line_info in lines:line = line_info.line@@ -698,10 +698,10 @@ def fetch_checkout_data(lines: list["CheckoutLineInfo"],address: Optional["Address"] = None,force_update: bool = False,- checkout_transactions: Optional[Iterable["TransactionItem"]] = None,+ checkout_transactions: Iterable["TransactionItem"] | None = None,force_status_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,):"""Fetch checkout data.diff --git a/saleor/checkout/checkout_cleaner.py b/saleor/checkout/checkout_cleaner.pyindex 5b10901bfb..5ed345ca5d 100644--- a/saleor/checkout/checkout_cleaner.py+++ b/saleor/checkout/checkout_cleaner.py@@ -1,6 +1,6 @@import datetimefrom collections.abc import Iterable-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKINGimport graphenefrom django.core.exceptions import ValidationError@@ -24,11 +24,9 @@ if TYPE_CHECKING:def clean_checkout_shipping(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],- error_code: Union[- type[CheckoutErrorCode],- type[PaymentErrorCode],- type[OrderCreateFromCheckoutErrorCode],- ],+ error_code: type[CheckoutErrorCode]+ | type[PaymentErrorCode]+ | type[OrderCreateFromCheckoutErrorCode],):delivery_method_info = checkout_info.delivery_method_info@@ -65,11 +63,9 @@ def clean_checkout_shipping(def clean_billing_address(checkout_info: "CheckoutInfo",- error_code: Union[- type[CheckoutErrorCode],- type[PaymentErrorCode],- type[OrderCreateFromCheckoutErrorCode],- ],+ error_code: type[CheckoutErrorCode]+ | type[PaymentErrorCode]+ | type[OrderCreateFromCheckoutErrorCode],):if not checkout_info.billing_address:raise ValidationError(@@ -87,7 +83,7 @@ def clean_checkout_payment(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],error_code: type[CheckoutErrorCode],- last_payment: Optional[payment_models.Payment],+ last_payment: payment_models.Payment | None,):clean_billing_address(checkout_info, error_code)if not is_fully_paid(manager, checkout_info, lines):diff --git a/saleor/checkout/complete_checkout.py b/saleor/checkout/complete_checkout.pyindex 953db2e05a..16205c844b 100644--- a/saleor/checkout/complete_checkout.py+++ b/saleor/checkout/complete_checkout.py@@ -2,7 +2,7 @@ import datetimeimport loggingfrom collections.abc import Iterablefrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Optional, Union, cast+from typing import TYPE_CHECKING, Any, Optional, castfrom uuid import UUIDfrom django.conf import settings@@ -147,8 +147,8 @@ def _release_checkout_voucher_usage(checkout: "Checkout",voucher_code: Optional["VoucherCode"],voucher: Optional["Voucher"],- user_email: Optional[str],- checkout_update_fields: Optional[list[str]] = None,+ user_email: str | None,+ checkout_update_fields: list[str] | None = None,):if not checkout.is_voucher_usage_increased:return@@ -234,8 +234,8 @@ def _create_line_for_order(checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],checkout_line_info: "CheckoutLineInfo",- products_translation: dict[int, Optional[str]],- variants_translation: dict[int, Optional[str]],+ products_translation: dict[int, str | None],+ variants_translation: dict[int, str | None],prices_entered_with_tax: bool,) -> OrderLineInfo:"""Create a line for the given order.@@ -393,8 +393,8 @@ def _create_line_for_order(def _get_unit_discount_reason(- voucher_code: Optional[str], is_line_voucher_code: bool, is_shipping_voucher: bool-) -> Optional[str]:+ voucher_code: str | None, is_line_voucher_code: bool, is_shipping_voucher: bool+) -> str | None:if not voucher_code or is_shipping_voucher:return Nonereturn (@@ -622,8 +622,8 @@ def _create_order(app: Optional["App"],manager: "PluginsManager",site_settings: Optional["SiteSettings"] = None,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,) -> Order:"""Create an order from the checkout.@@ -796,7 +796,7 @@ def _prepare_checkout_with_transactions(manager: "PluginsManager",checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],- redirect_url: Optional[str],+ redirect_url: str | None,):"""Prepare checkout object with transactions to complete the checkout process."""clean_billing_address(checkout_info, CheckoutErrorCode)@@ -841,8 +841,8 @@ def _prepare_checkout_with_payment(manager: "PluginsManager",checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],- redirect_url: Optional[str],- payment: Optional[Payment],+ redirect_url: str | None,+ payment: Payment | None,):"""Prepare checkout object with payment to complete the checkout process."""clean_checkout_payment(@@ -897,9 +897,9 @@ def _get_order_data(def _process_payment(checkout_info: CheckoutInfo,payment: Payment,- customer_id: Optional[str],+ customer_id: str | None,store_source: bool,- payment_data: Optional[dict],+ payment_data: dict | None,manager: "PluginsManager",channel_slug: str,voucher_code: Optional["VoucherCode"] = None,@@ -941,7 +941,7 @@ def complete_checkout_pre_payment_part(user,site_settings=None,redirect_url=None,-) -> tuple[Optional[Payment], Optional[str], dict]:+) -> tuple[Payment | None, str | None, dict]:"""Logic required to process checkout before payment.Should be used with transaction_with_commit_on_errors, as there is a possibility@@ -984,16 +984,16 @@ def complete_checkout_post_payment_part(manager: "PluginsManager",checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],- payment: Optional[Payment],- txn: Optional[Transaction],+ payment: Payment | None,+ txn: Transaction | None,order_data,user,app,site_settings=None,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,-) -> tuple[Optional[Order], bool, dict]:+) -> tuple[Order | None, bool, dict]:action_required = Falseaction_data: dict[str, str] = {}@@ -1088,7 +1088,7 @@ def _create_order_lines_from_checkout_lines(checkout_info: CheckoutInfo,lines: list[CheckoutLineInfo],manager: "PluginsManager",- order_pk: Union[str, UUID],+ order_pk: str | UUID,prices_entered_with_tax: bool,) -> list[OrderLineInfo]:order_lines_info = _create_lines_for_order(@@ -1183,7 +1183,7 @@ def _post_create_order_actions(checkout_info: "CheckoutInfo",order_lines_info: list["OrderLineInfo"],manager: "PluginsManager",- user: Optional[User],+ user: User | None,app: Optional["App"],site_settings: "SiteSettings",is_automatic_completion: bool,@@ -1219,10 +1219,10 @@ def _create_order_from_checkout(checkout_info: CheckoutInfo,checkout_lines_info: list[CheckoutLineInfo],manager: "PluginsManager",- user: Optional[User],+ user: User | None,app: Optional["App"],- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,):from ..order.utils import add_gift_cards_to_order@@ -1403,8 +1403,8 @@ def create_order_from_checkout(user: Optional["User"],app: Optional["App"],delete_checkout: bool = True,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,) -> Order:"""Crate order from checkout.@@ -1501,11 +1501,11 @@ def complete_checkout(user: Optional["User"],app: Optional["App"],site_settings: Optional["SiteSettings"] = None,- redirect_url: Optional[str] = None,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ redirect_url: str | None = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,-) -> tuple[Optional[Order], bool, dict]:+) -> tuple[Order | None, bool, dict]:checkout = checkout_info.checkouttransactions = checkout_info.checkout.payment_transactions.all()@@ -1577,11 +1577,11 @@ def complete_checkout_with_transaction(lines: list["CheckoutLineInfo"],user: Optional["User"],app: Optional["App"],- redirect_url: Optional[str] = None,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ redirect_url: str | None = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,-) -> Optional[Order]:+) -> Order | None:try:_prepare_checkout_with_transactions(manager=manager,@@ -1625,10 +1625,10 @@ def complete_checkout_with_payment(app,site_settings=None,redirect_url=None,- metadata_list: Optional[list] = None,- private_metadata_list: Optional[list] = None,+ metadata_list: list | None = None,+ private_metadata_list: list | None = None,is_automatic_completion: bool = False,-) -> tuple[Optional[Order], bool, dict]:+) -> tuple[Order | None, bool, dict]:"""Logic required to finalize the checkout and convert it to order.Should be used with transaction_with_commit_on_errors, as there is a possibility@@ -1787,7 +1787,7 @@ def _complete_checkout_fail_handler(*,voucher_code: Optional["VoucherCode"] = None,voucher: Optional["Voucher"] = None,- payment: Optional[Payment] = None,+ payment: Payment | None = None,) -> None:"""Handle the case when the checkout completion failed.diff --git a/saleor/checkout/fetch.py b/saleor/checkout/fetch.pyindex b820f7ff2e..8e68f69b29 100644--- a/saleor/checkout/fetch.py+++ b/saleor/checkout/fetch.py@@ -107,7 +107,7 @@ class CheckoutInfo:voucher: Optional["Voucher"] = Nonevoucher_code: Optional["VoucherCode"] = Nonedatabase_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME- pregenerated_payloads_for_excluded_shipping_method: Optional[dict] = None+ pregenerated_payloads_for_excluded_shipping_method: dict | None = None@cached_propertydef all_shipping_methods(self) -> list["ShippingMethodData"]:@@ -144,7 +144,7 @@ class CheckoutInfo:from ..webhook.transport.shipping import convert_to_app_id_with_identifierfrom .utils import get_external_shipping_id- delivery_method: Optional[Union[ShippingMethodData, Warehouse]] = None+ delivery_method: ShippingMethodData | Warehouse | None = Noneif self.shipping_method:# Find listing for the currently selected shipping method@@ -198,18 +198,18 @@ class CheckoutInfo:return self.checkout.country.codereturn address.country.code- def get_customer_email(self) -> Optional[str]:+ def get_customer_email(self) -> str | None:return self.user.email if self.user else self.checkout.email@dataclass(frozen=True)class DeliveryMethodBase:- delivery_method: Optional[Union["ShippingMethodData", "Warehouse"]] = None+ delivery_method: Union["ShippingMethodData", "Warehouse"] | None = Noneshipping_address: Optional["Address"] = Nonestore_as_customer_address: bool = False@property- def warehouse_pk(self) -> Optional[UUID]:+ def warehouse_pk(self) -> UUID | None:pass@property@@ -221,7 +221,7 @@ class DeliveryMethodBase:return False@property- def delivery_method_name(self) -> dict[str, Optional[str]]:+ def delivery_method_name(self) -> dict[str, str | None]:return {"shipping_method_name": None}def get_warehouse_filter_lookup(self) -> dict[str, Any]:@@ -241,7 +241,7 @@ class ShippingMethodInfo(DeliveryMethodBase):store_as_customer_address: bool = True@property- def delivery_method_name(self) -> dict[str, Optional[str]]:+ def delivery_method_name(self) -> dict[str, str | None]:return {"shipping_method_name": str(self.delivery_method.name)}@property@@ -281,7 +281,7 @@ class CollectionPointInfo(DeliveryMethodBase):)@property- def delivery_method_name(self) -> dict[str, Optional[str]]:+ def delivery_method_name(self) -> dict[str, str | None]:return {"collection_point_name": str(self.delivery_method)}def get_warehouse_filter_lookup(self) -> dict[str, Any]:@@ -306,7 +306,7 @@ class CollectionPointInfo(DeliveryMethodBase):@singledispatchdef get_delivery_method_info(- delivery_method: Optional[Union["ShippingMethodData", "Warehouse"]],+ delivery_method: Union["ShippingMethodData", "Warehouse"] | None,address: Optional["Address"] = None,) -> DeliveryMethodBase:if delivery_method is None:@@ -357,7 +357,7 @@ def fetch_checkout_lines()lines_info = []unavailable_variant_pks = []- product_channel_listing_mapping: dict[int, Optional[ProductChannelListing]] = {}+ product_channel_listing_mapping: dict[int, ProductChannelListing | None] = {}channel = checkout.channelfor line in lines:@@ -495,9 +495,7 @@ def fetch_checkout_info(checkout: "Checkout",lines: list[CheckoutLineInfo],manager: "PluginsManager",- shipping_channel_listings: Optional[- Iterable["ShippingMethodChannelListing"]- ] = None,+ shipping_channel_listings: Iterable["ShippingMethodChannelListing"] | None = None,voucher: Optional["Voucher"] = None,voucher_code: Optional["VoucherCode"] = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex 57eb29aef2..89259af802 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -212,7 +212,7 @@ class Checkout(models.Model):def __iter__(self):return iter(self.lines.all())- def get_customer_email(self) -> Optional[str]:+ def get_customer_email(self) -> str | None:return self.user.email if self.user else self.emaildef is_shipping_required(self) -> bool:diff --git a/saleor/checkout/payment_utils.py b/saleor/checkout/payment_utils.pyindex aa2c30005d..f6df8e9aae 100644--- a/saleor/checkout/payment_utils.py+++ b/saleor/checkout/payment_utils.py@@ -1,7 +1,6 @@"""Checkout-related utility functions."""from collections.abc import Iterable-from typing import Optionalfrom django.conf import settingsfrom django.db.models import Exists, Q@@ -84,7 +83,7 @@ def update_checkout_payment_statuses(checkout: Checkout,checkout_total_gross: Money,checkout_has_lines: bool,- checkout_transactions: Optional[Iterable["TransactionItem"]] = None,+ checkout_transactions: Iterable["TransactionItem"] | None = None,save: bool = True,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):diff --git a/saleor/checkout/problems.py b/saleor/checkout/problems.pyindex 1ad0759b23..683af6500d 100644--- a/saleor/checkout/problems.py+++ b/saleor/checkout/problems.py@@ -2,7 +2,6 @@ import datetimefrom collections import defaultdictfrom collections.abc import Iterablefrom dataclasses import dataclass-from typing import Optional, Unionfrom ..graphql.channel import ChannelContextfrom ..product.models import ProductChannelListing, ProductVariant@@ -15,7 +14,7 @@ from .models import CheckoutLineclass CheckoutLineProblemInsufficientStock:available_quantity: intline: CheckoutLine- variant: Optional[ChannelContext[ProductVariant]] = None+ variant: ChannelContext[ProductVariant] | None = None@dataclass@@ -23,12 +22,12 @@ class CheckoutLineProblemVariantNotAvailable:line: CheckoutLine-CHECKOUT_LINE_PROBLEM_TYPE = Union[- CheckoutLineProblemInsufficientStock, CheckoutLineProblemVariantNotAvailable-]-CHECKOUT_PROBLEM_TYPE = Union[- CheckoutLineProblemInsufficientStock, CheckoutLineProblemVariantNotAvailable-]+CHECKOUT_LINE_PROBLEM_TYPE = (+ CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable+)+CHECKOUT_PROBLEM_TYPE = (+ CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable+)VARIANT_ID = intPRODUCT_ID = intdiff --git a/saleor/checkout/tests/fixtures/checkout_with_prices.py b/saleor/checkout/tests/fixtures/checkout_with_prices.pyindex 4d7629fb1e..a0e01019ad 100644--- a/saleor/checkout/tests/fixtures/checkout_with_prices.py+++ b/saleor/checkout/tests/fixtures/checkout_with_prices.py@@ -29,7 +29,7 @@ def checkout_with_prices(lines_info, _ = fetch_checkout_lines(checkout_with_items)checkout_info = fetch_checkout_info(checkout_with_items, lines_info, manager)- for line, line_info in zip(lines, lines_info):+ for line, line_info in zip(lines, lines_info, strict=False):line.total_price_net_amount = base_calculations.calculate_base_line_total_price(line_info).amountdiff --git a/saleor/checkout/tests/test_calculations.py b/saleor/checkout/tests/test_calculations.pyindex b76681ad5f..db0df00ede 100644--- a/saleor/checkout/tests/test_calculations.py+++ b/saleor/checkout/tests/test_calculations.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import Literal, Union+from typing import Literalfrom unittest.mock import Mock, patchimport pytest@@ -83,7 +83,7 @@ def test_apply_tax_data(checkout_with_items, checkout_lines, tax_data):quantize_price(tax_data.shipping_price_gross_amount, checkout.currency))- for line, tax_line in zip(lines, tax_data.lines):+ for line, tax_line in zip(lines, tax_data.lines, strict=False):assert str(line.total_price.net.amount) == str(quantize_price(tax_line.total_net_amount, checkout.currency))@@ -111,7 +111,7 @@ DISCOUNT = Decimal("1.5")def get_checkout_taxed_prices_data(- obj: Union[TaxData, TaxLineData],+ obj: TaxData | TaxLineData,attr: Literal["total", "shipping_price"],currency: str,) -> TaxedMoney:@@ -123,7 +123,7 @@ def get_checkout_taxed_prices_data(def get_taxed_money(- obj: Union[TaxData, TaxLineData],+ obj: TaxData | TaxLineData,attr: Literal["total", "shipping_price"],currency: str,) -> TaxedMoney:@@ -155,7 +155,8 @@ def test_fetch_checkout_data_plugins(line.tax_rate / 100,)for line in tax_data.lines- ]+ ],+ strict=False,)plugins_manager.calculate_checkout_line_total = Mock(side_effect=totals * 3)plugins_manager.get_checkout_line_tax_rate = Mock(side_effect=tax_rates)@@ -183,7 +184,9 @@ def test_fetch_checkout_data_plugins(# thencheckout_with_items.refresh_from_db()- for checkout_line, tax_line in zip(checkout_with_items.lines.all(), tax_data.lines):+ for checkout_line, tax_line in zip(+ checkout_with_items.lines.all(), tax_data.lines, strict=False+ ):total_price = get_taxed_money(tax_line, "total", currency)assert checkout_line.total_price == total_priceassert checkout_line.tax_rate == tax_line.tax_rate / 100@@ -404,7 +407,9 @@ def test_fetch_checkout_data_webhooks_success(tax_data, "shipping_price", currency)assert checkout_with_items.shipping_tax_rate == tax_data.shipping_tax_rate / 100- for checkout_line, tax_line in zip(checkout_with_items.lines.all(), tax_data.lines):+ for checkout_line, tax_line in zip(+ checkout_with_items.lines.all(), tax_data.lines, strict=False+ ):assert checkout_line.total_price == get_taxed_money(tax_line, "total", currency)assert checkout_line.tax_rate == tax_line.tax_rate / 100diff --git a/saleor/checkout/tests/test_tasks.py b/saleor/checkout/tests/test_tasks.pyindex a9adb89734..dc48328154 100644--- a/saleor/checkout/tests/test_tasks.py+++ b/saleor/checkout/tests/test_tasks.py@@ -527,9 +527,9 @@ def test_delete_checkouts_until_done(mocked_task: mock.MagicMock, channel_USD):)assert deleted_count == 6assert has_more is True- assert (- Checkout.objects.count() == 1- ), "Should have deleted 6 checkouts thus only 1 should be left"+ assert Checkout.objects.count() == 1, (+ "Should have deleted 6 checkouts thus only 1 should be left"+ )# Should have triggered a new task to delete more checkoutsmocked_task.assert_called_once_with(**task_params, invocation_count=2)@@ -541,9 +541,9 @@ def test_delete_checkouts_until_done(mocked_task: mock.MagicMock, channel_USD):)assert deleted_count == 1assert has_more is False- assert (- Checkout.objects.count() == 0- ), "Should have deleted the last remaining checkout (one)"+ assert Checkout.objects.count() == 0, (+ "Should have deleted the last remaining checkout (one)"+ )# Shouldn't have triggered a new task as nothing is left to be deleted.mocked_task.assert_not_called()diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex 158928dfca..d15b48be0b 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -163,7 +163,7 @@ def get_user_checkout(user: User,checkout_queryset=None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> Optional[Checkout]:+) -> Checkout | None:if not checkout_queryset:checkout_queryset = Checkout.objects.using(database_connection_name).all()return checkout_queryset.filter(user=user, channel__is_active=True).first()@@ -176,9 +176,9 @@ def check_variant_in_stock(quantity: int = 1,replace: bool = False,check_quantity: bool = True,- checkout_lines: Optional[list["CheckoutLine"]] = None,+ checkout_lines: list["CheckoutLine"] | None = None,check_reservations: bool = False,-) -> tuple[int, Optional[CheckoutLine]]:+) -> tuple[int, CheckoutLine | None]:"""Check if a given variant is in stock and return the new quantity + line."""line = checkout.lines.filter(variant=variant).first()line_quantity = 0 if line is None else line.quantity@@ -287,7 +287,7 @@ def add_variants_to_checkout(channel,replace=False,replace_reservations=False,- reservation_length: Optional[int] = None,+ reservation_length: int | None = None,raise_error_for_missing_lines=False,):"""Add variants to checkout.@@ -623,7 +623,7 @@ def get_voucher_for_checkout(with_lock: bool = False,with_prefetch: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> tuple[Optional[Voucher], Optional[VoucherCode]]:+) -> tuple[Voucher | None, VoucherCode | None]:"""Return voucher assigned to checkout."""if checkout.voucher_code is not None:try:@@ -675,7 +675,7 @@ def get_voucher_for_checkout(def get_voucher_for_checkout_info(checkout_info: "CheckoutInfo", with_lock: bool = False, with_prefetch: bool = False-) -> tuple[Optional[Voucher], Optional[VoucherCode]]:+) -> tuple[Voucher | None, VoucherCode | None]:"""Return voucher with voucher code saved in checkout if active or None."""checkout = checkout_info.checkoutreturn get_voucher_for_checkout(@@ -935,7 +935,7 @@ def get_valid_internal_shipping_methods_for_checkout(lines: list["CheckoutLineInfo"],subtotal: "Money",shipping_channel_listings: Iterable["ShippingMethodChannelListing"],- country_code: Optional[str] = None,+ country_code: str | None = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> list[ShippingMethodData]:if not is_shipping_required(lines):diff --git a/saleor/core/apps.py b/saleor/core/apps.pyindex d77c5c3267..37e1796a73 100644--- a/saleor/core/apps.py+++ b/saleor/core/apps.py@@ -1,4 +1,4 @@-from typing import Callable, Optional+from collections.abc import Callablefrom django.apps import AppConfigfrom django.conf import settings@@ -29,7 +29,7 @@ class CoreAppConfig(AppConfig):except ImportError as e:raise ImportError(f"Failed to import JWT manager: {e}.") from e- validate_method: Optional[Callable[[], None]] = getattr(+ validate_method: Callable[[], None] | None = getattr(jwt_manager, "validate_configuration", None)if validate_method is None:diff --git a/saleor/core/auth.py b/saleor/core/auth.pyindex 6cf42c59f4..4ffb3e7801 100644--- a/saleor/core/auth.py+++ b/saleor/core/auth.py@@ -1,5 +1,3 @@-from typing import Optional-from django.http import HttpRequestSALEOR_AUTH_HEADER = "HTTP_AUTHORIZATION_BEARER"@@ -7,8 +5,8 @@ DEFAULT_AUTH_HEADER = "HTTP_AUTHORIZATION"AUTH_HEADER_PREFIXES = ["JWT", "BEARER"]-def get_token_from_request(request: HttpRequest) -> Optional[str]:- auth_token: Optional[str] = request.META.get(SALEOR_AUTH_HEADER)+def get_token_from_request(request: HttpRequest) -> str | None:+ auth_token: str | None = request.META.get(SALEOR_AUTH_HEADER)if not auth_token:auth = request.META.get(DEFAULT_AUTH_HEADER, "").split(maxsplit=1)diff --git a/saleor/core/db/fields.py b/saleor/core/db/fields.pyindex 4229771d2d..81e67ba023 100644--- a/saleor/core/db/fields.py+++ b/saleor/core/db/fields.py@@ -1,5 +1,5 @@import json-from typing import Callable+from collections.abc import Callablefrom django.db.models import JSONFieldfrom django.db.models.expressions import Expressiondiff --git a/saleor/core/exceptions.py b/saleor/core/exceptions.pyindex d77b4a2bbf..f5399d73a8 100644--- a/saleor/core/exceptions.py+++ b/saleor/core/exceptions.py@@ -1,7 +1,7 @@from collections.abc import Iterablefrom dataclasses import dataclassfrom enum import Enum-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKING, Optionalfrom uuid import UUIDfrom graphql import GraphQLError@@ -20,7 +20,7 @@ class InsufficientStockData:variant: Optional["ProductVariant"] = Nonecheckout_line: Optional["CheckoutLine"] = Noneorder_line: Optional["OrderLine"] = None- warehouse_pk: Union[UUID, None] = None+ warehouse_pk: UUID | None = Noneclass NonExistingCheckoutLines(Exception):@@ -58,7 +58,7 @@ class ProductNotPublished(Exception):class PermissionDenied(Exception):- def __init__(self, message=None, *, permissions: Optional[Iterable[Enum]] = None):+ def __init__(self, message=None, *, permissions: Iterable[Enum] | None = None):if not message:if permissions:permission_list = ", ".join(p.name for p in permissions)diff --git a/saleor/core/jwt.py b/saleor/core/jwt.pyindex 98a63ced93..828cb6a285 100644--- a/saleor/core/jwt.py+++ b/saleor/core/jwt.py@@ -1,6 +1,6 @@import datetimefrom collections.abc import Iterable-from typing import Any, Optional+from typing import Anyimport grapheneimport jwt@@ -29,7 +29,7 @@ JWT_OWNER_FIELD = "owner"def jwt_base_payload(- exp_delta: Optional[datetime.timedelta], token_owner: str+ exp_delta: datetime.timedelta | None, token_owner: str) -> dict[str, Any]:utc_now = datetime.datetime.now(tz=datetime.UTC)@@ -46,8 +46,8 @@ def jwt_base_payload(def jwt_user_payload(user: User,token_type: str,- exp_delta: Optional[datetime.timedelta],- additional_payload: Optional[dict[str, Any]] = None,+ exp_delta: datetime.timedelta | None,+ additional_payload: dict[str, Any] | None = None,token_owner: str = JWT_SALEOR_OWNER_NAME,) -> dict[str, Any]:payload = jwt_base_payload(exp_delta, token_owner)@@ -72,7 +72,7 @@ def jwt_encode(payload: dict[str, Any]) -> str:def jwt_decode_with_exception_handler(token: str, verify_expiration=settings.JWT_EXPIRE-) -> Optional[dict[str, Any]]:+) -> dict[str, Any] | None:try:return jwt_decode(token, verify_expiration=verify_expiration)except jwt.PyJWTError:@@ -92,7 +92,7 @@ def create_token(payload: dict[str, Any], exp_delta: datetime.timedelta) -> str:def create_access_token(- user: User, additional_payload: Optional[dict[str, Any]] = None+ user: User, additional_payload: dict[str, Any] | None = None) -> str:payload = jwt_user_payload(user, JWT_ACCESS_TYPE, settings.JWT_TTL_ACCESS, additional_payload@@ -101,7 +101,7 @@ def create_access_token(def create_refresh_token(- user: User, additional_payload: Optional[dict[str, Any]] = None+ user: User, additional_payload: dict[str, Any] | None = None) -> str:payload = jwt_user_payload(user,@@ -112,7 +112,7 @@ def create_refresh_token(return jwt_encode(payload)-def get_user_from_payload(payload: dict[str, Any], request=None) -> Optional[User]:+def get_user_from_payload(payload: dict[str, Any], request=None) -> User | None:# TODO: dataloaderuser = User.objects.filter(email=payload["email"], is_active=True).first()user_jwt_token = payload.get("token")@@ -139,7 +139,7 @@ def is_saleor_token(token: str) -> bool:return True-def get_user_from_access_payload(payload: dict, request=None) -> Optional[User]:+def get_user_from_access_payload(payload: dict, request=None) -> User | None:jwt_type = payload.get("type")if jwt_type not in [JWT_ACCESS_TYPE, JWT_THIRDPARTY_ACCESS_TYPE]:raise jwt.InvalidTokenError(@@ -163,7 +163,7 @@ def _create_access_token_for_third_party_actions(permissions: Iterable["Permission"],user: "User",app: "App",- extra: Optional[dict[str, Any]] = None,+ extra: dict[str, Any] | None = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):app_permission_enums = get_permission_names(permissions)diff --git a/saleor/core/jwt_manager.py b/saleor/core/jwt_manager.pyindex 580c6083b7..6c4b641885 100644--- a/saleor/core/jwt_manager.py+++ b/saleor/core/jwt_manager.py@@ -2,7 +2,7 @@ import jsonimport loggingfrom functools import cachefrom os.path import exists, join-from typing import Optional, Union, cast+from typing import castimport jwtfrom authlib.jose import JsonWebKey@@ -20,7 +20,7 @@ from .utils import build_absolute_uri, get_domainlogger = logging.getLogger(__name__)-PUBLIC_KEY: Optional[rsa.RSAPublicKey] = None+PUBLIC_KEY: rsa.RSAPublicKey | None = Noneclass JWTManagerBase:@@ -87,11 +87,11 @@ class JWTManager(JWTManagerBase):return cls._get_private_key(pem)@classmethod- def _get_private_key(cls, pem: Union[str, bytes]) -> rsa.RSAPrivateKey:+ def _get_private_key(cls, pem: str | bytes) -> rsa.RSAPrivateKey:if isinstance(pem, str):pem = pem.encode("utf-8")- password: Union[str, bytes, None] = settings.RSA_PRIVATE_PASSWORD+ password: str | bytes | None = settings.RSA_PRIVATE_PASSWORDif isinstance(password, str):password = password.encode("utf-8")return cast(diff --git a/saleor/core/models.py b/saleor/core/models.pyindex f48c58f91a..93e15ab211 100644--- a/saleor/core/models.py+++ b/saleor/core/models.py@@ -158,7 +158,7 @@ class EventPayloadManager(models.Manager["EventPayload"]):self, objs: Iterable["EventPayload"], payloads=Iterable[str]) -> list["EventPayload"]:created_objs = self.bulk_create(objs)- for obj, payload_data in zip(created_objs, payloads):+ for obj, payload_data in zip(created_objs, payloads, strict=False):obj.save_payload_file(payload_data, save_instance=False)self.bulk_update(created_objs, ["payload_file"])return created_objsdiff --git a/saleor/core/notify.py b/saleor/core/notify.pyindex a1675d5e08..91c7a7bdf8 100644--- a/saleor/core/notify.py+++ b/saleor/core/notify.py@@ -1,5 +1,5 @@+from collections.abc import Callablefrom functools import cache-from typing import Callableclass NotifyHandler:diff --git a/saleor/core/payments.py b/saleor/core/payments.pyindex f1e85c5665..63127fe3a4 100644--- a/saleor/core/payments.py+++ b/saleor/core/payments.py@@ -16,10 +16,10 @@ class PaymentInterface(ABC):@abstractmethoddef list_payment_gateways(self,- currency: Optional[str] = None,+ currency: str | None = None,checkout_info: Optional["CheckoutInfo"] = None,- checkout_lines: Optional[list["CheckoutLineInfo"]] = None,- channel_slug: Optional[str] = None,+ checkout_lines: list["CheckoutLineInfo"] | None = None,+ channel_slug: str | None = None,active_only: bool = True,) -> list["PaymentGateway"]:passdiff --git a/saleor/core/postgres.py b/saleor/core/postgres.pyindex 45849c9a61..e249013e76 100644--- a/saleor/core/postgres.py+++ b/saleor/core/postgres.py@@ -1,5 +1,4 @@import logging-from typing import Optional, Unionfrom django.conf import settingsfrom django.contrib.postgres.search import (@@ -68,7 +67,7 @@ class FlatConcat(Expression):# If the maximum expression count is not limited and there are multiple thousand# values to join, PostgreSQL may reject the SQL statement with:# "django.db.utils.OperationalError: stack depth limit exceeded"- max_expression_count: Optional[int] = None+ max_expression_count: int | None = Nonesilent_drop_expression: bool = Falsedef __init__(self, *expressions, output_field=None):@@ -127,7 +126,7 @@ class FlatConcat(Expression):def as_sql(self, compiler, connection, **_extra_context):connection.ops.check_expression_support(self)sql_parts: list[str] = []- params: list[Optional[Union[str, int]]] = []+ params: list[str | int | None] = []for arg in self.source_expressions:arg_sql, arg_params = compiler.compile(arg)sql_parts.append(arg_sql)diff --git a/saleor/core/pricing/interface.py b/saleor/core/pricing/interface.pyindex 5b32023e7c..9cda0e1c0d 100644--- a/saleor/core/pricing/interface.py+++ b/saleor/core/pricing/interface.py@@ -31,7 +31,7 @@ class LineInfo:discounts: Iterable[Union["OrderLineDiscount", "CheckoutLineDiscount"]]rules_info: list["VariantPromotionRuleInfo"]voucher: Optional["Voucher"]- voucher_code: Optional[str]+ voucher_code: str | None@propertydef variant_discounted_price(self):diff --git a/saleor/core/templatetags/taxed_prices.py b/saleor/core/templatetags/taxed_prices.pyindex 5cdd946421..b5d0805b0f 100644--- a/saleor/core/templatetags/taxed_prices.py+++ b/saleor/core/templatetags/taxed_prices.py@@ -1,5 +1,3 @@-from typing import Union-from django import templatefrom prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange@@ -7,7 +5,7 @@ register = template.Library()def _get_display_price(- base: Union[TaxedMoney, TaxedMoneyRange], display_gross: bool+ base: TaxedMoney | TaxedMoneyRange, display_gross: bool) -> Money:"""Return the price amount that should be displayed based on settings."""if isinstance(base, TaxedMoneyRange):@@ -23,7 +21,7 @@ def _get_display_price(@register.inclusion_tag("price.html")def price(base, display_gross, html=True):- if isinstance(base, (TaxedMoney, TaxedMoneyRange)):+ if isinstance(base, TaxedMoney | TaxedMoneyRange):base = _get_display_price(base, display_gross)is_range = isinstance(base, MoneyRange)diff --git a/saleor/core/tests/test_postgresql_search.py b/saleor/core/tests/test_postgresql_search.pyindex e5ef8f2afd..91d2ac7ba2 100644--- a/saleor/core/tests/test_postgresql_search.py+++ b/saleor/core/tests/test_postgresql_search.py@@ -66,7 +66,7 @@ USERS = [("John", "Doe", "[email protected]"),]ORDER_IDS = [10, 45, 13]-ORDERS = [[pk] + list(user) for pk, user in zip(ORDER_IDS, USERS)]+ORDERS = [[pk] + list(user) for pk, user in zip(ORDER_IDS, USERS, strict=False)]def gen_address_for_user(first_name, last_name):diff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.pyindex d447333343..1d5aa293ea 100644--- a/saleor/core/utils/__init__.py+++ b/saleor/core/utils/__init__.py@@ -1,6 +1,6 @@import socketfrom collections.abc import Iterable-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKINGfrom urllib.parse import urljoin, urlparsefrom celery.utils.log import get_task_logger@@ -21,7 +21,7 @@ if TYPE_CHECKING:from django.utils.safestring import SafeText-def get_domain(site: Optional[Site] = None) -> str:+def get_domain(site: Site | None = None) -> str:if settings.PUBLIC_URL:return urlparse(settings.PUBLIC_URL).netlocif site is None:@@ -29,7 +29,7 @@ def get_domain(site: Optional[Site] = None) -> str:return site.domain-def get_public_url(domain: Optional[str] = None) -> str:+def get_public_url(domain: str | None = None) -> str:if settings.PUBLIC_URL:return settings.PUBLIC_URLhost = domain or Site.objects.get_current().domain@@ -43,7 +43,7 @@ def is_ssl_enabled() -> bool:return settings.ENABLE_SSL-def build_absolute_uri(location: str, domain: Optional[str] = None) -> str:+def build_absolute_uri(location: str, domain: str | None = None) -> str:"""Create absolute uri from location.If provided location is absolute uri by itself, it returns unchanged value,@@ -138,7 +138,7 @@ def generate_unique_slug(def prepare_unique_slug(slug: str, slug_values: Iterable):"""Prepare unique slug value based on provided list of existing slug values."""- unique_slug: Union[SafeText, str] = slug+ unique_slug: SafeText | str = slugextension = 1while unique_slug in slug_values:diff --git a/saleor/core/utils/editorjs.py b/saleor/core/utils/editorjs.pyindex 7ad8690e59..82a7184676 100644--- a/saleor/core/utils/editorjs.py+++ b/saleor/core/utils/editorjs.py@@ -1,6 +1,6 @@import reimport warnings-from typing import Literal, Union, overload+from typing import Literal, overloadfrom django.utils.html import strip_tagsfrom urllib3.util import parse_url@@ -17,7 +17,7 @@ ITEM_TYPE_TO_CLEAN_FUNC_MAP = {@overloaddef clean_editor_js(- definitions: Union[dict, str, None], *, to_string: Literal[True]+ definitions: dict | str | None, *, to_string: Literal[True]) -> str: ...@@ -29,7 +29,7 @@ def clean_editor_js(definitions: dict) -> dict: ...def clean_editor_js(definitions: None) -> None: ...-def clean_editor_js(definitions, *, to_string=False) -> Union[dict, str, None]:+def clean_editor_js(definitions, *, to_string=False) -> dict | str | None:"""Sanitize a given EditorJS JSON definitions.Look for not allowed URLs, replaced them with `invalid` value, and clean valid ones.diff --git a/saleor/core/utils/events.py b/saleor/core/utils/events.pyindex 0447b6661b..b72637a38e 100644--- a/saleor/core/utils/events.py+++ b/saleor/core/utils/events.py@@ -127,7 +127,8 @@ def call_event(func_obj, *func_args, **func_kwargs):Ensures that in atomic transaction event is called on_commit."""is_protected_instance = any(- isinstance(arg, (Checkout, CheckoutInfo, Order, OrderInfo)) for arg in func_args+ isinstance(arg, Checkout | CheckoutInfo | Order | OrderInfo)+ for arg in func_args)func_obj_self = getattr(func_obj, "__self__", None)is_plugin_manager_method = "PluginsManager" in str(diff --git a/saleor/core/utils/lazyobjects.py b/saleor/core/utils/lazyobjects.pyindex a21528dab9..8cb92f19c7 100644--- a/saleor/core/utils/lazyobjects.py+++ b/saleor/core/utils/lazyobjects.py@@ -1,5 +1,6 @@import functools-from typing import Any, Callable, Optional+from collections.abc import Callable+from typing import Anyfrom django.utils.functional import LazyObject, SimpleLazyObject, empty@@ -13,7 +14,7 @@ def lazy_no_retry(func: Callable) -> SimpleLazyObject:This mitigates an issue where an expensive ``func`` can be rerun foreach GraphQL resolver instead of flagging it as rejected/failed."""- error: Optional[Exception] = None+ error: Exception | None = None@functools.wraps(func)def _wrapper():diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex 2bdae74beb..265a1c1df5 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -8,7 +8,7 @@ import uuidfrom collections import defaultdictfrom decimal import Decimalfrom functools import lru_cache-from typing import Any, Union, cast+from typing import Any, castfrom unittest.mock import patchimport graphene@@ -346,7 +346,7 @@ def create_product_variant_channel_listings(product_variant_channel_listings_datdef assign_attributes_to_product_types(- association_model: Union[type[AttributeProduct], type[AttributeVariant]],+ association_model: type[AttributeProduct] | type[AttributeVariant],attributes: list,):for value in attributes:@@ -1526,7 +1526,7 @@ def create_gift_cards(how_many=5):for i in range(how_many):staff_user = User.objects.filter(is_staff=True).order_by("?").first()gift_card, created = GiftCard.objects.get_or_create(- code=f"Gift_card_{i+1}",+ code=f"Gift_card_{i + 1}",defaults={"created_by": staff_user,"initial_balance": Money(50, DEFAULT_CURRENCY),@@ -1542,7 +1542,7 @@ def create_gift_cards(how_many=5):user = User.objects.filter(is_superuser=False).order_by("?").first()gift_card, created = GiftCard.objects.get_or_create(- code=f"Gift_card_1{i+1}",+ code=f"Gift_card_1{i + 1}",defaults={"created_by": user,"product_id": product_pk,diff --git a/saleor/core/utils/translations.py b/saleor/core/utils/translations.pyindex be84a46a60..585a29d4af 100644--- a/saleor/core/utils/translations.py+++ b/saleor/core/utils/translations.py@@ -1,4 +1,4 @@-from typing import Any, Union+from typing import Anyfrom django.conf import settingsfrom django.db import models@@ -33,7 +33,7 @@ class Translation(models.Model):class Meta:abstract = True- def get_translated_object_id(self) -> tuple[str, Union[int, str]]:+ def get_translated_object_id(self) -> tuple[str, int | str]:raise NotImplementedError("Models extending Translation should implement get_translated_object_id")diff --git a/saleor/csv/tasks.py b/saleor/csv/tasks.pyindex 0f48c39b12..505af5628d 100644--- a/saleor/csv/tasks.py+++ b/saleor/csv/tasks.py@@ -1,5 +1,3 @@-from typing import Optional, Union-from celery.utils.log import get_task_loggerfrom django.conf import settingsfrom django.core.files.storage import default_storage@@ -62,7 +60,7 @@ class ExportTask(RestrictWriterDBTask):@app.task(name="export-products", base=ExportTask)def export_products_task(export_file_id: int,- scope: dict[str, Union[str, dict]],+ scope: dict[str, str | dict],export_info: dict[str, list],file_type: str,delimiter: str = ",",@@ -79,7 +77,7 @@ def export_products_task(@app.task(name="export-gift-cards", base=ExportTask)def export_gift_cards_task(export_file_id: int,- scope: dict[str, Union[str, dict]],+ scope: dict[str, str | dict],file_type: str,delimiter: str = ",",):@@ -96,7 +94,7 @@ def export_gift_cards_task(def export_voucher_codes_task(export_file_id: int,file_type: str,- voucher_id: Optional[int],+ voucher_id: int | None,ids: list[int],):with allow_writer():diff --git a/saleor/csv/utils/export.py b/saleor/csv/utils/export.pyindex f01e0f3482..8ba802d6de 100644--- a/saleor/csv/utils/export.py+++ b/saleor/csv/utils/export.py@@ -1,7 +1,7 @@import datetimeimport uuidfrom tempfile import NamedTemporaryFile-from typing import IO, TYPE_CHECKING, Any, Optional, Union+from typing import IO, TYPE_CHECKING, Anyimport petl as etlfrom django.conf import settings@@ -27,7 +27,7 @@ BATCH_SIZE = 10000def export_products(export_file: "ExportFile",- scope: dict[str, Union[str, dict]],+ scope: dict[str, str | dict],export_info: dict[str, list],file_type: str,delimiter: str = ",",@@ -62,7 +62,7 @@ def export_products(def export_gift_cards(export_file: "ExportFile",- scope: dict[str, Union[str, dict]],+ scope: dict[str, str | dict],file_type: str,delimiter: str = ",",):@@ -93,8 +93,8 @@ def export_gift_cards(def export_voucher_codes(export_file: "ExportFile",file_type: str,- voucher_id: Optional[int] = None,- ids: Optional[list[int]] = None,+ voucher_id: int | None = None,+ ids: list[int] | None = None,delimiter: str = ",",):file_name = get_filename("voucher_code", file_type)@@ -132,7 +132,7 @@ def get_filename(model_name: str, file_type: str) -> str:)-def get_queryset(model, filter, scope: dict[str, Union[str, dict]]) -> "QuerySet":+def get_queryset(model, filter, scope: dict[str, str | dict]) -> "QuerySet":queryset = model.objects.using(settings.DATABASE_CONNECTION_REPLICA_NAME).all()if "ids" in scope:queryset = model.objects.using(@@ -146,7 +146,7 @@ def get_queryset(model, filter, scope: dict[str, Union[str, dict]]) -> "QuerySetreturn queryset-def parse_input(data: Any) -> dict[str, Union[str, dict]]:+def parse_input(data: Any) -> dict[str, str | dict]:"""Parse input into correct data types.Scope coming from Celery will be passed as strings.@@ -276,7 +276,7 @@ def queryset_in_batches(queryset):def append_to_file(- export_data: list[dict[str, Union[str, bool]]],+ export_data: list[dict[str, str | bool]],headers: list[str],temporary_file: Any,file_type: str,diff --git a/saleor/csv/utils/products_data.py b/saleor/csv/utils/products_data.pyindex 431e6585c1..6c3beac800 100644--- a/saleor/csv/utils/products_data.py+++ b/saleor/csv/utils/products_data.py@@ -1,6 +1,6 @@from collections import defaultdictfrom dataclasses import dataclass-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKINGfrom urllib.parse import urljoinimport graphene@@ -21,10 +21,10 @@ if TYPE_CHECKING:def get_products_data(queryset: "QuerySet",export_fields: set[str],- attribute_ids: Optional[list[str]],- warehouse_ids: Optional[list[str]],- channel_ids: Optional[list[str]],-) -> list[dict[str, Union[str, bool]]]:+ attribute_ids: list[str] | None,+ warehouse_ids: list[str] | None,+ channel_ids: list[str] | None,+) -> list[dict[str, str | bool]]:"""Create data list of products and their variants with fields values.It return list with product and variant data which can be used as import to@@ -99,8 +99,8 @@ def get_products_data(def get_products_relations_data(queryset: "QuerySet",export_fields: set[str],- attribute_ids: Optional[list[str]],- channel_ids: Optional[list[str]],+ attribute_ids: list[str] | None,+ channel_ids: list[str] | None,) -> dict[int, dict[str, str]]:"""Get data about product relations fields.@@ -123,8 +123,8 @@ def get_products_relations_data(def prepare_products_relations_data(queryset: "QuerySet",fields: set[str],- attribute_ids: Optional[list[str]],- channel_ids: Optional[list[str]],+ attribute_ids: list[str] | None,+ channel_ids: list[str] | None,) -> dict[int, dict[str, str]]:"""Prepare data about products relation fields for given queryset.@@ -178,9 +178,9 @@ def prepare_products_relations_data(def get_variants_relations_data(queryset: "QuerySet",export_fields: set[str],- attribute_ids: Optional[list[str]],- warehouse_ids: Optional[list[str]],- channel_ids: Optional[list[str]],+ attribute_ids: list[str] | None,+ warehouse_ids: list[str] | None,+ channel_ids: list[str] | None,) -> dict[int, dict[str, str]]:"""Get data about variants relations fields.@@ -203,9 +203,9 @@ def get_variants_relations_data(def prepare_variants_relations_data(queryset: "QuerySet",fields: set[str],- attribute_ids: Optional[list[str]],- warehouse_ids: Optional[list[str]],- channel_ids: Optional[list[str]],+ attribute_ids: list[str] | None,+ warehouse_ids: list[str] | None,+ channel_ids: list[str] | None,) -> dict[int, dict[str, str]]:"""Prepare data about variants relation fields for given queryset.@@ -305,24 +305,24 @@ def add_image_uris_to_data(class AttributeData:slug: strinput_type: str- entity_type: Optional[str] = None- unit: Optional[str] = None- value_slug: Optional[str] = None- value_name: Optional[str] = None- value: Optional[str] = None- file_url: Optional[str] = None- rich_text: Optional[str] = None- boolean: Optional[str] = None- date_time: Optional[str] = None- reference_page: Optional[str] = None- reference_product: Optional[str] = None- reference_variant: Optional[str] = None+ entity_type: str | None = None+ unit: str | None = None+ value_slug: str | None = None+ value_name: str | None = None+ value: str | None = None+ file_url: str | None = None+ rich_text: str | None = None+ boolean: str | None = None+ date_time: str | None = None+ reference_page: str | None = None+ reference_product: str | None = None+ reference_variant: str | None = Nonedef handle_attribute_data(pk: int,data: dict,- attribute_ids: Optional[list[str]],+ attribute_ids: list[str] | None,result_data: dict[int, dict],attribute_fields: dict,attribute_owner: str,@@ -347,7 +347,7 @@ def handle_attribute_data(def handle_channel_data(pk: int,data: dict,- channel_ids: Optional[list[str]],+ channel_ids: list[str] | None,result_data: dict[int, dict],pk_lookup: str,slug_lookup: str,@@ -373,7 +373,7 @@ def handle_channel_data(def handle_warehouse_data(pk: int,data: dict,- warehouse_ids: Optional[list[str]],+ warehouse_ids: list[str] | None,result_data: dict[int, dict],warehouse_fields: dict,):@@ -481,7 +481,7 @@ def _get_reference_value(attribute_data):def add_warehouse_info_to_data(pk: int,- warehouse_data: dict[str, Union[Optional[str]]],+ warehouse_data: dict[str, str | None],result_data: dict[int, dict],) -> dict[int, dict]:"""Add info about stock quantity to variant data.@@ -501,7 +501,7 @@ def add_warehouse_info_to_data(def add_channel_info_to_data(pk: int,- channel_data: dict[str, Union[Optional[str]]],+ channel_data: dict[str, str | None],result_data: dict[int, dict],fields: list[str],) -> dict[int, dict]:diff --git a/saleor/discount/events.py b/saleor/discount/events.pyindex 629dd9b743..67ea6f6a9b 100644--- a/saleor/discount/events.py+++ b/saleor/discount/events.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom ..account.models import User@@ -10,8 +8,8 @@ from .models import Promotion, PromotionEvent, PromotionRuledef _promotion_base_event(promotion: Promotion,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,type: str,):return PromotionEvent.objects.create(@@ -19,41 +17,33 @@ def _promotion_base_event()-def promotion_created_event(- promotion: Promotion, user: Optional[User], app: Optional[App]-):+def promotion_created_event(promotion: Promotion, user: User | None, app: App | None):return _promotion_base_event(promotion=promotion, user=user, app=app, type=PromotionEvents.PROMOTION_CREATED)-def promotion_updated_event(- promotion: Promotion, user: Optional[User], app: Optional[App]-):+def promotion_updated_event(promotion: Promotion, user: User | None, app: App | None):return _promotion_base_event(promotion=promotion, user=user, app=app, type=PromotionEvents.PROMOTION_UPDATED)-def promotion_started_event(- promotion: Promotion, user: Optional[User], app: Optional[App]-):+def promotion_started_event(promotion: Promotion, user: User | None, app: App | None):return _promotion_base_event(promotion=promotion, user=user, app=app, type=PromotionEvents.PROMOTION_STARTED)-def promotion_ended_event(- promotion: Promotion, user: Optional[User], app: Optional[App]-):+def promotion_ended_event(promotion: Promotion, user: User | None, app: App | None):return _promotion_base_event(promotion=promotion, user=user, app=app, type=PromotionEvents.PROMOTION_ENDED)def _rule_base_event(- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,rules: list[PromotionRule],type: str,):@@ -74,8 +64,8 @@ def _rule_base_event(def rule_created_event(- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,rules: list[PromotionRule],):return _rule_base_event(@@ -87,8 +77,8 @@ def rule_created_event(def rule_updated_event(- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,rules: list[PromotionRule],):return _rule_base_event(@@ -100,8 +90,8 @@ def rule_updated_event(def rule_deleted_event(- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,rules: list[PromotionRule],):return _rule_base_event(diff --git a/saleor/discount/interface.py b/saleor/discount/interface.pyindex f9b293f3df..5e9104bc62 100644--- a/saleor/discount/interface.py+++ b/saleor/discount/interface.py@@ -21,7 +21,7 @@ class VoucherInfo:"""It contains the voucher's details and PKs of all applicable objects."""voucher: Voucher- voucher_code: Optional[str]+ voucher_code: str | Noneproduct_pks: list[int]variant_pks: list[int]collection_pks: list[int]@@ -29,7 +29,7 @@ class VoucherInfo:def fetch_voucher_info(- voucher: Voucher, voucher_code: Optional[str] = None+ voucher: Voucher, voucher_code: str | None = None) -> VoucherInfo:variant_pks = [variant.id for variant in voucher.variants.all()]product_pks = [product.id for product in voucher.products.all()]diff --git a/saleor/discount/migrations/0053_drop_sales_indexes.py b/saleor/discount/migrations/0053_drop_sales_indexes.pyindex 9f9de980a8..b3feb8cd2d 100644--- a/saleor/discount/migrations/0053_drop_sales_indexes.py+++ b/saleor/discount/migrations/0053_drop_sales_indexes.py@@ -26,8 +26,7 @@ class Migration(migrations.Migration):reverse_sql=migrations.RunSQL.noop,),migrations.RunSQL(- "DROP INDEX CONCURRENTLY "- '"discount_sale_categories_category_id_64e132af";',+ 'DROP INDEX CONCURRENTLY "discount_sale_categories_category_id_64e132af";',reverse_sql=migrations.RunSQL.noop,),migrations.RunSQL(@@ -65,8 +64,7 @@ class Migration(migrations.Migration):reverse_sql=migrations.RunSQL.noop,),migrations.RunSQL(- "DROP INDEX CONCURRENTLY "- '"discount_checkoutlinediscount_sale_id_b0964e58";',+ 'DROP INDEX CONCURRENTLY "discount_checkoutlinediscount_sale_id_b0964e58";',reverse_sql=migrations.RunSQL.noop,),migrations.RunSQL(diff --git a/saleor/discount/tests/fixtures/benchmark.py b/saleor/discount/tests/fixtures/benchmark.pyindex 53ce829cb4..4d6d3fc322 100644--- a/saleor/discount/tests/fixtures/benchmark.py+++ b/saleor/discount/tests/fixtures/benchmark.py@@ -26,7 +26,7 @@ def promotion_list_for_benchmark(channel_USD, channel_PLN, product_list):)for promotion in promotions]- for rule, product in zip(rules, product_list):+ for rule, product in zip(rules, product_list, strict=False):rule.catalogue_predicate = {"productPredicate": {"ids": [graphene.Node.to_global_id("Product", product.id)]@@ -74,7 +74,7 @@ def promotion_converted_from_sale_list_for_benchmark(channel_USD, channel_PLN):values = [15, 5, 25]usd_rules, pln_rules = [], []- for promotion, value in zip(promotions, values):+ for promotion, value in zip(promotions, values, strict=False):usd_rules.append(PromotionRule(promotion=promotion,diff --git a/saleor/discount/tests/fixtures/promotion.py b/saleor/discount/tests/fixtures/promotion.pyindex 51cdfa69ac..198718a1d6 100644--- a/saleor/discount/tests/fixtures/promotion.py+++ b/saleor/discount/tests/fixtures/promotion.py@@ -326,7 +326,7 @@ def promotion_converted_from_sale_list(channel_USD, product_list, category, collreward_value_type=RewardValueType.FIXED,reward_value=Decimal("5"),)- for promotion, predicate in zip(promotions, predicates)+ for promotion, predicate in zip(promotions, predicates, strict=False)]PromotionRule.objects.bulk_create(rules)for rule in rules:diff --git a/saleor/discount/tests/fixtures/voucher.py b/saleor/discount/tests/fixtures/voucher.pyindex 72b71fd192..bb1722c669 100644--- a/saleor/discount/tests/fixtures/voucher.py+++ b/saleor/discount/tests/fixtures/voucher.py@@ -200,7 +200,7 @@ def vouchers_list(channel_USD, channel_PLN):)values = [15, 5, 25]voucher_channel_listings = []- for voucher, value in zip(vouchers, values):+ for voucher, value in zip(vouchers, values, strict=False):voucher_channel_listings.append(VoucherChannelListing(voucher=voucher,diff --git a/saleor/discount/tests/test_rounding_issue.py b/saleor/discount/tests/test_rounding_issue.pyindex 71c24f2f5f..ddbda390a0 100644--- a/saleor/discount/tests/test_rounding_issue.py+++ b/saleor/discount/tests/test_rounding_issue.py@@ -64,7 +64,7 @@ def test_rounding_issue_with_percentage_promotion(product_list.append(product)variants = []variant_channel_listings = []- for product, price in zip(product_list, variant_prices):+ for product, price in zip(product_list, variant_prices, strict=False):variant = product.variants.get()variant_channel_listing = variant.channel_listings.get(channel=channel_USD)variant_channel_listing.price_amount = price@@ -95,7 +95,9 @@ def test_rounding_issue_with_percentage_promotion()# then- for line_info, expected_discount in zip(lines_info, expected_discounts):+ for line_info, expected_discount in zip(+ lines_info, expected_discounts, strict=False+ ):assert len(line_info.discounts) == 1discount_from_info = line_info.discounts[0]discount_from_db = line_info.line.discounts.get()diff --git a/saleor/discount/tests/test_tasks.py b/saleor/discount/tests/test_tasks.pyindex 2ff4e05595..dbc1c2abf9 100644--- a/saleor/discount/tests/test_tasks.py+++ b/saleor/discount/tests/test_tasks.py@@ -83,7 +83,7 @@ def test_handle_promotion_toggle()rules = []- for promotion, product in zip(promotions, product_list):+ for promotion, product in zip(promotions, product_list, strict=False):rules.append(PromotionRule(promotion=promotion,diff --git a/saleor/discount/utils/manual_discount.py b/saleor/discount/utils/manual_discount.pyindex ae0dae1671..f0addd82f9 100644--- a/saleor/discount/utils/manual_discount.py+++ b/saleor/discount/utils/manual_discount.py@@ -1,6 +1,6 @@from decimal import ROUND_HALF_UP, Decimalfrom functools import partial-from typing import Optional, TypeVar+from typing import TypeVarfrom prices import Money, TaxedMoney, fixed_discount, percentage_discount@@ -14,7 +14,7 @@ T = TypeVar("T", Money, TaxedMoney)def apply_discount_to_value(value: Decimal,- value_type: Optional[str],+ value_type: str | None,currency: str,price_to_discount: T,) -> T:diff --git a/saleor/discount/utils/promotion.py b/saleor/discount/utils/promotion.pyindex 8abe4ce5c8..1dda0c4b2b 100644--- a/saleor/discount/utils/promotion.py+++ b/saleor/discount/utils/promotion.py@@ -1,9 +1,9 @@import datetimefrom collections import defaultdict-from collections.abc import Iterable, Iterator+from collections.abc import Callable, Iterable, Iteratorfrom decimal import Decimalfrom itertools import chain-from typing import TYPE_CHECKING, Callable, NamedTuple, Optional, Union, overload+from typing import TYPE_CHECKING, NamedTuple, Union, overloadfrom uuid import UUIDimport graphene@@ -52,7 +52,7 @@ if TYPE_CHECKING:from ...product.managers import ProductVariantQueryset-CatalogueInfo = defaultdict[str, set[Union[int, str]]]+CatalogueInfo = defaultdict[str, set[int | str]]CATALOGUE_FIELDS = ["categories", "collections", "products", "variants"]@@ -89,7 +89,7 @@ def calculate_discounted_price_for_promotions(rules_info_per_variant: dict[int, list[PromotionRuleInfo]],channel: "Channel",variant_id: int,-) -> Optional[tuple[UUID, Money]]:+) -> tuple[UUID, Money] | None:"""Return minimum product's price of all prices with promotions applied."""applied_discount = Nonerules_info_for_variant = rules_info_per_variant.get(variant_id)@@ -104,7 +104,7 @@ def get_best_promotion_discount(price: Money,rules_info_for_variant: list[PromotionRuleInfo],channel: "Channel",-) -> Optional[tuple[UUID, Money]]:+) -> tuple[UUID, Money] | None:"""Return the rule with the discount amount for the best promotion.The data for the promotion that gives the best saving are returned in the following@@ -172,8 +172,8 @@ def prepare_line_discount_objects_for_catalogue_promotions(def prepare_line_discount_objects_for_catalogue_promotions(lines_info):line_discounts_to_create_inputs: list[dict] = []- line_discounts_to_update: list[Union[CheckoutLineDiscount, OrderLineDiscount]] = []- line_discounts_to_remove: list[Union[CheckoutLineDiscount, OrderLineDiscount]] = []+ line_discounts_to_update: list[CheckoutLineDiscount | OrderLineDiscount] = []+ line_discounts_to_remove: list[CheckoutLineDiscount | OrderLineDiscount] = []updated_fields: list[str] = []if not lines_info:@@ -381,7 +381,7 @@ def get_best_rule(class RuleDiscount(NamedTuple):rule: PromotionRulediscount_amount: Money- gift_listing: Optional[ProductVariantChannelListing]+ gift_listing: ProductVariantChannelListing | Nonecurrency_code = channel.currency_coderule_discounts: list[RuleDiscount] = []@@ -421,7 +421,7 @@ def _get_best_gift_reward(channel: "Channel",country: str,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> tuple[Optional[PromotionRule], Optional[ProductVariantChannelListing]]:+) -> tuple[PromotionRule | None, ProductVariantChannelListing | None]:rule_ids = [rule.id for rule in rules]PromotionRuleGift = PromotionRule.gifts.throughrule_gifts = PromotionRuleGift.objects.using(database_connection_name).filter(@@ -513,8 +513,8 @@ def _get_available_for_purchase_variant_ids(@allow_writer()def delete_gift_line(- order_or_checkout: Union[Checkout, Order],- lines_info: Union[list["CheckoutLineInfo"], list["EditableOrderLineInfo"]],+ order_or_checkout: Checkout | Order,+ lines_info: list["CheckoutLineInfo"] | list["EditableOrderLineInfo"],):if gift_line_infos := [line for line in lines_info if line.line.is_gift]:order_or_checkout.lines.filter(is_gift=True).delete() # type: ignore[misc]@@ -523,7 +523,7 @@ def delete_gift_line(def create_gift_line(- order_or_checkout: Union[Checkout, Order],+ order_or_checkout: Checkout | Order,gift_listing: "ProductVariantChannelListing",):defaults = _get_defaults_for_gift_line(order_or_checkout, gift_listing)@@ -543,7 +543,7 @@ def create_gift_line(def _get_defaults_for_gift_line(- order_or_checkout: Union[Checkout, Order],+ order_or_checkout: Checkout | Order,gift_listing: "ProductVariantChannelListing",):variant_id = gift_listing.variant_id@@ -776,8 +776,8 @@ def update_rule_variant_relation(def create_discount_objects_for_order_promotions(- order_or_checkout: Union[Checkout, Order],- lines_info: Union[list["EditableOrderLineInfo"], list["CheckoutLineInfo"]],+ order_or_checkout: Checkout | Order,+ lines_info: list["EditableOrderLineInfo"] | list["CheckoutLineInfo"],subtotal: Money,channel: "Channel",country: str,@@ -853,8 +853,8 @@ def create_discount_objects_for_order_promotions(@allow_writer()def _handle_order_promotion(- order_or_checkout: Union[Order, Checkout],- lines_info: Union[list["EditableOrderLineInfo"], list["CheckoutLineInfo"]],+ order_or_checkout: Order | Checkout,+ lines_info: list["EditableOrderLineInfo"] | list["CheckoutLineInfo"],discount_object_defaults: dict,rule_info: VariantPromotionRuleInfo,):@@ -882,8 +882,8 @@ def _handle_order_promotion(@allow_writer()def _handle_gift_reward(- order_or_checkout: Union[Order, Checkout],- lines_info: Union[list[EditableOrderLineInfo], list[CheckoutLineInfo]],+ order_or_checkout: Order | Checkout,+ lines_info: list[EditableOrderLineInfo] | list[CheckoutLineInfo],gift_listing: ProductVariantChannelListing,channel: "Channel",discount_object_defaults: dict,diff --git a/saleor/discount/utils/shared.py b/saleor/discount/utils/shared.pyindex 4c26d5a017..2dee8b232e 100644--- a/saleor/discount/utils/shared.py+++ b/saleor/discount/utils/shared.py@@ -32,7 +32,7 @@ def update_discount("CheckoutLineDiscount", "CheckoutDiscount", "OrderLineDiscount", "OrderDiscount"],updated_fields: list[str],- voucher_code: Optional[str],+ voucher_code: str | None,):if voucher and discount_to_update.voucher_id != voucher.id:discount_to_update.voucher_id = voucher.iddiff --git a/saleor/discount/utils/voucher.py b/saleor/discount/utils/voucher.pyindex 78de39601a..e64850ff40 100644--- a/saleor/discount/utils/voucher.py+++ b/saleor/discount/utils/voucher.py@@ -33,7 +33,7 @@ if TYPE_CHECKING:from ..models import Voucher-def is_order_level_voucher(voucher: Optional[Voucher]):+def is_order_level_voucher(voucher: Voucher | None):return bool(voucherand voucher.type == VoucherType.ENTIRE_ORDER@@ -41,14 +41,14 @@ def is_order_level_voucher(voucher: Optional[Voucher]):)-def is_shipping_voucher(voucher: Optional[Voucher]):+def is_shipping_voucher(voucher: Voucher | None):return bool(voucher and voucher.type == VoucherType.SHIPPING)def increase_voucher_usage(voucher: "Voucher",code: "VoucherCode",- customer_email: Optional[str],+ customer_email: str | None,increase_voucher_customer_usage: bool = True,) -> None:if voucher.usage_limit:@@ -84,7 +84,7 @@ def activate_voucher_code(code: "VoucherCode") -> None:def add_voucher_usage_by_customer(- code: "VoucherCode", customer_email: Optional[str]+ code: "VoucherCode", customer_email: str | None) -> None:if not customer_email:raise NotApplicable("Unable to apply voucher as customer details are missing.")@@ -107,7 +107,7 @@ def remove_voucher_usage_by_customer(code: "VoucherCode", customer_email: str) -def release_voucher_code_usage(code: Optional["VoucherCode"],voucher: Optional["Voucher"],- user_email: Optional[str],+ user_email: str | None,):if not code:return@@ -223,7 +223,7 @@ def get_discounted_lines(def _get_the_cheapest_line(- lines_info: Optional[Iterable["LineInfo"]],+ lines_info: Iterable["LineInfo"] | None,) -> Optional["LineInfo"]:if not lines_info:return Nonediff --git a/saleor/giftcard/events.py b/saleor/giftcard/events.pyindex 23fbcdc377..466f7ea6d9 100644--- a/saleor/giftcard/events.py+++ b/saleor/giftcard/events.py@@ -1,5 +1,5 @@from collections.abc import Iterable-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom ..account.models import Userfrom ..app.models import App@@ -12,8 +12,8 @@ if TYPE_CHECKING:def gift_card_issued_event(gift_card: GiftCard,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):balance_data = {"currency": gift_card.currency,@@ -31,8 +31,8 @@ def gift_card_issued_event(def gift_cards_issued_event(gift_cards: Iterable[GiftCard],- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,balance: dict,):balance_data = {@@ -54,7 +54,7 @@ def gift_cards_issued_event(def gift_card_sent_event(- gift_card_id: int, user_id: Optional[int], app_id: Optional[int], email: str+ gift_card_id: int, user_id: int | None, app_id: int | None, email: str):return GiftCardEvent.objects.create(gift_card_id=gift_card_id,@@ -66,7 +66,7 @@ def gift_card_sent_event(def gift_card_resent_event(- gift_card_id: int, user_id: Optional[int], app_id: Optional[int], email: str+ gift_card_id: int, user_id: int | None, app_id: int | None, email: str):return GiftCardEvent.objects.create(gift_card_id=gift_card_id,@@ -80,8 +80,8 @@ def gift_card_resent_event(def gift_card_balance_reset_event(gift_card: GiftCard,old_gift_card: GiftCard,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):balance_data = {"currency": gift_card.currency,@@ -103,8 +103,8 @@ def gift_card_balance_reset_event(def gift_card_expiry_date_updated_event(gift_card: GiftCard,old_gift_card: GiftCard,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return GiftCardEvent.objects.create(gift_card=gift_card,@@ -121,8 +121,8 @@ def gift_card_expiry_date_updated_event(def gift_card_tags_updated_event(gift_card: GiftCard,old_tags: list[str],- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return GiftCardEvent.objects.create(gift_card=gift_card,@@ -140,8 +140,8 @@ def gift_card_tags_updated_event(def gift_card_activated_event(gift_card: GiftCard,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return GiftCardEvent.objects.create(gift_card=gift_card,@@ -153,8 +153,8 @@ def gift_card_activated_event(def gift_card_deactivated_event(gift_card: GiftCard,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return GiftCardEvent.objects.create(gift_card=gift_card,@@ -166,8 +166,8 @@ def gift_card_deactivated_event(def gift_cards_activated_event(gift_card_ids: Iterable[int],- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):events = [GiftCardEvent(@@ -183,8 +183,8 @@ def gift_cards_activated_event(def gift_cards_deactivated_event(gift_card_ids: Iterable[int],- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):events = [GiftCardEvent(@@ -199,7 +199,7 @@ def gift_cards_deactivated_event(def gift_card_note_added_event(- gift_card: GiftCard, user: Optional[User], app: Optional[App], message: str+ gift_card: GiftCard, user: User | None, app: App | None, message: str) -> GiftCardEvent:return GiftCardEvent.objects.create(gift_card=gift_card,@@ -213,8 +213,8 @@ def gift_card_note_added_event(def gift_cards_used_in_order_event(balance_data: Iterable[tuple[GiftCard, float]],order: "Order",- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):events = [GiftCardEvent(@@ -239,8 +239,8 @@ def gift_cards_used_in_order_event(def gift_cards_bought_event(gift_cards: Iterable[GiftCard],order: "Order",- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):events = [GiftCardEvent(diff --git a/saleor/giftcard/search.py b/saleor/giftcard/search.pyindex b1c64974bd..63ef510c23 100644--- a/saleor/giftcard/search.py+++ b/saleor/giftcard/search.py@@ -1,5 +1,3 @@-from typing import Union-from django.contrib.postgres.search import SearchQueryfrom django.db.models import Q, QuerySet, Value, prefetch_related_objects@@ -34,7 +32,7 @@ def prepare_gift_card_search_vector_value(return search_vectors-def mark_gift_cards_search_index_as_dirty(gift_cards: Union[list[GiftCard], QuerySet]):+def mark_gift_cards_search_index_as_dirty(gift_cards: list[GiftCard] | QuerySet):for gift_card in gift_cards:gift_card.search_index_dirty = TrueGiftCard.objects.bulk_update(gift_cards, ["search_index_dirty"])diff --git a/saleor/graphql/account/bulk_mutations/customer_bulk_update.py b/saleor/graphql/account/bulk_mutations/customer_bulk_update.pyindex 991bbcceee..87af6b1bbe 100644--- a/saleor/graphql/account/bulk_mutations/customer_bulk_update.py+++ b/saleor/graphql/account/bulk_mutations/customer_bulk_update.py@@ -566,7 +566,9 @@ class CustomerBulkUpdate(BaseMutation, I18nMixin):webhooks_updated = get_webhooks_for_event(WebhookEventAsyncType.CUSTOMER_UPDATED)- for updated_instance, old_instance in zip(instances, old_instances):+ for updated_instance, old_instance in zip(+ instances, old_instances, strict=False+ ):cls.call_event(manager.customer_updated, updated_instance, webhooks=webhooks_updated)diff --git a/saleor/graphql/account/dataloaders.py b/saleor/graphql/account/dataloaders.pyindex 8941af283d..08e8e418f0 100644--- a/saleor/graphql/account/dataloaders.py+++ b/saleor/graphql/account/dataloaders.py@@ -1,6 +1,6 @@from collections import defaultdictfrom collections.abc import Iterable-from typing import Generic, Optional, TypeVar, cast+from typing import Generic, TypeVar, castfrom ...account.models import Address, CustomerEvent, Group, Userfrom ...channel.models import Channel@@ -40,17 +40,17 @@ class CustomerEventsByUserLoader(DataLoader[str, list[CustomerEvent]]):class ThumbnailByUserIdSizeAndFormatLoader(- DataLoader[tuple[int, int, Optional[str]], Thumbnail]+ DataLoader[tuple[int, int, str | None], Thumbnail]):context_key = "thumbnail_by_user_size_and_format"- def batch_load(self, keys: Iterable[tuple[int, int, Optional[str]]]):+ def batch_load(self, keys: Iterable[tuple[int, int, str | None]]):user_ids = [user_id for user_id, _, _ in keys]thumbnails = Thumbnail.objects.using(self.database_connection_name).filter(user_id__in=user_ids)thumbnails_by_user_size_and_format_map: defaultdict[- tuple[int, int, Optional[str]], Optional[Thumbnail]+ tuple[int, int, str | None], Thumbnail | None] = defaultdict()for thumbnail in thumbnails:format = get_thumbnail_format(thumbnail.format)diff --git a/saleor/graphql/account/i18n.py b/saleor/graphql/account/i18n.pyindex e36e77de12..a2128c4ebf 100644--- a/saleor/graphql/account/i18n.py+++ b/saleor/graphql/account/i18n.py@@ -1,5 +1,3 @@-from typing import Optional-from django.core.exceptions import ValidationErrorfrom ...account.forms import get_address_form@@ -74,7 +72,7 @@ class I18nMixin:def _validate_address_form(cls,address_data: dict,- address_type: Optional[str] = None,+ address_type: str | None = None,instance=None,format_check=True,required_check=True,@@ -155,8 +153,8 @@ class I18nMixin:cls,address_data: dict,*,- address_type: Optional[str] = None,- instance: Optional[Address] = None,+ address_type: str | None = None,+ instance: Address | None = None,info=None,format_check=True,required_check=True,@@ -193,7 +191,7 @@ class I18nMixin:return instance@classmethod- def can_skip_address_validation(cls, info: Optional[ResolveInfo]):+ def can_skip_address_validation(cls, info: ResolveInfo | None):required_permissions = Noneif info:mutation_name = info.field_namediff --git a/saleor/graphql/account/mutations/account/send_confirmation_email.py b/saleor/graphql/account/mutations/account/send_confirmation_email.pyindex 18d5cd2bc9..40c3d94e05 100644--- a/saleor/graphql/account/mutations/account/send_confirmation_email.py+++ b/saleor/graphql/account/mutations/account/send_confirmation_email.py@@ -28,8 +28,7 @@ class SendConfirmationEmail(BaseMutation):redirect_url = graphene.String(required=True,description=(- "Base of frontend URL that will be needed to create confirmation "- "URL."+ "Base of frontend URL that will be needed to create confirmation URL."),)channel = graphene.String(diff --git a/saleor/graphql/account/mutations/authentication/refresh_token.py b/saleor/graphql/account/mutations/authentication/refresh_token.pyindex 2c3d4023fe..18ecc29225 100644--- a/saleor/graphql/account/mutations/authentication/refresh_token.py+++ b/saleor/graphql/account/mutations/authentication/refresh_token.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -59,8 +57,8 @@ class RefreshToken(BaseMutation):@classmethoddef get_refresh_token(- cls, info: ResolveInfo, refresh_token: Optional[str] = None- ) -> Optional[str]:+ cls, info: ResolveInfo, refresh_token: str | None = None+ ) -> str | None:request = info.contextif refresh_token is None:refresh_token = request.COOKIES.get(JWT_REFRESH_TOKEN_COOKIE_NAME, None)diff --git a/saleor/graphql/account/mutations/staff/staff_create.py b/saleor/graphql/account/mutations/staff/staff_create.pyindex 88dcac78ec..af0b415505 100644--- a/saleor/graphql/account/mutations/staff/staff_create.py+++ b/saleor/graphql/account/mutations/staff/staff_create.py@@ -56,8 +56,7 @@ class StaffCreate(ModelMutation):class Meta:description = (- "Creates a new staff user. "- "Apps are not allowed to perform this mutation."+ "Creates a new staff user. Apps are not allowed to perform this mutation.")doc_category = DOC_CATEGORY_USERSexclude = ["password"]diff --git a/saleor/graphql/account/resolvers.py b/saleor/graphql/account/resolvers.pyindex fe33d75ceb..cc14bbf63f 100644--- a/saleor/graphql/account/resolvers.py+++ b/saleor/graphql/account/resolvers.py@@ -1,5 +1,4 @@from itertools import chain-from typing import Optionalfrom django.db.models import Qfrom graphql import GraphQLError@@ -140,9 +139,9 @@ def resolve_users(info, ids=None, emails=None):def resolve_address_validation_rules(info: ResolveInfo,country_code: str,- country_area: Optional[str],- city: Optional[str],- city_area: Optional[str],+ country_area: str | None,+ city: str | None,+ city_area: str | None,):params = {"country_code": country_code,@@ -184,7 +183,7 @@ def resolve_address_validation_rules(@traced_resolverdef resolve_payment_sources(- _info, user: models.User, manager, channel_slug: Optional[str]+ _info, user: models.User, manager, channel_slug: str | None):stored_customer_accounts = [(gtw.id, fetch_customer_id(user, gtw.id))diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.pyindex 77492fcb6c..276d02b452 100644--- a/saleor/graphql/account/types.py+++ b/saleor/graphql/account/types.py@@ -1,6 +1,6 @@import uuidfrom functools import partial-from typing import Optional, cast+from typing import castimport graphenefrom django.contrib.auth import get_user_model@@ -636,8 +636,8 @@ class User(ModelObjectType[models.User]):def resolve_avatar(root: models.User,info: ResolveInfo,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,) -> None | Image | Promise[Image]:if not root.avatar:return None@@ -682,7 +682,7 @@ class User(ModelObjectType[models.User]):from .resolvers import resolve_usersids = set()- emails: set[Optional[str]] = set()+ emails: set[str | None] = set()for root in roots:if root.id is not None:ids.add(root.id)diff --git a/saleor/graphql/account/utils.py b/saleor/graphql/account/utils.pyindex d6ffd40186..9a0751f97b 100644--- a/saleor/graphql/account/utils.py+++ b/saleor/graphql/account/utils.py@@ -361,7 +361,7 @@ def look_for_permission_in_users_with_manage_staff(def is_owner_or_has_one_of_perms(- requestor: Union["User", "App", None], owner: Optional[Union["User", "App"]], *perms+ requestor: Union["User", "App", None], owner: Union["User", "App"] | None, *perms) -> bool:"""Check if requestor can access data.@@ -393,7 +393,7 @@ def check_is_owner_or_has_one_of_perms(raise PermissionDenied(permissions=list(perms) + [AuthorizationFilters.OWNER])-def get_user_accessible_channels(info, user: Optional[User]):+def get_user_accessible_channels(info, user: User | None):return ((AccessibleChannelsByUserIdLoader(info.context).load(user.id).get())if user is not Nonediff --git a/saleor/graphql/app/dataloaders/apps.py b/saleor/graphql/app/dataloaders/apps.pyindex a72b81c2de..44322a0224 100644--- a/saleor/graphql/app/dataloaders/apps.py+++ b/saleor/graphql/app/dataloaders/apps.py@@ -27,7 +27,7 @@ class AppsByEventTypeLoader(DataLoader):app_ids = set()def return_apps_for_webhooks(webhooks_by_event_type):- for event_type, webhooks in zip(keys, webhooks_by_event_type):+ for event_type, webhooks in zip(keys, webhooks_by_event_type, strict=False):ids = [webhook.app_id for webhook in webhooks]app_ids_by_event_type[event_type] = idsapp_ids.update(ids)diff --git a/saleor/graphql/app/dataloaders/utils.py b/saleor/graphql/app/dataloaders/utils.pyindex cda79dae02..454ac22dc9 100644--- a/saleor/graphql/app/dataloaders/utils.py+++ b/saleor/graphql/app/dataloaders/utils.py@@ -1,5 +1,4 @@from functools import partial, wraps-from typing import Optionalfrom django.utils.functional import LazyObjectfrom promise import Promise@@ -11,14 +10,14 @@ from ...core import SaleorContextfrom .app import AppByTokenLoader-def promise_app(context: SaleorContext) -> Promise[Optional[App]]:+def promise_app(context: SaleorContext) -> Promise[App | None]:auth_token = get_token_from_request(context)if not auth_token or len(auth_token) != 30:return Promise.resolve(None)return AppByTokenLoader(context).load(auth_token)-def get_app_promise(context: SaleorContext) -> Promise[Optional[App]]:+def get_app_promise(context: SaleorContext) -> Promise[App | None]:if hasattr(context, "app"):app = context.appif isinstance(app, LazyObject):diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.pyindex 9935334c8c..b7b95bd9fb 100644--- a/saleor/graphql/app/types.py+++ b/saleor/graphql/app/types.py@@ -1,5 +1,4 @@import base64-from typing import Optional, Unionimport graphene@@ -82,7 +81,7 @@ def check_permission_for_access_to_meta(root: models.App, info: ResolveInfo, appdef has_access_to_app_public_meta(root, info: ResolveInfo, app) -> bool:auth_token = info.context.decoded_auth_token or {}- app_id: Union[str, int, None]+ app_id: str | int | Noneif auth_token.get("type") == JWT_THIRDPARTY_ACCESS_TYPE:_, app_id = from_global_id_or_error(auth_token["app"], "App")else:@@ -262,8 +261,8 @@ class AppManifestBrandLogo(BaseObjectType):root,_info: ResolveInfo,*,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,):format = get_icon_thumbnail_format(format)# limit thumbnail max size as it is transferred@@ -295,11 +294,11 @@ class AppBrandLogo(BaseObjectType):@staticmethoddef resolve_default(- root: Union[models.App, models.AppInstallation],+ root: models.App | models.AppInstallation,info: ResolveInfo,*,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,):if not root.brand_logo_default:return None@@ -343,9 +342,7 @@ class AppBrand(BaseObjectType):doc_category = DOC_CATEGORY_APPS@staticmethod- def resolve_logo(- root: Union[models.App, models.AppInstallation], _info: ResolveInfo- ):+ def resolve_logo(root: models.App | models.AppInstallation, _info: ResolveInfo):return rootdiff --git a/saleor/graphql/app/utils.py b/saleor/graphql/app/utils.pyindex 748fc0538d..3db5927c6f 100644--- a/saleor/graphql/app/utils.py+++ b/saleor/graphql/app/utils.py@@ -1,5 +1,3 @@-from typing import Optional-from django.core.exceptions import ValidationErrorfrom ...app.models import App@@ -27,7 +25,7 @@ def ensure_can_manage_permissions(requestor, permission_items):def validate_app_is_not_removed(- app: Optional[App],+ app: App | None,app_global_id: str,field_name: str,code: str = AppErrorCode.NOT_FOUND.value,diff --git a/saleor/graphql/attribute/mutations/attribute_bulk_create.py b/saleor/graphql/attribute/mutations/attribute_bulk_create.pyindex bb1ad5db33..b66dd6d507 100644--- a/saleor/graphql/attribute/mutations/attribute_bulk_create.py+++ b/saleor/graphql/attribute/mutations/attribute_bulk_create.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Unionimport graphenefrom django.core.exceptions import ValidationError@@ -60,8 +59,7 @@ def validate_value(value_data.get(field) for field in ONLY_SWATCH_FIELDS):message = (- "Cannot define value, file and contentType fields for not "- "swatch attribute."+ "Cannot define value, file and contentType fields for not swatch attribute.")index_error_map[attribute_index].append(error_class(@@ -357,7 +355,7 @@ class AttributeBulkCreate(BaseMutation):)# check permissions based on attribute type- permissions: Union[tuple[ProductTypePermissions], tuple[PageTypePermissions]]+ permissions: tuple[ProductTypePermissions] | tuple[PageTypePermissions]if cleaned_input["type"] == AttributeTypeEnum.PRODUCT_TYPE.value:permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)else:diff --git a/saleor/graphql/attribute/mutations/attribute_bulk_update.py b/saleor/graphql/attribute/mutations/attribute_bulk_update.pyindex e7ba5729db..fe0dbee99d 100644--- a/saleor/graphql/attribute/mutations/attribute_bulk_update.py+++ b/saleor/graphql/attribute/mutations/attribute_bulk_update.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Unionimport graphenefrom django.core.exceptions import ValidationError@@ -313,7 +312,7 @@ class AttributeBulkUpdate(BaseMutation):attribute_data["instance"] = attr# check permissions based on attribute type- permissions: Union[tuple[ProductTypePermissions], tuple[PageTypePermissions]]+ permissions: tuple[ProductTypePermissions] | tuple[PageTypePermissions]if attr.type == AttributeTypeEnum.PRODUCT_TYPE.value:permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)else:diff --git a/saleor/graphql/attribute/mutations/attribute_create.py b/saleor/graphql/attribute/mutations/attribute_create.pyindex 96373ad7fb..db5de77828 100644--- a/saleor/graphql/attribute/mutations/attribute_create.py+++ b/saleor/graphql/attribute/mutations/attribute_create.py@@ -1,5 +1,3 @@-from typing import Union-import graphenefrom django.core.exceptions import ValidationError@@ -152,7 +150,7 @@ class AttributeCreate(AttributeMixin, ModelMutation):cls, _root, info: ResolveInfo, /, *, input):# check permissions based on attribute type- permissions: Union[tuple[ProductTypePermissions], tuple[PageTypePermissions]]+ permissions: tuple[ProductTypePermissions] | tuple[PageTypePermissions]if input["type"] == AttributeTypeEnum.PRODUCT_TYPE.value:permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)else:diff --git a/saleor/graphql/attribute/mutations/base_reorder_attributes.py b/saleor/graphql/attribute/mutations/base_reorder_attributes.pyindex 65c7469a2d..10f1709732 100644--- a/saleor/graphql/attribute/mutations/base_reorder_attributes.py+++ b/saleor/graphql/attribute/mutations/base_reorder_attributes.py@@ -57,7 +57,7 @@ class BaseReorderAttributesMutation(BaseMutation):operations = {attribute.pk: sort_order- for attribute, sort_order in zip(attributes_m2m, sort_orders)+ for attribute, sort_order in zip(attributes_m2m, sort_orders, strict=False)}return operations@@ -163,7 +163,8 @@ class BaseReorderAttributeValuesMutation(BaseMutation):) # preserve order in pksoperations = {- value.pk: sort_order for value, sort_order in zip(values_m2m, sort_orders)+ value.pk: sort_order+ for value, sort_order in zip(values_m2m, sort_orders, strict=False)}return operationsdiff --git a/saleor/graphql/attribute/mutations/mixins.py b/saleor/graphql/attribute/mutations/mixins.pyindex 5d1c1adf3e..d263c39f1e 100644--- a/saleor/graphql/attribute/mutations/mixins.py+++ b/saleor/graphql/attribute/mutations/mixins.py@@ -132,7 +132,7 @@ class AttributeMixin:name = unidecode(value_data["name"]).lower().strip()if name in existing_names:msg = (- f'Value {value_data["name"]} already exists within this attribute.'+ f"Value {value_data['name']} already exists within this attribute.")raise ValidationError({diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_create.py b/saleor/graphql/attribute/tests/mutations/test_attribute_create.pyindex 53b589a62e..fdd1cf81e9 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_create.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_create.py@@ -101,12 +101,12 @@ def test_create_attribute_and_attribute_values(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )assert data["attribute"]["externalReference"] == external_reference# Check if the attribute values were correctly created@@ -305,12 +305,12 @@ def test_create_swatch_attribute_and_attribute_values_only_name_provided(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]) == 1@@ -368,12 +368,12 @@ def test_create_swatch_attribute_and_attribute_values_with_file(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 1@@ -432,12 +432,12 @@ def test_create_swatch_attribute_and_attribute_values_with_value(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 1@@ -579,12 +579,12 @@ def test_create_attribute_with_file_input_type(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 0@@ -632,12 +632,12 @@ def test_create_attribute_with_reference_input_type(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 0@@ -718,12 +718,12 @@ def test_create_attribute_with_plain_text_input_type(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 0@@ -766,12 +766,12 @@ def test_create_page_attribute_and_attribute_values(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )assert data["attribute"]["filterableInStorefront"] is Falseassert data["attribute"]["filterableInDashboard"] is Falseassert data["attribute"]["availableInGrid"] is False@@ -862,12 +862,12 @@ def test_create_attribute_with_file_input_type_correct_attribute_settings(# Check if the attribute was correctly createdassert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(- attribute_name- ), "The default slug should be the slugified name"- assert (- data["attribute"]["productTypes"]["edges"] == []- ), "The attribute should not have been assigned to a product type"+ assert data["attribute"]["slug"] == slugify(attribute_name), (+ "The default slug should be the slugified name"+ )+ assert data["attribute"]["productTypes"]["edges"] == [], (+ "The attribute should not have been assigned to a product type"+ )# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 0diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_reorder_values.py b/saleor/graphql/attribute/tests/mutations/test_attribute_reorder_values.pyindex cc275e27dd..21b3fcb764 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_reorder_values.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_reorder_values.py@@ -141,7 +141,7 @@ def test_sort_values_within_attribute(actual_order = []- for attr, _expected_pk in zip(gql_values, expected_order):+ for attr, _expected_pk in zip(gql_values, expected_order, strict=False):gql_type, gql_attr_id = graphene.Node.from_global_id(attr["node"]["id"])assert gql_type == "AttributeValue"actual_order.append(int(gql_attr_id))diff --git a/saleor/graphql/attribute/utils.py b/saleor/graphql/attribute/utils.pyindex 05aa1bb3f5..75b8f99a5c 100644--- a/saleor/graphql/attribute/utils.py+++ b/saleor/graphql/attribute/utils.py@@ -3,7 +3,7 @@ import refrom collections import defaultdictfrom collections.abc import Iterablefrom dataclasses import dataclass-from typing import TYPE_CHECKING, NamedTuple, Optional, Union+from typing import TYPE_CHECKING, NamedTupleimport graphenefrom django.core.exceptions import ValidationError@@ -42,33 +42,31 @@ if TYPE_CHECKING:@dataclassclass AttrValuesForSelectableFieldInput:- id: Optional[str] = None- external_reference: Optional[str] = None- value: Optional[str] = None+ id: str | None = None+ external_reference: str | None = None+ value: str | None = None@dataclassclass AttrValuesInput:- global_id: Optional[str] = None- external_reference: Optional[str] = None- values: Optional[list[str]] = None- dropdown: Optional[AttrValuesForSelectableFieldInput] = None- swatch: Optional[AttrValuesForSelectableFieldInput] = None- multiselect: Optional[list[AttrValuesForSelectableFieldInput]] = None- numeric: Optional[str] = None- references: Union[list[str], list[page_models.Page], None] = None- file_url: Optional[str] = None- content_type: Optional[str] = None- rich_text: Optional[dict] = None- plain_text: Optional[str] = None- boolean: Optional[bool] = None- date: Optional[datetime.date] = None- date_time: Optional[datetime.datetime] = None---T_INSTANCE = Union[- product_models.Product, product_models.ProductVariant, page_models.Page-]+ global_id: str | None = None+ external_reference: str | None = None+ values: list[str] | None = None+ dropdown: AttrValuesForSelectableFieldInput | None = None+ swatch: AttrValuesForSelectableFieldInput | None = None+ multiselect: list[AttrValuesForSelectableFieldInput] | None = None+ numeric: str | None = None+ references: list[str] | list[page_models.Page] | None = None+ file_url: str | None = None+ content_type: str | None = None+ rich_text: dict | None = None+ plain_text: str | None = None+ boolean: bool | None = None+ date: datetime.date | None = None+ date_time: datetime.datetime | None = None+++T_INSTANCE = product_models.Product | product_models.ProductVariant | page_models.PageT_INPUT_MAP = list[tuple[attribute_models.Attribute, AttrValuesInput]]T_ERROR_DICT = dict[tuple[str, str], list]@@ -144,7 +142,7 @@ class AttributeAssignmentMixin:nodes_pk_list.add(node.pk)nodes_external_reference_list.add(node.external_reference)- for pk, global_id in zip(pks, global_ids):+ for pk, global_id in zip(pks, global_ids, strict=False):if pk not in nodes_pk_list:raise ValidationError(f"Could not resolve {global_id!r} to Attribute",@@ -230,7 +228,7 @@ class AttributeAssignmentMixin::raises ValidationError: contain the message.:return: The resolved data"""- error_class: type[Union[PageErrorCode, ProductErrorCode]] = (+ error_class: type[PageErrorCode | ProductErrorCode] = (PageErrorCode if is_page_attributes else ProductErrorCode)@@ -318,7 +316,7 @@ class AttributeAssignmentMixin:return cleaned_input@staticmethod- def _clean_file_url(file_url: Optional[str], error_class):+ def _clean_file_url(file_url: str | None, error_class):# extract storage path from file URLstorage_root_url = get_default_storage_root_url()if file_url and not file_url.startswith(storage_root_url):diff --git a/saleor/graphql/channel/__init__.py b/saleor/graphql/channel/__init__.pyindex cabf463fd7..c371213f77 100644--- a/saleor/graphql/channel/__init__.py+++ b/saleor/graphql/channel/__init__.py@@ -1,5 +1,5 @@from dataclasses import dataclass-from typing import Generic, Optional, TypeVar+from typing import Generic, TypeVarfrom django.db.models import QuerySet@@ -9,10 +9,10 @@ N = TypeVar("N")@dataclassclass ChannelContext(Generic[N]):node: N- channel_slug: Optional[str]+ channel_slug: str | None@dataclassclass ChannelQsContext:qs: QuerySet- channel_slug: Optional[str]+ channel_slug: str | Nonediff --git a/saleor/graphql/channel/mutations/base_channel_listing.py b/saleor/graphql/channel/mutations/base_channel_listing.pyindex 4e2ecba219..8355fe7c92 100644--- a/saleor/graphql/channel/mutations/base_channel_listing.py+++ b/saleor/graphql/channel/mutations/base_channel_listing.py@@ -31,8 +31,7 @@ class BaseChannelListingMutation(BaseMutation):duplicated_ids = get_duplicates_items(add_channels_ids, remove_channels_ids)if duplicated_ids:error_msg = (- "The same object cannot be in both lists "- "for adding and removing items."+ "The same object cannot be in both lists for adding and removing items.")errors["input"].append(ValidationError(@@ -93,7 +92,9 @@ class BaseChannelListingMutation(BaseMutation):cleaned_input = {input_source: [], "remove_channels": remove_channels_pks}- for channel_listing, channel in zip(add_channels, channels_to_add):+ for channel_listing, channel in zip(+ add_channels, channels_to_add, strict=False+ ):channel_listing["channel"] = channelcleaned_input[input_source].append(channel_listing)return cleaned_inputdiff --git a/saleor/graphql/channel/mutations/channel_delete.py b/saleor/graphql/channel/mutations/channel_delete.pyindex 90ee4ef0e8..ddd2d535a3 100644--- a/saleor/graphql/channel/mutations/channel_delete.py+++ b/saleor/graphql/channel/mutations/channel_delete.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -124,7 +122,7 @@ class ChannelDelete(ModelDeleteMutation):@classmethoddef perform_mutation( # type: ignore[override]- cls, root, info: ResolveInfo, /, *, id: str, input: Optional[dict] = None+ cls, root, info: ResolveInfo, /, *, id: str, input: dict | None = None):origin_channel = cls.get_node_or_error(info, id, only_type=Channel)target_channel_global_id = input.get("channel_id") if input else Nonediff --git a/saleor/graphql/channel/mutations/channel_reorder_warehouses.py b/saleor/graphql/channel/mutations/channel_reorder_warehouses.pyindex bdbb52cb55..50bda6befe 100644--- a/saleor/graphql/channel/mutations/channel_reorder_warehouses.py+++ b/saleor/graphql/channel/mutations/channel_reorder_warehouses.py@@ -89,7 +89,7 @@ class ChannelReorderWarehouses(BaseMutation):for warehouse_data in warehouses_m2m.values("id", "warehouse_id")}operations: defaultdict[str, int] = defaultdict(int)- for warehouse_pk, move in zip(warehouse_pks, moves):+ for warehouse_pk, move in zip(warehouse_pks, moves, strict=False):warehouse_m2m_id = warehouse_id_to_warehouse_m2m_id[warehouse_pk]operations[warehouse_m2m_id] += move.sort_orderdiff --git a/saleor/graphql/channel/mutations/utils.py b/saleor/graphql/channel/mutations/utils.pyindex 8d3ffe8578..684e796641 100644--- a/saleor/graphql/channel/mutations/utils.py+++ b/saleor/graphql/channel/mutations/utils.py@@ -1,5 +1,4 @@import datetime-from typing import Optionalfrom django.core.exceptions import ValidationError@@ -9,7 +8,7 @@ from ...core.enums import ChannelErrorCodeDELETE_EXPIRED_ORDERS_MAX_DAYS = 120-def clean_expire_orders_after(expire_orders_after: int) -> Optional[int]:+def clean_expire_orders_after(expire_orders_after: int) -> int | None:if expire_orders_after is None or expire_orders_after == 0:return Noneif expire_orders_after < 0:diff --git a/saleor/graphql/channel/resolvers.py b/saleor/graphql/channel/resolvers.pyindex 8cc4a8d2fd..bd7cde80fb 100644--- a/saleor/graphql/channel/resolvers.py+++ b/saleor/graphql/channel/resolvers.py@@ -1,5 +1,3 @@-from typing import Optional-from ...channel import modelsfrom ...permission.auth_filters import is_app, is_staff_userfrom ..core.context import get_database_connection_name@@ -8,7 +6,7 @@ from ..core.validators import validate_one_of_args_is_in_queryfrom .types import Channel-def resolve_channel(info, id: Optional[str], slug: Optional[str]):+def resolve_channel(info, id: str | None, slug: str | None):validate_one_of_args_is_in_query("id", id, "slug", slug)if id:_, db_id = from_global_id_or_error(id, Channel)diff --git a/saleor/graphql/channel/types.py b/saleor/graphql/channel/types.pyindex e56f034c2f..ff5e2e8423 100644--- a/saleor/graphql/channel/types.py+++ b/saleor/graphql/channel/types.py@@ -1,6 +1,6 @@import collectionsimport itertools-from typing import TYPE_CHECKING, TypeVar, Union, cast+from typing import TYPE_CHECKING, TypeVar, castimport graphenefrom django.db.models import Model@@ -87,7 +87,7 @@ class ChannelContextType(ChannelContextTypeForObjectType[T]):abstract = True@classmethod- def is_type_of(cls, root: Union[ChannelContext[T], T], _info: ResolveInfo) -> bool:+ def is_type_of(cls, root: ChannelContext[T] | T, _info: ResolveInfo) -> bool:# Unwrap node from ChannelContext if it didn't happen alreadyif isinstance(root, ChannelContext):root = root.nodediff --git a/saleor/graphql/checkout/dataloaders/checkout_infos.py b/saleor/graphql/checkout/dataloaders/checkout_infos.pyindex 3783870a2e..0726661682 100644--- a/saleor/graphql/checkout/dataloaders/checkout_infos.py+++ b/saleor/graphql/checkout/dataloaders/checkout_infos.py@@ -156,6 +156,7 @@ class CheckoutInfoByCheckoutTokenLoader(DataLoader[str, CheckoutInfo]):checkout_line_infos,checkout_discounts,pregenerated_payloads_for_excluded_shipping_methods,+ strict=False,):shipping_method = shipping_method_map.get(checkout.shipping_method_id@@ -278,19 +279,21 @@ class CheckoutLinesInfoByCheckoutTokenLoader(checkout_lines_discounts,variant_promotion_rules_info,) = results- variants_map = dict(zip(variants_pks, variants))- products_map = dict(zip(variants_pks, products))- product_types_map = dict(zip(variants_pks, product_types))- collections_map = dict(zip(variants_pks, collections))- tax_class_map = dict(zip(variants_pks, tax_classes))+ variants_map = dict(zip(variants_pks, variants, strict=False))+ products_map = dict(zip(variants_pks, products, strict=False))+ product_types_map = dict(zip(variants_pks, product_types, strict=False))+ collections_map = dict(zip(variants_pks, collections, strict=False))+ tax_class_map = dict(zip(variants_pks, tax_classes, strict=False))channel_listings_map = dict(- zip(variant_ids_channel_ids, channel_listings)+ zip(variant_ids_channel_ids, channel_listings, strict=False))- channels = dict(zip(channel_pks, channels))+ channels = dict(zip(channel_pks, channels, strict=False))checkout_lines_discounts = dict(- zip(lines_pks, checkout_lines_discounts)+ zip(lines_pks, checkout_lines_discounts, strict=False)+ )+ rules_info_map = dict(+ zip(lines_pks, variant_promotion_rules_info, strict=False))- rules_info_map = dict(zip(lines_pks, variant_promotion_rules_info))lines_info_map = defaultdict(list)voucher_infos_map = {@@ -298,7 +301,7 @@ class CheckoutLinesInfoByCheckoutTokenLoader(for voucher_info in voucher_infosif voucher_info is not None and voucher_info.voucher_code}- for checkout, lines in zip(checkouts, checkout_lines):+ for checkout, lines in zip(checkouts, checkout_lines, strict=False):lines_info_map[checkout.pk].extend([CheckoutLineInfo(@@ -373,7 +376,7 @@ class CheckoutLinesInfoByCheckoutTokenLoader()variant_ids_channel_ids = []- for channel_id, lines in zip(channel_pks, checkout_lines):+ for channel_id, lines in zip(channel_pks, checkout_lines, strict=False):variant_ids_channel_ids.extend([(line.variant_id, channel_id) for line in lines])diff --git a/saleor/graphql/checkout/dataloaders/problems.py b/saleor/graphql/checkout/dataloaders/problems.pyindex d13e705e82..42aa7d7cdc 100644--- a/saleor/graphql/checkout/dataloaders/problems.py+++ b/saleor/graphql/checkout/dataloaders/problems.py@@ -89,18 +89,20 @@ class CheckoutLinesProblemsByCheckoutIdLoader(COUNTRY_CODE,],Iterable[Stock],- ] = dict(zip(variant_data_list, variant_stocks))+ ] = dict(zip(variant_data_list, variant_stocks, strict=False))product_channel_listings_map: dict[tuple[PRODUCT_ID,CHANNEL_SLUG,],ProductChannelListing,- ] = dict(zip(product_data_set, product_channel_listings))+ ] = dict(zip(product_data_set, product_channel_listings, strict=False))problems = {}- for checkout_info, lines in zip(checkout_infos, checkout_lines):+ for checkout_info, lines in zip(+ checkout_infos, checkout_lines, strict=False+ ):checkout_id = checkout_info.checkout.pkproblems[checkout_id] = get_checkout_lines_problems(checkout_info,@@ -144,7 +146,7 @@ class CheckoutProblemsByCheckoutIdDataloader():checkout_problems = defaultdict(list)for checkout_pk, checkout_lines_problems in zip(- keys, checkouts_lines_problems+ keys, checkouts_lines_problems, strict=False):checkout_problems[checkout_pk] = get_checkout_problems(checkout_lines_problemsdiff --git a/saleor/graphql/checkout/dataloaders/promotion_rule_infos.py b/saleor/graphql/checkout/dataloaders/promotion_rule_infos.pyindex 9741d2fdfe..64442ce4cd 100644--- a/saleor/graphql/checkout/dataloaders/promotion_rule_infos.py+++ b/saleor/graphql/checkout/dataloaders/promotion_rule_infos.py@@ -41,7 +41,9 @@ class VariantPromotionRuleInfoByCheckoutLineIdLoader(rule_ids: list[int] = []rule_ids_language_codes: list[tuple[int, str]] = []for listing_promotion_rules, language_code in zip(- variant_listing_promotion_rules, language_codes+ variant_listing_promotion_rules,+ language_codes,+ strict=False,):for listing_promotion_rule in listing_promotion_rules:rule_ids.append(@@ -60,33 +62,44 @@ class VariantPromotionRuleInfoByCheckoutLineIdLoader(promotion_ids_language_codes = [(rule.promotion_id, language_code)for rule, (_rule_id, language_code) in zip(- promotion_rules, rule_ids_language_codes+ promotion_rules,+ rule_ids_language_codes,+ strict=False,)]def with_promotion_translations(promotion_translations):channel_listings_map = dict(- zip(variant_ids_channel_ids, channel_listings)+ zip(+ variant_ids_channel_ids,+ channel_listings,+ strict=False,+ ))listing_promotion_rules_map = dict(zip(channel_listing_ids,variant_listing_promotion_rules,+ strict=False,))- rule_map = dict(zip(rule_ids, promotion_rules))+ rule_map = dict(+ zip(rule_ids, promotion_rules, strict=False)+ )rule_id_to_promotion_map = dict(- zip(rule_ids, promotions)+ zip(rule_ids, promotions, strict=False))rule_id_to_rule_translation = dict(- zip(rule_ids, rule_translations)+ zip(rule_ids, rule_translations, strict=False))rule_id_to_promotion_translation = dict(- zip(rule_ids, promotion_translations)+ zip(rule_ids, promotion_translations, strict=False))rules_info_map = defaultdict(list)- for checkout, line in zip(checkouts, checkout_lines):+ for checkout, line in zip(+ checkouts, checkout_lines, strict=False+ ):if not line:continuechannel_listing = channel_listings_map[@@ -155,7 +168,9 @@ class VariantPromotionRuleInfoByCheckoutLineIdLoader(variant_ids_channel_ids = [(line.variant_id, channel_id)- for line, channel_id in zip(checkout_lines, channel_pks)+ for line, channel_id in zip(+ checkout_lines, channel_pks, strict=False+ )if line]language_codes = [checkout.language_code for checkout in checkouts]diff --git a/saleor/graphql/checkout/mutations/checkout_complete.py b/saleor/graphql/checkout/mutations/checkout_complete.pyindex 70daccdee1..dce79a6b18 100644--- a/saleor/graphql/checkout/mutations/checkout_complete.py+++ b/saleor/graphql/checkout/mutations/checkout_complete.py@@ -44,8 +44,7 @@ class CheckoutComplete(BaseMutation, I18nMixin):required=True,default_value=False,description=(- "Set to true if payment needs to be confirmed"- " before checkout is complete."+ "Set to true if payment needs to be confirmed before checkout is complete."),)confirmation_data = JSONString(diff --git a/saleor/graphql/checkout/mutations/checkout_create.py b/saleor/graphql/checkout/mutations/checkout_create.pyindex 73ab9a29a4..b18fce6d2a 100644--- a/saleor/graphql/checkout/mutations/checkout_create.py+++ b/saleor/graphql/checkout/mutations/checkout_create.py@@ -86,8 +86,7 @@ class CheckoutValidationRules(BaseInputObjectType):)billing_address = CheckoutAddressValidationRules(description=(- "The validation rules that can be applied to provided billing address"- " data."+ "The validation rules that can be applied to provided billing address data."))diff --git a/saleor/graphql/checkout/mutations/checkout_create_from_order.py b/saleor/graphql/checkout/mutations/checkout_create_from_order.pyindex 6529812d36..428146bebb 100644--- a/saleor/graphql/checkout/mutations/checkout_create_from_order.py+++ b/saleor/graphql/checkout/mutations/checkout_create_from_order.py@@ -1,4 +1,4 @@-from typing import Any, Optional, cast+from typing import Any, castimport graphenefrom django.contrib.sites.models import Site@@ -200,7 +200,7 @@ class CheckoutCreateFromOrder(BaseMutation):variant_ids_set: set[int],order_lines: list[order_models.OrderLine],variant_errors: list[dict[str, Any]],- global_quantity_limit: Optional[int],+ global_quantity_limit: int | None,) -> set[int]:variant_ids_to_exclude = []error_codes = CheckoutCreateFromOrderUnavailableVariantErrorCode@@ -229,7 +229,7 @@ class CheckoutCreateFromOrder(BaseMutation):cls,order: order_models.Order,order_lines: list[order_models.OrderLine],- global_quantity_limit: Optional[int],+ global_quantity_limit: int | None,) -> tuple[set[int], list[order_models.OrderLine], list[dict[str, Any]]]:variant_errors: list[dict[str, Any]] = []variant_ids_set = {line.variant_id for line in order_lines if line.variant_id}diff --git a/saleor/graphql/checkout/mutations/checkout_customer_attach.py b/saleor/graphql/checkout/mutations/checkout_customer_attach.pyindex ba26104f35..31ad69df5b 100644--- a/saleor/graphql/checkout/mutations/checkout_customer_attach.py+++ b/saleor/graphql/checkout/mutations/checkout_customer_attach.py@@ -82,8 +82,7 @@ class CheckoutCustomerAttach(BaseMutation):if checkout.user_id:raise PermissionDenied(message=(- "You cannot reassign a checkout that is already attached to a "- "user."+ "You cannot reassign a checkout that is already attached to a user."))diff --git a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.pyindex 1f6a7393c4..317e0501c6 100644--- a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py+++ b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -208,8 +206,8 @@ class CheckoutDeliveryMethodUpdate(BaseMutation):checkout_info,lines,*,- shipping_method: Optional[shipping_interface.ShippingMethodData],- collection_point: Optional[Warehouse],+ shipping_method: shipping_interface.ShippingMethodData | None,+ collection_point: Warehouse | None,) -> None:delivery_method = shipping_methoderror_msg = "This shipping method is not applicable."@@ -238,9 +236,9 @@ class CheckoutDeliveryMethodUpdate(BaseMutation):checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],*,- shipping_method: Optional[ShippingMethod],- external_shipping_method: Optional[shipping_interface.ShippingMethodData],- collection_point: Optional[Warehouse],+ shipping_method: ShippingMethod | None,+ external_shipping_method: shipping_interface.ShippingMethodData | None,+ collection_point: Warehouse | None,) -> None:checkout_fields_to_update = ["shipping_method", "collection_point"]checkout = checkout_info.checkout@@ -277,7 +275,7 @@ class CheckoutDeliveryMethodUpdate(BaseMutation):)@staticmethod- def _resolve_delivery_method_type(id_) -> Optional[str]:+ def _resolve_delivery_method_type(id_) -> str | None:if id_ is None:return Nonediff --git a/saleor/graphql/checkout/mutations/checkout_lines_add.py b/saleor/graphql/checkout/mutations/checkout_lines_add.pyindex 3d4828c15d..12a4584382 100644--- a/saleor/graphql/checkout/mutations/checkout_lines_add.py+++ b/saleor/graphql/checkout/mutations/checkout_lines_add.py@@ -167,7 +167,7 @@ class CheckoutLinesAdd(BaseMutation):variants_ids_to_validate = {variant.id- for variant, line_data in zip(variants, checkout_lines_data)+ for variant, line_data in zip(variants, checkout_lines_data, strict=False)if line_data.quantity_to_update and line_data.quantity != 0}# validate variant only when line quantity is bigger than 0diff --git a/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py b/saleor/graphql/checkout/mutations/checkout_remove_promo_code.pyindex dc000b7eb9..b1b4557338 100644--- a/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py+++ b/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationErrorfrom graphql.error import GraphQLError@@ -119,7 +117,7 @@ class CheckoutRemovePromoCode(BaseMutation):return CheckoutRemovePromoCode(checkout=checkout)@staticmethod- def clean_promo_code_id(promo_code_id: Optional[str]):+ def clean_promo_code_id(promo_code_id: str | None):if promo_code_id is None:return None, Nonetry:diff --git a/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py b/saleor/graphql/checkout/mutations/checkout_shipping_method_update.pyindex 07f5712dfa..eb5d4bcd84 100644--- a/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py+++ b/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -73,7 +71,7 @@ class CheckoutShippingMethodUpdate(BaseMutation):]@staticmethod- def _resolve_delivery_method_type(id_) -> Optional[str]:+ def _resolve_delivery_method_type(id_) -> str | None:if id_ is None:return None@@ -156,7 +154,7 @@ class CheckoutShippingMethodUpdate(BaseMutation):checkout_info,lines,*,- delivery_method: Optional[shipping_interface.ShippingMethodData],+ delivery_method: shipping_interface.ShippingMethodData | None,) -> None:delivery_method_is_valid = clean_delivery_method(checkout_info=checkout_info,diff --git a/saleor/graphql/checkout/mutations/utils.py b/saleor/graphql/checkout/mutations/utils.pyindex 55823b1666..e8e72d9d34 100644--- a/saleor/graphql/checkout/mutations/utils.py+++ b/saleor/graphql/checkout/mutations/utils.py@@ -4,7 +4,7 @@ from collections import defaultdictfrom collections.abc import Iterablefrom dataclasses import dataclassfrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Optional, Union, cast+from typing import TYPE_CHECKING, Any, castimport graphenefrom django.conf import settings@@ -54,24 +54,19 @@ ERROR_CC_ADDRESS_CHANGE_FORBIDDEN = (@dataclassclass CheckoutLineData:- variant_id: Optional[str] = None- line_id: Optional[str] = None+ variant_id: str | None = None+ line_id: str | None = Nonequantity: int = 0quantity_to_update: bool = False- custom_price: Optional[Decimal] = None+ custom_price: Decimal | None = Nonecustom_price_to_update: bool = False- metadata_list: Optional[list] = None+ metadata_list: list | None = Nonedef clean_delivery_method(checkout_info: "CheckoutInfo",lines: list[CheckoutLineInfo],- method: Optional[- Union[- shipping_interface.ShippingMethodData,- warehouse_models.Warehouse,- ]- ],+ method: shipping_interface.ShippingMethodData | warehouse_models.Warehouse | None,) -> bool:"""Check if current shipping method is valid."""if not method:@@ -136,7 +131,7 @@ def get_variants_and_total_quantities(quantity_to_update_check=False,):variants_total_quantity_map: defaultdict[ProductVariant, int] = defaultdict(int)- mapped_data: defaultdict[Optional[str], int] = defaultdict(int)+ mapped_data: defaultdict[str | None, int] = defaultdict(int)if quantity_to_update_check:lines_data = filter(lambda d: d.quantity_to_update, lines_data)@@ -291,7 +286,7 @@ def validate_variants_are_published(def get_checkout_by_token(- token: uuid.UUID, qs: Optional[QuerySet[models.Checkout]] = None+ token: uuid.UUID, qs: QuerySet[models.Checkout] | None = None):if qs is None:qs = models.Checkout.objects.select_related(@@ -318,10 +313,10 @@ def get_checkout_by_token(def get_checkout(mutation_class: type["BaseMutation"],info: ResolveInfo,- checkout_id: Optional[str] = None,- token: Optional[uuid.UUID] = None,- id: Optional[str] = None,- qs: Optional[QuerySet] = None,+ checkout_id: str | None = None,+ token: uuid.UUID | None = None,+ id: str | None = None,+ qs: QuerySet | None = None,):"""Return checkout by using the current id field or the deprecated one.diff --git a/saleor/graphql/checkout/tests/deprecated/test_checkout_complete.py b/saleor/graphql/checkout/tests/deprecated/test_checkout_complete.pyindex 9c23d2cb70..18eb11345f 100644--- a/saleor/graphql/checkout/tests/deprecated/test_checkout_complete.py+++ b/saleor/graphql/checkout/tests/deprecated/test_checkout_complete.py@@ -145,9 +145,9 @@ def test_checkout_complete(assert gift_card.current_balance == zero_money(gift_card.currency)assert gift_card.last_used_on- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -309,7 +309,7 @@ def test_checkout_complete_for_token_as_input(assert gift_card.current_balance == zero_money(gift_card.currency)assert gift_card.last_used_on- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete.pyindex 29aad7f171..fb56a94de5 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py@@ -250,9 +250,9 @@ def test_checkout_complete_0_total_value_no_payment(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -317,9 +317,9 @@ def test_checkout_complete_0_total_value_from_voucher(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -380,9 +380,9 @@ def test_checkout_complete_0_total_value_from_giftcard(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@freeze_time()diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.pyindex 2910babd06..568c87ca8e 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py@@ -278,9 +278,9 @@ def test_checkout_complete(assert GiftCardEvent.objects.filter(gift_card=gift_card, type=GiftCardEvents.USED_IN_ORDER)- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())recalculate_with_plugins_mock.assert_not_called()@@ -370,9 +370,9 @@ def test_checkout_complete_with_metadata(}assert order.private_metadata == checkout.metadata_storage.private_metadata- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -509,9 +509,9 @@ def test_checkout_complete_with_metadata_checkout_without_metadata(}assert order.private_metadata == checkout.metadata_storage.private_metadata- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -995,9 +995,9 @@ def test_checkout_with_voucher_complete(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -1102,9 +1102,9 @@ def test_checkout_complete_with_voucher_apply_once_per_order(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_with_voucher_complete_product_on_promotion(@@ -1256,9 +1256,9 @@ def test_checkout_with_voucher_complete_product_on_promotion(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_with_voucher_on_specific_product_complete(@@ -1359,9 +1359,9 @@ def test_checkout_with_voucher_on_specific_product_complete(assert order.voucher == voucher_specific_product_typeassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -1465,9 +1465,9 @@ def test_checkout_complete_with_voucher_single_use(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -1581,9 +1581,9 @@ def test_checkout_complete_with_voucher_and_gift_card(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )gift_card.refresh_from_db()assert gift_card.current_balance == zero_money(gift_card.currency)@@ -1702,9 +1702,9 @@ def test_checkout_complete_free_shipping_voucher_and_gift_card(assert order.voucher == voucher_free_shippingassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )gift_card.refresh_from_db()assert gift_card.current_balance == zero_money(gift_card.currency)@@ -1851,9 +1851,9 @@ def test_checkout_complete_product_on_promotion(assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_product_on_promotion_deleted_promotion_instance(@@ -1991,9 +1991,9 @@ def test_checkout_complete_product_on_promotion_deleted_promotion_instance(assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_price_override(@@ -2080,9 +2080,9 @@ def test_checkout_complete_price_override(order_payment = order.payments.first()assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_product_on_old_sale(@@ -2225,9 +2225,9 @@ def test_checkout_complete_product_on_old_sale(assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_with_voucher_on_specific_product_complete_with_product_on_promotion(@@ -2381,9 +2381,9 @@ def test_checkout_with_voucher_on_specific_product_complete_with_product_on_promassert order.voucher == voucher_specific_product_typeassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@patch.object(PluginsManager, "preprocess_order_creation")@@ -2431,9 +2431,9 @@ def test_checkout_with_voucher_not_increase_uses_on_preprocess_order_creation_facode.refresh_from_db()assert code.used == 0- assert Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout shouldn't have been deleted"+ assert Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout shouldn't have been deleted"+ )checkout.refresh_from_db()assert not checkout.completing_started_at@@ -2512,9 +2512,9 @@ def test_checkout_complete_without_inventory_tracking(assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_checkout_without_lines(@@ -2712,9 +2712,9 @@ def test_checkout_complete_does_not_delete_checkout_after_unsuccessful_payment(code.refresh_from_db(fields=["used"])assert code.used == expected_voucher_usage_count- assert Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should not have been deleted"+ assert Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should not have been deleted"+ )checkout.refresh_from_db()assert not checkout.completing_started_at@@ -3167,9 +3167,9 @@ def test_checkout_complete_own_reservation(assert order_line.quantity == quantity_availableassert order_line.variant == checkout_line.variant- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )# Reservation associated with checkout has been deletedwith pytest.raises(Reservation.DoesNotExist):@@ -3241,9 +3241,9 @@ def test_checkout_complete_without_redirect_url(assert gift_card.current_balance == zero_money(gift_card.currency)assert gift_card.last_used_on- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@patch("saleor.checkout.complete_checkout.gateway.payment_refund_or_void")@@ -3406,9 +3406,9 @@ def test_checkout_complete_with_digital(assert not content["errors"]# Ensure the order was actually created- assert (- Order.objects.count() == order_count + 1- ), "The order should have been created"+ assert Order.objects.count() == order_count + 1, (+ "The order should have been created"+ )@pytest.mark.integration@@ -3497,9 +3497,9 @@ def test_checkout_complete_0_total_value(assert order_payment == paymentassert payment.transactions.count() == 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_complete_checkout_for_local_click_and_collect(@@ -3916,9 +3916,9 @@ def test_checkout_complete_with_preorder_variant(assert stock_line.allocations.exists()assert not stock_line.preorder_allocations.exists()- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.pyindex a9108968f6..24e9a0e02b 100644--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py@@ -1351,9 +1351,9 @@ def test_checkout_complete(assert GiftCardEvent.objects.filter(gift_card=gift_card, type=GiftCardEvents.USED_IN_ORDER)- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())recalculate_with_plugins_mock.assert_not_called()@@ -1431,9 +1431,9 @@ def test_checkout_complete_with_metadata(}assert order.private_metadata == checkout.metadata_storage.private_metadata- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -1547,9 +1547,9 @@ def test_checkout_complete_with_metadata_checkout_without_metadata(}assert order.private_metadata == checkout.metadata_storage.private_metadata- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -1849,9 +1849,9 @@ def test_checkout_complete_with_shipping_voucher_and_gift_card(assert GiftCardEvent.objects.filter(gift_card=gift_card, type=GiftCardEvents.USED_IN_ORDER)- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())assert not len(Reservation.objects.all())@@ -1985,9 +1985,9 @@ def test_checkout_with_voucher_complete(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_line = order.lines.first()assert (@@ -2089,9 +2089,9 @@ def test_checkout_complete_with_entire_order_voucher_and_gift_card(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_line = order.lines.first()assert (@@ -2189,9 +2189,9 @@ def test_checkout_complete_with_voucher_apply_once_per_order(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -2290,9 +2290,9 @@ def test_checkout_complete_with_voucher_apply_once_per_order_and_gift_card(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )gift_card.refresh_from_db()assert gift_card.current_balance == zero_money(gift_card.currency)@@ -2379,9 +2379,9 @@ def test_checkout_complete_with_voucher_single_use(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@patch("saleor.plugins.manager.PluginsManager.order_confirmed")@@ -2492,9 +2492,9 @@ def test_checkout_complete_with_shipping_voucher()assert order.search_vector- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())assert not len(Reservation.objects.all())@@ -2624,9 +2624,9 @@ def test_checkout_with_voucher_complete_product_on_sale(assert order.voucher == voucher_percentageassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_with_voucher_on_specific_product_complete(@@ -2701,9 +2701,9 @@ def test_checkout_with_voucher_on_specific_product_complete(assert order.voucher == voucher_specific_product_typeassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_with_voucher_on_specific_product_and_gift_card(@@ -2796,9 +2796,9 @@ def test_checkout_complete_with_voucher_on_specific_product_and_gift_card(assert order.voucher == voucher_specific_product_typeassert order.voucher.code == code.code- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )gift_card.refresh_from_db()assert gift_card.current_balance == zero_money(gift_card.currency)@@ -2911,9 +2911,9 @@ def test_checkout_complete_product_on_promotion(assert order_line.sale_id == graphene.Node.to_global_id("Promotion", catalogue_promotion_without_rules.id)- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_multiple_rules_applied(@@ -3069,9 +3069,9 @@ def test_checkout_complete_multiple_rules_applied(assert order_line.sale_id == graphene.Node.to_global_id("Promotion", catalogue_promotion_without_rules.id)- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_with_voucher_on_specific_product_complete_with_product_on_promotion(@@ -3150,9 +3150,9 @@ def test_checkout_with_voucher_on_specific_product_complete_with_product_on_promcode.refresh_from_db()assert code.used == voucher_used_count + 1- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@patch.object(PluginsManager, "preprocess_order_creation")@@ -3200,9 +3200,9 @@ def test_checkout_with_voucher_not_increase_uses_on_preprocess_order_creation_facode.refresh_from_db()assert code.used == 0- assert Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout shouldn't have been deleted"+ assert Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout shouldn't have been deleted"+ )@pytest.mark.integration@@ -3410,9 +3410,9 @@ def test_checkout_complete_own_reservation(assert order_line.quantity == quantity_availableassert order_line.variant == checkout_line.variant- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )# Reservation associated with checkout has been deletedwith pytest.raises(Reservation.DoesNotExist):@@ -3455,9 +3455,9 @@ def test_checkout_complete_without_redirect_url(assert gift_card.current_balance == zero_money(gift_card.currency)assert gift_card.last_used_on- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_checkout_complete_with_digital(@@ -3872,9 +3872,9 @@ def test_checkout_complete_with_preorder_variant(assert stock_line.allocations.exists()assert not stock_line.preorder_allocations.exists()- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())diff --git a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.pyindex 4c1e2eb3e6..dc42dd9cd8 100644--- a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py+++ b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py@@ -1738,9 +1738,9 @@ def test_order_from_checkout_with_digital(assert not content["errors"]# Ensure the order was actually created- assert (- Order.objects.count() == order_count + 1- ), "The order should have been created"+ assert Order.objects.count() == order_count + 1, (+ "The order should have been created"+ )@pytest.mark.integration@@ -1810,9 +1810,9 @@ def test_order_from_checkout_0_total_value(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )def test_order_from_checkout_for_click_and_collect(@@ -2078,9 +2078,9 @@ def test_order_from_draft_create_with_preorder_variant(assert stock_line.allocations.exists()assert not stock_line.preorder_allocations.exists()- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )order_confirmed_mock.assert_called_once_with(order, webhooks=set())@@ -2438,9 +2438,9 @@ def test_order_from_draft_create_0_total_value_from_voucher(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )@pytest.mark.integration@@ -2498,6 +2498,6 @@ def test_order_from_draft_create_0_total_value_from_giftcard(assert order.shipping_address is Noneassert order.shipping_method is None- assert not Checkout.objects.filter(- pk=checkout.pk- ).exists(), "Checkout should have been deleted"+ assert not Checkout.objects.filter(pk=checkout.pk).exists(), (+ "Checkout should have been deleted"+ )diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.pyindex e42c8414b1..37fcd2d61b 100644--- a/saleor/graphql/checkout/types.py+++ b/saleor/graphql/checkout/types.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import TYPE_CHECKING, Any, Optional+from typing import TYPE_CHECKING, Anyimport graphenefrom promise import Promise@@ -98,7 +98,7 @@ if TYPE_CHECKING:def get_dataloaders_for_fetching_checkout_data(root: models.Checkout, info: ResolveInfo) -> tuple[- Optional[Promise["Address"]],+ Promise["Address"] | None,Promise[list["CheckoutLineInfo"]],Promise["CheckoutInfo"],Promise["PluginsManager"],@@ -1272,7 +1272,7 @@ class Checkout(ModelObjectType[models.Checkout]):@staticmethoddef resolve_stored_payment_methods(- root: models.Checkout, info: ResolveInfo, amount: Optional[Decimal] = None+ root: models.Checkout, info: ResolveInfo, amount: Decimal | None = None):if root.user_id is None:return []diff --git a/saleor/graphql/context.py b/saleor/graphql/context.pyindex 11ea9aad4e..ab8e059378 100644--- a/saleor/graphql/context.py+++ b/saleor/graphql/context.py@@ -1,4 +1,4 @@-from typing import Optional, cast+from typing import castfrom django.contrib.auth import authenticatefrom django.http import HttpRequest@@ -31,8 +31,8 @@ def clear_context(context: SaleorContext):class RequestWithUser(HttpRequest):- _cached_user: Optional[User]- app: Optional[App]+ _cached_user: User | None+ app: App | Nonedef set_decoded_auth_token(request: SaleorContext):@@ -48,9 +48,9 @@ def set_app_on_context(request: SaleorContext):request.app = get_app_promise(request).get()-def get_user(request: SaleorContext) -> Optional[User]:+def get_user(request: SaleorContext) -> User | None:if not hasattr(request, "_cached_user"):- request._cached_user = cast(Optional[User], authenticate(request=request))+ request._cached_user = cast(User | None, authenticate(request=request))return request._cached_userdiff --git a/saleor/graphql/core/connection.py b/saleor/graphql/core/connection.pyindex 14a91b46f0..08a580b9c8 100644--- a/saleor/graphql/core/connection.py+++ b/saleor/graphql/core/connection.py@@ -1,7 +1,7 @@import json-from collections.abc import Iterable+from collections.abc import Callable, Iterablefrom decimal import Decimal, InvalidOperation-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from typing import TYPE_CHECKING, Anyimport graphenefrom django.conf import settings@@ -88,8 +88,8 @@ def _prepare_filter_expression(cursor: list[str],sorting_fields: list[str],sorting_direction: str,-) -> tuple[Q, dict[str, Union[str, bool]]]:- field_expression: dict[str, Union[str, bool]] = {}+) -> tuple[Q, dict[str, str | bool]]:+ field_expression: dict[str, str | bool] = {}extra_expression = Q()for cursor_id, cursor_value in enumerate(cursor[:index]):field_expression[sorting_fields[cursor_id]] = cursor_value@@ -245,7 +245,7 @@ def _get_id_coercion(qs: QuerySet) -> Callable[[str], Any]:def connection_from_queryset_slice(qs: QuerySet,- args: Optional[ConnectionArguments] = None,+ args: ConnectionArguments | None = None,connection_type: Any = Connection,edge_type: Any = Edge,pageinfo_type: Any = PageInfo,@@ -315,7 +315,7 @@ def create_connection_slice(connection_type,edge_type=None,pageinfo_type=graphene.relay.PageInfo,- max_limit: Optional[int] = None,+ max_limit: int | None = None,):_validate_slice_args(info, args, max_limit)@@ -364,7 +364,7 @@ def create_connection_slice(def _validate_slice_args(info: "ResolveInfo",args: dict,- max_limit: Optional[int] = None,+ max_limit: int | None = None,):enforce_first_or_last = _is_first_or_last_required(info)@@ -603,7 +603,7 @@ def where_filter_qs(return queryset-def contains_filter_operator(input: dict[str, Union[dict, str]]):+def contains_filter_operator(input: dict[str, dict | str]):return any(operator in input for operator in ["AND", "OR", "NOT"])diff --git a/saleor/graphql/core/context.py b/saleor/graphql/core/context.pyindex 062ff02b78..270d60e871 100644--- a/saleor/graphql/core/context.py+++ b/saleor/graphql/core/context.py@@ -1,5 +1,5 @@import datetime-from typing import TYPE_CHECKING, Any, Optional, Union+from typing import TYPE_CHECKING, Anyfrom django.conf import settingsfrom django.http import HttpRequest@@ -13,13 +13,13 @@ if TYPE_CHECKING:class SaleorContext(HttpRequest):- _cached_user: Optional[User]- decoded_auth_token: Optional[dict[str, Any]]+ _cached_user: User | None+ decoded_auth_token: dict[str, Any] | Noneallow_replica: bool = Truedataloaders: dict[str, "DataLoader"]- app: Optional[App]- user: Optional[User] # type: ignore[assignment]- requestor: Union[App, User, None]+ app: App | None+ user: User | None # type: ignore[assignment]+ requestor: App | User | Nonerequest_time: datetime.datetimedef __init__(self, *args, **kwargs):diff --git a/saleor/graphql/core/dataloaders.py b/saleor/graphql/core/dataloaders.pyindex 0c846b26dc..3c5712c298 100644--- a/saleor/graphql/core/dataloaders.py+++ b/saleor/graphql/core/dataloaders.py@@ -1,6 +1,6 @@from collections import defaultdictfrom collections.abc import Iterable-from typing import Generic, Optional, TypeVar, Union+from typing import Generic, TypeVarimport opentracingimport opentracing.tags@@ -56,16 +56,16 @@ class DataLoader(BaseLoader, Generic[K, R]):return Promise.resolve(results)return results- def batch_load(self, keys: Iterable[K]) -> Union[Promise[list[R]], list[R]]:+ def batch_load(self, keys: Iterable[K]) -> Promise[list[R]] | list[R]:raise NotImplementedError()class BaseThumbnailBySizeAndFormatLoader(- DataLoader[tuple[int, int, Optional[str]], Thumbnail]+ DataLoader[tuple[int, int, str | None], Thumbnail]):model_name: str- def batch_load(self, keys: Iterable[tuple[int, int, Optional[str]]]):+ def batch_load(self, keys: Iterable[tuple[int, int, str | None]]):model_name = self.model_name.lower()instance_ids = [id for id, _, _ in keys]lookup = {f"{model_name}_id__in": instance_ids}@@ -73,7 +73,7 @@ class BaseThumbnailBySizeAndFormatLoader(**lookup)thumbnails_by_instance_id_size_and_format_map: defaultdict[- tuple[int, int, Optional[str]], Thumbnail+ tuple[int, int, str | None], Thumbnail] = defaultdict()for thumbnail in thumbnails:format = get_thumbnail_format(thumbnail.format)diff --git a/saleor/graphql/core/fields.py b/saleor/graphql/core/fields.pyindex b27878c512..9a9cb3965b 100644--- a/saleor/graphql/core/fields.py+++ b/saleor/graphql/core/fields.py@@ -1,6 +1,5 @@from functools import wrapsfrom json import JSONDecodeError-from typing import Optionalimport graphenefrom django.conf import settings@@ -13,9 +12,9 @@ from .utils import WebhookEventInfo, message_webhook_eventsclass BaseField(graphene.Field):- description: Optional[str]- doc_category: Optional[str]- webhook_events_info: Optional[list[WebhookEventInfo]]+ description: str | None+ doc_category: str | None+ webhook_events_info: list[WebhookEventInfo] | Nonedef __init__(self, *args, **kwargs):auto_webhook_events_info_message = kwargs.pop(@@ -39,7 +38,7 @@ class BaseField(graphene.Field):class PermissionsField(BaseField):- description: Optional[str]+ description: str | Nonedef __init__(self, *args, **kwargs):self.permissions = kwargs.pop("permissions", [])diff --git a/saleor/graphql/core/filters.py b/saleor/graphql/core/filters.pyindex 864b173e7d..7ce015c9ff 100644--- a/saleor/graphql/core/filters.py+++ b/saleor/graphql/core/filters.py@@ -26,7 +26,7 @@ class DefaultMultipleChoiceField(MultipleChoiceField):"""Validate that the input is a list or tuple."""if self.required and not value:raise ValidationError(self.error_messages["required"], code="required")- if not isinstance(value, (list, tuple)):+ if not isinstance(value, list | tuple):raise ValidationError(self.error_messages["invalid_list"], code="invalid_list")@@ -40,9 +40,9 @@ class EnumFilter(django_filters.CharFilter):"""def __init__(self, input_class, *args, **kwargs):- assert kwargs.get(- "method"- ), "Providing exact filter method is required for EnumFilter"+ assert kwargs.get("method"), (+ "Providing exact filter method is required for EnumFilter"+ )self.input_class = input_classsuper().__init__(*args, **kwargs)@@ -204,9 +204,9 @@ class WhereFilterSet(django_filters.FilterSet):if name not in self.form.data:continuequeryset = self.filters[name].filter(queryset, value)- assert isinstance(- queryset, models.QuerySet- ), f"Expected '{type(self).__name__}.{name}' to return a QuerySet, but got a {type(queryset).__name__} instead."+ assert isinstance(queryset, models.QuerySet), (+ f"Expected '{type(self).__name__}.{name}' to return a QuerySet, but got a {type(queryset).__name__} instead."+ )return queryset@@ -287,9 +287,9 @@ class EnumWhereFilter(CharWhereFilter):"""def __init__(self, input_class, *args, **kwargs):- assert kwargs.get(- "method"- ), "Providing exact filter method is required for EnumFilter"+ assert kwargs.get("method"), (+ "Providing exact filter method is required for EnumFilter"+ )self.input_class = input_classsuper().__init__(*args, **kwargs)diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.pyindex f8decbc67b..b02f678695 100644--- a/saleor/graphql/core/mutations.py+++ b/saleor/graphql/core/mutations.py@@ -3,7 +3,7 @@ import secretsfrom collections.abc import Collection, Iterablefrom enum import Enumfrom itertools import chain-from typing import Any, Optional, TypeVar, Union, cast, overload+from typing import Any, TypeVar, cast, overloadfrom uuid import UUIDimport graphene@@ -113,7 +113,7 @@ def validation_error_to_error_type(return err_list-def attach_error_params(error, params: Optional[dict], error_class_fields: set):+def attach_error_params(error, params: dict | None, error_class_fields: set):if not params:return# If some of the params key overlap with error class fields@@ -156,7 +156,7 @@ class BaseMutation(graphene.Mutation):auto_permission_message=True,description=None,doc_category=None,- permissions: Optional[Collection[BasePermissionEnum]] = None,+ permissions: Collection[BasePermissionEnum] | None = None,_meta=None,error_type_class=None,error_type_field=None,@@ -164,7 +164,7 @@ class BaseMutation(graphene.Mutation):support_meta_field=False,support_private_meta_field=False,auto_webhook_events_message: bool = True,- webhook_events_info: Optional[list[WebhookEventInfo]] = None,+ webhook_events_info: list[WebhookEventInfo] | None = None,exclude=None,**options,):@@ -227,9 +227,9 @@ class BaseMutation(graphene.Mutation):cls,info: ResolveInfo,graphene_type: type[ModelObjectType[MT]],- pk: Union[int, str],- qs: Optional[QuerySet[MT]] = None,- ) -> Optional[MT]:+ pk: int | str,+ qs: QuerySet[MT] | None = None,+ ) -> MT | None:"""Attempt to resolve a node from the given internal ID.Whether by using the provided query set object or by calling type's get_node().@@ -257,7 +257,7 @@ class BaseMutation(graphene.Mutation):def get_global_id_or_error(cls,id: str,- only_type: Union[ObjectType, str, None] = None,+ only_type: ObjectType | str | None = None,field: str = "id",):try:@@ -286,13 +286,13 @@ class BaseMutation(graphene.Mutation):def get_node_or_error(cls,info: ResolveInfo,- node_id: Optional[str],+ node_id: str | None,*,field: str = "id",only_type: type[ModelObjectType[MT]],qs: Any = None,code: str = "not_found",- ) -> Optional[MT]: ...+ ) -> MT | None: ...@overload@classmethod@@ -325,25 +325,25 @@ class BaseMutation(graphene.Mutation):def get_node_or_error(cls,info: ResolveInfo,- node_id: Optional[str],+ node_id: str | None,*,field: str = "id",only_type: Any = None,qs: Any = None,code: str = "not_found",- ) -> Optional[Model]: ...+ ) -> Model | None: ...@classmethoddef get_node_or_error(cls,info: ResolveInfo,- node_id: Optional[str],+ node_id: str | None,*,field: str = "id",- only_type: Optional[type[ObjectType]] = None,- qs: Optional[QuerySet] = None,+ only_type: type[ObjectType] | None = None,+ qs: QuerySet | None = None,code: str = "not_found",- ) -> Optional[Model]:+ ) -> Model | None:if not node_id:# FIXME: this is weird behavior and we should drop it# the function now has three possible outcomes:@@ -380,7 +380,7 @@ class BaseMutation(graphene.Mutation):def get_global_ids_or_error(cls,ids: Iterable[str],- only_type: Union[ObjectType, str, None] = None,+ only_type: ObjectType | str | None = None,field: str = "ids",):try:@@ -402,7 +402,7 @@ class BaseMutation(graphene.Mutation):@overload@classmethoddef get_nodes_or_error(- cls, ids, field, only_type: Optional[ObjectType] = None, qs=None, schema=None+ cls, ids, field, only_type: ObjectType | None = None, qs=None, schema=None) -> list[Model]: ...@classmethod@@ -595,7 +595,7 @@ class BaseMutation(graphene.Mutation):@classmethoddef check_channel_permissions(- cls, info: ResolveInfo, channel_ids: Iterable[Union[UUID, int]]+ cls, info: ResolveInfo, channel_ids: Iterable[UUID | int]):# App has access to all channelsif get_app_promise(info.context).get():@@ -872,7 +872,7 @@ class ModelWithRestrictedChannelAccessMutation(ModelMutation):return cls.success_response(instance)@classmethod- def get_instance_channel_id(cls, instance, **data) -> Union[UUID, int]:+ def get_instance_channel_id(cls, instance, **data) -> UUID | int:"""Retrieve the instance channel id for channel permission accessible check."""raise NotImplementedError()@@ -931,7 +931,7 @@ class ModelDeleteWithRestrictedChannelAccessMutation(ModelDeleteMutation):return cls.success_response(instance)@classmethod- def get_instance_channel_id(cls, instance) -> Union[UUID, int]:+ def get_instance_channel_id(cls, instance) -> UUID | int:"""Retrieve the instance channel id for channel permission accessible check."""raise NotImplementedError()@@ -985,7 +985,7 @@ class BaseBulkMutation(BaseMutation):def clean_input(cls, info: ResolveInfo, instances, ids):clean_instance_ids = []errors_dict: dict[str, list[ValidationError]] = {}- for instance, node_id in zip(instances, ids):+ for instance, node_id in zip(instances, ids, strict=False):instance_errors = []# catch individual validation errors to raise them later as@@ -1014,7 +1014,7 @@ class BaseBulkMutation(BaseMutation):@classmethoddef perform_mutation( # type: ignore[override]cls, _root, info: ResolveInfo, /, *, ids, **data- ) -> tuple[int, Optional[ValidationError]]:+ ) -> tuple[int, ValidationError | None]:"""Perform a mutation that deletes a list of model instances."""# Allow to pass empty list for dummy mutationif not ids:@@ -1077,7 +1077,7 @@ class BaseBulkWithRestrictedChannelAccessMutation(BaseBulkMutation):@classmethoddef perform_mutation( # type: ignore[override]cls, _root, info: ResolveInfo, /, *, ids, **data- ) -> tuple[int, Optional[ValidationError]]:+ ) -> tuple[int, ValidationError | None]:"""Perform a mutation that deletes a list of model instances."""# Allow to pass empty list for dummy mutationif not ids:@@ -1112,7 +1112,7 @@ class BaseBulkWithRestrictedChannelAccessMutation(BaseBulkMutation):return count, errors@classmethod- def get_channel_ids(cls, instances) -> Iterable[Union[UUID, int]]:+ def get_channel_ids(cls, instances) -> Iterable[UUID | int]:"""Get the instances channel ids for channel permission accessible check."""raise NotImplementedError()diff --git a/saleor/graphql/core/scalars.py b/saleor/graphql/core/scalars.pyindex 58dd057885..b74383fc3f 100644--- a/saleor/graphql/core/scalars.py+++ b/saleor/graphql/core/scalars.py@@ -21,7 +21,7 @@ class Decimal(graphene.Float):@staticmethoddef parse_literal(node) -> decimal.Decimal | None:- if isinstance(node, (ast.FloatValue, ast.IntValue)):+ if isinstance(node, ast.FloatValue | ast.IntValue):try:return decimal.Decimal(node.value)except decimal.DecimalException:diff --git a/saleor/graphql/core/tests/test_core_reordering.py b/saleor/graphql/core/tests/test_core_reordering.pyindex be0046ed7f..325081f636 100644--- a/saleor/graphql/core/tests/test_core_reordering.py+++ b/saleor/graphql/core/tests/test_core_reordering.py@@ -111,7 +111,7 @@ def test_inserting_at_the_edges(sorted_entries_seq, operation, expected_operatioexpected = _sorted_by_order([(node.pk, node.sort_order + op)- for node, op in zip(nodes, expected_operations)+ for node, op in zip(nodes, expected_operations, strict=False)])diff --git a/saleor/graphql/core/types/model.py b/saleor/graphql/core/types/model.pyindex 9a4861a77f..022a6d5902 100644--- a/saleor/graphql/core/types/model.py+++ b/saleor/graphql/core/types/model.py@@ -1,4 +1,4 @@-from typing import Generic, Optional, TypeVar+from typing import Generic, TypeVarfrom uuid import UUIDfrom django.db.models import Model, Q@@ -60,7 +60,7 @@ class ModelObjectType(Generic[MT], BaseObjectType):)@classmethod- def get_node(cls, _, id) -> Optional[MT]:+ def get_node(cls, _, id) -> MT | None:model = cls._meta.modeltype_name = cls._meta.namelookup = Q(pk=id)diff --git a/saleor/graphql/core/types/taxes.py b/saleor/graphql/core/types/taxes.pyindex 191a46e588..196b41affa 100644--- a/saleor/graphql/core/types/taxes.py+++ b/saleor/graphql/core/types/taxes.py@@ -1,5 +1,4 @@from functools import partial-from typing import Unionimport graphenefrom prices import Money@@ -105,7 +104,7 @@ class TaxableObjectLine(BaseObjectType):doc_category = DOC_CATEGORY_TAXES@staticmethod- def resolve_variant_name(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_variant_name(root: CheckoutLine | OrderLine, info: ResolveInfo):if isinstance(root, CheckoutLine):def get_name(variant):@@ -121,7 +120,7 @@ class TaxableObjectLine(BaseObjectType):return root.variant_name@staticmethod- def resolve_product_name(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_product_name(root: CheckoutLine | OrderLine, info: ResolveInfo):if isinstance(root, CheckoutLine):def get_name(product):@@ -137,7 +136,7 @@ class TaxableObjectLine(BaseObjectType):return root.product_name@staticmethod- def resolve_product_sku(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_product_sku(root: CheckoutLine | OrderLine, info: ResolveInfo):if isinstance(root, CheckoutLine):if not root.variant_id:return None@@ -153,11 +152,11 @@ class TaxableObjectLine(BaseObjectType):return root.product_sku@staticmethod- def resolve_source_line(root: Union[CheckoutLine, OrderLine], _info: ResolveInfo):+ def resolve_source_line(root: CheckoutLine | OrderLine, _info: ResolveInfo):return root@staticmethod- def resolve_charge_taxes(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_charge_taxes(root: CheckoutLine | OrderLine, info: ResolveInfo):def load_tax_configuration(channel, country_code):tax_config = TaxConfigurationByChannelId(info.context).load(channel.pk)@@ -215,7 +214,7 @@ class TaxableObjectLine(BaseObjectType):return order.then(load_channel_for_order)@staticmethod- def resolve_unit_price(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_unit_price(root: CheckoutLine | OrderLine, info: ResolveInfo):if isinstance(root, CheckoutLine):def with_checkout(checkout):@@ -241,7 +240,7 @@ class TaxableObjectLine(BaseObjectType):return root.base_unit_price@staticmethod- def resolve_total_price(root: Union[CheckoutLine, OrderLine], info: ResolveInfo):+ def resolve_total_price(root: CheckoutLine | OrderLine, info: ResolveInfo):if isinstance(root, CheckoutLine):def with_checkout(checkout):@@ -320,33 +319,31 @@ class TaxableObject(BaseObjectType):doc_category = DOC_CATEGORY_TAXES@staticmethod- def resolve_channel(root: Union[Checkout, Order], info: ResolveInfo):+ def resolve_channel(root: Checkout | Order, info: ResolveInfo):return ChannelByIdLoader(info.context).load(root.channel_id)@staticmethod- def resolve_address(root: Union[Checkout, Order], info: ResolveInfo):+ def resolve_address(root: Checkout | Order, info: ResolveInfo):address_id = root.shipping_address_id or root.billing_address_idif not address_id:return Nonereturn AddressByIdLoader(info.context).load(address_id)@staticmethod- def resolve_source_object(root: Union[Checkout, Order], _info: ResolveInfo):+ def resolve_source_object(root: Checkout | Order, _info: ResolveInfo):return root@staticmethod- def resolve_prices_entered_with_tax(- root: Union[Checkout, Order], info: ResolveInfo- ):+ def resolve_prices_entered_with_tax(root: Checkout | Order, info: ResolveInfo):tax_config = TaxConfigurationByChannelId(info.context).load(root.channel_id)return tax_config.then(lambda tc: tc.prices_entered_with_tax)@staticmethod- def resolve_currency(root: Union[Checkout, Order], _info: ResolveInfo):+ def resolve_currency(root: Checkout | Order, _info: ResolveInfo):return root.currency@staticmethod- def resolve_shipping_price(root: Union[Checkout, Order], info: ResolveInfo):+ def resolve_shipping_price(root: Checkout | Order, info: ResolveInfo):if isinstance(root, Checkout):def calculate_shipping_price(data):@@ -376,7 +373,7 @@ class TaxableObject(BaseObjectType):return root.base_shipping_price@staticmethod- def resolve_discounts(root: Union[Checkout, Order], info: ResolveInfo):+ def resolve_discounts(root: Checkout | Order, info: ResolveInfo):if isinstance(root, Checkout):def calculate_checkout_discounts(checkout_info):@@ -453,7 +450,7 @@ class TaxableObject(BaseObjectType):return Promise.all([discounts, order_lines]).then(calculate_order_discounts)@staticmethod- def resolve_lines(root: Union[Checkout, Order], info: ResolveInfo):+ def resolve_lines(root: Checkout | Order, info: ResolveInfo):if isinstance(root, Checkout):return CheckoutLinesByCheckoutTokenLoader(info.context).load(root.token)return OrderLinesByOrderIdLoader(info.context).load(root.id)diff --git a/saleor/graphql/core/utils/__init__.py b/saleor/graphql/core/utils/__init__.pyindex d5502b504f..73f0b535c0 100644--- a/saleor/graphql/core/utils/__init__.py+++ b/saleor/graphql/core/utils/__init__.py@@ -2,7 +2,7 @@ import binasciiimport osimport secretsfrom dataclasses import dataclass-from typing import Literal, NoReturn, Optional, Union, overload+from typing import Literal, NoReturn, overloadimport graphenefrom django.conf import settings@@ -46,7 +46,7 @@ def get_duplicated_values(values):@overloaddef from_global_id_or_error(global_id: str,- only_type: Union[ObjectType, str, None] = None,+ only_type: ObjectType | str | None = None,raise_error: Literal[True] = True,) -> tuple[str, str]: ...@@ -54,14 +54,14 @@ def from_global_id_or_error(@overloaddef from_global_id_or_error(global_id: str,- only_type: Union[type[ObjectType], str, None] = None,+ only_type: type[ObjectType] | str | None = None,raise_error: bool = False,-) -> Union[tuple[str, str], tuple[str, None]]: ...+) -> tuple[str, str] | tuple[str, None]: ...def from_global_id_or_error(global_id: str,- only_type: Union[type[ObjectType], str, None] = None,+ only_type: type[ObjectType] | str | None = None,raise_error: bool = False,):"""Resolve global ID or raise GraphQLError.@@ -99,7 +99,7 @@ def from_global_id_or_error(def from_global_id_or_none(- global_id, only_type: Union[ObjectType, str, None] = None, raise_error: bool = False+ global_id, only_type: ObjectType | str | None = None, raise_error: bool = False):if not global_id:return None@@ -151,7 +151,7 @@ def ext_ref_to_global_id_or_error(@dataclassclass WebhookEventInfo:type: str- description: Optional[str] = None+ description: str | None = NoneCHECKOUT_CALCULATE_TAXES_MESSAGE = (diff --git a/saleor/graphql/core/validators/query_cost.py b/saleor/graphql/core/validators/query_cost.pyindex 10607dffec..a2f7b69e7a 100644--- a/saleor/graphql/core/validators/query_cost.py+++ b/saleor/graphql/core/validators/query_cost.py@@ -1,6 +1,6 @@from functools import reducefrom operator import add, mul-from typing import Any, Optional, Union, cast+from typing import Any, castfrom graphql import (GraphQLError,@@ -22,13 +22,9 @@ from graphql.validation import validatefrom graphql.validation.rules.base import ValidationRulefrom graphql.validation.validation import ValidationContext-CostAwareNode = Union[- Field,- FragmentDefinition,- FragmentSpread,- InlineFragment,- OperationDefinition,-]+CostAwareNode = (+ Field | FragmentDefinition | FragmentSpread | InlineFragment | OperationDefinition+)GraphQLFieldMap = dict[str, GraphQLField]@@ -37,8 +33,8 @@ class CostValidator(ValidationRule):maximum_cost: intdefault_cost: int = 0default_complexity: int = 1- variables: Optional[dict] = None- cost_map: Optional[dict[str, dict[str, Any]]] = None+ variables: dict | None = None+ cost_map: dict[str, dict[str, Any]] | None = Nonedef __init__(self,@@ -46,8 +42,8 @@ class CostValidator(ValidationRule):*,default_cost: int = 0,default_complexity: int = 1,- variables: Optional[dict] = None,- cost_map: Optional[dict[str, dict[str, Any]]] = None,+ variables: dict | None = None,+ cost_map: dict[str, dict[str, Any]] | None = None,): # pylint: disable=super-init-not-calledself.maximum_cost = maximum_costself.variables = variables@@ -67,7 +63,7 @@ class CostValidator(ValidationRule):if isinstance(node, FragmentSpread) or not node.selection_set:return 0fields: GraphQLFieldMap = {}- if isinstance(type_def, (GraphQLObjectType, GraphQLInterfaceType)):+ if isinstance(type_def, GraphQLObjectType | GraphQLInterfaceType):fields = type_def.fieldstotal = 0for child_node in node.selection_set.selections:@@ -188,7 +184,7 @@ class CostValidator(ValidationRule):except (ValueError, TypeError):passmultipliers = [- len(multiplier) if isinstance(multiplier, (list, tuple)) else multiplier+ len(multiplier) if isinstance(multiplier, list | tuple) else multiplierfor multiplier in multipliers]return [m for m in multipliers if m > 0]@@ -207,9 +203,9 @@ class CostValidator(ValidationRule):def enter(self,node: Any,- key: Optional[Union[int, str]],+ key: int | str | None,parent: Any,- path: list[Union[int, str]],+ path: list[int | str],ancestors: list[Any],):if isinstance(node, OperationDefinition):@@ -218,9 +214,9 @@ class CostValidator(ValidationRule):def leave(self,node: Any,- key: Optional[Union[int, str]],+ key: int | str | None,parent: Any,- path: list[Union[int, str]],+ path: list[int | str],ancestors: list[Any],):if isinstance(node, OperationDefinition):@@ -271,8 +267,8 @@ def cost_validator(*,default_cost: int = 0,default_complexity: int = 1,- variables: Optional[dict] = None,- cost_map: Optional[dict[str, dict[str, Any]]] = None,+ variables: dict | None = None,+ cost_map: dict[str, dict[str, Any]] | None = None,) -> CostValidator:return CostValidator(maximum_cost=maximum_cost,diff --git a/saleor/graphql/csv/mutations/base_export.py b/saleor/graphql/csv/mutations/base_export.pyindex ea32fb703d..cae46741e8 100644--- a/saleor/graphql/csv/mutations/base_export.py+++ b/saleor/graphql/csv/mutations/base_export.py@@ -1,5 +1,4 @@from collections.abc import Mapping-from typing import Unionimport graphenefrom django.core.exceptions import ValidationError@@ -22,7 +21,7 @@ class BaseExportMutation(BaseMutation):abstract = True@classmethod- def get_scope(cls, input, only_type) -> Mapping[str, Union[list, dict, str]]:+ def get_scope(cls, input, only_type) -> Mapping[str, list | dict | str]:scope = input["scope"]if scope == ExportScope.IDS.value: # type: ignore[attr-defined] # mypy does not understand graphene enums # noqa: E501return cls.clean_ids(input, only_type)diff --git a/saleor/graphql/decorators.py b/saleor/graphql/decorators.pyindex 9e906a6857..07746e68ea 100644--- a/saleor/graphql/decorators.py+++ b/saleor/graphql/decorators.py@@ -1,7 +1,6 @@from collections.abc import Iterablefrom enum import Enumfrom functools import wraps-from typing import Unionfrom graphene import ResolveInfo@@ -66,7 +65,7 @@ def account_passes_test_for_attribute(test_func):return decorator-def permission_required(perm: Union[BasePermissionEnum, list[BasePermissionEnum]]):+def permission_required(perm: BasePermissionEnum | list[BasePermissionEnum]):def check_perms(context):if isinstance(perm, Enum):perms = [perm]diff --git a/saleor/graphql/discount/dataloaders.py b/saleor/graphql/discount/dataloaders.pyindex 1a82a4f12f..e51c61c20f 100644--- a/saleor/graphql/discount/dataloaders.py+++ b/saleor/graphql/discount/dataloaders.py@@ -1,5 +1,5 @@from collections import defaultdict-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom uuid import UUIDfrom django.db.models import Exists, F, OuterRef, Sum@@ -160,7 +160,7 @@ class VoucherChannelListingsByVoucherIdLoader(]-class VoucherInfoByVoucherCodeLoader(DataLoader[str, Optional[VoucherInfo]]):+class VoucherInfoByVoucherCodeLoader(DataLoader[str, VoucherInfo | None]):context_key = "voucher_info_by_voucher_code"def batch_load(self, keys):@@ -209,7 +209,7 @@ class VoucherInfoByVoucherCodeLoader(DataLoader[str, Optional[VoucherInfo]]):for voucher_id, collection_id in voucher_collections:collection_pks_map[voucher_id].append(collection_id)- voucher_infos: list[Optional[VoucherInfo]] = []+ voucher_infos: list[VoucherInfo | None] = []for code in keys:voucher_code = voucher_codes_map.get(code)if not voucher_code:@@ -370,9 +370,9 @@ class SaleChannelListingByPromotionIdLoader(rule_ids = [rule.id for item in rules for rule in item]def with_channels(channels):- rule_channels = dict(zip(rule_ids, channels))+ rule_channels = dict(zip(rule_ids, channels, strict=False))promotion_listing_map = defaultdict(list)- for promotion_id, promotion_rules in zip(keys, rules):+ for promotion_id, promotion_rules in zip(keys, rules, strict=False):for rule in promotion_rules:channels = rule_channels[rule.id]for channel in channels:diff --git a/saleor/graphql/discount/mutations/bulk_mutations.py b/saleor/graphql/discount/mutations/bulk_mutations.pyindex 5d70ccdc07..4ca3930736 100644--- a/saleor/graphql/discount/mutations/bulk_mutations.py+++ b/saleor/graphql/discount/mutations/bulk_mutations.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationErrorfrom django.db import transaction@@ -54,7 +52,7 @@ class SaleBulkDelete(ModelBulkDeleteMutation):@classmethoddef perform_mutation( # type: ignore[override]cls, _root, info: ResolveInfo, /, *, ids, **data- ) -> tuple[int, Optional[ValidationError]]:+ ) -> tuple[int, ValidationError | None]:"""Perform a mutation that deletes a list of model instances."""try:instances = cls.get_promotion_instances(ids)@@ -174,5 +172,5 @@ class VoucherBulkDelete(ModelBulkDeleteMutation):webhooks = get_webhooks_for_event(WebhookEventAsyncType.VOUCHER_DELETED)queryset.delete()- for voucher, code in zip(vouchers, codes):+ for voucher, code in zip(vouchers, codes, strict=False):cls.call_event(manager.voucher_deleted, voucher, code, webhooks=webhooks)diff --git a/saleor/graphql/discount/mutations/promotion/promotion_update.py b/saleor/graphql/discount/mutations/promotion/promotion_update.pyindex b885afa9bd..b16defcffb 100644--- a/saleor/graphql/discount/mutations/promotion/promotion_update.py+++ b/saleor/graphql/discount/mutations/promotion/promotion_update.py@@ -1,5 +1,4 @@import datetime-from typing import Optionalimport graphenefrom django.core.exceptions import ValidationError@@ -112,7 +111,7 @@ class PromotionUpdate(ModelMutation):cls.call_event(mark_catalogue_promotion_rules_as_dirty, [instance.pk])@classmethod- def get_toggle_type(cls, instance, clean_input, previous_end_date) -> Optional[str]:+ def get_toggle_type(cls, instance, clean_input, previous_end_date) -> str | None:"""Check if promotion has started, ended or there was no toggle.Promotion toggles when start or end date already passed and the@@ -154,7 +153,7 @@ class PromotionUpdate(ModelMutation):cls,manager: "PluginsManager",instance: models.Promotion,- toggle_type: Optional[str],+ toggle_type: str | None,):"""Send a webhook about starting or ending promotion, if it wasn't sent yet."""event = None@@ -174,7 +173,7 @@ class PromotionUpdate(ModelMutation):cls,info: ResolveInfo,instance: models.Promotion,- toggle_type: Optional[str],+ toggle_type: str | None,):app = get_app_promise(info.context).get()user = info.context.userdiff --git a/saleor/graphql/discount/mutations/promotion/validators.py b/saleor/graphql/discount/mutations/promotion/validators.pyindex 8bc304e1c1..260e840daa 100644--- a/saleor/graphql/discount/mutations/promotion/validators.py+++ b/saleor/graphql/discount/mutations/promotion/validators.py@@ -1,4 +1,4 @@-from typing import TYPE_CHECKING, Union+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom django.core.exceptions import ValidationError@@ -143,8 +143,7 @@ def _clean_predicates(errors["order_predicate"].append(ValidationError(message=(- "For `order` predicate type, `orderPredicate` "- "must be provided."+ "For `order` predicate type, `orderPredicate` must be provided."),code=error_class.REQUIRED.value,params={"index": index} if index is not None else {},@@ -512,7 +511,7 @@ def clean_predicate(predicate, error_class, index=None):if isinstance(predicate, list):return [clean_predicate(item, error_class, index)- if isinstance(item, (dict, list))+ if isinstance(item, dict | list)else itemfor item in predicate]@@ -525,13 +524,13 @@ def clean_predicate(predicate, error_class, index=None):)return {to_camel_case(key): clean_predicate(value, error_class, index)- if isinstance(value, (dict, list))+ if isinstance(value, dict | list)else valuefor key, value in predicate.items()}-def _contains_operator(input: dict[str, Union[dict, str]]):+def _contains_operator(input: dict[str, dict | str]):return any(operator in input for operator in ["AND", "OR"])diff --git a/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py b/saleor/graphql/discount/mutations/sale/sale_add_catalogues.pyindex 1e7b150ab4..7810725d7c 100644--- a/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py+++ b/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py@@ -1,5 +1,3 @@-from typing import Optional-from .....core.tracing import traced_atomic_transactionfrom .....discount.error_codes import DiscountErrorCodefrom .....discount.models import Promotion, PromotionRule@@ -89,7 +87,7 @@ class SaleAddCatalogues(SaleBaseCatalogueMutation):@classmethoddef add_items_to_catalogue(cls, rules: list[PromotionRule], previous_catalogue_info: CatalogueInfo, input- ) -> Optional[dict]:+ ) -> dict | None:catalogue_info_to_add = cls.get_catalogue_info_from_input(input)if any(catalogue_info_to_add):new_catalogue = merge_catalogues_info(diff --git a/saleor/graphql/discount/mutations/sale/sale_base_catalogue.py b/saleor/graphql/discount/mutations/sale/sale_base_catalogue.pyindex 1b7c501b34..d031ebde9f 100644--- a/saleor/graphql/discount/mutations/sale/sale_base_catalogue.py+++ b/saleor/graphql/discount/mutations/sale/sale_base_catalogue.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Unionimport graphenefrom django.core.exceptions import ValidationError@@ -21,7 +20,7 @@ from ...utils import (from ..utils import update_variants_for_promotionfrom ..voucher.voucher_add_catalogues import CatalogueInput-CatalogueInfo = defaultdict[str, set[Union[int, str]]]+CatalogueInfo = defaultdict[str, set[int | str]]class SaleBaseCatalogueMutation(BaseMutation):diff --git a/saleor/graphql/discount/mutations/sale/sale_channel_listing_update.py b/saleor/graphql/discount/mutations/sale/sale_channel_listing_update.pyindex 45345f45f0..8d1456d8c1 100644--- a/saleor/graphql/discount/mutations/sale/sale_channel_listing_update.py+++ b/saleor/graphql/discount/mutations/sale/sale_channel_listing_update.py@@ -1,5 +1,6 @@from collections import defaultdict-from typing import Any, Callable, cast+from collections.abc import Callable+from typing import Any, castimport graphenefrom django.core.exceptions import ValidationErrordiff --git a/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py b/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.pyindex f7ef6414d7..e2101f8338 100644--- a/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py+++ b/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py@@ -1,5 +1,3 @@-from typing import Optional-from .....core.tracing import traced_atomic_transactionfrom .....discount.error_codes import DiscountErrorCodefrom .....discount.models import Promotion, PromotionRule@@ -91,7 +89,7 @@ class SaleRemoveCatalogues(SaleBaseCatalogueMutation):@classmethoddef remove_items_from_catalogue(cls, rules: list[PromotionRule], previous_catalogue_info: CatalogueInfo, input- ) -> Optional[dict]:+ ) -> dict | None:if not any(previous_catalogue_info):return previous_catalogue_infodiff --git a/saleor/graphql/discount/utils.py b/saleor/graphql/discount/utils.pyindex d0b5f58c8d..8c34b70590 100644--- a/saleor/graphql/discount/utils.py+++ b/saleor/graphql/discount/utils.py@@ -1,7 +1,7 @@from collections import defaultdictfrom copy import deepcopyfrom enum import Enum-from typing import Any, Optional, Union, cast+from typing import Any, castimport graphenefrom django.conf import settings@@ -30,7 +30,7 @@ from ..product.filters import (ProductWhere,)-PREDICATE_OPERATOR_DATA_T = list[dict[str, Union[list, dict, str, bool]]]+PREDICATE_OPERATOR_DATA_T = list[dict[str, list | dict | str | bool]]class PredicateObjectType(Enum):@@ -91,7 +91,7 @@ def get_variants_for_promotion(def _handle_product_predicate(- predicate_data: dict[str, Union[dict, list]], variant_qs: QuerySet[ProductVariant]+ predicate_data: dict[str, dict | list], variant_qs: QuerySet[ProductVariant]) -> ProductVariantQueryset:product_qs = where_filter_qs(Product.objects.filter(Exists(variant_qs.filter(product_id=OuterRef("id")))),@@ -106,7 +106,7 @@ def _handle_product_predicate(def _handle_variant_predicate(- predicate_data: dict[str, Union[dict, list]], variant_qs: QuerySet[ProductVariant]+ predicate_data: dict[str, dict | list], variant_qs: QuerySet[ProductVariant]) -> ProductVariantQueryset:return where_filter_qs(ProductVariant.objects.filter(id__in=variant_qs.values("id")),@@ -118,7 +118,7 @@ def _handle_variant_predicate(def _handle_collection_predicate(- predicate_data: dict[str, Union[dict, list]], variant_qs: QuerySet[ProductVariant]+ predicate_data: dict[str, dict | list], variant_qs: QuerySet[ProductVariant]) -> ProductVariantQueryset:collection_products = CollectionProduct.objects.filter(product_id__in=variant_qs.values("product_id")@@ -141,7 +141,7 @@ def _handle_collection_predicate(def _handle_category_predicate(- predicate_data: dict[str, Union[dict, list]], variant_qs+ predicate_data: dict[str, dict | list], variant_qs) -> ProductVariantQueryset:products = Product.objects.filter(id__in=variant_qs.values("product_id"))category_qs = where_filter_qs(@@ -169,7 +169,7 @@ PREDICATE_TO_HANDLE_METHOD = {def get_variants_for_catalogue_predicate(predicate,- queryset: Optional[ProductVariantQueryset] = None,+ queryset: ProductVariantQueryset | None = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):if not predicate:@@ -183,9 +183,9 @@ def filter_qs_by_predicate(predicate: dict,base_qs: QuerySet,predicate_type: PredicateObjectType,- currency: Optional[str] = None,+ currency: str | None = None,*,- result_qs: Optional[QuerySet] = None,+ result_qs: QuerySet | None = None,) -> QuerySet:"""Filter QuerySet by predicate conditions.@@ -206,8 +206,8 @@ def filter_qs_by_predicate(result_qs = cast(QuerySet, result_qs)- and_data: Optional[list[dict]] = predicate.pop("AND", None)- or_data: Optional[list[dict]] = predicate.pop("OR", None)+ and_data: list[dict] | None = predicate.pop("AND", None)+ or_data: list[dict] | None = predicate.pop("OR", None)if and_data:result_qs = _handle_and_data(@@ -230,7 +230,7 @@ def _handle_and_data(base_qs: QuerySet,data: PREDICATE_OPERATOR_DATA_T,predicate_type: PredicateObjectType,- currency: Optional[str] = None,+ currency: str | None = None,) -> QuerySet:for predicate_data in data:if contains_filter_operator(predicate_data):@@ -254,7 +254,7 @@ def _handle_or_data(base_qs: QuerySet,data: PREDICATE_OPERATOR_DATA_T,predicate_type: PredicateObjectType,- currency: Optional[str] = None,+ currency: str | None = None,) -> QuerySet:qs = result_qs.model.objects.none()for predicate_data in data:@@ -270,17 +270,17 @@ def _handle_or_data(return result_qs-def contains_filter_operator(input: dict[str, Union[dict, str, list, bool]]) -> bool:+def contains_filter_operator(input: dict[str, dict | str | list | bool]) -> bool:return any(operator in input for operator in ["AND", "OR", "NOT"])def _handle_predicate(result_qs: QuerySet,base_qs: QuerySet,- predicate_data: dict[str, Union[dict, str, list, bool]],+ predicate_data: dict[str, dict | str | list | bool],operator: Operators,predicate_type: PredicateObjectType,- currency: Optional[str] = None,+ currency: str | None = None,):if predicate_type == PredicateObjectType.CATALOGUE:return _handle_catalogue_predicate(result_qs, base_qs, predicate_data, operator)@@ -298,12 +298,12 @@ def _handle_predicate(def _handle_catalogue_predicate(result_qs: QuerySet,base_qs: QuerySet,- predicate_data: dict[str, Union[dict, str, list, bool]],+ predicate_data: dict[str, dict | str | list | bool],operator,) -> QuerySet[ProductVariant]:for field, handle_method in PREDICATE_TO_HANDLE_METHOD.items():if field_data := predicate_data.get(field):- field_data = cast(dict[str, Union[dict, list]], field_data)+ field_data = cast(dict[str, dict | list], field_data)if operator == Operators.AND:result_qs &= handle_method(field_data, base_qs)else:@@ -314,9 +314,9 @@ def _handle_catalogue_predicate(def _handle_checkout_predicate(result_qs: QuerySet,base_qs: QuerySet,- predicate_data: dict[str, Union[dict, str, list, bool]],+ predicate_data: dict[str, dict | str | list | bool],operator,- currency: Optional[str] = None,+ currency: str | None = None,):predicate_data = _predicate_to_snake_case(predicate_data)if predicate := predicate_data.get("discounted_object_predicate"):@@ -337,9 +337,9 @@ def _handle_checkout_predicate(def _handle_order_predicate(result_qs: QuerySet,base_qs: QuerySet,- predicate_data: dict[str, Union[dict, str, list, bool]],+ predicate_data: dict[str, dict | str | list | bool],operator,- currency: Optional[str] = None,+ currency: str | None = None,):predicate_data = _predicate_to_snake_case(predicate_data)if predicate := predicate_data.get("discounted_object_predicate"):@@ -377,7 +377,7 @@ def _predicate_to_snake_case(obj: Any) -> Any:def convert_migrated_sale_predicate_to_model_ids(catalogue_predicate,-) -> Optional[dict[str, list[int]]]:+) -> dict[str, list[int]] | None:"""Convert global ids from catalogue predicate of Promotion created from old sale.All migrated sales have related PromotionRule with "OR" catalogue predicate. This@@ -405,7 +405,7 @@ def convert_migrated_sale_predicate_to_model_ids(return None-CatalogueInfo = defaultdict[str, set[Union[int, str]]]+CatalogueInfo = defaultdict[str, set[int | str]]PREDICATE_TO_CATALOGUE_INFO_MAP = {"collectionPredicate": "collections","categoryPredicate": "categories",diff --git a/saleor/graphql/menu/mutations/menu_item_move.py b/saleor/graphql/menu/mutations/menu_item_move.pyindex 29d57ea8fd..7df9dbdfd4 100644--- a/saleor/graphql/menu/mutations/menu_item_move.py+++ b/saleor/graphql/menu/mutations/menu_item_move.py@@ -1,5 +1,4 @@from dataclasses import dataclass-from typing import Optionalimport graphenefrom django.core.exceptions import ValidationError@@ -25,7 +24,7 @@ from ..types import Menu, MenuItem, MenuItemMoveInputclass _MenuMoveOperation:menu_item: models.MenuItemparent_changed: bool- new_parent: Optional[models.MenuItem]+ new_parent: models.MenuItem | Nonesort_order: int@@ -143,7 +142,7 @@ class MenuItemMove(BaseMutation):move_operations: list[MenuItemMoveInput],) -> list[_MenuMoveOperation]:operations = []- item_to_current_parent: dict[int, Optional[models.MenuItem]] = {}+ item_to_current_parent: dict[int, models.MenuItem | None] = {}for move in move_operations:cls.clean_move(move)operation = cls.get_operation(info, item_to_current_parent, menu, move)diff --git a/saleor/graphql/meta/permissions.py b/saleor/graphql/meta/permissions.pyindex 7ac50072ad..a16f9b6b31 100644--- a/saleor/graphql/meta/permissions.py+++ b/saleor/graphql/meta/permissions.py@@ -1,4 +1,5 @@-from typing import Any, Callable, Union+from collections.abc import Callable+from typing import Anyfrom django.core.exceptions import ValidationErrorfrom django.db.models import Exists, OuterRef@@ -201,7 +202,7 @@ def menu_permissions(_info: ResolveInfo, _object_pk: Any) -> list[BasePermissiondef app_permissions(info: ResolveInfo, object_pk: str) -> list[BasePermissionEnum]:auth_token = info.context.decoded_auth_token or {}app = get_app_promise(info.context).get()- app_id: Union[str, int, None]+ app_id: str | int | Noneif auth_token.get("type") == JWT_THIRDPARTY_ACCESS_TYPE:_, app_id = from_global_id_or_error(auth_token["app"], "App")else:diff --git a/saleor/graphql/meta/types.py b/saleor/graphql/meta/types.pyindex 19a68ded5a..7dda114483 100644--- a/saleor/graphql/meta/types.py+++ b/saleor/graphql/meta/types.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom graphene.types.generic import GenericScalar@@ -124,7 +122,7 @@ class ObjectWithMetadata(graphene.Interface):@staticmethoddef resolve_metafield(root: ModelWithMetadata, _info: ResolveInfo, *, key: str- ) -> Optional[str]:+ ) -> str | None:return root.metadata.get(key)@staticmethod@@ -138,7 +136,7 @@ class ObjectWithMetadata(graphene.Interface):@staticmethoddef resolve_private_metafield(root: ModelWithMetadata, info: ResolveInfo, *, key: str- ) -> Optional[str]:+ ) -> str | None:check_private_metadata_privilege(root, info)return root.private_metadata.get(key)diff --git a/saleor/graphql/order/bulk_mutations/draft_orders.py b/saleor/graphql/order/bulk_mutations/draft_orders.pyindex 09b6bbc601..8b329de582 100644--- a/saleor/graphql/order/bulk_mutations/draft_orders.py+++ b/saleor/graphql/order/bulk_mutations/draft_orders.py@@ -1,5 +1,4 @@from collections.abc import Iterable-from typing import Unionfrom uuid import UUIDimport graphene@@ -82,7 +81,7 @@ class DraftOrderBulkDelete(instances_ids = [instance.id for instance in instances]related_objects = cls.get_ids_with_related_objects(instances_ids)- for instance, node_id in zip(instances, ids):+ for instance, node_id in zip(instances, ids, strict=False):instance_errors = []# catch individual validation errors to raise them later as@@ -104,7 +103,7 @@ class DraftOrderBulkDelete(return clean_instance_ids, errors_dict@classmethod- def get_channel_ids(cls, instances) -> Iterable[Union[UUID, int]]:+ def get_channel_ids(cls, instances) -> Iterable[UUID | int]:"""Get the instances channel ids for channel permission accessible check."""return [order.channel_id for order in instances]@@ -138,7 +137,7 @@ class DraftOrderLinesBulkDelete()@classmethod- def get_channel_ids(cls, instances) -> Iterable[Union[UUID, int]]:+ def get_channel_ids(cls, instances) -> Iterable[UUID | int]:"""Get the instances channel ids for channel permission accessible check."""orders = models.Order.objects.filter(id__in=[line.order_id for line in instances]diff --git a/saleor/graphql/order/bulk_mutations/order_bulk_cancel.py b/saleor/graphql/order/bulk_mutations/order_bulk_cancel.pyindex 952f92a1fd..e7aa430871 100644--- a/saleor/graphql/order/bulk_mutations/order_bulk_cancel.py+++ b/saleor/graphql/order/bulk_mutations/order_bulk_cancel.py@@ -1,5 +1,4 @@from collections.abc import Iterable-from typing import Unionfrom uuid import UUIDimport graphene@@ -51,6 +50,6 @@ class OrderBulkCancel(BaseBulkWithRestrictedChannelAccessMutation):)@classmethod- def get_channel_ids(cls, instances) -> Iterable[Union[UUID, int]]:+ def get_channel_ids(cls, instances) -> Iterable[UUID | int]:"""Get the instances channel ids for channel permission accessible check."""return [order.channel_id for order in instances]diff --git a/saleor/graphql/order/bulk_mutations/order_bulk_create.py b/saleor/graphql/order/bulk_mutations/order_bulk_create.pyindex e76948aa9f..981b062f8b 100644--- a/saleor/graphql/order/bulk_mutations/order_bulk_create.py+++ b/saleor/graphql/order/bulk_mutations/order_bulk_create.py@@ -5,7 +5,7 @@ from dataclasses import dataclassfrom dataclasses import field as dataclass_fieldfrom dataclasses import fields as dataclass_fieldsfrom decimal import Decimal-from typing import Any, Optional+from typing import Anyfrom uuid import UUIDimport graphene@@ -82,8 +82,8 @@ MAX_NOTE_LENGTH = 255@dataclassclass OrderBulkError:message: str- code: Optional[OrderBulkCreateErrorCode] = None- path: Optional[str] = None+ code: OrderBulkCreateErrorCode | None = None+ path: str | None = None@dataclass@@ -112,7 +112,7 @@ class OrderBulkTransaction:@dataclassclass OrderBulkCreateData:- order: Optional[Order] = None+ order: Order | None = Noneerrors: list[OrderBulkError] = dataclass_field(default_factory=list)lines: list[OrderBulkOrderLine] = dataclass_field(default_factory=list)notes: list[OrderEvent] = dataclass_field(default_factory=list)@@ -121,11 +121,11 @@ class OrderBulkCreateData:invoices: list[Invoice] = dataclass_field(default_factory=list)discounts: list[OrderDiscount] = dataclass_field(default_factory=list)gift_cards: list[GiftCard] = dataclass_field(default_factory=list)- user: Optional[User] = None- billing_address: Optional[Address] = None- channel: Optional[Channel] = None- shipping_address: Optional[Address] = None- voucher_code: Optional[VoucherCode] = None+ user: User | None = None+ billing_address: Address | None = None+ channel: Channel | None = None+ shipping_address: Address | None = None+ voucher_code: VoucherCode | None = None# error which ignores error policy and disqualify orderis_critical_error: bool = False@@ -246,14 +246,14 @@ class OrderBulkCreateData:@dataclassclass DeliveryMethod:is_shipping_required: bool- warehouse: Optional[Warehouse] = None- warehouse_name: Optional[str] = None- shipping_method: Optional[ShippingMethod] = None- shipping_method_name: Optional[str] = None- shipping_tax_class: Optional[TaxClass] = None- shipping_tax_class_name: Optional[str] = None- shipping_tax_class_metadata: Optional[list[dict[str, str]]] = None- shipping_tax_class_private_metadata: Optional[list[dict[str, str]]] = None+ warehouse: Warehouse | None = None+ warehouse_name: str | None = None+ shipping_method: ShippingMethod | None = None+ shipping_method_name: str | None = None+ shipping_tax_class: TaxClass | None = None+ shipping_tax_class_name: str | None = None+ shipping_tax_class_metadata: list[dict[str, str]] | None = None+ shipping_tax_class_private_metadata: list[dict[str, str]] | None = None@dataclass@@ -276,8 +276,8 @@ class LineAmounts:unit_gross: Decimalunit_net: Decimalunit_discount_value: Decimal- unit_discount_type: Optional[str]- unit_discount_reason: Optional[str]+ unit_discount_type: str | None+ unit_discount_reason: str | Noneundiscounted_total_gross: Decimalundiscounted_total_net: Decimalundiscounted_unit_gross: Decimal@@ -1012,7 +1012,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):object_storage=object_storage,)- billing_address: Optional[Address] = None+ billing_address: Address | None = Nonebilling_address_input = order_input["billing_address"]metadata_list = billing_address_input.pop("metadata", None)private_metadata_list = billing_address_input.pop("private_metadata", None)@@ -1030,7 +1030,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):))- shipping_address: Optional[Address] = None+ shipping_address: Address | None = Noneif shipping_address_input := order_input.get("shipping_address"):metadata_list = shipping_address_input.pop("metadata", None)@@ -1095,7 +1095,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):order_data: OrderBulkCreateData,currency: str,index: int,- ) -> Optional[LineAmounts]:+ ) -> LineAmounts | None:gross_amount = line_input["total_price"]["gross"]net_amount = line_input["total_price"]["net"]undiscounted_gross_amount = line_input["undiscounted_total_price"]["gross"]@@ -1382,7 +1382,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):order_data: OrderBulkCreateData,object_storage: dict[str, Any],index: int,- ) -> Optional[OrderEvent]:+ ) -> OrderEvent | None:if len(note_input["message"]) > MAX_NOTE_LENGTH:order_data.errors.append(OrderBulkError(@@ -1604,7 +1604,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):object_storage,order_input: dict[str, Any],index: int,- ) -> Optional[OrderBulkOrderLine]:+ ) -> OrderBulkOrderLine | None:variant = cls.get_instance_with_errors(input=order_line_input,errors=order_data.errors,@@ -1739,7 +1739,7 @@ class OrderBulkCreate(BaseMutation, I18nMixin):order_data: OrderBulkCreateData,object_storage: dict[str, Any],index: int,- ) -> Optional[OrderBulkFulfillment]:+ ) -> OrderBulkFulfillment | None:fulfillment = Fulfillment(order=order_data.order,status=FulfillmentStatus.FULFILLED,diff --git a/saleor/graphql/order/mutations/draft_order_create.py b/saleor/graphql/order/mutations/draft_order_create.pyindex 728fe17d54..d3380f2bbb 100644--- a/saleor/graphql/order/mutations/draft_order_create.py+++ b/saleor/graphql/order/mutations/draft_order_create.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Optionalimport graphenefrom django.core.exceptions import ValidationError@@ -307,7 +306,7 @@ class DraftOrderCreate(@classmethoddef clean_voucher_code(- cls, voucher_code: Optional[str], channel: Channel, cleaned_input: dict+ cls, voucher_code: str | None, channel: Channel, cleaned_input: dict):# We need to clean voucher instance as wellif voucher_code is None:diff --git a/saleor/graphql/order/mutations/fulfillment_cancel.py b/saleor/graphql/order/mutations/fulfillment_cancel.pyindex 61a3825975..483769538d 100644--- a/saleor/graphql/order/mutations/fulfillment_cancel.py+++ b/saleor/graphql/order/mutations/fulfillment_cancel.py@@ -1,4 +1,4 @@-from typing import Optional, cast+from typing import castimport graphenefrom django.core.exceptions import ValidationError@@ -101,7 +101,7 @@ class FulfillmentCancel(BaseMutation):if fulfillment.status == FulfillmentStatus.WAITING_FOR_APPROVAL:warehouse = Noneelif input:- warehouse_id: Optional[str] = input.get("warehouse_id")+ warehouse_id: str | None = input.get("warehouse_id")if warehouse_id:warehouse = cls.get_node_or_error(info, warehouse_id, only_type=Warehouse, field="warehouse_id"diff --git a/saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.py b/saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.pyindex 27f569e0df..c3c4c1ebf7 100644--- a/saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.py+++ b/saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.py@@ -97,7 +97,9 @@ class FulfillmentRefundAndReturnProductBase(BaseMutation):)fulfillment_lines = list(fulfillment_lines)cleaned_fulfillment_lines = []- for line, line_data in zip(fulfillment_lines, fulfillment_lines_data):+ for line, line_data in zip(+ fulfillment_lines, fulfillment_lines_data, strict=False+ ):quantity = line_data["quantity"]if line.order_line.is_gift_card:cls._raise_error_for_line(@@ -109,8 +111,7 @@ class FulfillmentRefundAndReturnProductBase(BaseMutation):)if line.quantity < quantity:cls._raise_error_for_line(- "Provided quantity is bigger than quantity from "- "fulfillment line",+ "Provided quantity is bigger than quantity from fulfillment line","FulfillmentLine",line.pk,"fulfillment_line_id",@@ -154,7 +155,7 @@ class FulfillmentRefundAndReturnProductBase(BaseMutation):)order_lines = list(order_lines)cleaned_order_lines = []- for line, line_data in zip(order_lines, lines_data):+ for line, line_data in zip(order_lines, lines_data, strict=False):quantity = line_data["quantity"]if line.is_gift_card:cls._raise_error_for_line(diff --git a/saleor/graphql/order/mutations/order_cancel.py b/saleor/graphql/order/mutations/order_cancel.pyindex 733b60fd3d..00dac466ea 100644--- a/saleor/graphql/order/mutations/order_cancel.py+++ b/saleor/graphql/order/mutations/order_cancel.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -18,7 +16,7 @@ from ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import Order-def clean_order_cancel(order: Optional[models.Order]) -> models.Order:+def clean_order_cancel(order: models.Order | None) -> models.Order:if not order or not order.can_cancel():raise ValidationError({diff --git a/saleor/graphql/order/mutations/order_capture.py b/saleor/graphql/order/mutations/order_capture.pyindex 3a6f52f783..6f22b7c69b 100644--- a/saleor/graphql/order/mutations/order_capture.py+++ b/saleor/graphql/order/mutations/order_capture.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -22,7 +20,7 @@ from .utils import clean_payment, try_payment_actiondef clean_order_capture(- payment: Optional[payment_models.Payment],+ payment: payment_models.Payment | None,) -> payment_models.Payment:payment = clean_payment(payment)if not payment.is_active:diff --git a/saleor/graphql/order/mutations/order_fulfill.py b/saleor/graphql/order/mutations/order_fulfill.pyindex 30994a47dd..37195eb0bd 100644--- a/saleor/graphql/order/mutations/order_fulfill.py+++ b/saleor/graphql/order/mutations/order_fulfill.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Optionalfrom uuid import UUIDimport graphene@@ -232,7 +231,7 @@ class OrderFulfill(BaseMutation):lines_for_warehouses: defaultdict[UUID, list[OrderFulfillmentLineInfo]] = (defaultdict(list))- for line, order_line in zip(lines, order_lines):+ for line, order_line in zip(lines, order_lines, strict=False):for stock in line["stocks"]:if stock["quantity"] > 0:warehouse_pk = UUID(@@ -250,7 +249,7 @@ class OrderFulfill(BaseMutation):@classmethoddef perform_mutation( # type: ignore[override]- cls, _root, info: ResolveInfo, /, *, input, order: Optional[str] = None+ cls, _root, info: ResolveInfo, /, *, input, order: str | None = None):instance = cls.get_node_or_error(info,diff --git a/saleor/graphql/order/mutations/order_grant_refund_create.py b/saleor/graphql/order/mutations/order_grant_refund_create.pyindex bfae4e1803..92b871974d 100644--- a/saleor/graphql/order/mutations/order_grant_refund_create.py+++ b/saleor/graphql/order/mutations/order_grant_refund_create.py@@ -1,5 +1,5 @@import decimal-from typing import Any, Optional, Union+from typing import Anyimport graphenefrom django.core.exceptions import ValidationError@@ -123,8 +123,8 @@ class OrderGrantRefundCreate(BaseMutation):def clean_input_lines(cls,order: models.Order,- lines: list[dict[str, Union[str, int]]],- ) -> tuple[list[models.OrderGrantedRefundLine], Optional[list[dict[str, str]]]]:+ lines: list[dict[str, str | int]],+ ) -> tuple[list[models.OrderGrantedRefundLine], list[dict[str, str]] | None]:errors: list[dict[str, str]] = []input_lines_data = get_input_lines_data(lines, errors, OrderGrantRefundCreateLineErrorCode.GRAPHQL_ERROR.valuediff --git a/saleor/graphql/order/mutations/order_grant_refund_update.py b/saleor/graphql/order/mutations/order_grant_refund_update.pyindex 527c0d7ff3..6c0d7e2e0e 100644--- a/saleor/graphql/order/mutations/order_grant_refund_update.py+++ b/saleor/graphql/order/mutations/order_grant_refund_update.py@@ -1,4 +1,4 @@-from typing import Any, Union, cast+from typing import Any, castimport graphenefrom django.core.exceptions import ValidationError@@ -223,7 +223,7 @@ class OrderGrantRefundUpdate(BaseMutation):def clean_add_lines(cls,order: models.Order,- lines: list[dict[str, Union[str, int]]],+ lines: list[dict[str, str | int]],errors: list[dict[str, Any]],line_ids_exclude: list[int],) -> list[models.OrderGrantedRefundLine]:diff --git a/saleor/graphql/order/mutations/order_grant_refund_utils.py b/saleor/graphql/order/mutations/order_grant_refund_utils.pyindex 718771f34b..6c1b069731 100644--- a/saleor/graphql/order/mutations/order_grant_refund_utils.py+++ b/saleor/graphql/order/mutations/order_grant_refund_utils.py@@ -1,6 +1,6 @@import uuidfrom collections import defaultdict-from typing import Any, Optional, Union, cast+from typing import Any, castimport graphenefrom graphql import GraphQLError@@ -25,7 +25,7 @@ def handle_lines_with_quantity_already_refunded(input_lines_data: dict[uuid.UUID, models.OrderGrantedRefundLine],errors: list[dict[str, Any]],error_code: str,- granted_refund_lines_to_exclude: Optional[list[int]] = None,+ granted_refund_lines_to_exclude: list[int] | None = None,):all_granted_refund_ids = order.granted_refunds.all().values_list("id", flat=True)all_granted_refund_lines = models.OrderGrantedRefundLine.objects.filter(@@ -72,7 +72,7 @@ def handle_lines_with_quantity_already_refunded(def get_input_lines_data(- lines: list[dict[str, Union[str, int]]],+ lines: list[dict[str, str | int]],errors: list[dict[str, str]],error_code: str,) -> dict[uuid.UUID, models.OrderGrantedRefundLine]:@@ -84,7 +84,7 @@ def get_input_lines_data(order_line_id, only_type="OrderLine", raise_error=True)uuid_pk = uuid.UUID(pk)- reason = cast(Optional[str], line.get("reason"))+ reason = cast(str | None, line.get("reason"))granted_refund_lines[uuid_pk] = models.OrderGrantedRefundLine(order_line_id=uuid_pk,quantity=int(line["quantity"]),diff --git a/saleor/graphql/order/mutations/order_mark_as_paid.py b/saleor/graphql/order/mutations/order_mark_as_paid.pyindex 7eaed91778..c234998e7c 100644--- a/saleor/graphql/order/mutations/order_mark_as_paid.py+++ b/saleor/graphql/order/mutations/order_mark_as_paid.py@@ -62,7 +62,7 @@ class OrderMarkAsPaid(BaseMutation):request_user: User,app: Optional["App"],manager: "PluginsManager",- external_reference: Optional[str] = None,+ external_reference: str | None = None,):try_payment_action(order, request_user, app, None, clean_mark_order_as_paid, order@@ -82,7 +82,7 @@ class OrderMarkAsPaid(BaseMutation):request_user: User,app: Optional["App"],manager: "PluginsManager",- external_reference: Optional[str] = None,+ external_reference: str | None = None,):try:clean_mark_order_as_paid(order=order)diff --git a/saleor/graphql/order/mutations/order_refund.py b/saleor/graphql/order/mutations/order_refund.pyindex 3747bfd842..343e8f5ca6 100644--- a/saleor/graphql/order/mutations/order_refund.py+++ b/saleor/graphql/order/mutations/order_refund.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -22,7 +20,7 @@ from .utils import clean_payment, try_payment_actiondef clean_refund_payment(- payment: Optional[payment_models.Payment],+ payment: payment_models.Payment | None,) -> payment_models.Payment:payment = clean_payment(payment)if not payment.can_refund():diff --git a/saleor/graphql/order/mutations/order_void.py b/saleor/graphql/order/mutations/order_void.pyindex ed134eb044..2019e60d04 100644--- a/saleor/graphql/order/mutations/order_void.py+++ b/saleor/graphql/order/mutations/order_void.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -19,7 +17,7 @@ from .utils import clean_payment, try_payment_actiondef clean_void_payment(- payment: Optional[payment_models.Payment],+ payment: payment_models.Payment | None,) -> payment_models.Payment:"""Check for payment errors."""payment = clean_payment(payment)diff --git a/saleor/graphql/order/mutations/utils.py b/saleor/graphql/order/mutations/utils.pyindex e89f22bbf9..4c7d8da180 100644--- a/saleor/graphql/order/mutations/utils.py+++ b/saleor/graphql/order/mutations/utils.py@@ -1,4 +1,4 @@-from typing import NamedTuple, Optional+from typing import NamedTupleimport graphenefrom django.conf import settings@@ -176,7 +176,7 @@ def try_payment_action(order, user, app, payment, func, *args, **kwargs):) from e-def clean_payment(payment: Optional[payment_models.Payment]) -> payment_models.Payment:+def clean_payment(payment: payment_models.Payment | None) -> payment_models.Payment:if not payment:raise ValidationError({diff --git a/saleor/graphql/order/schema.py b/saleor/graphql/order/schema.pyindex f0f3dacdc1..2dff8af1d4 100644--- a/saleor/graphql/order/schema.py+++ b/saleor/graphql/order/schema.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationErrorfrom graphql import GraphQLError@@ -76,7 +74,7 @@ def search_string_in_kwargs(kwargs: dict) -> bool:return bool(filter_search.strip())-def sort_field_from_kwargs(kwargs: dict) -> Optional[list[str]]:+def sort_field_from_kwargs(kwargs: dict) -> list[str] | None:return kwargs.get("sort_by", {}).get("field") or Nonediff --git a/saleor/graphql/order/tests/queries/test_order_events.py b/saleor/graphql/order/tests/queries/test_order_events.pyindex c374d6c7d2..d1a3d6eb75 100644--- a/saleor/graphql/order/tests/queries/test_order_events.py+++ b/saleor/graphql/order/tests/queries/test_order_events.py@@ -340,7 +340,7 @@ def test_retrieving_event_lines_with_deleted_line(# Check every line is returned and the one deleted is Noneassert len(data["lines"]) == len(lines)- for expected_data, received_line in zip(lines, data["lines"]):+ for expected_data, received_line in zip(lines, data["lines"], strict=False):quantity = expected_data.quantityline = expected_datadiff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex ccfd9dbfa1..8cdc199ea6 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -1,6 +1,5 @@import loggingfrom decimal import Decimal-from typing import Optionalfrom uuid import UUIDimport graphene@@ -931,7 +930,7 @@ class OrderLine(ModelObjectType[models.OrderLine]):@staticmethod@traced_resolverdef resolve_thumbnail(- root: models.OrderLine, info, *, size: int = 256, format: Optional[str] = None+ root: models.OrderLine, info, *, size: int = 256, format: str | None = None):if not root.variant_id:return None@@ -1602,7 +1601,7 @@ class Order(ModelObjectType[models.Order]):@staticmethod@traced_resolverdef resolve_discount(root: models.Order, info):- def return_voucher_discount(discounts) -> Optional[Money]:+ def return_voucher_discount(discounts) -> Money | None:if not discounts:return Nonefor discount in discounts:@@ -1621,7 +1620,7 @@ class Order(ModelObjectType[models.Order]):@staticmethod@traced_resolverdef resolve_discount_name(root: models.Order, info):- def return_voucher_name(discounts) -> Optional[Money]:+ def return_voucher_name(discounts) -> Money | None:if not discounts:return Nonefor discount in discounts:@@ -1638,7 +1637,7 @@ class Order(ModelObjectType[models.Order]):@staticmethod@traced_resolverdef resolve_translated_discount_name(root: models.Order, info):- def return_voucher_translated_name(discounts) -> Optional[Money]:+ def return_voucher_translated_name(discounts) -> Money | None:if not discounts:return Nonefor discount in discounts:@@ -2114,7 +2113,7 @@ class Order(ModelObjectType[models.Order]):shipping_method.tax_class_id)- def calculate_price(data) -> Optional[ShippingMethodData]:+ def calculate_price(data) -> ShippingMethodData | None:listing, tax_class = dataif not listing:return Nonediff --git a/saleor/graphql/order/utils.py b/saleor/graphql/order/utils.pyindex dbfbe298a2..e4de3efe31 100644--- a/saleor/graphql/order/utils.py+++ b/saleor/graphql/order/utils.py@@ -35,12 +35,12 @@ T_ERRORS = dict[str, list[ValidationError]]@dataclassclass OrderLineData:- variant_id: Optional[str] = None- variant: Optional[ProductVariant] = None- line_id: Optional[str] = None- price_override: Optional[Decimal] = None+ variant_id: str | None = None+ variant: ProductVariant | None = None+ line_id: str | None = None+ price_override: Decimal | None = Nonequantity: int = 0- rules_info: Optional[Iterable[VariantPromotionRuleInfo]] = None+ rules_info: Iterable[VariantPromotionRuleInfo] | None = Nonedef validate_total_quantity(lines: Iterable["OrderLine"], errors: T_ERRORS):diff --git a/saleor/graphql/page/dataloaders.py b/saleor/graphql/page/dataloaders.pyindex 74eee1d7d6..6cf8f1b31f 100644--- a/saleor/graphql/page/dataloaders.py+++ b/saleor/graphql/page/dataloaders.py@@ -124,8 +124,10 @@ class BaseAttributeValuesByPageIdLoader(DataLoader[int, list[dict]]):def with_attributes_and_values(result):attribute_pages, values = result- page_type_attrubutes = dict(zip(page_type_ids, attribute_pages))- values_by_id_map = dict(zip(value_ids, values))+ page_type_attrubutes = dict(+ zip(page_type_ids, attribute_pages, strict=False)+ )+ values_by_id_map = dict(zip(value_ids, values, strict=False))assigned_page_map = defaultdict(list)for page in pages:diff --git a/saleor/graphql/page/tests/mutations/test_page_reorder_attribute_values.py b/saleor/graphql/page/tests/mutations/test_page_reorder_attribute_values.pyindex fea621dbd8..71891a848a 100644--- a/saleor/graphql/page/tests/mutations/test_page_reorder_attribute_values.py+++ b/saleor/graphql/page/tests/mutations/test_page_reorder_attribute_values.py@@ -107,7 +107,7 @@ def test_sort_page_attribute_values(gql_attribute_values = content["page"]["attributes"][0]["values"]assert len(gql_attribute_values) == 3- for attr, expected_pk in zip(gql_attribute_values, expected_order):+ for attr, expected_pk in zip(gql_attribute_values, expected_order, strict=False):db_type, value_pk = graphene.Node.from_global_id(attr["id"])assert db_type == "AttributeValue"assert int(value_pk) == expected_pkdiff --git a/saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.py b/saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.pyindex e9f759c921..8af873ff49 100644--- a/saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.py+++ b/saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.py@@ -85,7 +85,9 @@ def test_reorder_page_type_attributes_by_staff(sorted_attributes[0].pk,]- for attr, expected_pk in zip(page_type_data["attributes"], expected_order):+ for attr, expected_pk in zip(+ page_type_data["attributes"], expected_order, strict=False+ ):gql_type, gql_attr_id = graphene.Node.from_global_id(attr["id"])assert gql_type == "Attribute"assert int(gql_attr_id) == expected_pk@@ -180,7 +182,9 @@ def test_reorder_page_type_attributes_by_app(sorted_attributes[0].pk,]- for attr, expected_pk in zip(page_type_data["attributes"], expected_order):+ for attr, expected_pk in zip(+ page_type_data["attributes"], expected_order, strict=False+ ):gql_type, gql_attr_id = graphene.Node.from_global_id(attr["id"])assert gql_type == "Attribute"assert int(gql_attr_id) == expected_pkdiff --git a/saleor/graphql/payment/mutations/base.py b/saleor/graphql/payment/mutations/base.pyindex 1e0ad87c8d..8740b7721f 100644--- a/saleor/graphql/payment/mutations/base.py+++ b/saleor/graphql/payment/mutations/base.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom django.core.exceptions import ValidationError@@ -30,7 +30,7 @@ class TransactionSessionBase(BaseMutation):incorrect_type_error_code: str,not_found_error: str,manager: "PluginsManager",- ) -> Union[checkout_models.Checkout, order_models.Order]:+ ) -> checkout_models.Checkout | order_models.Order:source_object_type, source_object_id = from_global_id_or_error(id, raise_error=False)@@ -47,7 +47,7 @@ class TransactionSessionBase(BaseMutation):)})- source_object: Optional[Union[checkout_models.Checkout, order_models.Order]]+ source_object: checkout_models.Checkout | order_models.Order | Noneif source_object_type == "Checkout":source_object = (checkout_models.Checkout.objects.select_related("channel")@@ -97,8 +97,8 @@ class TransactionSessionBase(BaseMutation):@classmethoddef get_amount(cls,- source_object: Union[checkout_models.Checkout, order_models.Order],- input_amount: Optional[Decimal],+ source_object: checkout_models.Checkout | order_models.Order,+ input_amount: Decimal | None,) -> Decimal:currency = source_object.currencyif input_amount is not None:diff --git a/saleor/graphql/payment/mutations/payment/payment_check_balance.py b/saleor/graphql/payment/mutations/payment/payment_check_balance.pyindex e69824018e..7929c1d8f5 100644--- a/saleor/graphql/payment/mutations/payment/payment_check_balance.py+++ b/saleor/graphql/payment/mutations/payment/payment_check_balance.py@@ -23,8 +23,7 @@ class MoneyInput(graphene.InputObjectType):class CardInput(graphene.InputObjectType):code = graphene.String(description=(- "Payment method nonce, a token returned "- "by the appropriate provider's SDK."+ "Payment method nonce, a token returned by the appropriate provider's SDK."),required=True,)diff --git a/saleor/graphql/payment/mutations/transaction/transaction_create.py b/saleor/graphql/payment/mutations/transaction/transaction_create.pyindex ea2d879ada..8a9517b533 100644--- a/saleor/graphql/payment/mutations/transaction/transaction_create.py+++ b/saleor/graphql/payment/mutations/transaction/transaction_create.py@@ -1,6 +1,6 @@import uuidfrom decimal import Decimal-from typing import Optional, Union, cast+from typing import castimport graphenefrom django.core.exceptions import ValidationError@@ -110,7 +110,7 @@ class TransactionCreate(BaseMutation):permissions = (PaymentPermissions.HANDLE_PAYMENTS,)@classmethod- def validate_external_url(cls, external_url: Optional[str], error_code: str):+ def validate_external_url(cls, external_url: str | None, error_code: str):if external_url is None:returnvalidator = URLValidator()@@ -127,7 +127,7 @@ class TransactionCreate(BaseMutation):@classmethoddef validate_metadata_keys( # type: ignore[override]- cls, metadata_list: Optional[list[dict]], field_name, error_code+ cls, metadata_list: list[dict] | None, field_name, error_code):if not metadata_list:return@@ -177,9 +177,9 @@ class TransactionCreate(BaseMutation):@classmethoddef validate_instance(cls, instance: Model, instance_id- ) -> Union[checkout_models.Checkout, order_models.Order]:+ ) -> checkout_models.Checkout | order_models.Order:"""Validate if provided instance is an order or checkout type."""- if not isinstance(instance, (checkout_models.Checkout, order_models.Order)):+ if not isinstance(instance, checkout_models.Checkout | order_models.Order):raise ValidationError({"id": ValidationError(@@ -217,8 +217,8 @@ class TransactionCreate(BaseMutation):@classmethoddef validate_input(- cls, instance: Union[checkout_models.Checkout, order_models.Order], transaction- ) -> Union[checkout_models.Checkout, order_models.Order]:+ cls, instance: checkout_models.Checkout | order_models.Order, transaction+ ) -> checkout_models.Checkout | order_models.Order:currency = instance.currencycls.validate_money_input(diff --git a/saleor/graphql/payment/mutations/transaction/transaction_event_report.py b/saleor/graphql/payment/mutations/transaction/transaction_event_report.pyindex 7b26187b31..addac370e9 100644--- a/saleor/graphql/payment/mutations/transaction/transaction_event_report.py+++ b/saleor/graphql/payment/mutations/transaction/transaction_event_report.py@@ -181,10 +181,10 @@ class TransactionEventReport(ModelMutation):manager: "PluginsManager",transaction: payment_models.TransactionItem,transaction_event: payment_models.TransactionEvent,- available_actions: Optional[list[str]] = None,+ available_actions: list[str] | None = None,app: Optional["App"] = None,- metadata: Optional[list[dict]] = None,- private_metadata: Optional[list[dict]] = None,+ metadata: list[dict] | None = None,+ private_metadata: list[dict] | None = None,):fields_to_update = ["authorized_value",@@ -231,7 +231,7 @@ class TransactionEventReport(ModelMutation):@classmethoddef get_related_granted_refund(cls, event_psp_reference: str, transaction: payment_models.TransactionItem- ) -> Optional[order_models.OrderGrantedRefund]:+ ) -> order_models.OrderGrantedRefund | None:request_refund = (payment_models.TransactionEvent.objects.filter(psp_reference=event_psp_reference,@@ -245,7 +245,7 @@ class TransactionEventReport(ModelMutation):@classmethoddef clean_amount_value(- cls, amount: Optional[float], event_type: str, psp_reference: str, currency: str+ cls, amount: float | None, event_type: str, psp_reference: str, currency: str):if amount is None:if event_type not in OPTIONAL_AMOUNT_EVENTS:@@ -286,8 +286,8 @@ class TransactionEventReport(ModelMutation):external_url=None,message=None,available_actions=None,- transaction_metadata: Optional[list[dict]] = None,- transaction_private_metadata: Optional[list[dict]] = None,+ transaction_metadata: list[dict] | None = None,+ transaction_private_metadata: list[dict] | None = None,):validate_one_of_args_is_in_mutation("id", id, "token", token)transaction = get_transaction_item(id, token)diff --git a/saleor/graphql/payment/mutations/transaction/transaction_initialize.py b/saleor/graphql/payment/mutations/transaction/transaction_initialize.pyindex dff68a1995..55e0322c67 100644--- a/saleor/graphql/payment/mutations/transaction/transaction_initialize.py+++ b/saleor/graphql/payment/mutations/transaction/transaction_initialize.py@@ -1,5 +1,4 @@import uuid-from typing import Optionalimport graphenefrom django.conf import settings@@ -96,7 +95,7 @@ class TransactionInitialize(TransactionSessionBase):error_type_class = common_types.TransactionInitializeError@classmethod- def clean_action(cls, info, action: Optional[str], channel: "Channel"):+ def clean_action(cls, info, action: str | None, channel: "Channel"):if not action:return channel.default_transaction_flow_strategyapp = get_app_promise(info.context).get()@@ -123,7 +122,7 @@ class TransactionInitialize(TransactionSessionBase):return app@classmethod- def clean_idempotency_key(cls, idempotency_key: Optional[str]):+ def clean_idempotency_key(cls, idempotency_key: str | None):if not idempotency_key and isinstance(idempotency_key, str):raise ValidationError({diff --git a/saleor/graphql/payment/mutations/transaction/transaction_process.py b/saleor/graphql/payment/mutations/transaction/transaction_process.pyindex 1856d61f0e..6a663fa5b1 100644--- a/saleor/graphql/payment/mutations/transaction/transaction_process.py+++ b/saleor/graphql/payment/mutations/transaction/transaction_process.py@@ -1,4 +1,4 @@-from typing import TYPE_CHECKING, Optional, Union, cast+from typing import TYPE_CHECKING, castimport graphenefrom django.conf import settings@@ -92,7 +92,7 @@ class TransactionProcess(BaseMutation):@classmethoddef get_source_object(cls, transaction_item: payment_models.TransactionItem- ) -> Union[checkout_models.Checkout, order_models.Order]:+ ) -> checkout_models.Checkout | order_models.Order:if transaction_item.checkout_id:checkout = cast(checkout_models.Checkout, transaction_item.checkout)return checkout@@ -136,7 +136,7 @@ class TransactionProcess(BaseMutation):)@classmethod- def get_already_processed_event(cls, events) -> Optional[TransactionEvent]:+ def get_already_processed_event(cls, events) -> TransactionEvent | None:for event in events:if (event.type in get_final_session_statuses()diff --git a/saleor/graphql/payment/mutations/transaction/transaction_request_action.py b/saleor/graphql/payment/mutations/transaction/transaction_request_action.pyindex f73555d0a1..7eb136d81b 100644--- a/saleor/graphql/payment/mutations/transaction/transaction_request_action.py+++ b/saleor/graphql/payment/mutations/transaction/transaction_request_action.py@@ -72,9 +72,9 @@ class TransactionRequestAction(BaseMutation):cls,action,action_kwargs,- action_value: Optional[Decimal],+ action_value: Decimal | None,user: Optional["User"],- app: Optional[App],+ app: App | None,):if action == TransactionAction.CANCEL:transaction = action_kwargs["transaction"]diff --git a/saleor/graphql/payment/mutations/transaction/utils.py b/saleor/graphql/payment/mutations/transaction/utils.pyindex 2ac49c805e..c869e74cfb 100644--- a/saleor/graphql/payment/mutations/transaction/utils.py+++ b/saleor/graphql/payment/mutations/transaction/utils.py@@ -1,4 +1,4 @@-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom django.core.exceptions import ValidationErrorfrom django.core.validators import validate_ipv46_address@@ -51,9 +51,7 @@ def get_transaction_item(return instance-def clean_customer_ip_address(- info, customer_ip_address: Optional[str], error_code: str-):+def clean_customer_ip_address(info, customer_ip_address: str | None, error_code: str):"""Get customer IP address.The customer IP address is required for some payment gateways. By default, thediff --git a/saleor/graphql/payment/tests/mutations/test_check_payment_balance.py b/saleor/graphql/payment/tests/mutations/test_check_payment_balance.pyindex 7729eb40a3..6360305cef 100644--- a/saleor/graphql/payment/tests/mutations/test_check_payment_balance.py+++ b/saleor/graphql/payment/tests/mutations/test_check_payment_balance.py@@ -68,8 +68,7 @@ def test_payment_check_balance_validate_not_supported_currency(assert errors[0]["code"] == PaymentErrorCode.NOT_SUPPORTED_GATEWAY.value.upper()assert errors[0]["field"] == "currency"assert errors[0]["message"] == (- "The currency ABSTRACT_CURRENCY is not "- "available for mirumee.payments.gateway."+ "The currency ABSTRACT_CURRENCY is not available for mirumee.payments.gateway.")assert check_payment_balance_mock.call_count == 0diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.pyindex 87e7049ebb..1a4bd990b7 100644--- a/saleor/graphql/payment/types.py+++ b/saleor/graphql/payment/types.py@@ -1,4 +1,4 @@-from typing import Any, Optional+from typing import Anyfrom uuid import UUIDimport graphene@@ -611,7 +611,7 @@ class TransactionItem(ModelObjectType[models.TransactionItem]):return root.message or ""@classmethod- def get_node(cls, _: Any, id: str) -> Optional[models.TransactionItem]:+ def get_node(cls, _: Any, id: str) -> models.TransactionItem | None:model = cls._meta.modellookup = Q(token=id)try:diff --git a/saleor/graphql/plugins/filters.py b/saleor/graphql/plugins/filters.pyindex 9d262391f4..52ae3110cc 100644--- a/saleor/graphql/plugins/filters.py+++ b/saleor/graphql/plugins/filters.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom ..channel.types import Channel@@ -42,7 +40,7 @@ def filter_plugin_by_type(plugins: list[Plugin], type):return plugins-def filter_plugin_search(plugins: list[Plugin], value: Optional[str]) -> list[Plugin]:+def filter_plugin_search(plugins: list[Plugin], value: str | None) -> list[Plugin]:plugin_fields = ["name", "description"]if value is not None:return [diff --git a/saleor/graphql/plugins/sorters.py b/saleor/graphql/plugins/sorters.pyindex b8323d43e3..03726fcf9e 100644--- a/saleor/graphql/plugins/sorters.py+++ b/saleor/graphql/plugins/sorters.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom ..core.enums import OrderDirection@@ -19,7 +17,7 @@ def sort_active_key(plugin: Plugin, sort_reverse: bool):return not active if sort_reverse else active, name-def sort_plugins(plugins: list["Plugin"], sort_by: Optional[dict]) -> list["Plugin"]:+def sort_plugins(plugins: list["Plugin"], sort_by: dict | None) -> list["Plugin"]:sort_reverse = Falsedirection = sort_by.get("direction", OrderDirection.ASC) if sort_by else Noneif direction == OrderDirection.DESC:diff --git a/saleor/graphql/product/bulk_mutations/product_variant_bulk_create.py b/saleor/graphql/product/bulk_mutations/product_variant_bulk_create.pyindex c751d4a2f9..3a43655e80 100644--- a/saleor/graphql/product/bulk_mutations/product_variant_bulk_create.py+++ b/saleor/graphql/product/bulk_mutations/product_variant_bulk_create.py@@ -639,8 +639,7 @@ class ProductVariantBulkCreate(BaseMutation):quantity_limit = cleaned_input.get("quantity_limit_per_customer")if quantity_limit is not None and quantity_limit < 1:message = (- "Product variant can't have "- "quantity_limit_per_customer lower than 1."+ "Product variant can't have quantity_limit_per_customer lower than 1.")code = ProductVariantBulkErrorCode.INVALID.valueindex_error_map[index].append(diff --git a/saleor/graphql/product/bulk_mutations/product_variant_stocks_update.py b/saleor/graphql/product/bulk_mutations/product_variant_stocks_update.pyindex 94173e7b7d..7f18ad23ba 100644--- a/saleor/graphql/product/bulk_mutations/product_variant_stocks_update.py+++ b/saleor/graphql/product/bulk_mutations/product_variant_stocks_update.py@@ -98,7 +98,7 @@ class ProductVariantStocksUpdate(ProductVariantStocksCreate):webhooks_stock_update = get_webhooks_for_event(WebhookEventAsyncType.PRODUCT_VARIANT_STOCK_UPDATED)- for stock_data, warehouse in zip(stocks_data, warehouses):+ for stock_data, warehouse in zip(stocks_data, warehouses, strict=False):stock, is_created = warehouse_models.Stock.objects.get_or_create(product_variant=variant, warehouse=warehouse)diff --git a/saleor/graphql/product/dataloaders/attributes.py b/saleor/graphql/product/dataloaders/attributes.pyindex f6a5e9f8b9..a027691dd5 100644--- a/saleor/graphql/product/dataloaders/attributes.py+++ b/saleor/graphql/product/dataloaders/attributes.py@@ -185,7 +185,7 @@ class AttributeValuesByAssignedVariantAttributeIdLoader(DataLoader):value_ids = [a.value_id for a in attribute_values]def map_assignment_to_values(values):- value_map = dict(zip(value_ids, values))+ value_map = dict(zip(value_ids, values, strict=False))assigned_variant_map = defaultdict(list)for attribute_value in attribute_values:assigned_variant_map[attribute_value.assignment_id].append(@@ -222,9 +222,9 @@ class BaseAttributeValuesByProductIdLoader(DataLoader):def with_attributes_and_values(result):attribute_products, values = resultproduct_type_attrubutes = dict(- zip(product_type_ids, attribute_products)+ zip(product_type_ids, attribute_products, strict=False))- values_by_id_map = dict(zip(value_ids, values))+ values_by_id_map = dict(zip(value_ids, values, strict=False))assigned_product_map = defaultdict(list)for product in products:@@ -301,14 +301,14 @@ class SelectedAttributesByProductVariantIdLoader(DataLoader):assigned_variant_attribute_ids = [a.id for attrs in variant_attributes for a in attrs]- variant_attributes = dict(zip(keys, variant_attributes))+ variant_attributes = dict(zip(keys, variant_attributes, strict=False))def with_products_and_attribute_values(results):products, attribute_values = resultsproduct_type_ids = list({p.product_type_id for p in products})- products = dict(zip(product_ids, products))+ products = dict(zip(product_ids, products, strict=False))attribute_values = dict(- zip(assigned_variant_attribute_ids, attribute_values)+ zip(assigned_variant_attribute_ids, attribute_values, strict=False))def with_attribute_products(attribute_products):@@ -316,12 +316,18 @@ class SelectedAttributesByProductVariantIdLoader(DataLoader):{ap.attribute_id for aps in attribute_products for ap in aps})- attribute_products = dict(zip(product_type_ids, attribute_products))+ attribute_products = dict(+ zip(product_type_ids, attribute_products, strict=False)+ )def with_attributes(attributes):- id_to_attribute = dict(zip(attribute_ids, attributes))+ id_to_attribute = dict(+ zip(attribute_ids, attributes, strict=False)+ )selected_attributes_map = defaultdict(list)- for key, product_variant in zip(keys, product_variants):+ for key, product_variant in zip(+ keys, product_variants, strict=False+ ):product = products[product_variant.product_id]assigned_producttype_attributes = attribute_products[product.product_type_iddiff --git a/saleor/graphql/product/dataloaders/products.py b/saleor/graphql/product/dataloaders/products.pyindex 70216ef966..0fec5b3c22 100644--- a/saleor/graphql/product/dataloaders/products.py+++ b/saleor/graphql/product/dataloaders/products.py@@ -1,6 +1,5 @@from collections import defaultdictfrom collections.abc import Iterable-from typing import Optionalfrom django.db.models import Exists, F, OuterRef, Q@@ -25,7 +24,7 @@ from ...core.dataloaders import BaseThumbnailBySizeAndFormatLoader, DataLoaderProductIdAndChannelSlug = tuple[int, str]VariantIdAndChannelSlug = tuple[int, str]-VariantIdAndChannelId = tuple[int, Optional[int]]+VariantIdAndChannelId = tuple[int, int | None]class CategoryByIdLoader(DataLoader[int, Category]):@@ -112,7 +111,7 @@ class ProductChannelListingByProductIdAndChannelSlugLoader(# For each channel execute a single query for all products.product_channel_listing_by_product_and_channel: defaultdict[- ProductIdAndChannelSlug, Optional[ProductChannelListing]+ ProductIdAndChannelSlug, ProductChannelListing | None] = defaultdict()for channel_slug, product_ids in product_channel_listing_by_channel.items():product_channel_listings = self.batch_load_channel(@@ -127,7 +126,7 @@ class ProductChannelListingByProductIdAndChannelSlugLoader(def batch_load_channel(self, channel_slug: str, products_ids: Iterable[int]- ) -> Iterable[tuple[int, Optional[ProductChannelListing]]]:+ ) -> Iterable[tuple[int, ProductChannelListing | None]]:product_channel_listings = ProductChannelListing.objects.using(self.database_connection_name).filter(channel__slug=channel_slug, product_id__in=products_ids)@@ -331,7 +330,7 @@ class VariantChannelListingByVariantIdAndChannelIdLoader(# Split the list of keys by channel first. A typical query will only touch# a handful of unique countries but may access thousands of product variants# so it's cheaper to execute one query per channel.- variant_channel_listing_by_channel: defaultdict[Optional[int], list[int]] = (+ variant_channel_listing_by_channel: defaultdict[int | None, list[int]] = (defaultdict(list))for variant_id, channel_id in keys:@@ -339,7 +338,7 @@ class VariantChannelListingByVariantIdAndChannelIdLoader(# For each channel execute a single query for all product variants.variant_channel_listing_by_variant_and_channel: defaultdict[- VariantIdAndChannelId, Optional[ProductVariantChannelListing]+ VariantIdAndChannelId, ProductVariantChannelListing | None] = defaultdict()for channel_id, variant_ids in variant_channel_listing_by_channel.items():variant_channel_listings = self.batch_load_channel(channel_id, variant_ids)@@ -351,8 +350,8 @@ class VariantChannelListingByVariantIdAndChannelIdLoader(return [variant_channel_listing_by_variant_and_channel[key] for key in keys]def batch_load_channel(- self, channel_id: Optional[int], variant_ids: Iterable[int]- ) -> Iterable[tuple[int, Optional[ProductVariantChannelListing]]]:+ self, channel_id: int | None, variant_ids: Iterable[int]+ ) -> Iterable[tuple[int, ProductVariantChannelListing | None]]:filter = {"channel_id": channel_id,"variant_id__in": variant_ids,@@ -395,7 +394,7 @@ class VariantsChannelListingByProductIdAndChannelSlugLoader(# For each channel execute a single query for all product variants.variant_channel_listing_by_product_and_channel: defaultdict[- ProductIdAndChannelSlug, Optional[Iterable[ProductVariantChannelListing]]+ ProductIdAndChannelSlug, Iterable[ProductVariantChannelListing] | None] = defaultdict()for channel_slug, product_ids in variant_channel_listing_by_channel.items():variant_channel_listings = self.batch_load_channel(@@ -412,7 +411,7 @@ class VariantsChannelListingByProductIdAndChannelSlugLoader(def batch_load_channel(self, channel_slug: str, products_ids: Iterable[int]- ) -> Iterable[tuple[int, Optional[list[ProductVariantChannelListing]]]]:+ ) -> Iterable[tuple[int, list[ProductVariantChannelListing] | None]]:variants_channel_listings = (ProductVariantChannelListing.objects.all().using(self.database_connection_name)diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.pyindex 919a5a95a8..dddf137400 100644--- a/saleor/graphql/product/filters.py+++ b/saleor/graphql/product/filters.py@@ -1,7 +1,7 @@import datetimeimport mathfrom collections import defaultdict-from typing import Optional, TypedDict+from typing import TypedDictimport django_filtersimport graphene@@ -199,7 +199,7 @@ def _clean_product_attributes_date_time_range_filter_input(class KeyValueDict(TypedDict):pk: int- values: dict[Optional[bool], int]+ values: dict[bool | None, int]def _clean_product_attributes_boolean_filter_input(diff --git a/saleor/graphql/product/mutations/channels.py b/saleor/graphql/product/mutations/channels.pyindex d041960961..ac3f5616db 100644--- a/saleor/graphql/product/mutations/channels.py+++ b/saleor/graphql/product/mutations/channels.py@@ -444,7 +444,7 @@ class ProductVariantChannelListingUpdate(BaseMutation):channels = cls.get_nodes_or_error(add_channels_ids, "channel_id", Channel)- for channel_listing_data, channel in zip(input, channels):+ for channel_listing_data, channel in zip(input, channels, strict=False):channel_listing_data["channel"] = channelcleaned_input.append(channel_listing_data)return cleaned_inputdiff --git a/saleor/graphql/product/mutations/digital_contents.py b/saleor/graphql/product/mutations/digital_contents.pyindex 914c3298da..40679f580c 100644--- a/saleor/graphql/product/mutations/digital_contents.py+++ b/saleor/graphql/product/mutations/digital_contents.py@@ -23,8 +23,7 @@ class DigitalContentInput(BaseInputObjectType):)max_downloads = graphene.Int(description=(- "Determines how many times a download link can be accessed by a "- "customer."+ "Determines how many times a download link can be accessed by a customer."),required=False,)diff --git a/saleor/graphql/product/mutations/product/product_media_create.py b/saleor/graphql/product/mutations/product/product_media_create.pyindex 8002c5c8d8..f9e5c416c4 100644--- a/saleor/graphql/product/mutations/product/product_media_create.py+++ b/saleor/graphql/product/mutations/product/product_media_create.py@@ -85,8 +85,7 @@ class ProductMediaCreate(BaseMutation):raise ValidationError({"input": ValidationError(- f"Alt field exceeds the character "- f"limit of {ALT_CHAR_LIMIT}.",+ f"Alt field exceeds the character limit of {ALT_CHAR_LIMIT}.",code=ProductErrorCode.INVALID.value,)}diff --git a/saleor/graphql/product/mutations/product_variant/product_variant_delete.py b/saleor/graphql/product/mutations/product_variant/product_variant_delete.pyindex 1eaf6e4f1a..0d85ccb898 100644--- a/saleor/graphql/product/mutations/product_variant/product_variant_delete.py+++ b/saleor/graphql/product/mutations/product_variant/product_variant_delete.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationErrorfrom django.db.models import Exists, OuterRef@@ -66,9 +64,9 @@ class ProductVariantDelete(ModelDeleteMutation, ModelWithExtRefMutation):info: ResolveInfo,/,*,- external_reference: Optional[str] = None,- id: Optional[str] = None,- sku: Optional[str] = None,+ external_reference: str | None = None,+ id: str | None = None,+ sku: str | None = None,):validate_one_of_args_is_in_mutation("sku",@@ -79,7 +77,7 @@ class ProductVariantDelete(ModelDeleteMutation, ModelWithExtRefMutation):external_reference,)node_id: str- instance: Optional[models.ProductVariant]+ instance: models.ProductVariant | Noneif external_reference:id = ext_ref_to_global_id_or_error(models.ProductVariant, external_reference=external_referencediff --git a/saleor/graphql/product/resolvers.py b/saleor/graphql/product/resolvers.pyindex d2450d5782..7f6f43e395 100644--- a/saleor/graphql/product/resolvers.py+++ b/saleor/graphql/product/resolvers.py@@ -1,5 +1,3 @@-from typing import Optional-from django.db.models import Exists, OuterRef, Sumfrom ...channel.models import Channel@@ -92,7 +90,7 @@ def resolve_product(slug,slug_language_code,external_reference,- channel: Optional[Channel],+ channel: Channel | None,limited_channel_access: bool,requestor,):@@ -117,7 +115,7 @@ def resolve_product(def resolve_products(info: ResolveInfo,requestor,- channel: Optional[Channel],+ channel: Channel | None,limited_channel_access: bool,) -> ChannelQsContext:connection_name = get_database_connection_name(info.context)@@ -161,7 +159,7 @@ def resolve_variant(sku,external_reference,*,- channel: Optional[Channel],+ channel: Channel | None,limited_channel_access: bool,requestor,requestor_has_access_to_all,@@ -190,8 +188,8 @@ def resolve_product_variants(info: ResolveInfo,requestor,ids=None,- channel: Optional[Channel] = None,- product_id: Optional[int] = None,+ channel: Channel | None = None,+ product_id: int | None = None,limited_channel_access: bool = False,) -> ChannelQsContext:connection_name = get_database_connection_name(info.context)diff --git a/saleor/graphql/product/tests/benchmark/test_collection.py b/saleor/graphql/product/tests/benchmark/test_collection.pyindex 752b1bf0a9..7ca6808e86 100644--- a/saleor/graphql/product/tests/benchmark/test_collection.py+++ b/saleor/graphql/product/tests/benchmark/test_collection.py@@ -445,13 +445,11 @@ def test_collections_for_federation_query_count(@patch(- "saleor.graphql.product.mutations.collection.collection_delete."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_delete.PRODUCTS_BATCH_SIZE",2,)@patch(- "saleor.graphql.product.mutations.collection.collection_create."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_create.PRODUCTS_BATCH_SIZE",2,)@pytest.mark.parametrize(@@ -468,13 +466,11 @@ def test_collection_batching_not_even(mutation_class):@patch(- "saleor.graphql.product.mutations.collection.collection_delete."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_delete.PRODUCTS_BATCH_SIZE",2,)@patch(- "saleor.graphql.product.mutations.collection.collection_create."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_create.PRODUCTS_BATCH_SIZE",2,)@pytest.mark.parametrize(@@ -491,13 +487,11 @@ def test_collection_batching_even(mutation_class):@patch(- "saleor.graphql.product.mutations.collection.collection_delete."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_delete.PRODUCTS_BATCH_SIZE",2,)@patch(- "saleor.graphql.product.mutations.collection.collection_create."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_create.PRODUCTS_BATCH_SIZE",2,)@pytest.mark.parametrize(@@ -514,13 +508,11 @@ def test_collection_batching_smaller_than_batch_size(mutation_class):@patch(- "saleor.graphql.product.mutations.collection.collection_delete."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_delete.PRODUCTS_BATCH_SIZE",2,)@patch(- "saleor.graphql.product.mutations.collection.collection_create."- "PRODUCTS_BATCH_SIZE",+ "saleor.graphql.product.mutations.collection.collection_create.PRODUCTS_BATCH_SIZE",2,)@pytest.mark.parametrize(diff --git a/saleor/graphql/product/tests/mutations/test_product_bulk_create.py b/saleor/graphql/product/tests/mutations/test_product_bulk_create.pyindex 51261d9832..bd6ef11040 100644--- a/saleor/graphql/product/tests/mutations/test_product_bulk_create.py+++ b/saleor/graphql/product/tests/mutations/test_product_bulk_create.py@@ -1370,8 +1370,7 @@ def test_product_bulk_create_with_variants_with_duplicated_sku(@patch(- "saleor.graphql.product.bulk_mutations."- "product_bulk_create.get_webhooks_for_event"+ "saleor.graphql.product.bulk_mutations.product_bulk_create.get_webhooks_for_event")@patch("saleor.plugins.manager.PluginsManager.product_variant_created")@patch("saleor.plugins.manager.PluginsManager.product_created")@@ -1688,8 +1687,7 @@ def test_product_bulk_create_with_variants_and_invalid_stock(@patch(- "saleor.graphql.product.bulk_mutations."- "product_bulk_create.get_webhooks_for_event"+ "saleor.graphql.product.bulk_mutations.product_bulk_create.get_webhooks_for_event")@patch("saleor.plugins.manager.PluginsManager.product_created")@patch("saleor.plugins.manager.PluginsManager.product_variant_created")diff --git a/saleor/graphql/product/tests/mutations/test_product_create.py b/saleor/graphql/product/tests/mutations/test_product_create.pyindex 107e87373f..5f3f23803d 100644--- a/saleor/graphql/product/tests/mutations/test_product_create.py+++ b/saleor/graphql/product/tests/mutations/test_product_create.py@@ -1819,7 +1819,7 @@ def test_create_product_with_product_reference_attribute_values_saved_in_order("dateTime": None,"reference": reference,}- for product, reference in zip(reference_instances, reference_ids)+ for product, reference in zip(reference_instances, reference_ids, strict=False)]assert len(data["product"]["attributes"]) == 1diff --git a/saleor/graphql/product/tests/mutations/test_product_update.py b/saleor/graphql/product/tests/mutations/test_product_update.pyindex 429fc11dd3..1460028438 100644--- a/saleor/graphql/product/tests/mutations/test_product_update.py+++ b/saleor/graphql/product/tests/mutations/test_product_update.py@@ -1975,9 +1975,9 @@ def test_update_product_with_existing_attribute_value()["data"]["productUpdate"]assert not data["errors"]- assert (- color_attribute.values.count() == expected_attribute_values_count- ), "A new attribute value shouldn't have been created"+ assert color_attribute.values.count() == expected_attribute_values_count, (+ "A new attribute value shouldn't have been created"+ )def test_update_product_with_non_existing_attribute(diff --git a/saleor/graphql/product/tests/mutations/test_product_variant_update.py b/saleor/graphql/product/tests/mutations/test_product_variant_update.pyindex fcea526782..090ec44dec 100644--- a/saleor/graphql/product/tests/mutations/test_product_variant_update.py+++ b/saleor/graphql/product/tests/mutations/test_product_variant_update.py@@ -2315,9 +2315,9 @@ def test_update_product_variant_requires_values()variant.refresh_from_db()content = get_graphql_content(response)- assert (- len(content["data"]["productVariantUpdate"]["errors"]) == 1- ), f"expected: {message}"+ assert len(content["data"]["productVariantUpdate"]["errors"]) == 1, (+ f"expected: {message}"+ )assert content["data"]["productVariantUpdate"]["errors"][0] == {"field": "attributes","message": message,diff --git a/saleor/graphql/product/tests/queries/test_product_query.py b/saleor/graphql/product/tests/queries/test_product_query.pyindex 81707d54e6..4d17468f9c 100644--- a/saleor/graphql/product/tests/queries/test_product_query.py+++ b/saleor/graphql/product/tests/queries/test_product_query.py@@ -2808,6 +2808,7 @@ def test_fetch_all_products_with_availability_data(product_list,[product_1_qty, product_2_qty, product_3_qty],[product_1_qty_allocated, product_2_qty_allocated, product_3_qty_allocated],+ strict=False,):data = {"node": {diff --git a/saleor/graphql/product/tests/queries/test_product_type_query.py b/saleor/graphql/product/tests/queries/test_product_type_query.pyindex 345a81040a..7478fa63bf 100644--- a/saleor/graphql/product/tests/queries/test_product_type_query.py+++ b/saleor/graphql/product/tests/queries/test_product_type_query.py@@ -408,9 +408,9 @@ def test_product_type_get_unassigned_product_type_attributes())["data"]["productType"]["availableAttributes"]["edges"]- assert len(gql_unassigned_attributes) == len(- unassigned_attributes- ), gql_unassigned_attributes+ assert len(gql_unassigned_attributes) == len(unassigned_attributes), (+ gql_unassigned_attributes+ )received_ids = sorted(attr["node"]["id"] for attr in gql_unassigned_attributes)expected_ids = sorted(diff --git a/saleor/graphql/product/tests/test_attributes.py b/saleor/graphql/product/tests/test_attributes.pyindex c1fad82e32..9bd42be725 100644--- a/saleor/graphql/product/tests/test_attributes.py+++ b/saleor/graphql/product/tests/test_attributes.py@@ -1282,14 +1282,14 @@ def test_sort_attributes_within_product_type()["data"]["productTypeReorderAttributes"]assert not content["errors"]- assert (- content["productType"]["id"] == product_type_id- ), "Did not return the correct product type"+ assert content["productType"]["id"] == product_type_id, (+ "Did not return the correct product type"+ )gql_attributes = content["productType"][snake_to_camel_case(relation_field)]assert len(gql_attributes) == len(expected_order)- for attr, expected_pk in zip(gql_attributes, expected_order):+ for attr, expected_pk in zip(gql_attributes, expected_order, strict=False):gql_type, gql_attr_id = graphene.Node.from_global_id(attr["id"])assert gql_type == "Attribute"assert int(gql_attr_id) == expected_pk@@ -1400,7 +1400,7 @@ def test_sort_product_attribute_values(gql_attribute_values = content["product"]["attributes"][0]["values"]assert len(gql_attribute_values) == 3- for attr, expected_pk in zip(gql_attribute_values, expected_order):+ for attr, expected_pk in zip(gql_attribute_values, expected_order, strict=False):db_type, value_pk = graphene.Node.from_global_id(attr["id"])assert db_type == "AttributeValue"assert int(value_pk) == expected_pk@@ -1630,14 +1630,14 @@ def test_sort_product_variant_attribute_values()["data"]["productVariantReorderAttributeValues"]assert not content["errors"]- assert (- content["productVariant"]["id"] == variant_id- ), "Did not return the correct product variant"+ assert content["productVariant"]["id"] == variant_id, (+ "Did not return the correct product variant"+ )gql_attribute_values = content["productVariant"]["attributes"][0]["values"]assert len(gql_attribute_values) == 3- for attr, expected_pk in zip(gql_attribute_values, expected_order):+ for attr, expected_pk in zip(gql_attribute_values, expected_order, strict=False):db_type, value_pk = graphene.Node.from_global_id(attr["id"])assert db_type == "AttributeValue"assert int(value_pk) == expected_pkdiff --git a/saleor/graphql/product/tests/test_bulk_delete.py b/saleor/graphql/product/tests/test_bulk_delete.pyindex 2d58e4efdb..416ae72764 100644--- a/saleor/graphql/product/tests/test_bulk_delete.py+++ b/saleor/graphql/product/tests/test_bulk_delete.py@@ -45,7 +45,7 @@ def test_delete_categories(permission_manage_products,):# given- for product, category in zip(product_list, category_list):+ for product, category in zip(product_list, category_list, strict=False):product.category = categoryProduct.objects.bulk_update(product_list, ["category"])@@ -81,7 +81,7 @@ def test_delete_categories_invalidate_active_promotion_rules(catalogue_promotion,):# given- for product, category in zip(product_list, category_list):+ for product, category in zip(product_list, category_list, strict=False):product.category = categoryProduct.objects.bulk_update(product_list, ["category"])@@ -314,7 +314,7 @@ def test_delete_collections(# givenquery = MUTATION_COLLECTION_BULK_DELETE- for product, collection in zip(product_list, collection_list):+ for product, collection in zip(product_list, collection_list, strict=False):collection.products.add(product)variables = {@@ -614,8 +614,7 @@ def test_delete_products_with_images(@patch(- "saleor.graphql.product.bulk_mutations."- "product_bulk_delete.get_webhooks_for_event"+ "saleor.graphql.product.bulk_mutations.product_bulk_delete.get_webhooks_for_event")@patch("saleor.plugins.webhook.plugin.trigger_webhooks_async")@patch("saleor.order.tasks.recalculate_orders_task.delay")@@ -652,8 +651,7 @@ def test_delete_products_trigger_webhook(@patch(- "saleor.graphql.product.bulk_mutations."- "product_bulk_delete.get_webhooks_for_event"+ "saleor.graphql.product.bulk_mutations.product_bulk_delete.get_webhooks_for_event")@patch("saleor.plugins.webhook.plugin.trigger_webhooks_async")def test_delete_products_without_variants(diff --git a/saleor/graphql/product/tests/test_product_sorting_attributes.py b/saleor/graphql/product/tests/test_product_sorting_attributes.pyindex 1962bdf551..a808d08c3f 100644--- a/saleor/graphql/product/tests/test_product_sorting_attributes.py+++ b/saleor/graphql/product/tests/test_product_sorting_attributes.py@@ -112,7 +112,7 @@ def products_structures(category, channel_USD):product_type=pt_apples,category=category,)- for i, attrs in enumerate(zip(COLORS, TRADEMARKS))+ for i, attrs in enumerate(zip(COLORS, TRADEMARKS, strict=False))]))@@ -142,7 +142,7 @@ def products_structures(category, channel_USD):product_type=pt_oranges,category=category,)- for i, attrs in enumerate(zip(COLORS, TRADEMARKS))+ for i, attrs in enumerate(zip(COLORS, TRADEMARKS, strict=False))]))@@ -214,14 +214,14 @@ def products_structures(category, channel_USD):)for products in (apples, oranges):- for product, attr_values in zip(products, COLORS):+ for product, attr_values in zip(products, COLORS, strict=False):attr_values = attr_value(colors_attr, *attr_values)associate_attribute_values_to_instance(product,{colors_attr.pk: attr_values},)- for product, attr_values in zip(products, TRADEMARKS):+ for product, attr_values in zip(products, TRADEMARKS, strict=False):attr_values = attr_value(trademark_attr, attr_values)associate_attribute_values_to_instance(product,diff --git a/saleor/graphql/product/types/categories.py b/saleor/graphql/product/types/categories.pyindex 318289f85f..5d4db872c1 100644--- a/saleor/graphql/product/types/categories.py+++ b/saleor/graphql/product/types/categories.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom graphene import relayfrom promise import Promise@@ -117,8 +115,8 @@ class Category(ModelObjectType[models.Category]):def resolve_background_image(root: models.Category,info,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,) -> None | Image | Promise[Image]:if not root.background_image:return Nonediff --git a/saleor/graphql/product/types/channels.py b/saleor/graphql/product/types/channels.pyindex cf930eaf1c..7d75bb8941 100644--- a/saleor/graphql/product/types/channels.py+++ b/saleor/graphql/product/types/channels.py@@ -1,6 +1,5 @@from dataclasses import asdictfrom decimal import Decimal-from typing import Optionalimport graphenefrom promise import Promise@@ -150,7 +149,7 @@ class ProductChannelListing(ModelObjectType[models.ProductChannelListing]):def calculate_margin_with_channel(channel):def calculate_margin_with_channel_listings(variant_channel_listings: list[- Optional[models.ProductVariantChannelListing]+ models.ProductVariantChannelListing | None],):existing_listings = list(filter(None, variant_channel_listings))@@ -189,7 +188,7 @@ class ProductChannelListing(ModelObjectType[models.ProductChannelListing]):def calculate_margin_with_channel(channel):def calculate_margin_with_channel_listings(variant_channel_listings: list[- Optional[models.ProductVariantChannelListing]+ models.ProductVariantChannelListing | None],):existing_listings = list(filter(None, variant_channel_listings))diff --git a/saleor/graphql/product/types/collections.py b/saleor/graphql/product/types/collections.pyindex 406d9b496b..99681b1962 100644--- a/saleor/graphql/product/types/collections.py+++ b/saleor/graphql/product/types/collections.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Optionalimport graphenefrom graphene import relay@@ -104,8 +103,8 @@ class Collection(ChannelContextTypeWithMetadata[models.Collection]):def resolve_background_image(root: ChannelContext[models.Collection],info: ResolveInfo,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,) -> None | Image | Promise[Image]:node = root.nodeif not node.background_image:diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex dcf9520002..a923aba6a0 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -2,7 +2,6 @@ import sysfrom collections import defaultdictfrom dataclasses import asdictfrom decimal import Decimal-from typing import Optionalimport graphenefrom graphene import relay@@ -224,8 +223,7 @@ class ProductPricingInfo(BasePricingInfo):price_range_local_currency = graphene.Field(TaxedMoneyRange,description=(- "The discounted price range of the product variants "- "in the local currency."+ "The discounted price range of the product variants in the local currency."),deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Always returns `null`.",)@@ -568,7 +566,7 @@ class ProductVariant(ChannelContextTypeWithMetadata[models.ProductVariant]):def resolve_attributes(root: ChannelContext[models.ProductVariant],info,- variant_selection: Optional[str] = None,+ variant_selection: str | None = None,):def apply_variant_selection_filter(selected_attributes):if not variant_selection or variant_selection == VariantAttributeScope.ALL:@@ -1088,7 +1086,7 @@ class Product(ChannelContextTypeWithMetadata[models.Product]):info,*,size: int = 256,- format: Optional[str] = None,+ format: str | None = None,):format = get_thumbnail_format(format)size = get_thumbnail_size(size)@@ -1294,7 +1292,7 @@ class Product(ChannelContextTypeWithMetadata[models.Product]):def resolve_attribute(root: ChannelContext[models.Product], info, slug):def get_selected_attribute_by_slug(attributes: list[SelectedAttribute],- ) -> Optional[SelectedAttribute]:+ ) -> SelectedAttribute | None:return next((atr for atr in attributes if atr["attribute"].slug == slug),None,@@ -1391,7 +1389,7 @@ class Product(ChannelContextTypeWithMetadata[models.Product]):def get_product_variant(product_variants,- ) -> Optional[ProductVariant]:+ ) -> ProductVariant | None:if id:id_type, variant_id = graphene.Node.from_global_id(id)if id_type != "ProductVariant":@@ -1793,7 +1791,7 @@ class ProductType(ModelObjectType[models.ProductType]):def resolve_variant_attributes(root: models.ProductType,info,- variant_selection: Optional[str] = None,+ variant_selection: str | None = None,):def apply_variant_selection_filter(attributes):if not variant_selection or variant_selection == VariantAttributeScope.ALL:@@ -1829,7 +1827,7 @@ class ProductType(ModelObjectType[models.ProductType]):def resolve_assigned_variant_attributes(root: models.ProductType,info,- variant_selection: Optional[str] = None,+ variant_selection: str | None = None,):def apply_variant_selection_filter(attributes):if not variant_selection or variant_selection == VariantAttributeScope.ALL:@@ -1954,8 +1952,8 @@ class ProductMedia(ModelObjectType[models.ProductMedia]):root: models.ProductMedia,info,*,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,) -> str | None | Promise[str]:if root.external_url:return root.external_url@@ -2023,8 +2021,8 @@ class ProductImage(BaseObjectType):root: models.ProductMedia,info,*,- size: Optional[int] = None,- format: Optional[str] = None,+ size: int | None = None,+ format: str | None = None,) -> None | str | Promise[str]:if not root.image:return Nonediff --git a/saleor/graphql/product/utils.py b/saleor/graphql/product/utils.pyindex a218ea44f5..c3bfb771ce 100644--- a/saleor/graphql/product/utils.py+++ b/saleor/graphql/product/utils.py@@ -1,6 +1,6 @@from collections import defaultdictfrom collections.abc import Iterable-from typing import TYPE_CHECKING, NamedTuple, Optional+from typing import TYPE_CHECKING, NamedTuplefrom uuid import UUIDimport graphene@@ -89,7 +89,7 @@ def create_stocks(warehouse=warehouse,quantity=stock_data["quantity"],)- for stock_data, warehouse in zip(stocks_data, warehouses)+ for stock_data, warehouse in zip(stocks_data, warehouses, strict=False)])except IntegrityError as e:@@ -123,7 +123,7 @@ def get_draft_order_lines_data_for_variants(return DraftOrderLinesData(order_to_lines_mapping, line_pks, order_pks)-def clean_variant_sku(sku: Optional[str]) -> Optional[str]:+def clean_variant_sku(sku: str | None) -> str | None:if sku:return sku.strip() or Nonereturn None@@ -157,7 +157,7 @@ def search_string_in_kwargs(kwargs: dict) -> bool:return bool(filter_search.strip()) or bool(search.strip())-def sort_field_from_kwargs(kwargs: dict) -> Optional[list[str]]:+def sort_field_from_kwargs(kwargs: dict) -> list[str] | None:sort_by = kwargs.get("sort_by", {}) or {}return sort_by.get("field") or sort_by.get("attribute_id")diff --git a/saleor/graphql/schema_printer.py b/saleor/graphql/schema_printer.pyindex 9ef3af8815..bc474a51f7 100644--- a/saleor/graphql/schema_printer.py+++ b/saleor/graphql/schema_printer.py@@ -3,7 +3,8 @@Can be dropped once we upgrade from the legacy version of GraphQL Core."""-from typing import Callable, Optional, Union, cast+from collections.abc import Callable+from typing import castfrom graphene.types.definitions import GrapheneObjectTypefrom graphql.language.printer import print_ast@@ -75,7 +76,7 @@ def print_filtered_schema()-def print_schema_definition(schema: GraphQLSchema) -> Optional[str]:+def print_schema_definition(schema: GraphQLSchema) -> str | None:operation_types = []query_type = schema.get_query_type()@@ -285,7 +286,7 @@ def print_input_object(type_: GraphQLInputObjectType) -> str:def print_fields(- type_: Union[GraphQLObjectType, GraphQLInterfaceType],+ type_: GraphQLObjectType | GraphQLInterfaceType,include_doc_category_directives: bool = True,) -> str:fields = [@@ -346,7 +347,7 @@ def print_directive(directive: GraphQLDirective) -> str:)-def print_deprecated(reason: Optional[str]) -> str:+def print_deprecated(reason: str | None) -> str:if reason is None:return ""if reason != DEFAULT_DEPRECATION_REASON:@@ -447,17 +448,15 @@ def print_block_string(value: str, minimize: bool = False) -> str:def print_description(- def_: Union[- GraphQLArgument,- GraphQLDirective,- GraphQLEnumType,- GraphQLEnumValue,- GraphQLInputObjectType,- GraphQLInterfaceType,- GraphQLObjectType,- GraphQLScalarType,- GraphQLUnionType,- ],+ def_: GraphQLArgument+ | GraphQLDirective+ | GraphQLEnumType+ | GraphQLEnumValue+ | GraphQLInputObjectType+ | GraphQLInterfaceType+ | GraphQLObjectType+ | GraphQLScalarType+ | GraphQLUnionType,indentation: str = "",first_in_block: bool = True,) -> str:diff --git a/saleor/graphql/shipping/dataloaders.py b/saleor/graphql/shipping/dataloaders.pyindex 85462fdb5a..f029e59da0 100644--- a/saleor/graphql/shipping/dataloaders.py+++ b/saleor/graphql/shipping/dataloaders.py@@ -173,7 +173,9 @@ class ShippingMethodChannelListingByShippingMethodIdAndChannelSlugLoader(DataLoadef _find_listing_by_shipping_method_id(listings_by_channel):listings_by_method = []- for method_id, listings in zip(shipping_method_ids, listings_by_channel):+ for method_id, listings in zip(+ shipping_method_ids, listings_by_channel, strict=False+ ):for listing in listings:if method_id == listing.shipping_method_id:listings_by_method.append(listing)diff --git a/saleor/graphql/shipping/mutations/base.py b/saleor/graphql/shipping/mutations/base.pyindex 7166914f0e..45fc41b7ce 100644--- a/saleor/graphql/shipping/mutations/base.py+++ b/saleor/graphql/shipping/mutations/base.py@@ -389,14 +389,12 @@ class ShippingPriceMixin:):if cleaned_input.get("minimum_delivery_days") is not None:error_msg = (- "Minimum delivery days should be lower "- "than maximum delivery days."+ "Minimum delivery days should be lower than maximum delivery days.")field = "minimum_delivery_days"else:error_msg = (- "Maximum delivery days should be higher than "- "minimum delivery days."+ "Maximum delivery days should be higher than minimum delivery days.")field = "maximum_delivery_days"errors[field] = ValidationError(diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.pyindex c64318c61d..ee08313e39 100644--- a/saleor/graphql/shipping/types.py+++ b/saleor/graphql/shipping/types.py@@ -1,5 +1,3 @@-from typing import Union-import graphenefrom django.db.models import QuerySetfrom graphene import relay@@ -239,7 +237,7 @@ class ShippingMethodType(ChannelContextTypeWithMetadataForObjectType):):from ..product.types import ProductCountableConnection- qs: Union[QuerySet[product_models.Product], ChannelQsContext]+ qs: QuerySet[product_models.Product] | ChannelQsContextif not root.node.excluded_products:qs = product_models.Product.objects.none()diff --git a/saleor/graphql/shipping/utils.py b/saleor/graphql/shipping/utils.pyindex 23069d8046..ae0af4c825 100644--- a/saleor/graphql/shipping/utils.py+++ b/saleor/graphql/shipping/utils.py@@ -1,5 +1,5 @@from collections.abc import Iterable-from typing import Optional, overload+from typing import overloadfrom django.core.exceptions import ValidationError@@ -16,8 +16,8 @@ def get_shipping_model_by_object_id(@overloaddef get_shipping_model_by_object_id(- object_id: Optional[str], raise_error=False, error_field="id"-) -> Optional[models.ShippingMethod]: ...+ object_id: str | None, raise_error=False, error_field="id"+) -> models.ShippingMethod | None: ...def get_shipping_model_by_object_id(object_id, raise_error=True, error_field="id"):diff --git a/saleor/graphql/shop/mutations/shop_settings_update.py b/saleor/graphql/shop/mutations/shop_settings_update.pyindex d4126189d7..9669641bc3 100644--- a/saleor/graphql/shop/mutations/shop_settings_update.py+++ b/saleor/graphql/shop/mutations/shop_settings_update.py@@ -25,8 +25,7 @@ class ShopSettingsInput(graphene.InputObjectType):description = graphene.String(description="SEO description.")track_inventory_by_default = graphene.Boolean(description=(- "This field is used as a default value for "- "`ProductVariant.trackInventory`."+ "This field is used as a default value for `ProductVariant.trackInventory`."))default_weight_unit = WeightUnitsEnum(description="Default weight unit.")diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.pyindex 57d1919633..93c7b94462 100644--- a/saleor/graphql/shop/types.py+++ b/saleor/graphql/shop/types.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.conf import settingsfrom django_countries import countries@@ -247,8 +245,7 @@ class Shop(graphene.ObjectType):)track_inventory_by_default = graphene.Boolean(description=(- "This field is used as a default value for "- "`ProductVariant.trackInventory`."+ "This field is used as a default value for `ProductVariant.trackInventory`."))default_weight_unit = WeightUnitsEnum(description="Default weight unit.")@@ -407,7 +404,7 @@ class Shop(graphene.ObjectType):@traced_resolver@plugin_manager_promise_callbackdef resolve_available_payment_gateways(- _, _info, manager, currency: Optional[str] = None, channel: Optional[str] = None+ _, _info, manager, currency: str | None = None, channel: str | None = None):return manager.list_payment_gateways(currency=currency, channel_slug=channel)diff --git a/saleor/graphql/shop/utils.py b/saleor/graphql/shop/utils.pyindex 0d6f13ff6e..53ff5299bd 100644--- a/saleor/graphql/shop/utils.py+++ b/saleor/graphql/shop/utils.py@@ -1,5 +1,3 @@-from typing import Optional-from django.conf import settingsfrom django_countries import countries@@ -8,7 +6,7 @@ from ..site.dataloaders import get_site_promisedef get_countries_codes_list(- attached_to_shipping_zones: Optional[bool] = None,+ attached_to_shipping_zones: bool | None = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):"""Return set of countries codes.diff --git a/saleor/graphql/site/dataloaders.py b/saleor/graphql/site/dataloaders.pyindex c5e21708dd..1fee54ef71 100644--- a/saleor/graphql/site/dataloaders.py+++ b/saleor/graphql/site/dataloaders.py@@ -1,5 +1,6 @@+from collections.abc import Callablefrom functools import partial, reduce-from typing import Callable, TypeVar+from typing import TypeVarfrom django.conf import settingsfrom django.contrib.sites.models import Sitediff --git a/saleor/graphql/tax/dataloaders.py b/saleor/graphql/tax/dataloaders.pyindex 0d872014a5..513f5a0807 100644--- a/saleor/graphql/tax/dataloaders.py+++ b/saleor/graphql/tax/dataloaders.py@@ -89,8 +89,8 @@ class TaxClassByProductIdLoader(DataLoader):def load_tax_classes(results):(products, product_types) = results- products_map = dict(zip(keys, products))- product_types_map = dict(zip(keys, product_types))+ products_map = dict(zip(keys, products, strict=False))+ product_types_map = dict(zip(keys, product_types, strict=False))tax_class_ids_map = {}for product_id in keys:@@ -118,8 +118,8 @@ class TaxClassByVariantIdLoader(DataLoader):def load_tax_classes(results):(products, product_types) = results- products_map = dict(zip(keys, products))- product_types_map = dict(zip(keys, product_types))+ products_map = dict(zip(keys, products, strict=False))+ product_types_map = dict(zip(keys, product_types, strict=False))tax_class_ids_map = {}for variant_pk in keys:diff --git a/saleor/graphql/tax/mutations/tax_country_configuration_update.py b/saleor/graphql/tax/mutations/tax_country_configuration_update.pyindex 9c6f6306e9..a7b8f786ad 100644--- a/saleor/graphql/tax/mutations/tax_country_configuration_update.py+++ b/saleor/graphql/tax/mutations/tax_country_configuration_update.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationErrorfrom django.db.models import Q@@ -103,7 +101,7 @@ class TaxCountryConfigurationUpdate(BaseMutation):failed_ids = []for item in tax_rate_items:global_id = item.get("tax_class_id")- pk: Optional[int] = None+ pk: int | None = Noneif global_id:try:_, node_id = from_global_id_or_error(diff --git a/saleor/graphql/tax/mutations/tax_exemption_manage.py b/saleor/graphql/tax/mutations/tax_exemption_manage.pyindex 1e0a142e34..3002cc7aa1 100644--- a/saleor/graphql/tax/mutations/tax_exemption_manage.py+++ b/saleor/graphql/tax/mutations/tax_exemption_manage.py@@ -53,7 +53,7 @@ class TaxExemptionManage(BaseMutation):@classmethoddef validate_input(cls, info: ResolveInfo, data):obj = cls.get_node_or_error(info, data["id"])- if not isinstance(obj, (Order, Checkout)):+ if not isinstance(obj, Order | Checkout):code = error_codes.TaxExemptionManageErrorCode.NOT_FOUND.valuemessage = "Invalid object ID. Only Checkout and Order ID's are accepted."raise ValidationError({"id": ValidationError(code=code, message=message)})diff --git a/saleor/graphql/tests/utils.py b/saleor/graphql/tests/utils.pyindex bfd69cce79..7d2deb148d 100644--- a/saleor/graphql/tests/utils.py+++ b/saleor/graphql/tests/utils.py@@ -30,9 +30,9 @@ def assert_no_permission(response):def assert_negative_positive_decimal_value(response):content = get_graphql_content_from_response(response)assert "errors" in content, content- assert (- 'Expected type "PositiveDecimal"' in content["errors"][0]["message"]- ), content["errors"]+ assert 'Expected type "PositiveDecimal"' in content["errors"][0]["message"], (+ content["errors"]+ )def assert_graphql_error_with_message(response, message):diff --git a/saleor/graphql/utils/__init__.py b/saleor/graphql/utils/__init__.pyindex 3acbad5ade..c06d6cc5d9 100644--- a/saleor/graphql/utils/__init__.py+++ b/saleor/graphql/utils/__init__.py@@ -2,7 +2,7 @@ import hashlibimport loggingimport tracebackfrom collections.abc import Iterable-from typing import TYPE_CHECKING, Any, Union+from typing import TYPE_CHECKING, Anyfrom uuid import UUIDimport graphene@@ -96,7 +96,7 @@ def _resolve_graphene_type(schema, type_name):def get_nodes(ids,- graphene_type: Union[graphene.ObjectType, str, None] = None,+ graphene_type: graphene.ObjectType | str | None = None,model=None,qs=None,schema=None,@@ -143,9 +143,9 @@ def get_nodes(old_id_field = "number" if str(graphene_type) == "Order" else "old_id"nodes_pk_list.extend([str(getattr(node, old_id_field)) for node in nodes])for pk in pks:- assert (- pk in nodes_pk_list- ), f"There is no node of type {graphene_type} with pk {pk}"+ assert pk in nodes_pk_list, (+ f"There is no node of type {graphene_type} with pk {pk}"+ )return nodes@@ -193,7 +193,7 @@ def format_permissions_for_display(permissions):return formatted_permissions-def get_user_or_app_from_context(context: "SaleorContext") -> Union[App, User, None]:+def get_user_or_app_from_context(context: "SaleorContext") -> App | User | None:# order is important# app can be None but user if None then is passed as anonymousreturn context.app or context.userdiff --git a/saleor/graphql/utils/filters.py b/saleor/graphql/utils/filters.pyindex fce1bfa161..ef9057375f 100644--- a/saleor/graphql/utils/filters.py+++ b/saleor/graphql/utils/filters.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import TYPE_CHECKING, Union+from typing import TYPE_CHECKINGfrom django.utils import timezone@@ -8,7 +8,7 @@ from ..core.enums import ReportingPeriodif TYPE_CHECKING:from django.db.models import QuerySet-Number = Union[float, int, Decimal]+Number = float | int | Decimaldef reporting_period_to_date(period):@@ -86,7 +86,7 @@ def filter_where_range_field(qs, field, value):def filter_where_by_string_field(- qs: "QuerySet", field: str, value: dict[str, Union[str, list[str]]]+ qs: "QuerySet", field: str, value: dict[str, str | list[str]]):if value is None:return qs.none()@@ -99,7 +99,7 @@ def filter_where_by_string_field(def filter_where_by_id_field(- qs: "QuerySet", field: str, value: dict[str, Union[str, list[str]]], type: str+ qs: "QuerySet", field: str, value: dict[str, str | list[str]], type: str):from . import resolve_global_ids_to_primary_keys@@ -117,7 +117,7 @@ def filter_where_by_id_field(def filter_where_by_numeric_field(qs: "QuerySet",field: str,- value: dict[str, Union[Number, list[Number], dict[str, Number]]],+ value: dict[str, Number | list[Number] | dict[str, Number]],):one_of = value.get("one_of")range = value.get("range")diff --git a/saleor/graphql/utils/sorting.py b/saleor/graphql/utils/sorting.pyindex adfb9b6186..785c937e52 100644--- a/saleor/graphql/utils/sorting.py+++ b/saleor/graphql/utils/sorting.py@@ -1,5 +1,3 @@-from typing import Optional-from django.db.models import QuerySetfrom graphql.error import GraphQLError@@ -47,7 +45,7 @@ def sort_queryset(queryset: QuerySet,sort_by: SortInputObjectType,reversed: bool,- channel_slug: Optional[str],+ channel_slug: str | None,) -> QuerySet:"""Sort queryset according to given parameters.diff --git a/saleor/graphql/views.py b/saleor/graphql/views.pyindex 9b965c22b5..0af1ae45ba 100644--- a/saleor/graphql/views.py+++ b/saleor/graphql/views.py@@ -2,7 +2,7 @@ import hashlibimport importlibimport jsonfrom inspect import isclass-from typing import Any, Optional, Union+from typing import Anyfrom urllib.parse import urljoinimport opentracing@@ -62,7 +62,7 @@ class GraphQLView(View):middleware = Noneroot_value = Nonebackend: GraphQLBackend = None # type: ignore[assignment]- _query: Optional[str] = None+ _query: str | None = NoneHANDLED_EXCEPTIONS = (GraphQLError,@@ -76,7 +76,7 @@ class GraphQLView(View):schema: GraphQLSchema,backend: GraphQLBackend,executor=None,- middleware: Optional[list[str]] = None,+ middleware: list[str] | None = None,root_value=None,):super().__init__()@@ -147,9 +147,7 @@ class GraphQLView(View):if isinstance(data, list):responses = [self.get_response(request, entry) for entry in data]- result: Union[list, Optional[dict]] = [- response for response, code in responses- ]+ result: list | dict | None = [response for response, code in responses]status_code = max((code for response, code in responses), default=200)else:result, status_code = self.get_response(request, data)@@ -213,7 +211,7 @@ class GraphQLView(View):def get_response(self, request: HttpRequest, data: dict- ) -> tuple[Optional[dict[str, list[Any]]], int]:+ ) -> tuple[dict[str, list[Any]] | None, int]:with observability.report_gql_operation() as operation:execution_result = self.execute_graphql_request(request, data)status_code = 200@@ -229,7 +227,7 @@ class GraphQLView(View):response["data"] = execution_result.dataif execution_result.extensions:response["extensions"] = execution_result.extensions- result: Optional[dict[str, list[Any]]] = response+ result: dict[str, list[Any]] | None = responseelse:result = Noneoperation.result = result@@ -240,8 +238,8 @@ class GraphQLView(View):return self.root_valuedef parse_query(- self, query: Optional[str]- ) -> tuple[Optional[GraphQLDocument], Optional[ExecutionResult]]:+ self, query: str | None+ ) -> tuple[GraphQLDocument | None, ExecutionResult | None]:"""Attempt to parse a query (mandatory) to a gql document object.If no query was given or query is not a string, it returns an error.@@ -307,7 +305,7 @@ class GraphQLView(View):result = ExecutionResult(errors=cost_errors, invalid=True)return set_query_cost_on_result(result, query_cost)- extra_options: dict[str, Optional[Any]] = {}+ extra_options: dict[str, Any | None] = {}if self.executor:# We only include it optionally sincediff --git a/saleor/graphql/warehouse/dataloaders.py b/saleor/graphql/warehouse/dataloaders.pyindex 79ab4c9de7..085333d98f 100644--- a/saleor/graphql/warehouse/dataloaders.py+++ b/saleor/graphql/warehouse/dataloaders.py@@ -1,12 +1,7 @@import sysfrom collections import defaultdictfrom collections.abc import Iterable-from typing import (- TYPE_CHECKING,- Optional,- TypedDict,- Union,-)+from typing import TYPE_CHECKING, TypedDictfrom uuid import UUIDfrom django.contrib.sites.models import Site@@ -48,7 +43,7 @@ else:StockWithAvailableQuantity = Stock-CountryCode = Optional[str]+CountryCode = str | NoneVariantIdCountryCodeChannelSlug = tuple[int, CountryCode, str]@@ -98,8 +93,8 @@ class AvailableQuantityByProductVariantIdCountryCodeAndChannelSlugLoader(def batch_load_quantities_by_country(self,- country_code: Optional[CountryCode],- channel_slug: Optional[str],+ country_code: CountryCode | None,+ channel_slug: str | None,variant_ids: Iterable[int],site: Site,) -> Iterable[tuple[int, int]]:@@ -280,7 +275,7 @@ class AvailableQuantityByProductVariantIdCountryCodeAndChannelSlugLoader("""cc_warehouses_in_bulk = cc_warehouses.in_bulk()warehouse_ids_by_shipping_zone_by_variant: defaultdict[- int, defaultdict[Union[int, UUID], list[UUID]]+ int, defaultdict[int | UUID, list[UUID]]] = defaultdict(lambda: defaultdict(list))variants_with_global_cc_warehouses = []available_quantity_by_warehouse_id_and_variant_id: defaultdict[@@ -408,23 +403,25 @@ class StocksWithAvailableQuantityByProductVariantIdCountryCodeAndChannelLoader(shipping_zones_by_channel_map = {channel.slug: set(shipping_zones)for shipping_zones, channel in zip(- shipping_zones_by_channel, channels+ shipping_zones_by_channel, channels, strict=False)}shipping_zones_by_country_map = {country_code: set(shipping_zones)for shipping_zones, country_code in zip(- shipping_zones_by_country, country_codes+ shipping_zones_by_country, country_codes, strict=False)}warehouses_by_channel_map = {channel.slug: set(warehouses)- for warehouses, channel in zip(warehouses_by_channel, channels)+ for warehouses, channel in zip(+ warehouses_by_channel, channels, strict=False+ )}warehouses_by_zone_map = {shipping_zone_id: set(warehouses)for warehouses, shipping_zone_id in zip(- warehouses_by_zone, shipping_zone_ids+ warehouses_by_zone, shipping_zone_ids, strict=False)}@@ -657,7 +654,7 @@ class PreorderQuantityReservedByVariantChannelListingIdLoader(DataLoader[int, inclass WarehouseByIdLoader(DataLoader):context_key = "warehouse_by_id"- def batch_load(self, keys: Iterable[UUID]) -> list[Optional[Warehouse]]:+ def batch_load(self, keys: Iterable[UUID]) -> list[Warehouse | None]:warehouses = (Warehouse.objects.all().using(self.database_connection_name).in_bulk(keys))diff --git a/saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.py b/saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.pyindex 704d541592..29105dc562 100644--- a/saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.py+++ b/saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.py@@ -77,8 +77,7 @@ def test_stocks_bulk_update_using_ids(@patch(- "saleor.graphql.warehouse.bulk_mutations."- "stock_bulk_update.get_webhooks_for_event"+ "saleor.graphql.warehouse.bulk_mutations.stock_bulk_update.get_webhooks_for_event")@patch("saleor.plugins.manager.PluginsManager.product_variant_stocks_updated")def test_stocks_bulk_update_send_stock_updated_event(@@ -124,8 +123,7 @@ def test_stocks_bulk_update_send_stock_updated_event(@patch(- "saleor.graphql.warehouse.bulk_mutations."- "stock_bulk_update.get_webhooks_for_event"+ "saleor.graphql.warehouse.bulk_mutations.stock_bulk_update.get_webhooks_for_event")@patch("saleor.plugins.manager.PluginsManager.product_variant_stocks_updated")def test_stocks_bulk_update_send_stock_updated_event_only_for_changed_stocks(diff --git a/saleor/graphql/webhook/dataloaders/pregenerated_payload_for_checkout_tax.py b/saleor/graphql/webhook/dataloaders/pregenerated_payload_for_checkout_tax.pyindex 7e1c681f48..c7a0bbb9f3 100644--- a/saleor/graphql/webhook/dataloaders/pregenerated_payload_for_checkout_tax.py+++ b/saleor/graphql/webhook/dataloaders/pregenerated_payload_for_checkout_tax.py@@ -59,7 +59,9 @@ class PregeneratedCheckoutTaxPayloadsByCheckoutTokenLoader(DataLoader):checkouts_info, checkout_lines_info, apps, request_context, webhooks = dataapps_map = {app.id: app for app in apps}promises = []- for checkout_info, lines_info in zip(checkouts_info, checkout_lines_info):+ for checkout_info, lines_info in zip(+ checkouts_info, checkout_lines_info, strict=False+ ):tax_configuration, country_tax_configuration = (get_tax_configuration_for_checkout(checkout_info, lines_info, self.database_connection_namediff --git a/saleor/graphql/webhook/dataloaders/request_context.py b/saleor/graphql/webhook/dataloaders/request_context.pyindex 2a91c8112b..6f69ab8333 100644--- a/saleor/graphql/webhook/dataloaders/request_context.py+++ b/saleor/graphql/webhook/dataloaders/request_context.py@@ -1,5 +1,4 @@from collections import defaultdict-from typing import Optionalfrom ...core import SaleorContextfrom ...core.dataloaders import DataLoader@@ -11,9 +10,7 @@ class PayloadsRequestContextByEventTypeLoader(DataLoader):context_key = "payloads_request_context_by_event_type"def batch_load(self, keys):- request_context_by_event_type: dict[str, Optional[SaleorContext]] = (- defaultdict()- )+ request_context_by_event_type: dict[str, SaleorContext | None] = defaultdict()requestor = get_user_or_app_from_context(self.context)for event_type in keys:request_context_by_event_type[event_type] = initialize_request(diff --git a/saleor/graphql/webhook/mutations/webhook_create.py b/saleor/graphql/webhook/mutations/webhook_create.pyindex 131e6e27b4..747163ca4c 100644--- a/saleor/graphql/webhook/mutations/webhook_create.py+++ b/saleor/graphql/webhook/mutations/webhook_create.py@@ -1,5 +1,3 @@-from typing import Optional-import graphenefrom django.core.exceptions import ValidationError@@ -156,9 +154,7 @@ class WebhookCreate(ModelMutation, NotifyUserEventValidationMixin):return cleaned_data@classmethod- def _clean_webhook_events(- cls, data, subscription_query: Optional[SubscriptionQuery]- ):+ def _clean_webhook_events(cls, data, subscription_query: SubscriptionQuery | None):# if `events` field is not empty, use this field. Otherwise get event types# from `async_events` and `sync_events`. If the fields are also empty,# parse events from `query`.diff --git a/saleor/graphql/webhook/subscription_payload.py b/saleor/graphql/webhook/subscription_payload.pyindex 909361c367..6efa725c88 100644--- a/saleor/graphql/webhook/subscription_payload.py+++ b/saleor/graphql/webhook/subscription_payload.py@@ -1,6 +1,6 @@import datetimefrom collections.abc import Iterable-from typing import Any, Optional, Union+from typing import Anyfrom celery.utils.log import get_task_loggerfrom django.conf import settings@@ -27,9 +27,9 @@ def initialize_request(requestor=None,sync_event=False,allow_replica=False,- event_type: Optional[str] = None,- request_time: Optional[datetime.datetime] = None,- dataloaders: Optional[dict] = None,+ event_type: str | None = None,+ request_time: datetime.datetime | None = None,+ dataloaders: dict | None = None,) -> SaleorContext:"""Prepare a request object for webhook subscription.@@ -70,8 +70,8 @@ def generate_payload_promise_from_subscription(subscribable_object,subscription_query: str,request: SaleorContext,- app: Optional[App] = None,-) -> Promise[Optional[dict[str, Any]]]:+ app: App | None = None,+) -> Promise[dict[str, Any] | None]:"""Generate webhook payload from subscription query.It uses a graphql's engine to build payload by using the same logic as response.@@ -154,8 +154,8 @@ def generate_payload_from_subscription(subscribable_object,subscription_query: str,request: SaleorContext,- app: Optional[App] = None,-) -> Optional[dict[str, Any]]:+ app: App | None = None,+) -> dict[str, Any] | None:"""Generate webhook payload from subscription query.It uses a graphql's engine to build payload by using the same logic as response.@@ -233,7 +233,7 @@ def generate_pre_save_payloads(webhooks: Iterable[Webhook],instances: Iterable[models.Model],event_type: str,- requestor: Union[User, App, None],+ requestor: User | App | None,request_time: datetime.datetime,):if not settings.ENABLE_LIMITING_WEBHOOKS_FOR_IDENTICAL_PAYLOADS:diff --git a/saleor/graphql/webhook/subscription_query.py b/saleor/graphql/webhook/subscription_query.pyindex 1e61ab38ee..689d892af7 100644--- a/saleor/graphql/webhook/subscription_query.py+++ b/saleor/graphql/webhook/subscription_query.py@@ -1,5 +1,5 @@from enum import Flag-from typing import Optional, Union, cast+from typing import castfrom django.core.exceptions import ValidationErrorfrom graphene.utils.str_converters import to_snake_case@@ -28,7 +28,7 @@ class SubscriptionQuery:self.is_valid: bool = Falseself.ast: Document = Document("")self.events: list[str] = []- self.error_code: Optional[str] = None+ self.error_code: str | None = Noneself.errors = self.validate_query()self.error_msg: str = ";".join({str(err.message) for err in self.errors})@@ -78,7 +78,7 @@ class SubscriptionQuery:is_invalid = Truereturn is_invalid- def validate_query(self) -> list[Union[GraphQLSyntaxError, ValidationError]]:+ def validate_query(self) -> list[GraphQLSyntaxError | ValidationError]:from ..api import schemagraphql_backend = get_default_backend()@@ -160,7 +160,7 @@ class SubscriptionQuery:return sorted(map(to_snake_case, events))@staticmethod- def _get_subscription(ast: Document) -> Optional[OperationDefinition]:+ def _get_subscription(ast: Document) -> OperationDefinition | None:for definition in ast.definitions:if (hasattr(definition, "operation")@@ -181,7 +181,7 @@ class SubscriptionQuery:@staticmethoddef _get_events_from_field(- field: Union[Field, FragmentDefinition],+ field: Field | FragmentDefinition,events: dict[str, IsFragment],) -> dict[str, IsFragment]:if (diff --git a/saleor/graphql/webhook/utils.py b/saleor/graphql/webhook/utils.pyindex d05d703204..89ea9ba8eb 100644--- a/saleor/graphql/webhook/utils.py+++ b/saleor/graphql/webhook/utils.py@@ -1,6 +1,5 @@import hashlibimport logging-from typing import Optionalfrom ...webhook.models import Webhook@@ -13,8 +12,8 @@ def get_subscription_query_hash(subscription_query: str) -> str:def get_pregenerated_subscription_payload(webhook: Webhook,- pregenerated_subscription_payloads: Optional[dict] = None,-) -> Optional[dict]:+ pregenerated_subscription_payloads: dict | None = None,+) -> dict | None:if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}if webhook.subscription_query is None or pregenerated_subscription_payloads is None:diff --git a/saleor/invoice/events.py b/saleor/invoice/events.pyindex 2bc2a960b9..fd2dae057f 100644--- a/saleor/invoice/events.py+++ b/saleor/invoice/events.py@@ -1,5 +1,3 @@-from typing import Optional-from ..account.models import Userfrom ..app.models import Appfrom ..order.models import Order@@ -7,7 +5,7 @@ from .models import Invoice, InvoiceEvent, InvoiceEventsdef invoice_requested_event(- *, user: Optional[User], app: Optional[App], order: Order, number: Optional[str]+ *, user: User | None, app: App | None, order: Order, number: str | None) -> InvoiceEvent:return InvoiceEvent.objects.create(type=InvoiceEvents.REQUESTED,@@ -19,7 +17,7 @@ def invoice_requested_event(def invoice_requested_deletion_event(- *, user: Optional[User], app: Optional[App], invoice: Invoice+ *, user: User | None, app: App | None, invoice: Invoice) -> InvoiceEvent:return InvoiceEvent.objects.create(type=InvoiceEvents.REQUESTED_DELETION,@@ -31,7 +29,7 @@ def invoice_requested_deletion_event(def invoice_created_event(- *, user: Optional[User], app: Optional[App], invoice: Invoice, number: str, url: str+ *, user: User | None, app: App | None, invoice: Invoice, number: str, url: str) -> InvoiceEvent:return InvoiceEvent.objects.create(type=InvoiceEvents.CREATED,@@ -44,7 +42,7 @@ def invoice_created_event(def invoice_deleted_event(- *, user: Optional[User], app: Optional[App], invoice_id: int+ *, user: User | None, app: App | None, invoice_id: int) -> InvoiceEvent:return InvoiceEvent.objects.create(type=InvoiceEvents.DELETED,@@ -56,8 +54,8 @@ def invoice_deleted_event(def notification_invoice_sent_event(*,- user_id: Optional[int],- app_id: Optional[int],+ user_id: int | None,+ app_id: int | None,invoice_id: int,customer_email: str,) -> InvoiceEvent:diff --git a/saleor/order/actions.py b/saleor/order/actions.pyindex aea786bbde..ebd4966981 100644--- a/saleor/order/actions.py+++ b/saleor/order/actions.py@@ -191,7 +191,7 @@ def call_order_events(event_names: list[str],order: "Order",database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):missing_events = set(event_names).difference(ORDER_WEBHOOK_EVENT_MAP.keys())if missing_events:@@ -238,7 +238,7 @@ def call_order_event(event_name: str,order: "Order",database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):if event_name not in ORDER_WEBHOOK_EVENT_MAP:raise ValueError(f"Event {event_name} not found in ORDER_WEBHOOK_EVENT_MAP.")@@ -279,7 +279,7 @@ def call_order_event(def order_created(order_info: "OrderInfo",- user: Optional[User],+ user: User | None,app: Optional["App"],manager: "PluginsManager",from_draft: bool = False,@@ -332,11 +332,11 @@ def order_created(def order_confirmed(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],manager: "PluginsManager",send_confirmation_email: bool = False,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):"""Order confirmed.@@ -357,10 +357,10 @@ def handle_fully_paid_order(manager: "PluginsManager",order_info: "OrderInfo",webhook_event_map: dict[str, set["Webhook"]],- user: Optional[User] = None,+ user: User | None = None,app: Optional["App"] = None,site_settings: Optional["SiteSettings"] = None,- gateway: Optional[str] = None,+ gateway: str | None = None,):from ..giftcard.utils import fulfill_non_shippable_gift_cards@@ -396,10 +396,10 @@ def handle_fully_paid_order(def cancel_order(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],manager: "PluginsManager",- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):"""Cancel order.@@ -430,13 +430,13 @@ def cancel_order(def order_refunded(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],amount: "Decimal",payment: Optional["Payment"],manager: "PluginsManager",trigger_order_updated: bool = True,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):if payment:call_event(@@ -499,7 +499,7 @@ def order_refunded(def order_voided(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],payment: "Payment",manager: "PluginsManager",@@ -510,7 +510,7 @@ def order_voided(def order_returned(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],returned_lines: list[tuple[QuantityType, OrderLine]],):@@ -520,14 +520,14 @@ def order_returned(def order_fulfilled(fulfillments: list[Fulfillment],- user: Optional[User],+ user: User | None,app: Optional["App"],fulfillment_lines: list[FulfillmentLine],manager: "PluginsManager",gift_card_lines_info: list[GiftCardLineData],site_settings: "SiteSettings",notify_customer=True,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):from ..giftcard.utils import gift_cards_create@@ -575,7 +575,7 @@ def order_fulfilled(def order_awaits_fulfillment_approval(fulfillments: list[Fulfillment],- user: Optional[User],+ user: User | None,app: Optional["App"],fulfillment_lines: list[FulfillmentLine],manager: "PluginsManager",@@ -589,12 +589,12 @@ def order_awaits_fulfillment_approval(def order_authorized(order: "Order",- user: Optional[User],+ user: User | None,app: Optional["App"],amount: "Decimal",payment: "Payment",manager: "PluginsManager",- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):events.payment_authorized_event(order=order, user=user, app=app, amount=amount, payment=payment@@ -609,14 +609,14 @@ def order_authorized(def order_charged(order_info: "OrderInfo",- user: Optional[User],+ user: User | None,app: Optional["App"],amount: Optional["Decimal"],payment: Optional["Payment"],manager: "PluginsManager",site_settings: Optional["SiteSettings"] = None,- gateway: Optional[str] = None,- webhook_event_map: Optional[dict[str, set["Webhook"]]] = None,+ gateway: str | None = None,+ webhook_event_map: dict[str, set["Webhook"]] | None = None,):order = order_info.orderif payment and amount is not None:@@ -657,7 +657,7 @@ def order_transaction_updated(order_info: "OrderInfo",transaction_item: "TransactionItem",manager: "PluginsManager",- user: Optional[User],+ user: User | None,app: Optional["App"],previous_authorized_value: Decimal,previous_charged_value: Decimal,@@ -923,7 +923,7 @@ def mark_order_as_paid_with_transaction(request_user: User,app: Optional["App"],manager: "PluginsManager",- external_reference: Optional[str] = None,+ external_reference: str | None = None,):"""Mark order as paid.@@ -961,7 +961,7 @@ def mark_order_as_paid_with_payment(request_user: User,app: Optional["App"],manager: "PluginsManager",- external_reference: Optional[str] = None,+ external_reference: str | None = None,):"""Mark order as paid.@@ -1242,7 +1242,7 @@ def _create_fulfillment_lines(def create_fulfillments(- user: Optional[User],+ user: User | None,app: Optional["App"],order: "Order",fulfillment_lines_for_warehouses: dict[UUID, list[OrderFulfillmentLineInfo]],@@ -1378,7 +1378,7 @@ def _get_fulfillment_line(target_fulfillment: Fulfillment,lines_in_target_fulfillment: list[FulfillmentLine],order_line_id: OrderLineIDType,- stock_id: Optional[int] = None,+ stock_id: int | None = None,) -> tuple[FulfillmentLine, bool]:"""Get fulfillment line if extists or create new fulfillment line object."""# Check if line for order_line_id and stock_id does not exist in DB.@@ -1514,9 +1514,9 @@ def _move_fulfillment_lines_to_target_fulfillment(def __get_shipping_refund_amount(refund_shipping_costs: bool,- refund_amount: Optional[Decimal],+ refund_amount: Decimal | None,shipping_price: Decimal,-) -> Optional[Decimal]:+) -> Decimal | None:# We set shipping refund amount only when refund amount is calculated by Saleorshipping_refund_amount = Noneif refund_shipping_costs and refund_amount is None:@@ -1525,7 +1525,7 @@ def __get_shipping_refund_amount(def create_refund_fulfillment(- user: Optional[User],+ user: User | None,app: Optional["App"],order,payment,@@ -1620,7 +1620,7 @@ def _populate_replace_order_fields(original_order: "Order"):def create_replace_order(- user: Optional[User],+ user: User | None,app: Optional["App"],original_order: "Order",order_lines_to_replace: list[OrderLineInfo],@@ -1690,8 +1690,8 @@ def _move_lines_to_return_fulfillment(fulfillment_lines: list[FulfillmentLineData],fulfillment_status: str,order: "Order",- total_refund_amount: Optional[Decimal],- shipping_refund_amount: Optional[Decimal],+ total_refund_amount: Decimal | None,+ shipping_refund_amount: Decimal | None,manager: "PluginsManager",) -> Fulfillment:target_fulfillment = Fulfillment.objects.create(@@ -1767,13 +1767,13 @@ def _move_lines_to_replace_fulfillment(def create_return_fulfillment(- user: Optional[User],+ user: User | None,app: Optional["App"],order: "Order",order_lines: list[OrderLineInfo],fulfillment_lines: list[FulfillmentLineData],- total_refund_amount: Optional[Decimal],- shipping_refund_amount: Optional[Decimal],+ total_refund_amount: Decimal | None,+ shipping_refund_amount: Decimal | None,manager: "PluginsManager",) -> Fulfillment:status = FulfillmentStatus.RETURNED@@ -1821,7 +1821,7 @@ def create_return_fulfillment(def process_replace(- user: Optional[User],+ user: User | None,app: Optional["App"],order: "Order",order_lines: list[OrderLineInfo],@@ -1865,17 +1865,17 @@ def process_replace(def create_fulfillments_for_returned_products(- user: Optional[User],+ user: User | None,app: Optional["App"],order: "Order",- payment: Optional[Payment],+ payment: Payment | None,order_lines: list[OrderLineInfo],fulfillment_lines: list[FulfillmentLineData],manager: "PluginsManager",refund: bool = False,- amount: Optional[Decimal] = None,+ amount: Decimal | None = None,refund_shipping_costs=False,-) -> tuple[Fulfillment, Optional[Fulfillment], Optional[Order]]:+) -> tuple[Fulfillment, Fulfillment | None, Order | None]:"""Process the request for replacing or returning the products.Process the refund when the refund is set to True. The amount of refund will be@@ -1989,13 +1989,13 @@ def _calculate_refund_amount(@transaction_with_commit_on_errors()def _process_refund(- user: Optional[User],+ user: User | None,app: Optional["App"],order: "Order",- payment: Optional[Payment],+ payment: Payment | None,order_lines_to_refund: list[OrderLineInfo],fulfillment_lines_to_refund: list[FulfillmentLineData],- amount: Optional[Decimal],+ amount: Decimal | None,refund_shipping_costs: bool,manager: "PluginsManager",):diff --git a/saleor/order/base_calculations.py b/saleor/order/base_calculations.pyindex f5a8a31779..9a408acad1 100644--- a/saleor/order/base_calculations.py+++ b/saleor/order/base_calculations.py@@ -1,5 +1,5 @@from collections.abc import Iterable-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom prices import Money, TaxedMoney@@ -270,7 +270,7 @@ def get_total_price_with_subtotal_discount_for_order_line(lines: Iterable["OrderLine"],base_subtotal: Money,subtotal_discount: Money,-) -> Optional[Money]:+) -> Money | None:for order_line, total_price in propagate_order_discount_on_order_lines_prices(lines, base_subtotal, subtotal_discount):diff --git a/saleor/order/calculations.py b/saleor/order/calculations.pyindex a808700441..7ea42f1402 100644--- a/saleor/order/calculations.py+++ b/saleor/order/calculations.py@@ -1,7 +1,6 @@import loggingfrom collections.abc import Iterablefrom decimal import Decimal-from typing import Optionalfrom django.conf import settingsfrom django.db import transaction@@ -44,10 +43,10 @@ logger = logging.getLogger(__name__)def fetch_order_prices_if_expired(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> tuple[Order, Optional[Iterable[OrderLine]]]:+) -> tuple[Order, Iterable[OrderLine] | None]:"""Fetch order prices with taxes.First applies order level discounts, then calculates taxes.@@ -201,7 +200,7 @@ def _recalculate_prices(def _calculate_and_add_tax(tax_calculation_strategy: str,- tax_app_identifier: Optional[str],+ tax_app_identifier: str | None,order: "Order",lines: Iterable["OrderLine"],manager: "PluginsManager",@@ -276,7 +275,7 @@ def _recalculate_with_plugins(order: Order,lines: Iterable[OrderLine],prices_entered_with_tax: bool,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> None:"""Fetch taxes from plugins and recalculate order/lines prices.@@ -366,7 +365,7 @@ def _get_undiscounted_price(def _apply_tax_data(order: Order,lines: Iterable[OrderLine],- tax_data: Optional[TaxData],+ tax_data: TaxData | None,prices_entered_with_tax: bool,) -> None:"""Apply all prices from tax data to order and order lines."""@@ -392,7 +391,7 @@ def _apply_tax_data(subtotal = zero_taxed_money(order.currency)undiscounted_subtotal = zero_taxed_money(order.currency)- for order_line, tax_line in zip(lines, tax_data.lines):+ for order_line, tax_line in zip(lines, tax_data.lines, strict=False):line_total_price = TaxedMoney(net=Money(tax_line.total_net_amount, currency),gross=Money(tax_line.total_gross_amount, currency),@@ -475,7 +474,7 @@ def _remove_tax_net(order, lines):def _find_order_line(- lines: Optional[Iterable[OrderLine]],+ lines: Iterable[OrderLine] | None,order_line: OrderLine,) -> OrderLine:"""Return order line from provided lines.@@ -491,7 +490,7 @@ def order_line_unit(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> OrderTaxedPricesData:@@ -520,7 +519,7 @@ def order_line_total(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> OrderTaxedPricesData:@@ -551,10 +550,10 @@ def order_line_tax_rate(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> Optional[Decimal]:+) -> Decimal | None:"""Return the tax rate of provided line.It takes into account all plugins.@@ -576,7 +575,7 @@ def order_line_unit_discount(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,) -> Decimal:"""Return the line unit discount.@@ -599,7 +598,7 @@ def order_line_unit_discount_value(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,) -> Decimal:"""Return the line unit discount value.@@ -617,9 +616,9 @@ def order_line_unit_discount_type(order: Order,order_line: OrderLine,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,-) -> Optional[str]:+) -> str | None:"""Return the line unit discount type.It takes into account all plugins.@@ -634,7 +633,7 @@ def order_line_unit_discount_type(def order_undiscounted_shipping(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> TaxedMoney:@@ -658,7 +657,7 @@ def order_undiscounted_shipping(def order_shipping(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> TaxedMoney:@@ -682,10 +681,10 @@ def order_shipping(def order_shipping_tax_rate(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,-) -> Optional[Decimal]:+) -> Decimal | None:"""Return the shipping tax rate of the order.It takes into account all plugins.@@ -705,7 +704,7 @@ def order_shipping_tax_rate(def order_subtotal(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):@@ -731,7 +730,7 @@ def order_subtotal(def order_total(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> TaxedMoney:@@ -755,7 +754,7 @@ def order_total(def order_undiscounted_total(order: Order,manager: PluginsManager,- lines: Optional[Iterable[OrderLine]] = None,+ lines: Iterable[OrderLine] | None = None,force_update: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> TaxedMoney:diff --git a/saleor/order/events.py b/saleor/order/events.pyindex e248674cd4..c33f669f2b 100644--- a/saleor/order/events.py+++ b/saleor/order/events.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKING, Optionalfrom ..account import events as account_eventsfrom ..account.models import User@@ -24,7 +24,7 @@ def _lines_per_quantity_to_line_object_list(order_lines):]-def _get_payment_data(amount: Optional[Decimal], payment: Payment) -> dict:+def _get_payment_data(amount: Decimal | None, payment: Payment) -> dict:return {"parameters": {"amount": amount,@@ -38,8 +38,8 @@ def event_transaction_charge_requested(order_id: "UUID",reference: str,amount: Decimal,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return OrderEvent.objects.create(order_id=order_id,@@ -57,8 +57,8 @@ def event_transaction_refund_requested(order_id: "UUID",reference: str,amount: Decimal,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):return OrderEvent.objects.create(order_id=order_id,@@ -73,7 +73,7 @@ def event_transaction_refund_requested(def event_transaction_cancel_requested(- order_id: "UUID", reference: str, user: Optional[User], app: Optional[App]+ order_id: "UUID", reference: str, user: User | None, app: App | None):return OrderEvent.objects.create(order_id=order_id,@@ -87,7 +87,7 @@ def event_transaction_cancel_requested(def event_order_refunded_notification(- order_id: "UUID", user_id: Optional[int], app_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, app_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -102,7 +102,7 @@ def event_order_refunded_notification(def event_order_confirmed_notification(- order_id: "UUID", user_id: Optional[int], app_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, app_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -117,7 +117,7 @@ def event_order_confirmed_notification(def event_order_cancelled_notification(- order_id: "UUID", user_id: Optional[int], app_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, app_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -132,7 +132,7 @@ def event_order_cancelled_notification(def event_order_confirmation_notification(- order_id: "UUID", user_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -146,7 +146,7 @@ def event_order_confirmation_notification(def event_fulfillment_confirmed_notification(- order_id: "UUID", user_id: Optional[int], app_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, app_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -161,7 +161,7 @@ def event_fulfillment_confirmed_notification(def event_fulfillment_digital_links_notification(- order_id: "UUID", user_id: Optional[int], app_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, app_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -176,7 +176,7 @@ def event_fulfillment_digital_links_notification(def event_payment_confirmed_notification(- order_id: "UUID", user_id: Optional[int], customer_email: str+ order_id: "UUID", user_id: int | None, customer_email: str):return OrderEvent.objects.create(order_id=order_id,@@ -189,8 +189,8 @@ def event_payment_confirmed_notification(def invoice_requested_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,) -> OrderEvent:return OrderEvent.objects.create(order=order, app=app, type=OrderEvents.INVOICE_REQUESTED, user=user@@ -200,8 +200,8 @@ def invoice_requested_event(def invoice_generated_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,invoice_number: str,) -> OrderEvent:return OrderEvent.objects.create(@@ -216,8 +216,8 @@ def invoice_generated_event(def invoice_updated_event(*,order: Order,- user: Optional[Optional[User]],- app: Optional[App],+ user: User | None,+ app: App | None,invoice_number: str,url: str,status: str,@@ -232,7 +232,7 @@ def invoice_updated_event(def event_invoice_sent_notification(- *, order_id: "UUID", user_id: Optional[int], app_id: Optional[int], email: str+ *, order_id: "UUID", user_id: int | None, app_id: int | None, email: str) -> OrderEvent:return OrderEvent.objects.create(order_id=order_id,@@ -244,13 +244,13 @@ def event_invoice_sent_notification(def email_resent_event(- *, order: Order, user: Optional[User], email_type: OrderEventsEmails+ *, order: Order, user: User | None, email_type: OrderEventsEmails) -> OrderEvent:raise NotImplementedErrordef draft_order_created_event(- *, order: Order, user: Optional[User], app: Optional[App]+ *, order: Order, user: User | None, app: App | None) -> OrderEvent:return OrderEvent.objects.create(order=order, type=OrderEvents.DRAFT_CREATED, user=user, app=app@@ -260,10 +260,10 @@ def draft_order_created_event(def order_added_products_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_lines: list[OrderLine],- quantity_diff: Optional[int] = None,+ quantity_diff: int | None = None,) -> OrderEvent:if quantity_diff:lines = [_line_per_quantity_to_line_object(quantity_diff, order_lines[0])]@@ -282,10 +282,10 @@ def order_added_products_event(def order_removed_products_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_lines: list[OrderLine],- quantity_diff: Optional[int] = None,+ quantity_diff: int | None = None,) -> OrderEvent:if quantity_diff:lines = [_line_per_quantity_to_line_object(quantity_diff, order_lines[0])]@@ -305,8 +305,8 @@ def draft_order_created_from_replace_event(*,draft_order: Order,original_order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,lines: list[OrderLine],):parameters = {@@ -325,8 +325,8 @@ def draft_order_created_from_replace_event(def order_created_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,from_draft=False,automatic=False,) -> OrderEvent:@@ -346,7 +346,7 @@ def order_created_event(def order_confirmed_event(- *, order: Order, user: Optional[User], app: Optional[App]+ *, order: Order, user: User | None, app: App | None) -> OrderEvent:return OrderEvent.objects.create(order=order, type=OrderEvents.CONFIRMED, user=user, app=app@@ -354,7 +354,7 @@ def order_confirmed_event(def order_canceled_event(- *, order: Order, user: Optional[User], app: Optional[App]+ *, order: Order, user: User | None, app: App | None) -> OrderEvent:return OrderEvent.objects.create(order=order, type=OrderEvents.CANCELED, user=user, app=app@@ -364,9 +364,9 @@ def order_canceled_event(def order_manually_marked_as_paid_event(*,order: Order,- user: Optional[User],- app: Optional[App],- transaction_reference: Optional[str] = None,+ user: User | None,+ app: App | None,+ transaction_reference: str | None = None,) -> OrderEvent:parameters = {}if transaction_reference:@@ -383,9 +383,9 @@ def order_manually_marked_as_paid_event(def order_fully_paid_event(*,order: Order,- user: Optional[User],- app: Optional[App],- gateway: Optional[str] = None,+ user: User | None,+ app: App | None,+ gateway: str | None = None,) -> OrderEvent:parameters = {}if gateway:@@ -403,8 +403,8 @@ def order_replacement_created(*,original_order: Order,replace_order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,) -> OrderEvent:parameters = {"related_order_pk": replace_order.pk}return OrderEvent.objects.create(@@ -419,8 +419,8 @@ def order_replacement_created(def payment_authorized_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,amount: Decimal,payment: Payment,) -> OrderEvent:@@ -436,8 +436,8 @@ def payment_authorized_event(def payment_captured_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,amount: Decimal,payment: Payment,) -> OrderEvent:@@ -453,8 +453,8 @@ def payment_captured_event(def payment_refunded_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,amount: Decimal,payment: Payment,) -> OrderEvent:@@ -468,7 +468,7 @@ def payment_refunded_event(def payment_voided_event(- *, order: Order, user: Optional[User], app: Optional[App], payment: Payment+ *, order: Order, user: User | None, app: App | None, payment: Payment) -> OrderEvent:return OrderEvent.objects.create(order=order,@@ -482,8 +482,8 @@ def payment_voided_event(def payment_failed_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,message: str,payment: Payment,) -> OrderEvent:@@ -502,7 +502,7 @@ def payment_failed_event(def transaction_mark_order_as_paid_failed_event(- order: Order, user: Optional[User], app: Optional[App], message: str+ order: Order, user: User | None, app: App | None, message: str):parameters = {"message": message}@@ -518,8 +518,8 @@ def transaction_mark_order_as_paid_failed_event(def transaction_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,reference: str,message: str,) -> OrderEvent:@@ -536,10 +536,10 @@ def transaction_event(def external_notification_event(*,order: Order,- user: Optional[User],- app: Optional[App],- message: Optional[str],- parameters: Optional[dict],+ user: User | None,+ app: App | None,+ message: str | None,+ parameters: dict | None,) -> OrderEvent:parameters = parameters or {}parameters["message"] = message@@ -556,9 +556,9 @@ def external_notification_event(def fulfillment_canceled_event(*,order: Order,- user: Optional[User],- app: Optional[App],- fulfillment: Optional[Fulfillment],+ user: User | None,+ app: App | None,+ fulfillment: Fulfillment | None,) -> OrderEvent:return OrderEvent.objects.create(order=order,@@ -572,9 +572,9 @@ def fulfillment_canceled_event(def fulfillment_restocked_items_event(*,order: Order,- user: Optional[User],- app: Optional[App],- fulfillment: Union[Order, Fulfillment],+ user: User | None,+ app: App | None,+ fulfillment: Order | Fulfillment,warehouse_pk: Optional["UUID"] = None,) -> OrderEvent:return OrderEvent.objects.create(@@ -592,8 +592,8 @@ def fulfillment_restocked_items_event(def fulfillment_fulfilled_items_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,fulfillment_lines: list[FulfillmentLine],) -> OrderEvent:return OrderEvent.objects.create(@@ -608,8 +608,8 @@ def fulfillment_fulfilled_items_event(def fulfillment_awaits_approval_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,fulfillment_lines: list[FulfillmentLine],) -> OrderEvent:return OrderEvent.objects.create(@@ -624,8 +624,8 @@ def fulfillment_awaits_approval_event(def order_returned_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,returned_lines: list[tuple[int, OrderLine]],):return OrderEvent.objects.create(@@ -645,8 +645,8 @@ def order_returned_event(def fulfillment_replaced_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,replaced_lines: list[OrderLine],):return OrderEvent.objects.create(@@ -661,8 +661,8 @@ def fulfillment_replaced_event(def fulfillment_refunded_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,refunded_lines: list[tuple[int, OrderLine]],amount: Decimal,shipping_costs_included: bool,@@ -686,8 +686,8 @@ def fulfillment_refunded_event(def fulfillment_tracking_updated_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,tracking_number: str,fulfillment: Fulfillment,) -> OrderEvent:@@ -704,9 +704,9 @@ def fulfillment_tracking_updated_event(def order_note_added_event(- *, order: Order, user: Optional[User], app: Optional[App], message: str+ *, order: Order, user: User | None, app: App | None, message: str) -> OrderEvent:- kwargs: dict[str, Union[Optional[App], Optional[User]]] = {"app": app}+ kwargs: dict[str, App | None | User] = {"app": app}if user is not None:if order.user is not None and order.user.pk == user.pk:account_events.customer_added_to_note_order_event(@@ -725,8 +725,8 @@ def order_note_added_event(def order_note_updated_event(*,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,message: str,related_event: OrderEvent,) -> OrderEvent:@@ -762,8 +762,8 @@ def order_discount_event(*,event_type: str,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_discount: "OrderDiscount",old_order_discount: Optional["OrderDiscount"] = None,) -> OrderEvent:@@ -804,8 +804,8 @@ def order_discount_automatically_updated_event(def order_discount_added_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_discount: "OrderDiscount",) -> OrderEvent:return order_discount_event(@@ -819,8 +819,8 @@ def order_discount_added_event(def order_discount_updated_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_discount: "OrderDiscount",old_order_discount: Optional["OrderDiscount"] = None,) -> OrderEvent:@@ -836,8 +836,8 @@ def order_discount_updated_event(def order_discount_deleted_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_discount: "OrderDiscount",) -> OrderEvent:return order_discount_event(@@ -853,8 +853,8 @@ def order_line_discount_event(*,event_type: str,order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,line: OrderLine,line_before_update: Optional["OrderLine"] = None,) -> OrderEvent:@@ -885,8 +885,8 @@ def order_line_discount_event(def order_line_discount_updated_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,line: OrderLine,line_before_update: Optional["OrderLine"] = None,) -> OrderEvent:@@ -902,8 +902,8 @@ def order_line_discount_updated_event(def order_line_discount_removed_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,line: OrderLine,) -> OrderEvent:return order_line_discount_event(@@ -917,8 +917,8 @@ def order_line_discount_removed_event(def order_line_product_removed_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_lines: list[tuple[int, OrderLine]],):return OrderEvent.objects.create(@@ -932,8 +932,8 @@ def order_line_product_removed_event(def order_line_variant_removed_event(order: Order,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,order_lines: list[tuple[int, OrderLine]],):return OrderEvent.objects.create(diff --git a/saleor/order/fetch.py b/saleor/order/fetch.pyindex dfc0d4db1e..60cf1903a2 100644--- a/saleor/order/fetch.py+++ b/saleor/order/fetch.py@@ -39,11 +39,11 @@ class OrderLineInfo:line: "OrderLine"quantity: intvariant: Optional["ProductVariant"] = None- is_digital: Optional[bool] = None+ is_digital: bool | None = Nonedigital_content: Optional["DigitalContent"] = Nonereplace: bool = False- warehouse_pk: Optional[UUID] = None- line_discounts: Optional[Iterable["OrderLineDiscount"]] = None+ warehouse_pk: UUID | None = None+ line_discounts: Iterable["OrderLineDiscount"] | None = Nonedef fetch_order_info(order: "Order") -> OrderInfo:@@ -115,7 +115,7 @@ class EditableOrderLineInfo(LineInfo):def fetch_draft_order_lines_info(- order: "Order", lines: Optional[Iterable["OrderLine"]] = None+ order: "Order", lines: Iterable["OrderLine"] | None = None) -> list[EditableOrderLineInfo]:prefetch_related_fields = ["discounts__promotion_rule__promotion",@@ -176,8 +176,8 @@ def fetch_draft_order_lines_info(def get_prefetched_variant_listing(- variant: Optional[ProductVariant], channel_id: int-) -> Optional[ProductVariantChannelListing]:+ variant: ProductVariant | None, channel_id: int+) -> ProductVariantChannelListing | None:if not variant:return Nonefor channel_listing in variant.channel_listings.all():diff --git a/saleor/order/migrations/0111_auto_20210518_1357.py b/saleor/order/migrations/0111_auto_20210518_1357.pyindex 24e63426bd..e984f21394 100644--- a/saleor/order/migrations/0111_auto_20210518_1357.py+++ b/saleor/order/migrations/0111_auto_20210518_1357.py@@ -31,7 +31,7 @@ def populate_refund_amounts_in_fulfillments(apps, schema_editor):fulfillment_count = fulfillments.count()refunded_events_count = len(refunded_events)if fulfillment_count == refunded_events_count:- for fulfillment, event in zip(fulfillments, refunded_events):+ for fulfillment, event in zip(fulfillments, refunded_events, strict=False):amount = event.parameters.get("amount") or 0included_shipping_costs = event.parameters.get("shipping_costs_included", Falsediff --git a/saleor/order/models.py b/saleor/order/models.pyindex ee4d1eca00..79fbcf8483 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -1,7 +1,7 @@from decimal import Decimalfrom operator import attrgetterfrom re import match-from typing import TYPE_CHECKING, Optional, cast+from typing import TYPE_CHECKING, castfrom uuid import uuid4from django.conf import settings@@ -406,7 +406,7 @@ class Order(ModelWithMetadata, ModelWithExternalReference):def __str__(self):return f"#{self.id}"- def get_last_payment(self) -> Optional[Payment]:+ def get_last_payment(self) -> Payment | None:# Skipping a partial payment is a temporary workaround for storing a basic data# about partial payment from Adyen plugin. This is something that will removed# in 3.1 by introducing a partial payments feature.diff --git a/saleor/order/notifications.py b/saleor/order/notifications.pyindex 9a688b9e01..89f69fb244 100644--- a/saleor/order/notifications.py+++ b/saleor/order/notifications.py@@ -181,7 +181,7 @@ def get_product_variant_payload(variant: ProductVariant):def get_order_line_payload(line: "OrderLine", attribute_data: AttributeData):- digital_url: Optional[str] = None+ digital_url: str | None = Noneif line.is_digital:content = DigitalContentUrl.objects.filter(line=line).first()digital_url = content.get_absolute_url() if content else None@@ -320,8 +320,8 @@ def get_custom_order_payload(order: Order):def get_default_order_payload(order: "Order",redirect_url: str = "",- lines: Optional[Iterable["OrderLine"]] = None,- attribute_data: Optional[AttributeData] = None,+ lines: Iterable["OrderLine"] | None = None,+ attribute_data: AttributeData | None = None,):order_details_url = ""if redirect_url:diff --git a/saleor/order/tests/fixtures/order.py b/saleor/order/tests/fixtures/order.pyindex 4877158ac6..b489bed773 100644--- a/saleor/order/tests/fixtures/order.py+++ b/saleor/order/tests/fixtures/order.py@@ -275,7 +275,9 @@ def order_lines_generator():variant__in=variants, channel=channel)}- for variant, price, quantity in zip(variants, unit_prices, quantities):+ for variant, price, quantity in zip(+ variants, unit_prices, quantities, strict=False+ ):product = variant.productvariant_channel_listing = variant_channel_listings_map[variant.id]currency = channel.currency_code@@ -1092,7 +1094,7 @@ def preorders(orders, product):undiscounted_total_price_net_amount=Decimal("10.0"),undiscounted_total_price_gross_amount=Decimal("10.0"),)- for variant, order in zip(variants, orders)+ for variant, order in zip(variants, orders, strict=False)]OrderLine.objects.bulk_create(lines)preorders = orders[: len(variants) - 1]diff --git a/saleor/order/tests/test_calculations.py b/saleor/order/tests/test_calculations.pyindex 06154e9259..6956713769 100644--- a/saleor/order/tests/test_calculations.py+++ b/saleor/order/tests/test_calculations.py@@ -1,5 +1,5 @@from decimal import Decimal-from typing import Literal, Union+from typing import Literalfrom unittest.mock import Mock, patch, sentinelimport pytest@@ -125,7 +125,7 @@ def test_recalculate_with_plugins(order_with_lines, order_lines, tax_data):get_order_priced_taxes_data(line, "total", currency) for line in tax_data.lines]unit_prices = []- for line, total_price in zip(lines, total_prices):+ for line, total_price in zip(lines, total_prices, strict=False):unit_prices.append(OrderTaxedPricesData(undiscounted_price=total_price.undiscounted_price / line.quantity,@@ -159,7 +159,7 @@ def test_recalculate_with_plugins(order_with_lines, order_lines, tax_data):assert order.shipping_tax_rate == shipping_tax_ratefor line_unit, line_total, tax_rate, line in zip(- unit_prices, total_prices, tax_rates, lines+ unit_prices, total_prices, tax_rates, lines, strict=False):undiscounted_unit_gross = line_unit.undiscounted_price.net.amount * (1 + (tax_rate / 100)@@ -234,7 +234,7 @@ def test_recalculate_with_plugins_tax_error_line_prices(get_order_priced_taxes_data(line, "total", currency) for line in tax_data.lines]unit_prices = []- for line, total_price in zip(lines, total_prices):+ for line, total_price in zip(lines, total_prices, strict=False):unit_prices.append(OrderTaxedPricesData(undiscounted_price=total_price.undiscounted_price / line.quantity,@@ -275,7 +275,7 @@ def test_recalculate_with_plugins_tax_error_line_prices(assert old_line_tax_rate == error_line.tax_ratefor line_unit, line_total, tax_rate, line in list(- zip(unit_prices, total_prices, tax_rates, lines)+ zip(unit_prices, total_prices, tax_rates, lines, strict=False))[1:]:undiscounted_unit_gross = line_unit.undiscounted_price.net.amount * (1 + (tax_rate / 100)@@ -309,7 +309,7 @@ def test_recalculate_with_plugins_tax_error_shipping_price(get_order_priced_taxes_data(line, "total", currency) for line in tax_data.lines]unit_prices = []- for line, total_price in zip(lines, total_prices):+ for line, total_price in zip(lines, total_prices, strict=False):unit_prices.append(OrderTaxedPricesData(undiscounted_price=total_price.undiscounted_price / line.quantity,@@ -342,7 +342,7 @@ def test_recalculate_with_plugins_tax_error_shipping_price(assert order.shipping_tax_rate == old_shipping_tax_ratefor line_unit, line_total, tax_rate, line in zip(- unit_prices, total_prices, tax_rates, lines+ unit_prices, total_prices, tax_rates, lines, strict=False):undiscounted_unit_gross = line_unit.undiscounted_price.net.amount * (1 + (tax_rate / 100)@@ -403,7 +403,7 @@ def test_recalculate_with_plugins_order_discounts_and_total_undiscounted_price_cget_order_priced_taxes_data(line, "total", currency) for line in tax_data.lines]unit_prices = []- for line, total_price in zip(lines, total_prices):+ for line, total_price in zip(lines, total_prices, strict=False):unit_prices.append(OrderTaxedPricesData(undiscounted_price=total_price.undiscounted_price / line.quantity,@@ -538,7 +538,7 @@ def test_apply_tax_data(assert str(order.shipping_price.gross.amount) == str(tax_data.shipping_price_gross_amount)- for line, tax_line in zip(lines, tax_data.lines):+ for line, tax_line in zip(lines, tax_data.lines, strict=False):assert str(line.total_price.net.amount) == str(tax_line.total_net_amount)assert str(line.total_price.gross.amount) == str(tax_line.total_gross_amount)assert str(line.undiscounted_total_price.net.amount) == str(@@ -587,7 +587,9 @@ def manager_with_mocked_plugins_calculations(plugins_manager.calculate_order_line_total = Mock(side_effect=total_prices)unit_prices = []- for line, total_price in zip(order_with_lines.lines.all(), total_prices):+ for line, total_price in zip(+ order_with_lines.lines.all(), total_prices, strict=False+ ):unit_price = quantize_price(total_price.price_with_discounts / line.quantity, currency)@@ -624,7 +626,7 @@ def fetch_kwargs_with_lines(order_with_lines, order_lines, plugins_manager):def get_taxed_money(- obj: Union[TaxData, TaxLineData],+ obj: TaxData | TaxLineData,attr: Literal["unit", "total", "subtotal", "shipping_price"],currency: str,exempt_taxes: bool = False,@@ -647,7 +649,7 @@ def get_taxed_money(def get_order_priced_taxes_data(- obj: Union[TaxData, TaxLineData],+ obj: TaxData | TaxLineData,attr: Literal["unit", "total", "subtotal", "shipping_price"],currency: str,) -> OrderTaxedPricesData:@@ -670,7 +672,9 @@ def test_fetch_order_prices_if_expired_plugins(]subtotal = zero_taxed_money(currency)unit_prices = []- for line, total_price in zip(order_with_lines.lines.all(), total_prices):+ for line, total_price in zip(+ order_with_lines.lines.all(), total_prices, strict=False+ ):subtotal += total_price.price_with_discountsunit_prices.append(OrderTaxedPricesData(@@ -703,7 +707,7 @@ def test_fetch_order_prices_if_expired_plugins(assert order_with_lines.shipping_tax_rate == tax_data.shipping_tax_rate / 100assert order_with_lines.total == totalfor order_line, tax_line, unit_price in zip(- order_with_lines.lines.all(), tax_data.lines, unit_prices+ order_with_lines.lines.all(), tax_data.lines, unit_prices, strict=False):assert order_line.unit_price == unit_price.price_with_discountsassert order_line.total_price == get_taxed_money(tax_line, "total", currency)@@ -763,7 +767,9 @@ def test_fetch_order_prices_if_expired_webhooks_success(assert order_with_lines.shipping_price == shipping_priceassert order_with_lines.shipping_tax_rate == tax_data.shipping_tax_rate / 100subtotal = zero_taxed_money(currency)- for order_line, tax_line in zip(order_with_lines.lines.all(), tax_data.lines):+ for order_line, tax_line in zip(+ order_with_lines.lines.all(), tax_data.lines, strict=False+ ):line_total = get_taxed_money(tax_line, "total", currency)subtotal += line_totalassert order_line.total_price == line_total@@ -804,7 +810,9 @@ def test_fetch_order_prices_if_expired_recalculate_all_prices(assert order_with_lines.shipping_price == shipping_priceassert order_with_lines.shipping_tax_rate == tax_data.shipping_tax_rate / 100subtotal = zero_taxed_money(currency)- for order_line, tax_line in zip(order_with_lines.lines.all(), tax_data.lines):+ for order_line, tax_line in zip(+ order_with_lines.lines.all(), tax_data.lines, strict=False+ ):line_total = get_taxed_money(tax_line, "total", currency)subtotal += line_totalassert order_line.total_price == line_total@@ -865,7 +873,9 @@ def test_fetch_order_prices_when_tax_exemption(assert order_with_lines.shipping_price == shipping_priceassert order_with_lines.shipping_tax_rate == Decimal("0.00")subtotal = zero_taxed_money(currency)- for order_line, tax_line in zip(order_with_lines.lines.all(), tax_data.lines):+ for order_line, tax_line in zip(+ order_with_lines.lines.all(), tax_data.lines, strict=False+ ):line_total = get_taxed_money(tax_line,"total",@@ -988,7 +998,9 @@ def test_fetch_order_prices_on_promotion_if_expired_recalculate_all_prices(assert order_with_lines.shipping_tax_rate == tax_data.shipping_tax_rate / 100subtotal = zero_taxed_money(currency)undiscounted_subtotal = zero_taxed_money(currency)- for order_line, tax_line in zip(order_with_lines.lines.all(), tax_data.lines):+ for order_line, tax_line in zip(+ order_with_lines.lines.all(), tax_data.lines, strict=False+ ):line_total = get_taxed_money(tax_line, "total", currency)subtotal += line_totalundiscounted_subtotal += order_line.undiscounted_total_pricediff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 99ce14cc42..9dc32e2245 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -448,7 +448,7 @@ def add_gift_cards_to_order(checkout_info: "CheckoutInfo",order: Order,total_price_left: Money,- user: Optional[User],+ user: User | None,app: Optional["App"],):total_before_gift_card_compensation = total_price_left@@ -510,7 +510,7 @@ def update_gift_card_balance(def set_gift_card_user(gift_card: GiftCard,- used_by_user: Optional[User],+ used_by_user: User | None,used_by_email: str,):"""Set the user, each time a giftcard is used."""@@ -799,7 +799,7 @@ def create_order_discount_for_order(reason: str,value_type: str,value: Decimal,- type: Optional[str] = None,+ type: str | None = None,):"""Add new order discount and update the prices."""@@ -836,9 +836,9 @@ def remove_order_discount_from_order(order: Order, order_discount: OrderDiscountdef update_discount_for_order_line(order_line: OrderLine,order: "Order",- reason: Optional[str],- value_type: Optional[str],- value: Optional[Decimal],+ reason: str | None,+ value_type: str | None,+ value: Decimal | None,):"""Update discount fields for order line. Apply discount to the price."""# TODO: Move price calculation to fetch_order_prices_if_expired function.@@ -1018,9 +1018,9 @@ def _update_order_total_charged(def update_order_charge_data(order: Order,- order_payments: Optional[QuerySet["Payment"]] = None,- order_transactions: Optional[QuerySet["TransactionItem"]] = None,- order_granted_refunds: Optional[QuerySet["OrderGrantedRefund"]] = None,+ order_payments: QuerySet["Payment"] | None = None,+ order_transactions: QuerySet["TransactionItem"] | None = None,+ order_granted_refunds: QuerySet["OrderGrantedRefund"] | None = None,with_save=True,):if order_payments is None:@@ -1084,9 +1084,9 @@ def update_order_authorize_status(order: Order, granted_refund_amount: Decimal):def update_order_authorize_data(order: Order,- order_payments: Optional[QuerySet["Payment"]] = None,- order_transactions: Optional[QuerySet["TransactionItem"]] = None,- order_granted_refunds: Optional[QuerySet["OrderGrantedRefund"]] = None,+ order_payments: QuerySet["Payment"] | None = None,+ order_transactions: QuerySet["TransactionItem"] | None = None,+ order_granted_refunds: QuerySet["OrderGrantedRefund"] | None = None,with_save=True,):if order_payments is None:@@ -1295,7 +1295,9 @@ def order_info_for_logs(order: Order, lines: Iterable[OrderLine]):def clean_order_line_quantities(order_lines, quantities_for_lines):- for order_line, line_quantities in zip(order_lines, quantities_for_lines):+ for order_line, line_quantities in zip(+ order_lines, quantities_for_lines, strict=False+ ):line_total_quantity = sum(line_quantities)line_quantity_unfulfilled = order_line.quantity_unfulfilleddiff --git a/saleor/payment/gateway.py b/saleor/payment/gateway.pyindex e5bb4402a1..d374050c7e 100644--- a/saleor/payment/gateway.py+++ b/saleor/payment/gateway.py@@ -1,6 +1,7 @@import logging+from collections.abc import Callablefrom decimal import Decimal-from typing import TYPE_CHECKING, Callable, Optional, cast+from typing import TYPE_CHECKING, Optional, castfrom ..account.models import Userfrom ..app.models import App@@ -85,11 +86,11 @@ def with_locked_payment(fn: Callable) -> Callable:def request_charge_action(transaction: TransactionItem,manager: "PluginsManager",- charge_value: Optional[Decimal],+ charge_value: Decimal | None,request_event: TransactionEvent,channel_slug: str,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,):if charge_value is None:charge_value = transaction.authorized_value@@ -121,12 +122,12 @@ def request_charge_action(def request_refund_action(transaction: TransactionItem,manager: "PluginsManager",- refund_value: Optional[Decimal],+ refund_value: Decimal | None,request_event: TransactionEvent,channel_slug: str,- user: Optional[User],- app: Optional[App],- granted_refund: Optional[OrderGrantedRefund] = None,+ user: User | None,+ app: App | None,+ granted_refund: OrderGrantedRefund | None = None,):if refund_value is None:refund_value = transaction.charged_value@@ -160,11 +161,11 @@ def request_refund_action(def request_cancelation_action(transaction: TransactionItem,manager: "PluginsManager",- cancel_value: Optional[Decimal],+ cancel_value: Decimal | None,request_event: TransactionEvent,channel_slug: str,- user: Optional[User],- app: Optional[App],+ user: User | None,+ app: App | None,action: str,):transaction_action_data = _create_transaction_data(@@ -194,9 +195,9 @@ def request_cancelation_action(def _create_transaction_data(transaction: TransactionItem,action_type: str,- action_value: Optional[Decimal],+ action_value: Decimal | None,request_event: TransactionEvent,- granted_refund: Optional[OrderGrantedRefund] = None,+ granted_refund: OrderGrantedRefund | None = None,):app_owner = Noneif transaction.app_id:@@ -262,9 +263,9 @@ def process_payment(token: str,manager: "PluginsManager",channel_slug: str,- customer_id: Optional[str] = None,+ customer_id: str | None = None,store_source: bool = False,- additional_data: Optional[dict] = None,+ additional_data: dict | None = None,) -> Transaction:payment_data = create_payment_information(payment=payment,@@ -303,7 +304,7 @@ def authorize(token: str,manager: "PluginsManager",channel_slug: str,- customer_id: Optional[str] = None,+ customer_id: str | None = None,store_source: bool = False,) -> Transaction:clean_authorize(payment)@@ -340,8 +341,8 @@ def capture(payment: Payment,manager: "PluginsManager",channel_slug: str,- amount: Optional[Decimal] = None,- customer_id: Optional[str] = None,+ amount: Decimal | None = None,+ customer_id: str | None = None,store_source: bool = False,) -> Transaction:if amount is None:@@ -380,7 +381,7 @@ def refund(payment: Payment,manager: "PluginsManager",channel_slug: str,- amount: Optional[Decimal] = None,+ amount: Decimal | None = None,refund_data: Optional["RefundData"] = None,) -> Transaction:if amount is None:@@ -452,7 +453,7 @@ def confirm(payment: Payment,manager: "PluginsManager",channel_slug: str,- additional_data: Optional[dict] = None,+ additional_data: dict | None = None,) -> Transaction:txn = payment.transactions.filter(kind=TransactionKind.ACTION_TO_CONFIRM, is_success=True@@ -487,13 +488,13 @@ def list_payment_sources(gateway: str,customer_id: str,manager: "PluginsManager",- channel_slug: Optional[str],+ channel_slug: str | None,) -> list["CustomerSource"]:return manager.list_payment_sources(gateway, customer_id, channel_slug=channel_slug)def list_gateways(- manager: "PluginsManager", channel_slug: Optional[str] = None+ manager: "PluginsManager", channel_slug: str | None = None) -> list["PaymentGateway"]:return manager.list_payment_gateways(channel_slug=channel_slug)@@ -532,10 +533,10 @@ def _validate_refund_amount(payment: Payment, amount: Decimal):def payment_refund_or_void(- payment: Optional[Payment],+ payment: Payment | None,manager: "PluginsManager",- channel_slug: Optional[str],- transaction_id: Optional[str] = None,+ channel_slug: str | None,+ transaction_id: str | None = None,):if payment is None:return@@ -563,7 +564,7 @@ def payment_refund_or_void(def _get_success_transaction(- kind: str, payment: Payment, transaction_id: Optional[str]+ kind: str, payment: Payment, transaction_id: str | None) -> None | Transaction:if not transaction_id:try:diff --git a/saleor/payment/gateways/adyen/plugin.py b/saleor/payment/gateways/adyen/plugin.pyindex 28b1eaf14f..02f7914430 100644--- a/saleor/payment/gateways/adyen/plugin.py+++ b/saleor/payment/gateways/adyen/plugin.py@@ -300,9 +300,9 @@ class AdyenGatewayPlugin(BasePlugin):def get_payment_gateways(self,- currency: Optional[str],+ currency: str | None,checkout_info: Optional["CheckoutInfo"],- checkout_lines: Optional[list["CheckoutLineInfo"]],+ checkout_lines: list["CheckoutLineInfo"] | None,previous_value,) -> list["PaymentGateway"]:"""Fetch current configuration for given checkout.diff --git a/saleor/payment/gateways/adyen/utils/apple_pay.py b/saleor/payment/gateways/adyen/utils/apple_pay.pyindex 6ef1d060ff..211f219f3f 100644--- a/saleor/payment/gateways/adyen/utils/apple_pay.py+++ b/saleor/payment/gateways/adyen/utils/apple_pay.py@@ -1,6 +1,5 @@import loggingfrom tempfile import NamedTemporaryFile-from typing import Optionalfrom urllib.parse import urlsplitimport requests@@ -38,10 +37,10 @@ logger = logging.getLogger(__name__)def validate_payment_data_for_apple_pay(- validation_url: Optional[str],- merchant_identifier: Optional[str],- domain: Optional[str],- display_name: Optional[str],+ validation_url: str | None,+ merchant_identifier: str | None,+ domain: str | None,+ display_name: str | None,certificate,):if not certificate:diff --git a/saleor/payment/gateways/adyen/utils/common.py b/saleor/payment/gateways/adyen/utils/common.pyindex 27f17edeab..5c8d0305e0 100644--- a/saleor/payment/gateways/adyen/utils/common.py+++ b/saleor/payment/gateways/adyen/utils/common.py@@ -1,7 +1,8 @@import jsonimport logging+from collections.abc import Callablefrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalimport Adyenimport opentracing@@ -81,7 +82,7 @@ def get_tax_percentage_in_adyen_format(total_gross, total_net):def api_call(- request_data: Optional[dict[str, Any]], method: Callable, **kwargs+ request_data: dict[str, Any] | None, method: Callable, **kwargs) -> Adyen.Adyen:try:return method(request_data, **kwargs)@@ -90,7 +91,7 @@ def api_call(raise PaymentError(f"Unable to process the payment request: {e}.") from e-def prepare_address_request_data(address: Optional["AddressData"]) -> Optional[dict]:+def prepare_address_request_data(address: Optional["AddressData"]) -> dict | None:"""Create address structure for Adyen request.The sample recieved from Adyen team:@@ -337,7 +338,7 @@ def get_shopper_locale_value(country_code: str):def request_data_for_gateway_config(checkout_info: "CheckoutInfo",- lines: Optional[list[CheckoutLineInfo]],+ lines: list[CheckoutLineInfo] | None,merchant_account,) -> dict[str, Any]:manager = get_plugins_manager(allow_replica=False)diff --git a/saleor/payment/gateways/adyen/webhooks.py b/saleor/payment/gateways/adyen/webhooks.pyindex c67bdaf24d..851c7e51ea 100644--- a/saleor/payment/gateways/adyen/webhooks.py+++ b/saleor/payment/gateways/adyen/webhooks.py@@ -4,10 +4,10 @@ import hashlibimport hmacimport jsonimport logging-from collections.abc import Iterable+from collections.abc import Callable, Iterablefrom decimal import Decimalfrom json.decoder import JSONDecodeError-from typing import Any, Callable, Optional, cast+from typing import Any, castfrom urllib.parse import urlencode, urlparseimport Adyen@@ -65,8 +65,8 @@ logger = logging.getLogger(__name__)def get_payment_id(- payment_id: Optional[str],- transaction_id: Optional[str] = None,+ payment_id: str | None,+ transaction_id: str | None = None,):if payment_id is None or not payment_id.strip():logger.warning("Missing payment ID. Reference %s", transaction_id)@@ -86,10 +86,10 @@ def get_payment_id(def get_payment(- payment_id: Optional[str],- transaction_id: Optional[str] = None,+ payment_id: str | None,+ transaction_id: str | None = None,check_if_active=True,-) -> Optional[Payment]:+) -> Payment | None:transaction_id = transaction_id or ""db_payment_id = get_payment_id(payment_id)if not db_payment_id:@@ -112,7 +112,7 @@ def get_payment(return payment-def get_checkout(payment_id: int) -> Optional[Checkout]:+def get_checkout(payment_id: int) -> Checkout | None:# Lock checkout in the same way as in checkoutCompletereturn (Checkout.objects.select_for_update(of=("self",))@@ -128,9 +128,9 @@ def get_checkout(payment_id: int) -> Optional[Checkout]:def get_transaction(payment: "Payment",- transaction_id: Optional[str],+ transaction_id: str | None,kind: str,-) -> Optional[Transaction]:+) -> Transaction | None:transaction = payment.transactions.filter(kind=kind, token=transaction_id).last()return transaction@@ -164,7 +164,7 @@ def create_new_transaction(notification, payment, kind):def create_payment_notification_for_order(- payment: Payment, success_msg: str, failed_msg: Optional[str], is_success: bool+ payment: Payment, success_msg: str, failed_msg: str | None, is_success: bool):if not payment.order:# Order is not assigned@@ -541,7 +541,7 @@ def handle_refund(notification: dict[str, Any], _gateway_config: GatewayConfig):)-def _get_kind(transaction: Optional[Transaction]) -> str:+def _get_kind(transaction: Transaction | None) -> str:if transaction:return transaction.kind# To proceed the refund we already need to have the capture status so we will use it@@ -679,7 +679,7 @@ def handle_order_opened(notification: dict[str, Any], gateway_config: GatewayCondef get_or_create_adyen_partial_payments(notification: dict[str, Any], payment: Payment-) -> Optional[list[Payment]]:+) -> list[Payment] | None:"""Store basic data about partial payments created by Adyen.This is a workaround for not supporting partial payments in Saleor. Adyen can@@ -911,10 +911,10 @@ EVENT_MAP = {def validate_hmac_signature(notification: dict[str, Any], gateway_config: "GatewayConfig") -> bool:- hmac_signature: Optional[str] = notification.get("additionalData", {}).get(+ hmac_signature: str | None = notification.get("additionalData", {}).get("hmacSignature")- hmac_key: Optional[str] = gateway_config.connection_params.get("webhook_hmac")+ hmac_key: str | None = gateway_config.connection_params.get("webhook_hmac")if not hmac_key:return not hmac_signature@@ -948,7 +948,7 @@ def validate_hmac_signature(def validate_auth_user(headers: HttpHeaders, gateway_config: "GatewayConfig") -> bool:username = gateway_config.connection_params["webhook_user"]password = gateway_config.connection_params["webhook_user_password"]- auth_header: Optional[str] = headers.get("Authorization")+ auth_header: str | None = headers.get("Authorization")if not auth_header:if not username:return True@@ -1135,7 +1135,7 @@ def prepare_redirect_url(def handle_api_response(payment: Payment,- checkout: Optional[Checkout],+ checkout: Checkout | None,response: Adyen.Adyen,channel_slug: str,):diff --git a/saleor/payment/gateways/authorize_net/__init__.py b/saleor/payment/gateways/authorize_net/__init__.pyindex d0598ef0c5..9b4ca13ff4 100644--- a/saleor/payment/gateways/authorize_net/__init__.py+++ b/saleor/payment/gateways/authorize_net/__init__.py@@ -1,5 +1,5 @@import json-from typing import Any, Optional, Union+from typing import Any, Unionfrom authorizenet import apicontractsv1from authorizenet.apicontrollers import (@@ -59,7 +59,7 @@ def authenticate_test(def process_payment(payment_information: PaymentData,config: GatewayConfig,- user_id: Optional[int] = None,+ user_id: int | None = None,) -> GatewayResponse:return authorize(payment_information, config, user_id=user_id)@@ -106,7 +106,7 @@ def capture(payment_information: PaymentData, config: GatewayConfig) -> GatewayRdef authorize(payment_information: PaymentData,config: GatewayConfig,- user_id: Optional[int] = None,+ user_id: int | None = None,) -> GatewayResponse:"""Based on AcceptSuite create-an-accept-payment-transaction example.@@ -351,10 +351,10 @@ def refund(def _handle_authorize_net_response(response: ObjectifiedElement,-) -> tuple[bool, Optional[str], str, Any, Any]:+) -> tuple[bool, str | None, str, Any, Any]:success = False- error: Optional[str] = None- transaction_id: Optional[int] = None+ error: str | None = None+ transaction_id: int | None = Nonetransaction_response: Any = Noneraw_response = ""if response is not None:@@ -392,7 +392,7 @@ def _handle_authorize_net_response(def _authorize_net_account_to_payment_method_info(transaction_response: Union["ObjectifiedElement", None],-) -> Optional[PaymentMethodInfo]:+) -> PaymentMethodInfo | None:"""Transform Authorize.Net transactionResponse to Saleor credit card.accountNumber: "XXXX0015"@@ -448,7 +448,7 @@ def _normalize_last_4(account_number: str):return account_number.strip("X")-def _normalize_card_expiration(expiration_date: str) -> list[Optional[int]]:+def _normalize_card_expiration(expiration_date: str) -> list[int | None]:"""Convert authorize.net combined expiration date into month and year.Example: 2021-02 > [2021, 2]diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.pyindex 3ce485985a..e78140cf6d 100644--- a/saleor/payment/gateways/braintree/__init__.py+++ b/saleor/payment/gateways/braintree/__init__.py@@ -1,5 +1,3 @@-from typing import Optional-import braintree as braintree_sdkimport opentracingimport opentracing.tags@@ -69,7 +67,7 @@ def get_error_for_client(errors: list) -> str:def extract_gateway_response(braintree_result) -> dict:"""Extract data from Braintree response that will be stored locally."""- errors: list[Optional[dict[str, str]]] = []+ errors: list[dict[str, str] | None] = []if not braintree_result.is_success:errors = [{"code": error.code, "message": error.message}@@ -109,7 +107,7 @@ def get_braintree_gateway(def get_client_token(- config: GatewayConfig, token_config: Optional[TokenConfig] = None+ config: GatewayConfig, token_config: TokenConfig | None = None) -> str:gateway = get_braintree_gateway(**config.connection_params)with opentracing.global_tracer().start_active_span(@@ -123,7 +121,7 @@ def get_client_token(def create_token_params(- config: GatewayConfig, token_config: Optional[TokenConfig] = None+ config: GatewayConfig, token_config: TokenConfig | None = None) -> dict:params = {}if "merchant_account_id" in config.connection_params:diff --git a/saleor/payment/gateways/dummy_credit_card/__init__.py b/saleor/payment/gateways/dummy_credit_card/__init__.pyindex c0a6ae21aa..ad17810914 100644--- a/saleor/payment/gateways/dummy_credit_card/__init__.py+++ b/saleor/payment/gateways/dummy_credit_card/__init__.py@@ -1,5 +1,4 @@import uuid-from typing import Optionalfrom ... import TransactionKindfrom ...interface import GatewayConfig, GatewayResponse, PaymentData, PaymentMethodInfo@@ -26,7 +25,7 @@ def dummy_success():return True-def validate_token(token: Optional[str]):+def validate_token(token: str | None):return TOKEN_VALIDATION_MAPPING.get(token, None) if token else Nonediff --git a/saleor/payment/gateways/np_atobarai/api.py b/saleor/payment/gateways/np_atobarai/api.pyindex 057089a3b1..44dbdf78ab 100644--- a/saleor/payment/gateways/np_atobarai/api.py+++ b/saleor/payment/gateways/np_atobarai/api.py@@ -1,6 +1,5 @@import loggingfrom decimal import Decimal-from typing import Optionalfrom ....order.models import Fulfillmentfrom ...interface import PaymentData@@ -153,8 +152,8 @@ def reregister_transaction_for_partial_return(config: ApiConfig,payment: Payment,payment_information: PaymentData,- shipping_company_code: Optional[str],- tracking_number: Optional[str],+ shipping_company_code: str | None,+ tracking_number: str | None,goods: list[dict],billed_amount: Decimal,) -> PaymentResult:diff --git a/saleor/payment/gateways/np_atobarai/api_helpers.py b/saleor/payment/gateways/np_atobarai/api_helpers.pyindex d1486696af..841b6901d3 100644--- a/saleor/payment/gateways/np_atobarai/api_helpers.py+++ b/saleor/payment/gateways/np_atobarai/api_helpers.py@@ -1,7 +1,7 @@import loggingfrom collections.abc import Iterablefrom decimal import Decimal-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGimport requestsfrom django.conf import settings@@ -49,7 +49,7 @@ def _request(config: "ApiConfig",method: str,path: str = "",- json: Optional[dict] = None,+ json: dict | None = None,) -> requests.Response:trace_name = f"np-atobarai.request.{path.lstrip('/')}"with np_atobarai_opentracing_trace(trace_name):@@ -71,7 +71,7 @@ def _request(def np_request(- config: "ApiConfig", method: str, path: str = "", json: Optional[dict] = None+ config: "ApiConfig", method: str, path: str = "", json: dict | None = None) -> NPResponse:response_data = {}try:@@ -86,7 +86,7 @@ def np_request(def handle_unrecoverable_state(- order: Optional[Order],+ order: Order | None,action: str,transaction_id: str,error_codes: Iterable[str],@@ -110,7 +110,7 @@ def format_name(ad: AddressData) -> str:return f"{ad.last_name} {ad.first_name}".strip()-def format_address(config: "ApiConfig", ad: AddressData) -> Optional[str]:+def format_address(config: "ApiConfig", ad: AddressData) -> str | None:"""Follow the Japanese address guidelines."""# example: "東京都千代田区麹町4-2-6 住友不動産麹町ファーストビル5階"if not config.fill_missing_address:@@ -258,8 +258,8 @@ def cancel(config: "ApiConfig", transaction_id: str) -> NPResponse:def register(config: "ApiConfig",payment_information: "PaymentData",- billed_amount: Optional[int] = None,- goods: Optional[list[dict]] = None,+ billed_amount: int | None = None,+ goods: list[dict] | None = None,) -> NPResponse:if billed_amount is None:billed_amount = format_price(@@ -319,9 +319,9 @@ def register(def report(config: "ApiConfig",- shipping_company_code: Optional[str],- psp_reference: Optional[str],- shipping_slip_number: Optional[str],+ shipping_company_code: str | None,+ psp_reference: str | None,+ shipping_slip_number: str | None,) -> NPResponse:if not shipping_company_code:return error_np_response(SHIPPING_COMPANY_CODE_INVALID)diff --git a/saleor/payment/gateways/np_atobarai/api_types.py b/saleor/payment/gateways/np_atobarai/api_types.pyindex fbacc53fc5..6225252285 100644--- a/saleor/payment/gateways/np_atobarai/api_types.py+++ b/saleor/payment/gateways/np_atobarai/api_types.py@@ -1,6 +1,6 @@from dataclasses import dataclass, fieldfrom enum import Enum-from typing import NamedTuple, Optional+from typing import NamedTuplefrom .const import (FILL_MISSING_ADDRESS,@@ -46,7 +46,7 @@ class PaymentStatus(str, Enum):@dataclassclass PaymentResult:status: PaymentStatus- psp_reference: Optional[str] = None+ psp_reference: str | None = Noneraw_response: dict[str, str] = field(default_factory=dict)errors: list[str] = field(default_factory=list)diff --git a/saleor/payment/gateways/np_atobarai/tests/test_api_helpers.py b/saleor/payment/gateways/np_atobarai/tests/test_api_helpers.pyindex 8a613e83e3..2bbd33acc8 100644--- a/saleor/payment/gateways/np_atobarai/tests/test_api_helpers.py+++ b/saleor/payment/gateways/np_atobarai/tests/test_api_helpers.py@@ -86,9 +86,7 @@ def test_format_name(np_address_data):# thenassert formatted_name == (- f"{np_address_data.last_name}"- f"{double_byte_space}"- f"{np_address_data.first_name}"+ f"{np_address_data.last_name}{double_byte_space}{np_address_data.first_name}")@@ -293,7 +291,7 @@ def test_get_goods_with_refunds_manual_product_refund_product_refund()assert billed_amount == expected_billed_amountassert goods[0]["quantity"] == line_to_refund.quantity - 1- for goods_line, order_line in zip(goods[1:], order_lines[1:]):+ for goods_line, order_line in zip(goods[1:], order_lines[1:], strict=False):assert goods_line["quantity"] == order_line.quantity@@ -326,7 +324,7 @@ def test_get_goods_with_refunds_product_refund_shipping_refund()assert billed_amount == expected_billed_amountassert goods[0]["quantity"] == line_to_refund.quantity - 1- for goods_line, order_line in zip(goods[1:], order_lines[1:]):+ for goods_line, order_line in zip(goods[1:], order_lines[1:], strict=False):assert goods_line["quantity"] == order_line.quantity@@ -352,7 +350,7 @@ def test_get_goods_with_refunds_manual_shipping_misc_refund(Decimal("5.30") + Decimal("4.30"))assert billed_amount == expected_billed_amount- for goods_line, order_line in zip(goods, order_lines):+ for goods_line, order_line in zip(goods, order_lines, strict=False):assert goods_line["quantity"] == order_line.quantity@@ -387,5 +385,5 @@ def test_get_goods_with_refunds_shipping_refund_manual_product_refund(order_with_lines.shipping_price_gross_amount + Decimal("8.20"))assert billed_amount == expected_billed_amount- for goods_line, order_line in zip(goods, order_lines):+ for goods_line, order_line in zip(goods, order_lines, strict=False):assert goods_line["quantity"] == order_line.quantitydiff --git a/saleor/payment/gateways/np_atobarai/tests/test_utils.py b/saleor/payment/gateways/np_atobarai/tests/test_utils.pyindex ee6028d9b9..ecf9616704 100644--- a/saleor/payment/gateways/np_atobarai/tests/test_utils.py+++ b/saleor/payment/gateways/np_atobarai/tests/test_utils.py@@ -105,7 +105,11 @@ def test_get_shipping_company_code_no_metadata(@pytest.mark.parametrize(("config_shipping_company_code", "result_shipping_company_code"),- zip(SHIPPING_COMPANY_CODES + ["invalid_code"], SHIPPING_COMPANY_CODES + [None]),+ zip(+ SHIPPING_COMPANY_CODES + ["invalid_code"],+ SHIPPING_COMPANY_CODES + [None],+ strict=False,+ ),)def test_get_shipping_company_code_valid_metadata(config, fulfillment, config_shipping_company_code, result_shipping_company_codediff --git a/saleor/payment/gateways/np_atobarai/utils.py b/saleor/payment/gateways/np_atobarai/utils.pyindex 465a4d6ee7..cd6e4909a5 100644--- a/saleor/payment/gateways/np_atobarai/utils.py+++ b/saleor/payment/gateways/np_atobarai/utils.py@@ -3,7 +3,6 @@ from collections.abc import Iterablefrom contextlib import contextmanagerfrom decimal import Decimalfrom itertools import chain-from typing import Optionalfrom django.db.models import Q@@ -34,7 +33,7 @@ STATUSES_NOT_ALLOWED_TO_REFUND = [def get_shipping_company_code(config: ApiConfig, fulfillment: Fulfillment-) -> Optional[str]:+) -> str | None:code = fulfillment.get_value_from_private_metadata(SHIPPING_COMPANY_CODE_METADATA_KEY, default=config.shipping_company)diff --git a/saleor/payment/gateways/stripe/plugin.py b/saleor/payment/gateways/stripe/plugin.pyindex 1311036f6b..ee705a908b 100644--- a/saleor/payment/gateways/stripe/plugin.py+++ b/saleor/payment/gateways/stripe/plugin.py@@ -1,5 +1,5 @@import logging-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom django.core.exceptions import ValidationErrorfrom django.core.handlers.wsgi import WSGIRequest@@ -176,7 +176,7 @@ class StripeGatewayPlugin(BasePlugin):def _get_setup_future_usage_from_store_payment_method(self, store_payment_method: StorePaymentMethodEnum- ) -> Optional[str]:+ ) -> str | None:if store_payment_method == StorePaymentMethodEnum.ON_SESSION:return "on_session"if store_payment_method == StorePaymentMethodEnum.OFF_SESSION:diff --git a/saleor/payment/gateways/stripe/stripe_api.py b/saleor/payment/gateways/stripe/stripe_api.pyindex e428aa1660..4243094b91 100644--- a/saleor/payment/gateways/stripe/stripe_api.py+++ b/saleor/payment/gateways/stripe/stripe_api.py@@ -1,7 +1,6 @@import loggingfrom contextlib import contextmanagerfrom decimal import Decimal-from typing import Optionalfrom urllib.parse import urljoinimport stripe@@ -47,7 +46,7 @@ def is_secret_api_key_valid(api_key: str):return False-def _extra_log_data(error: StripeError, payment_intent_id: Optional[str] = None):+def _extra_log_data(error: StripeError, payment_intent_id: str | None = None):data = {"error_message": error.user_message,"http_status": error.http_status,@@ -58,7 +57,7 @@ def _extra_log_data(error: StripeError, payment_intent_id: Optional[str] = None)return data-def subscribe_webhook(api_key: str, channel_slug: str) -> Optional[StripeObject]:+def subscribe_webhook(api_key: str, channel_slug: str) -> StripeObject | None:domain = get_domain()api_path = reverse("plugins-per-channel",@@ -98,9 +97,9 @@ def delete_webhook(api_key: str, webhook_id: str):def get_or_create_customer(api_key: str,- customer_id: Optional[str] = None,- customer_email: Optional[str] = None,-) -> Optional[StripeObject]:+ customer_id: str | None = None,+ customer_email: str | None = None,+) -> StripeObject | None:try:if customer_id:with stripe_opentracing_trace("stripe.Customer.retrieve"):@@ -126,14 +125,14 @@ def create_payment_intent(amount: Decimal,currency: str,auto_capture: bool = True,- customer: Optional[StripeObject] = None,- payment_method_id: Optional[str] = None,- metadata: Optional[dict] = None,- setup_future_usage: Optional[str] = None,- off_session: Optional[bool] = None,- payment_method_types: Optional[list[str]] = None,- customer_email: Optional[str] = None,-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+ customer: StripeObject | None = None,+ payment_method_id: str | None = None,+ metadata: dict | None = None,+ setup_future_usage: str | None = None,+ off_session: bool | None = None,+ payment_method_types: list[str] | None = None,+ customer_email: str | None = None,+) -> tuple[StripeObject | None, StripeError | None]:capture_method = AUTOMATIC_CAPTURE_METHOD if auto_capture else MANUAL_CAPTURE_METHODadditional_params = {}@@ -197,7 +196,7 @@ def update_payment_method(def list_customer_payment_methods(api_key: str, customer_id: str-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+) -> tuple[StripeObject | None, StripeError | None]:try:with stripe_opentracing_trace("stripe.PaymentMethod.list"):payment_methods = stripe.PaymentMethod.list(@@ -212,7 +211,7 @@ def list_customer_payment_methods(def retrieve_payment_intent(api_key: str, payment_intent_id: str-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+) -> tuple[StripeObject | None, StripeError | None]:try:with stripe_opentracing_trace("stripe.PaymentIntent.retrieve"):payment_intent = stripe.PaymentIntent.retrieve(@@ -230,7 +229,7 @@ def retrieve_payment_intent(def capture_payment_intent(api_key: str, payment_intent_id: str, amount_to_capture: int-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+) -> tuple[StripeObject | None, StripeError | None]:try:with stripe_opentracing_trace("stripe.PaymentIntent.capture"):payment_intent = stripe.PaymentIntent.capture(@@ -249,7 +248,7 @@ def capture_payment_intent(def refund_payment_intent(api_key: str, payment_intent_id: str, amount_to_refund: int-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+) -> tuple[StripeObject | None, StripeError | None]:try:with stripe_opentracing_trace("stripe.Refund.create"):refund = stripe.Refund.create(@@ -268,7 +267,7 @@ def refund_payment_intent(def cancel_payment_intent(api_key: str, payment_intent_id: str-) -> tuple[Optional[StripeObject], Optional[StripeError]]:+) -> tuple[StripeObject | None, StripeError | None]:try:with stripe_opentracing_trace("stripe.PaymentIntent.cancel"):payment_intent = stripe.PaymentIntent.cancel(@@ -296,7 +295,7 @@ def construct_stripe_event(def get_payment_method_details(payment_intent: StripeObject,-) -> Optional[PaymentMethodInfo]:+) -> PaymentMethodInfo | None:charges = payment_intent.get("charges", None)payment_method_info = Noneif charges:diff --git a/saleor/payment/gateways/stripe/webhooks.py b/saleor/payment/gateways/stripe/webhooks.pyindex 73356e9e4b..78346f6184 100644--- a/saleor/payment/gateways/stripe/webhooks.py+++ b/saleor/payment/gateways/stripe/webhooks.py@@ -1,5 +1,5 @@import logging-from typing import Optional, cast+from typing import castimport stripefrom django.core.exceptions import ValidationError@@ -121,7 +121,7 @@ def _channel_slug_is_different_from_payment_channel_slug(return True-def _get_payment(payment_intent_id: str, with_lock=True) -> Optional[Payment]:+def _get_payment(payment_intent_id: str, with_lock=True) -> Payment | None:qs = Payment.objects.prefetch_related(Prefetch("checkout", queryset=Checkout.objects.select_related("channel")),Prefetch("order", queryset=Order.objects.select_related("channel")),@@ -131,7 +131,7 @@ def _get_payment(payment_intent_id: str, with_lock=True) -> Optional[Payment]:return qs.filter(transactions__token=payment_intent_id).first()-def _get_checkout(payment_id: int) -> Optional[Checkout]:+def _get_checkout(payment_id: int) -> Checkout | None:return (Checkout.objects.prefetch_related("payments").select_for_update(of=("self",))diff --git a/saleor/payment/interface.py b/saleor/payment/interface.pyindex 6e728e84d0..52a6f82ff4 100644--- a/saleor/payment/interface.py+++ b/saleor/payment/interface.py@@ -1,9 +1,10 @@import datetime+from collections.abc import Callablefrom dataclasses import InitVar, dataclass, fieldfrom decimal import Decimalfrom enum import Enumfrom functools import cached_property-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from typing import TYPE_CHECKING, Any, Optional, Unionfrom ..order import FulfillmentLineDatafrom ..order.fetch import OrderLineInfo@@ -16,8 +17,8 @@ if TYPE_CHECKING:from ..checkout.models import Checkoutfrom ..order.models import Order, OrderGrantedRefund-JSONValue = Union[str, int, float, bool, None, dict[str, Any], list[Any]]-JSONType = Union[dict[str, JSONValue], list[JSONValue]]+JSONValue = str | int | float | bool | None | dict[str, Any] | list[Any]+JSONType = dict[str, JSONValue] | list[JSONValue]@dataclass@@ -41,7 +42,7 @@ class StoredPaymentMethodRequestDeleteResponseData:"""Dataclass for storing the response information from payment app."""result: StoredPaymentMethodRequestDeleteResult- error: Optional[str] = None+ error: str | None = None@dataclass@@ -75,7 +76,7 @@ class PaymentMethodCreditCardInfo:last_digits: strexp_month: intexp_year: int- first_digits: Optional[str] = None+ first_digits: str | None = None@dataclass@@ -102,9 +103,9 @@ class PaymentMethodData:external_id: strgateway: PaymentGatewaysupported_payment_flows: list[str] = field(default_factory=list)- credit_card_info: Optional[PaymentMethodCreditCardInfo] = None- name: Optional[str] = None- data: Optional[JSONType] = None+ credit_card_info: PaymentMethodCreditCardInfo | None = None+ name: str | None = None+ data: JSONType | None = None@dataclass@@ -113,24 +114,24 @@ class TransactionActionData:transaction: TransactionItemevent: "TransactionEvent"transaction_app_owner: Optional["App"]- action_value: Optional[Decimal] = None+ action_value: Decimal | None = Nonegranted_refund: Optional["OrderGrantedRefund"] = None@dataclassclass TransactionRequestEventResponse:- psp_reference: Optional[str]+ psp_reference: str | Nonetype: stramount: Decimal- time: Optional[datetime.datetime] = None- external_url: Optional[str] = ""- message: Optional[str] = ""+ time: datetime.datetime | None = None+ external_url: str | None = ""+ message: str | None = ""@dataclassclass TransactionRequestResponse:- psp_reference: Optional[str]- available_actions: Optional[list[str]] = None+ psp_reference: str | None+ available_actions: list[str] | None = Noneevent: Optional["TransactionRequestEventResponse"] = None@@ -146,8 +147,8 @@ class TransactionData:@dataclassclass PaymentGatewayData:app_identifier: str- data: Optional[dict[Any, Any]] = None- error: Optional[str] = None+ data: dict[Any, Any] | None = None+ error: str | None = None@dataclass@@ -163,28 +164,28 @@ class TransactionSessionData:source_object: Union["Checkout", "Order"]action: TransactionProcessActionDatapayment_gateway_data: PaymentGatewayData- customer_ip_address: Optional[str]- idempotency_key: Optional[str] = None+ customer_ip_address: str | None+ idempotency_key: str | None = None@dataclassclass TransactionSessionResult:app_identifier: str- response: Optional[dict[Any, Any]] = None- error: Optional[str] = None+ response: dict[Any, Any] | None = None+ error: str | None = None@dataclassclass PaymentMethodTokenizationBaseRequestData:channel: "Channel"user: "User"- data: Optional[dict]+ data: dict | None@dataclassclass PaymentMethodTokenizationBaseResponseData:- error: Optional[str]- data: Optional[dict]+ error: str | None+ data: dict | None@dataclass@@ -261,20 +262,20 @@ class PaymentMethodTokenizationResponseData(PaymentMethodTokenizationBaseRespons"""Dataclass for storing the response information from payment app."""result: PaymentMethodTokenizationResult- id: Optional[str] = None+ id: str | None = None@dataclassclass PaymentMethodInfo:"""Uniform way to represent payment method information."""- first_4: Optional[str] = None- last_4: Optional[str] = None- exp_year: Optional[int] = None- exp_month: Optional[int] = None- brand: Optional[str] = None- name: Optional[str] = None- type: Optional[str] = None+ first_4: str | None = None+ last_4: str | None = None+ exp_year: int | None = None+ exp_month: int | None = None+ brand: str | None = None+ name: str | None = None+ type: str | None = None@dataclass@@ -291,15 +292,15 @@ class GatewayResponse:amount: Decimalcurrency: strtransaction_id: str- error: Optional[str]- customer_id: Optional[str] = None- payment_method_info: Optional[PaymentMethodInfo] = None- raw_response: Optional[dict[str, str]] = None- action_required_data: Optional[JSONType] = None+ error: str | None+ customer_id: str | None = None+ payment_method_info: PaymentMethodInfo | None = None+ raw_response: dict[str, str] | None = None+ action_required_data: JSONType | None = None# Some gateway can process transaction asynchronously. This value define if we# should create new transaction based on this responsetransaction_already_processed: bool = False- psp_reference: Optional[str] = None+ psp_reference: str | None = None@dataclass@@ -315,8 +316,8 @@ class AddressData:country: strcountry_area: strphone: str- metadata: Optional[dict]- private_metadata: Optional[dict]+ metadata: dict | None+ private_metadata: dict | Nonevalidation_skipped: bool = False@@ -331,7 +332,7 @@ class PaymentLineData:amount: Decimalvariant_id: intproduct_name: str- product_sku: Optional[str]+ product_sku: str | Nonequantity: int@@ -361,25 +362,25 @@ class PaymentData:gateway: stramount: Decimalcurrency: str- billing: Optional[AddressData]- shipping: Optional[AddressData]+ billing: AddressData | None+ shipping: AddressData | Nonepayment_id: intgraphql_payment_id: str- order_id: Optional[str]- customer_ip_address: Optional[str]+ order_id: str | None+ customer_ip_address: str | Nonecustomer_email: str- order_channel_slug: Optional[str] = None- token: Optional[str] = None- customer_id: Optional[str] = None # stores payment gateway customer ID+ order_channel_slug: str | None = None+ token: str | None = None+ customer_id: str | None = None # stores payment gateway customer IDreuse_source: bool = False # Note: this field will be removed in 4.0.- data: Optional[dict] = None- graphql_customer_id: Optional[str] = None- checkout_token: Optional[str] = None- checkout_metadata: Optional[dict] = None+ data: dict | None = None+ graphql_customer_id: str | None = None+ checkout_token: str | None = None+ checkout_metadata: dict | None = Nonestore_payment_method: StorePaymentMethodEnum = StorePaymentMethodEnum.NONEpayment_metadata: dict[str, str] = field(default_factory=dict)- psp_reference: Optional[str] = None- refund_data: Optional[RefundData] = None+ psp_reference: str | None = None+ refund_data: RefundData | None = Nonetransactions: list[TransactionData] = field(default_factory=list)# Optional, lazy-evaluated gateway arguments_resolve_lines_data: InitVar[Callable[[], PaymentLinesData]] = None@@ -398,7 +399,7 @@ class PaymentData:class TokenConfig:"""Dataclass for payment gateway token fetching customization."""- customer_id: Optional[str] = None+ customer_id: str | None = None@dataclass@@ -425,12 +426,12 @@ class CustomerSource:id: strgateway: str- credit_card_info: Optional[PaymentMethodInfo] = None- metadata: Optional[dict[str, str]] = None+ credit_card_info: PaymentMethodInfo | None = None+ metadata: dict[str, str] | None = None@dataclassclass InitializedPaymentResponse:gateway: strname: str- data: Optional[JSONType] = None+ data: JSONType | None = Nonediff --git a/saleor/payment/tests/fixtures/transaction_event.py b/saleor/payment/tests/fixtures/transaction_event.pyindex 96f1b964c6..77b898dae0 100644--- a/saleor/payment/tests/fixtures/transaction_event.py+++ b/saleor/payment/tests/fixtures/transaction_event.py@@ -1,5 +1,5 @@+from collections.abc import Callablefrom decimal import Decimal-from typing import Callableimport pytest@@ -7,11 +7,9 @@ from ....payment.models import TransactionEvent, TransactionItem@pytest.fixture-def transaction_events_generator() -> (- Callable[- [list[str], list[str], list[Decimal], TransactionItem], list[TransactionEvent]- ]-):+def transaction_events_generator() -> Callable[+ [list[str], list[str], list[Decimal], TransactionItem], list[TransactionEvent]+]:def factory(psp_references: list[str],types: list[str],@@ -27,7 +25,9 @@ def transaction_events_generator() -> (include_in_calculations=True,currency=transaction.currency,)- for reference, event_type, amount in zip(psp_references, types, amounts)+ for reference, event_type, amount in zip(+ psp_references, types, amounts, strict=False+ ))return factorydiff --git a/saleor/payment/transaction_item_calculations.py b/saleor/payment/transaction_item_calculations.pyindex eea7bcee97..c5cd2a8954 100644--- a/saleor/payment/transaction_item_calculations.py+++ b/saleor/payment/transaction_item_calculations.py@@ -2,7 +2,7 @@ from collections import defaultdictfrom collections.abc import Iterablefrom dataclasses import dataclass, fieldfrom decimal import Decimal-from typing import Optional, cast+from typing import castfrom . import TransactionEventTypefrom .models import TransactionEvent, TransactionItem@@ -10,24 +10,24 @@ from .models import TransactionEvent, TransactionItem@dataclassclass BaseEvent:- request: Optional[TransactionEvent] = None- success: Optional[TransactionEvent] = None- failure: Optional[TransactionEvent] = None+ request: TransactionEvent | None = None+ success: TransactionEvent | None = None+ failure: TransactionEvent | None = None@dataclassclass AuthorizationEvents(BaseEvent):- adjustment: Optional[TransactionEvent] = None+ adjustment: TransactionEvent | None = None@dataclassclass ChargeEvents(BaseEvent):- back: Optional[TransactionEvent] = None+ back: TransactionEvent | None = None@dataclassclass RefundEvents(BaseEvent):- reverse: Optional[TransactionEvent] = None+ reverse: TransactionEvent | None = None@dataclass@@ -62,9 +62,9 @@ class ActionEventMap:def _should_increase_pending_amount(- request: Optional[TransactionEvent],- success: Optional[TransactionEvent],- failure: Optional[TransactionEvent],+ request: TransactionEvent | None,+ success: TransactionEvent | None,+ failure: TransactionEvent | None,) -> bool:if request:# the pending amount should be increased only when we don't@@ -75,7 +75,7 @@ def _should_increase_pending_amount(def _should_increse_amount(- success: Optional[TransactionEvent], failure: Optional[TransactionEvent]+ success: TransactionEvent | None, failure: TransactionEvent | None) -> bool:if success and failure:# in case of having success and failure events for the same psp reference@@ -90,12 +90,12 @@ def _should_increse_amount(def _recalculate_base_amounts(transaction: TransactionItem,- request: Optional[TransactionEvent],- success: Optional[TransactionEvent],- failure: Optional[TransactionEvent],+ request: TransactionEvent | None,+ success: TransactionEvent | None,+ failure: TransactionEvent | None,pending_amount_field_name: str,amount_field_name: str,- previous_amount_field_name: Optional[str],+ previous_amount_field_name: str | None,):if _should_increase_pending_amount(request, success, failure):request = cast(TransactionEvent, request)@@ -215,7 +215,7 @@ def _get_authorize_events(events: Iterable[TransactionEvent]) -> list[Transactioauthorize_events: list[TransactionEvent] = [event for event in events if event.type in AUTHORIZATION_EVENTS]- auth_adjustment_event: Optional[TransactionEvent] = next(+ auth_adjustment_event: TransactionEvent | None = next((eventfor event in reversed(authorize_events)diff --git a/saleor/payment/utils.py b/saleor/payment/utils.pyindex 27efbce3f8..eb1c69aca2 100644--- a/saleor/payment/utils.py+++ b/saleor/payment/utils.py@@ -3,7 +3,7 @@ import decimalimport jsonimport loggingfrom decimal import Decimal-from typing import Any, Optional, Union, cast, overload+from typing import Any, Optional, cast, overloadimport graphenefrom babel.numbers import get_currency_precision@@ -79,7 +79,7 @@ TRANSACTION_EVENT_MSG_MAX_LENGTH: int = TransactionEvent._meta.get_field( # typdef _recalculate_last_refund_success_for_transaction(transaction_item: TransactionItem,request_event: TransactionEvent,- response_event: Optional[TransactionEvent] = None,+ response_event: TransactionEvent | None = None,) -> bool:"""Recalculate last_refund_success for transaction.@@ -124,7 +124,7 @@ def _recalculate_last_refund_success_for_transaction(def recalculate_refundable_for_checkout(transaction_item: TransactionItem,request_event: TransactionEvent,- response_event: Optional[TransactionEvent] = None,+ response_event: TransactionEvent | None = None,):last_refund_success_changed = _recalculate_last_refund_success_for_transaction(transaction_item,@@ -248,13 +248,13 @@ def generate_transactions_data(payment: Payment) -> list[TransactionData]:def create_payment_information(payment: Payment,- payment_token: Optional[str] = None,- amount: Optional[Decimal] = None,- customer_id: Optional[str] = None,+ payment_token: str | None = None,+ amount: Decimal | None = None,+ customer_id: str | None = None,store_source: bool = False,- refund_data: Optional[RefundData] = None,- additional_data: Optional[dict] = None,- manager: Optional[PluginsManager] = None,+ refund_data: RefundData | None = None,+ additional_data: dict | None = None,+ manager: PluginsManager | None = None,) -> PaymentData:"""Extract order information along with payment details.@@ -334,15 +334,15 @@ def create_payment(total: Decimal,currency: str,email: str,- customer_ip_address: Optional[str] = None,- payment_token: Optional[str] = None,- extra_data: Optional[dict] = None,- checkout: Optional[Checkout] = None,- order: Optional[Order] = None,- return_url: Optional[str] = None,- external_reference: Optional[str] = None,+ customer_ip_address: str | None = None,+ payment_token: str | None = None,+ extra_data: dict | None = None,+ checkout: Checkout | None = None,+ order: Order | None = None,+ return_url: str | None = None,+ external_reference: str | None = None,store_payment_method: str = StorePaymentMethod.NONE,- metadata: Optional[dict[str, str]] = None,+ metadata: dict[str, str] | None = None,) -> Payment:"""Create a payment instance.@@ -422,7 +422,7 @@ def create_transaction(kind: str,payment_information: PaymentData,action_required: bool = False,- gateway_response: Optional[GatewayResponse] = None,+ gateway_response: GatewayResponse | None = None,error_msg=None,is_success=False,) -> Transaction: ...@@ -433,7 +433,7 @@ def create_transaction(payment: Payment,*,kind: str,- payment_information: Optional[PaymentData],+ payment_information: PaymentData | None,action_required: bool = False,gateway_response: GatewayResponse,error_msg=None,@@ -445,9 +445,9 @@ def create_transaction(payment: Payment,*,kind: str,- payment_information: Optional[PaymentData],+ payment_information: PaymentData | None,action_required: bool = False,- gateway_response: Optional[GatewayResponse] = None,+ gateway_response: GatewayResponse | None = None,error_msg=None,is_success=False,) -> Transaction:@@ -489,7 +489,7 @@ def get_already_processed_transaction_or_create_new_transaction(kind: str,payment_information: PaymentData,action_required: bool = False,- gateway_response: Optional[GatewayResponse] = None,+ gateway_response: GatewayResponse | None = None,error_msg=None,) -> Transaction:if gateway_response and gateway_response.transaction_already_processed:@@ -718,7 +718,7 @@ def price_to_minor_unit(value: Decimal, currency: str):return str(value_without_comma.quantize(Decimal("1")))-def get_channel_slug_from_payment(payment: Payment) -> Optional[str]:+def get_channel_slug_from_payment(payment: Payment) -> str | None:channel_slug = Noneif payment.checkout:@@ -811,7 +811,7 @@ def get_correct_event_types_based_on_request_type(request_type: str) -> list[strdef parse_transaction_event_amount(- amount_data: Union[str, int, float, None],+ amount_data: str | int | float | None,parsed_event_data: dict,error_field_msg: list[str],invalid_msg: str,@@ -841,7 +841,7 @@ def parse_transaction_event_data(event_data: dict,parsed_event_data: dict,error_field_msg: list[str],- psp_reference: Optional[str],+ psp_reference: str | None,request_type: str,event_is_optional: bool = True,):@@ -940,7 +940,7 @@ def parse_transaction_action_data(response_data: Any,request_type: str,event_is_optional: bool = True,-) -> tuple[Optional["TransactionRequestResponse"], Optional[error_msg]]:+) -> tuple[Optional["TransactionRequestResponse"], error_msg | None]:"""Parse response from transaction action webhook.It takes the recieved response from sync webhook and@@ -1066,7 +1066,7 @@ def authorization_success_already_exists(transaction_id: int) -> bool:).exists()-def get_already_existing_event(event: TransactionEvent) -> Optional[TransactionEvent]:+def get_already_existing_event(event: TransactionEvent) -> TransactionEvent | None:if event.type in [TransactionEventType.AUTHORIZATION_ACTION_REQUIRED,TransactionEventType.CHARGE_ACTION_REQUIRED,@@ -1091,7 +1091,7 @@ def get_already_existing_event(event: TransactionEvent) -> Optional[TransactionEdef deduplicate_event(event: TransactionEvent, app: App-) -> tuple[TransactionEvent, Optional[error_msg]]:+) -> tuple[TransactionEvent, error_msg | None]:"""Deduplicate the TransactionEvent.In case of having an existing event with the same type, psp reference@@ -1141,8 +1141,8 @@ def _create_event_from_response(app: App,transaction_id: int,currency: str,- related_granted_refund_id: Optional[int] = None,-) -> tuple[Optional[TransactionEvent], Optional[error_msg]]:+ related_granted_refund_id: int | None = None,+) -> tuple[TransactionEvent | None, error_msg | None]:app_identifier = Noneif app and app.identifier:app_identifier = app.identifier@@ -1175,10 +1175,10 @@ def _create_event_from_response(def _get_parsed_transaction_action_data(- transaction_webhook_response: Optional[dict[str, Any]],+ transaction_webhook_response: dict[str, Any] | None,event_type: str,event_is_optional: bool = True,-) -> tuple[Optional["TransactionRequestResponse"], Optional[error_msg]]:+) -> tuple[Optional["TransactionRequestResponse"], error_msg | None]:if transaction_webhook_response is None:return None, "Failed to delivery request."@@ -1213,7 +1213,7 @@ def create_transaction_event_for_transaction_session(request_event: TransactionEvent,app: App,manager: "PluginsManager",- transaction_webhook_response: Optional[dict[str, Any]] = None,+ transaction_webhook_response: dict[str, Any] | None = None,):request_event_type = "session-request"@@ -1335,7 +1335,7 @@ def update_order_granted_status_if_needed(request_event: TransactionEvent):def create_transaction_event_from_request_and_webhook_response(request_event: TransactionEvent,app: App,- transaction_webhook_response: Optional[dict[str, Any]] = None,+ transaction_webhook_response: dict[str, Any] | None = None,):transaction_request_response, error_msg = _get_parsed_transaction_action_data(transaction_webhook_response=transaction_webhook_response,@@ -1546,11 +1546,11 @@ def create_manual_adjustment_events(def get_transaction_item_params(- source_object: Union[Checkout, Order],- user: Optional[User],- app: Optional[App],- psp_reference: Optional[str],- available_actions: Optional[list[str]] = None,+ source_object: Checkout | Order,+ user: User | None,+ app: App | None,+ psp_reference: str | None,+ available_actions: list[str] | None = None,name: str = "",):return {@@ -1573,9 +1573,9 @@ def create_transaction_for_order(order: "Order",user: Optional["User"],app: Optional["App"],- psp_reference: Optional[str],+ psp_reference: str | None,charged_value: Decimal,- available_actions: Optional[list[str]] = None,+ available_actions: list[str] | None = None,name: str = "",) -> TransactionItem:transaction_defaults = get_transaction_item_params(@@ -1599,11 +1599,11 @@ def create_transaction_for_order(@allow_writer()def handle_transaction_initialize_session(- source_object: Union[Checkout, Order],+ source_object: Checkout | Order,payment_gateway_data: PaymentGatewayData,amount: Decimal,action: str,- customer_ip_address: Optional[str],+ customer_ip_address: str | None,app: App,manager: PluginsManager,idempotency_key: str,@@ -1671,11 +1671,11 @@ def handle_transaction_initialize_session(def handle_transaction_process_session(transaction_item: TransactionItem,- source_object: Union[Checkout, Order],+ source_object: Checkout | Order,payment_gateway_data: PaymentGatewayData,action: str,app: App,- customer_ip_address: Optional[str],+ customer_ip_address: str | None,manager: PluginsManager,request_event: TransactionEvent,):diff --git a/saleor/plugins/admin_email/notify_events.py b/saleor/plugins/admin_email/notify_events.pyindex 14274daaa3..dd43d5958f 100644--- a/saleor/plugins/admin_email/notify_events.py+++ b/saleor/plugins/admin_email/notify_events.py@@ -1,4 +1,5 @@-from typing import TYPE_CHECKING, Callable+from collections.abc import Callable+from typing import TYPE_CHECKINGfrom ..email_common import get_email_subject, get_email_template_or_defaultfrom . import constantsdiff --git a/saleor/plugins/admin_email/plugin.py b/saleor/plugins/admin_email/plugin.pyindex b524c06a7c..80cf3c3664 100644--- a/saleor/plugins/admin_email/plugin.py+++ b/saleor/plugins/admin_email/plugin.py@@ -1,7 +1,7 @@import logging+from collections.abc import Callablefrom copy import deepcopyfrom dataclasses import asdict-from typing import Callable, Unionfrom django.conf import settingsfrom promise.promise import Promise@@ -183,7 +183,7 @@ class AdminEmailPlugin(BasePlugin):def resolve_plugin_configuration(self, request- ) -> Union[PluginConfigurationType, Promise[PluginConfigurationType]]:+ ) -> PluginConfigurationType | Promise[PluginConfigurationType]:# Get email templates from the database and merge them with self.configuration.if not self.db_config:return self.configuration@@ -216,7 +216,7 @@ class AdminEmailPlugin(BasePlugin):def notify(self,- event: Union[NotifyEventType, str],+ event: NotifyEventType | str,payload_func: Callable[[], dict],previous_value: None,) -> None:diff --git a/saleor/plugins/avatax/__init__.py b/saleor/plugins/avatax/__init__.pyindex 2200e68432..042cba2f63 100644--- a/saleor/plugins/avatax/__init__.py+++ b/saleor/plugins/avatax/__init__.py@@ -3,7 +3,7 @@ import jsonimport loggingfrom dataclasses import dataclassfrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Optional, Union, cast+from typing import TYPE_CHECKING, Any, castfrom urllib.parse import urljoinimport opentracing@@ -152,9 +152,9 @@ def api_get_request(def _validate_address_details(- shipping_address: Optional[Address],+ shipping_address: Address | None,is_shipping_required: bool,- address: Optional[Address],+ address: Address | None,delivery_method,):if not is_shipping_required and address:@@ -171,9 +171,9 @@ def _validate_order(order: "Order") -> bool:if not order.lines.exists():return Falseshipping_required = order.is_shipping_required()- delivery_method: Union[None, ShippingMethod, Warehouse]- address: Optional[Address]- shipping_address: Optional[Address]+ delivery_method: None | ShippingMethod | Warehouse+ address: Address | None+ shipping_address: Address | Noneif order.collection_point:collection_point = order.collection_pointdelivery_method = collection_point@@ -237,11 +237,11 @@ def append_line_to_data(tax_code: str,item_code: str,prices_entered_with_tax: bool,- name: Optional[str] = None,- discounted: Optional[bool] = False,- tax_override_data: Optional[dict] = None,- ref1: Optional[str] = None,- ref2: Optional[str] = None,+ name: str | None = None,+ discounted: bool | None = False,+ tax_override_data: dict | None = None,+ ref1: str | None = None,+ ref2: str | None = None,):line_data = {"quantity": quantity,@@ -264,10 +264,10 @@ def append_line_to_data(def append_shipping_to_data(data: list[dict],- shipping_price_amount: Optional[Decimal],+ shipping_price_amount: Decimal | None,shipping_tax_code: str,prices_entered_with_tax: bool,- discounted: Optional[bool] = False,+ discounted: bool | None = False,):if shipping_price_amount is not None:append_line_to_data(@@ -285,8 +285,8 @@ def generate_request_data_from_checkout_lines(checkout_info: "CheckoutInfo",lines_info: list["CheckoutLineInfo"],config: AvataxConfiguration,-) -> list[dict[str, Union[str, int, bool, None]]]:- data: list[dict[str, Union[str, int, bool, None]]] = []+) -> list[dict[str, str | int | bool | None]]:+ data: list[dict[str, str | int | bool | None]] = []charge_taxes = get_charge_taxes_for_checkout(checkout_info, lines_info)prices_entered_with_tax = checkout_info.tax_configuration.prices_entered_with_tax@@ -370,8 +370,8 @@ def generate_request_data_from_checkout_lines(def get_order_lines_data(order: "Order", config: AvataxConfiguration, discounted: bool-) -> list[dict[str, Union[str, int, bool, None]]]:- data: list[dict[str, Union[str, int, bool, None]]] = []+) -> list[dict[str, str | int | bool | None]]:+ data: list[dict[str, str | int | bool | None]] = []lines = order.lines.prefetch_related("variant__product__category","variant__product__collections",@@ -459,7 +459,7 @@ def generate_request_data(customer_email: str,config: AvataxConfiguration,currency: str,- discount: Optional[Decimal] = None,+ discount: Decimal | None = None,):ship_from = {"line1": config.from_street_address,@@ -703,7 +703,7 @@ def _get_product_tax_code(product: "Product", product_type: "ProductType"):def retrieve_tax_code_from_meta(- obj: "TaxClass", default: Optional[str] = DEFAULT_TAX_CODE+ obj: "TaxClass", default: str | None = DEFAULT_TAX_CODE):tax_code = obj.get_value_from_metadata(META_CODE_KEY, default)return tax_codediff --git a/saleor/plugins/avatax/plugin.py b/saleor/plugins/avatax/plugin.pyindex 409b4d24fe..b3fa53d2e6 100644--- a/saleor/plugins/avatax/plugin.py+++ b/saleor/plugins/avatax/plugin.py@@ -1,9 +1,9 @@import logging-from collections.abc import Iterable+from collections.abc import Callable, Iterablefrom dataclasses import asdictfrom decimal import Decimalfrom functools import partial-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from typing import TYPE_CHECKING, Any, Optional, Unionfrom urllib.parse import urljoinimport opentracing@@ -185,7 +185,7 @@ class AvataxPlugin(BasePlugin):)def _skip_plugin(- self, previous_value: Union[TaxedMoney, TaxedMoneyRange, Decimal]+ self, previous_value: TaxedMoney | TaxedMoneyRange | Decimal) -> bool:if not (self.config.username_or_account and self.config.password_or_license):return True@@ -306,7 +306,7 @@ class AvataxPlugin(BasePlugin):def preprocess_order_creation(self,checkout_info: "CheckoutInfo",- lines: Optional[list["CheckoutLineInfo"]],+ lines: list["CheckoutLineInfo"] | None,previous_value: Any,):"""Ensure all the data is correct and we can proceed with creation of order.@@ -747,7 +747,7 @@ class AvataxPlugin(BasePlugin):self,checkout_info: "CheckoutInfo",lines_info: list["CheckoutLineInfo"],- base_value: Union[TaxedMoney, Decimal],+ base_value: TaxedMoney | Decimal,):if self._skip_plugin(base_value):self._set_checkout_tax_error(@@ -787,7 +787,7 @@ class AvataxPlugin(BasePlugin):checkout_info.checkout.tax_error = tax_error_messagedef _get_order_tax_data(- self, order: "Order", base_value: Union[Decimal, OrderTaxedPricesData]+ self, order: "Order", base_value: Decimal | OrderTaxedPricesData):if self._skip_plugin(base_value):self._set_order_tax_error(order, TaxDataErrorMessage.EMPTY)diff --git a/saleor/plugins/base_plugin.py b/saleor/plugins/base_plugin.pyindex dd0665fd22..1ed0a969ad 100644--- a/saleor/plugins/base_plugin.py+++ b/saleor/plugins/base_plugin.py@@ -1,8 +1,9 @@from collections import defaultdict+from collections.abc import Callablefrom copy import copyfrom dataclasses import dataclassfrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from typing import TYPE_CHECKING, Any, Optional, Unionfrom django.core.handlers.wsgi import WSGIRequestfrom django.http import HttpResponse@@ -91,16 +92,16 @@ class ConfigurationTypeField:@dataclassclass ExternalAccessTokens:- token: Optional[str] = None- refresh_token: Optional[str] = None- csrf_token: Optional[str] = None+ token: str | None = None+ refresh_token: str | None = None+ csrf_token: str | None = Noneuser: Optional["User"] = None@dataclassclass ExcludedShippingMethod:id: str- reason: Optional[str]+ reason: str | Noneclass BasePlugin:@@ -132,14 +133,14 @@ class BasePlugin:configuration: PluginConfigurationType,active: bool,channel: Optional["Channel"] = None,- requestor_getter: Optional[Callable[[], "Requestor"]] = None,+ requestor_getter: Callable[[], "Requestor"] | None = None,db_config: Optional["PluginConfiguration"] = None,allow_replica: bool = True,):self.configuration = self.get_plugin_configuration(configuration)self.active = activeself.channel = channel- self.requestor: Optional[RequestorOrLazyObject] = (+ self.requestor: RequestorOrLazyObject | None = (SimpleLazyObject(requestor_getter) if requestor_getter else requestor_getter)self.db_config = db_config@@ -170,9 +171,7 @@ class BasePlugin:## Note: this method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from plugin to core modules.- account_confirmation_requested: Callable[- ["User", str, str, Optional[str], None], None- ]+ account_confirmation_requested: Callable[["User", str, str, str | None, None], None]# Trigger when account change email is requested.#@@ -517,7 +516,7 @@ class BasePlugin:channel_metadata_updated: Callable[["Channel", None], None]change_user_address: Callable[- ["Address", Union[str, None], Union["User", None], bool, "Address"], "Address"+ ["Address", str | None, Union["User", None], bool, "Address"], "Address"]# Retrieves the balance remaining on a shopper's gift card@@ -726,7 +725,7 @@ class BasePlugin:# Note: This method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from the plugin to core modules.get_taxes_for_checkout: Callable[- ["CheckoutInfo", list["CheckoutLineInfo"], str, Any, Optional[dict]],+ ["CheckoutInfo", list["CheckoutLineInfo"], str, Any, dict | None],Optional["TaxData"],]@@ -851,7 +850,7 @@ class BasePlugin:draft_order_deleted: Callable[["Order", Any, None], Any]initialize_payment: Callable[- [dict, Optional[InitializedPaymentResponse]], InitializedPaymentResponse+ [dict, InitializedPaymentResponse | None], InitializedPaymentResponse]# Trigger before invoice is deleted.@@ -867,7 +866,7 @@ class BasePlugin:# May return Invoice object.# Overwrite to create invoice with proper data, call invoice.update_invoice.invoice_request: Callable[- ["Order", "Invoice", Union[str, None], Any], Optional["Invoice"]+ ["Order", "Invoice", str | None, Any], Optional["Invoice"]]# Trigger after invoice is sent.@@ -1177,7 +1176,7 @@ class BasePlugin:preprocess_order_creation: Callable[["CheckoutInfo",- Union[list["CheckoutLineInfo"], None],+ list["CheckoutLineInfo"] | None,Any,],Any,@@ -1202,7 +1201,7 @@ class BasePlugin:payment_gateway_initialize_session: Callable[[Decimal,- Optional[list["PaymentGatewayData"]],+ list["PaymentGatewayData"] | None,Union["Checkout", "Order"],None,],@@ -1714,9 +1713,9 @@ class BasePlugin:def get_payment_gateways(self,- currency: Optional[str],+ currency: str | None,checkout_info: Optional["CheckoutInfo"],- checkout_lines: Optional[list["CheckoutLineInfo"]],+ checkout_lines: list["CheckoutLineInfo"] | None,previous_value,) -> list["PaymentGateway"]:payment_config = (@@ -1897,9 +1896,9 @@ class BasePlugin:def resolve_plugin_configuration(self, request- ) -> Union[PluginConfigurationType, Promise[PluginConfigurationType]]:+ ) -> PluginConfigurationType | Promise[PluginConfigurationType]:# Override this function to customize resolving plugin configuration in API.return self.configuration- def is_event_active(self, event: str, channel=Optional[str]):+ def is_event_active(self, event: str, channel: str | None = None):return hasattr(self, event)diff --git a/saleor/plugins/email_common.py b/saleor/plugins/email_common.pyindex 2be04e82b5..2246f76029 100644--- a/saleor/plugins/email_common.py+++ b/saleor/plugins/email_common.py@@ -2,10 +2,11 @@ import loggingimport operatorimport osimport re+from collections.abc import Callablefrom dataclasses import asdict, dataclassfrom decimal import Decimal, InvalidOperationfrom email.headerregistry import Address-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Anyimport dateutil.parserimport i18naddress@@ -43,12 +44,12 @@ DEFAULT_EMAIL_TIMEOUT = 5@dataclassclass EmailConfig:- host: Optional[str] = None- port: Optional[str] = None- username: Optional[str] = None- password: Optional[str] = None- sender_name: Optional[str] = None- sender_address: Optional[str] = None+ host: str | None = None+ port: str | None = None+ username: str | None = None+ password: str | None = None+ sender_name: str | None = None+ sender_address: str | None = Noneuse_tls: bool = Falseuse_ssl: bool = False@@ -124,7 +125,7 @@ def format_address(this, address, include_phone=True, inline=False, latin=False)address["name"] = f"{address.get('first_name', '')} {address.get('last_name', '')}"address["country_code"] = address["country"]address["street_address"] = (- f"{address.get('street_address_1','')}\n {address.get('street_address_2','')}"+ f"{address.get('street_address_1', '')}\n {address.get('street_address_2', '')}")address_lines = i18naddress.format_address(address, latin).split("\n")phone = address.get("phone")@@ -398,7 +399,7 @@ def get_email_template_or_default(def get_email_subject(- plugin_configuration: Optional[list],+ plugin_configuration: list | None,subject_field_name: str,default: str,) -> str:diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.pyindex 9243d6ea40..301c876123 100644--- a/saleor/plugins/manager.py+++ b/saleor/plugins/manager.py@@ -1,7 +1,7 @@from collections import defaultdict-from collections.abc import Iterable+from collections.abc import Callable, Iterablefrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from typing import TYPE_CHECKING, Any, Optional, Unionimport opentracingfrom django.conf import settings@@ -150,7 +150,7 @@ class PluginsManager(PaymentInterface):self.loaded_channels.clear()def _ensure_channel_plugins_loaded(- self, channel_slug: Optional[str], channel: Optional[Channel] = None+ self, channel_slug: str | None, channel: Channel | None = None):if channel_slug is None and not self.loaded_global:global_db_config = self._get_db_plugin_configs(None)@@ -199,7 +199,7 @@ class PluginsManager(PaymentInterface):self.plugins_per_channel[channel_slug].extend(self.global_plugins)self.loaded_channels.add(channel_slug)- def _get_db_plugin_configs(self, channel: Optional[Channel]):+ def _get_db_plugin_configs(self, channel: Channel | None):with opentracing.global_tracer().start_active_span("_get_db_plugin_configs"):plugin_manager_configs = PluginConfiguration.objects.using(self.database@@ -214,8 +214,8 @@ class PluginsManager(PaymentInterface):method_name: str,default_value: Any,*args,- channel_slug: Optional[str],- plugin_ids: Optional[list[str]] = None,+ channel_slug: str | None,+ plugin_ids: list[str] | None = None,**kwargs,):"""Try to run a method with the given name on each declared active plugin."""@@ -263,7 +263,7 @@ class PluginsManager(PaymentInterface):def change_user_address(self,address: "Address",- address_type: Optional[str],+ address_type: str | None,user: Optional["User"],save: bool = True,) -> "Address":@@ -283,7 +283,7 @@ class PluginsManager(PaymentInterface):checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:currency = checkout_info.checkout.currency@@ -317,7 +317,7 @@ class PluginsManager(PaymentInterface):checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:line_totals = [self.calculate_checkout_line_total(@@ -341,7 +341,7 @@ class PluginsManager(PaymentInterface):checkout_info: "CheckoutInfo",lines: list["CheckoutLineInfo"],address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:price = base_calculations.base_checkout_delivery_price(checkout_info, lines)default_value = TaxedMoney(price, price)@@ -362,7 +362,7 @@ class PluginsManager(PaymentInterface):self,order: "Order",lines: Iterable["OrderLine"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:currency = order.currencydefault_value = base_order_calculations.base_order_total(order, lines)@@ -389,7 +389,7 @@ class PluginsManager(PaymentInterface):self,order: "Order",lines: Iterable["OrderLine"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:subtotal, shipping_price = propagate_order_discount_on_order_prices(order, lines@@ -412,7 +412,7 @@ class PluginsManager(PaymentInterface):lines: list["CheckoutLineInfo"],address: Optional["Address"],shipping_price: TaxedMoney,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,):default_value = calculate_tax_rate(shipping_price)return self.__run_method_on_plugins(@@ -429,7 +429,7 @@ class PluginsManager(PaymentInterface):self,order: "Order",shipping_price: TaxedMoney,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,):default_value = calculate_tax_rate(shipping_price)return self.__run_method_on_plugins(@@ -446,7 +446,7 @@ class PluginsManager(PaymentInterface):lines: list["CheckoutLineInfo"],checkout_line_info: "CheckoutLineInfo",address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:# apply entire order discount or discount from order promotiondefault_value = (@@ -478,7 +478,7 @@ class PluginsManager(PaymentInterface):variant: "ProductVariant",product: "Product",lines: Iterable["OrderLine"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> OrderTaxedPricesData:base_subtotal = base_order_subtotal(order, lines)subtotal, shipping_price = propagate_order_discount_on_order_prices(@@ -520,7 +520,7 @@ class PluginsManager(PaymentInterface):lines: list["CheckoutLineInfo"],checkout_line_info: "CheckoutLineInfo",address: Optional["Address"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> TaxedMoney:quantity = checkout_line_info.line.quantity# apply entire order discount@@ -553,7 +553,7 @@ class PluginsManager(PaymentInterface):variant: "ProductVariant",product: "Product",lines: Iterable["OrderLine"],- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> OrderTaxedPricesData:base_subtotal = base_order_subtotal(order, lines)subtotal, shipping_price = propagate_order_discount_on_order_prices(@@ -599,7 +599,7 @@ class PluginsManager(PaymentInterface):checkout_line_info: "CheckoutLineInfo",address: Optional["Address"],price: TaxedMoney,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> Decimal:default_value = calculate_tax_rate(price)return self.__run_method_on_plugins(@@ -620,7 +620,7 @@ class PluginsManager(PaymentInterface):variant: "ProductVariant",address: Optional["Address"],price: TaxedMoney,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> Decimal:default_value = calculate_tax_rate(price)return self.__run_method_on_plugins(@@ -653,8 +653,8 @@ class PluginsManager(PaymentInterface):checkout_info,lines,app_identifier,- pregenerated_subscription_payloads: Optional[dict] = None,- ) -> Optional[TaxData]:+ pregenerated_subscription_payloads: dict | None = None,+ ) -> TaxData | None:if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}return self.__run_plugin_method_until_first_success(@@ -668,7 +668,7 @@ class PluginsManager(PaymentInterface):# Note: this method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from plugin to core modules.- def get_taxes_for_order(self, order: "Order", app_identifier) -> Optional[TaxData]:+ def get_taxes_for_order(self, order: "Order", app_identifier) -> TaxData | None:return self.__run_plugin_method_until_first_success("get_taxes_for_order",order,@@ -679,7 +679,7 @@ class PluginsManager(PaymentInterface):def preprocess_order_creation(self,checkout_info: "CheckoutInfo",- lines: Optional[list["CheckoutLineInfo"]] = None,+ lines: list["CheckoutLineInfo"] | None = None,):default_value = Nonereturn self.__run_method_on_plugins(@@ -1120,9 +1120,7 @@ class PluginsManager(PaymentInterface):"promotion_rule_deleted", default_value, promotion_rule, channel_slug=None)- def invoice_request(- self, order: "Order", invoice: "Invoice", number: Optional[str]- ):+ def invoice_request(self, order: "Order", invoice: "Invoice", number: str | None):default_value = Nonereturn self.__run_method_on_plugins("invoice_request",@@ -1277,7 +1275,7 @@ class PluginsManager(PaymentInterface):# Note: this method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from plugin to core modules.def fulfillment_created(- self, fulfillment: "Fulfillment", notify_customer: Optional[bool] = True+ self, fulfillment: "Fulfillment", notify_customer: bool | None = True):default_value = Nonereturn self.__run_method_on_plugins(@@ -1302,7 +1300,7 @@ class PluginsManager(PaymentInterface):# Note: this method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from plugin to core modules.def fulfillment_approved(- self, fulfillment: "Fulfillment", notify_customer: Optional[bool] = True+ self, fulfillment: "Fulfillment", notify_customer: bool | None = True):default_value = Nonereturn self.__run_method_on_plugins(@@ -1501,7 +1499,7 @@ class PluginsManager(PaymentInterface):def payment_gateway_initialize_session(self,amount: Decimal,- payment_gateways: Optional[list["PaymentGatewayData"]],+ payment_gateways: list["PaymentGatewayData"] | None,source_object: Union["Order", "Checkout"],) -> list["PaymentGatewayData"]:default_value = None@@ -1564,7 +1562,7 @@ class PluginsManager(PaymentInterface):# Note: this method is deprecated in Saleor 3.20 and will be removed in Saleor 3.21.# Webhook-related functionality will be moved from plugin to core modules.def account_confirmation_requested(- self, user: "User", channel_slug: str, token: str, redirect_url: Optional[str]+ self, user: "User", channel_slug: str, token: str, redirect_url: str | None):default_value = Nonereturn self.__run_method_on_plugins(@@ -2375,7 +2373,7 @@ class PluginsManager(PaymentInterface):self,gateway: str,customer_id: str,- channel_slug: Optional[str],+ channel_slug: str | None,) -> list["CustomerSource"]:default_value: list = []gtw = self.get_plugin(gateway, channel_slug=channel_slug)@@ -2508,9 +2506,9 @@ class PluginsManager(PaymentInterface):def get_plugins(self,- channel_slug: Optional[str] = None,+ channel_slug: str | None = None,active_only=False,- plugin_ids: Optional[list[str]] = None,+ plugin_ids: list[str] | None = None,) -> list["BasePlugin"]:"""Return list of plugins for a given channel."""if channel_slug is not None:@@ -2530,10 +2528,10 @@ class PluginsManager(PaymentInterface):def list_payment_gateways(self,- currency: Optional[str] = None,+ currency: str | None = None,checkout_info: Optional["CheckoutInfo"] = None,- checkout_lines: Optional[list["CheckoutLineInfo"]] = None,- channel_slug: Optional[str] = None,+ checkout_lines: list["CheckoutLineInfo"] | None = None,+ channel_slug: str | None = None,active_only: bool = True,) -> list["PaymentGateway"]:channel_slug = checkout_info.channel.slug if checkout_info else channel_slug@@ -2568,7 +2566,7 @@ class PluginsManager(PaymentInterface):def list_shipping_methods_for_checkout(self,checkout: "Checkout",- channel_slug: Optional[str] = None,+ channel_slug: str | None = None,active_only: bool = True,) -> list["ShippingMethodData"]:channel_slug = channel_slug if channel_slug else checkout.channel.slug@@ -2591,7 +2589,7 @@ class PluginsManager(PaymentInterface):self,shipping_method_id: str,checkout: Optional["Checkout"] = None,- channel_slug: Optional[str] = None,+ channel_slug: str | None = None,):if checkout:methods = {@@ -2642,8 +2640,8 @@ class PluginsManager(PaymentInterface):self,method_name: str,*args,- channel_slug: Optional[str],- plugins: Optional[list["BasePlugin"]] = None,+ channel_slug: str | None,+ plugins: list["BasePlugin"] | None = None,**kwargs,):if plugins is None:@@ -2682,7 +2680,7 @@ class PluginsManager(PaymentInterface):def get_tax_code_from_object_meta(self,obj: Union["Product", "ProductType", "TaxClass"],- channel_slug: Optional[str],+ channel_slug: str | None,) -> TaxType:default_value = TaxType(code="", description="")return self.__run_method_on_plugins(@@ -2693,7 +2691,7 @@ class PluginsManager(PaymentInterface):)def save_plugin_configuration(- self, plugin_id, channel_slug: Optional[str], cleaned_data: dict+ self, plugin_id, channel_slug: str | None, cleaned_data: dict) -> None | PluginConfiguration:if channel_slug:plugins = self.get_plugins(channel_slug=channel_slug)@@ -2726,7 +2724,7 @@ class PluginsManager(PaymentInterface):return Nonedef get_plugin(- self, plugin_id: str, channel_slug: Optional[str] = None+ self, plugin_id: str, channel_slug: str | None = None) -> Optional["BasePlugin"]:plugins = self.get_plugins(channel_slug=channel_slug)for plugin in plugins:@@ -2757,7 +2755,7 @@ class PluginsManager(PaymentInterface):)def webhook(- self, request: SaleorContext, plugin_id: str, channel_slug: Optional[str]+ self, request: SaleorContext, plugin_id: str, channel_slug: str | None) -> HttpResponse:split_path = request.path.split(plugin_id, maxsplit=1)path = None@@ -2786,8 +2784,8 @@ class PluginsManager(PaymentInterface):self,event: "NotifyEventTypeChoice",payload_func: Callable,- channel_slug: Optional[str] = None,- plugin_id: Optional[str] = None,+ channel_slug: str | None = None,+ plugin_id: str | None = None,):default_value = Noneif plugin_id:@@ -2855,7 +2853,7 @@ class PluginsManager(PaymentInterface):) -> tuple[Optional["User"], dict]:"""Verify the provided authentication data."""default_data: dict[str, str] = {}- default_user: Optional[User] = None+ default_user: User | None = Nonedefault_value = default_user, default_dataplugin = self.get_plugin(plugin_id)return self.__run_method_on_single_plugin(@@ -2880,7 +2878,7 @@ class PluginsManager(PaymentInterface):checkout: "Checkout",channel: "Channel",available_shipping_methods: list["ShippingMethodData"],- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> list[ExcludedShippingMethod]:if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -2894,7 +2892,7 @@ class PluginsManager(PaymentInterface):)def is_event_active_for_any_plugin(- self, event: str, channel_slug: Optional[str] = None+ self, event: str, channel_slug: str | None = None) -> bool:self._ensure_channel_plugins_loaded(channel_slug)"""Check if any plugin supports defined event."""@@ -2907,7 +2905,7 @@ class PluginsManager(PaymentInterface):def get_plugins_manager(allow_replica: bool,- requestor_getter: Optional[Callable[[], "Requestor"]] = None,+ requestor_getter: Callable[[], "Requestor"] | None = None,) -> PluginsManager:with opentracing.global_tracer().start_active_span("get_plugins_manager"):if allow_replica:diff --git a/saleor/plugins/openid_connect/plugin.py b/saleor/plugins/openid_connect/plugin.pyindex 87163dc387..c1205d9834 100644--- a/saleor/plugins/openid_connect/plugin.py+++ b/saleor/plugins/openid_connect/plugin.py@@ -1,5 +1,5 @@import logging-from typing import Optional, cast+from typing import castfrom authlib.common.errors import AuthlibBaseErrorfrom django.core import signing@@ -462,7 +462,7 @@ class OpenIDConnectPlugin(BasePlugin):def external_verify(self, data: dict, request: WSGIRequest, previous_value- ) -> tuple[Optional[User], dict]:+ ) -> tuple[User | None, dict]:if not self.active:return previous_value@@ -492,7 +492,7 @@ class OpenIDConnectPlugin(BasePlugin):)return user, payload- def authenticate_user(self, request: WSGIRequest, previous_value) -> Optional[User]:+ def authenticate_user(self, request: WSGIRequest, previous_value) -> User | None:if not self.active:return previous_valuetoken = get_token_from_request(request)diff --git a/saleor/plugins/openid_connect/utils.py b/saleor/plugins/openid_connect/utils.pyindex f3d368c132..d55db8b471 100644--- a/saleor/plugins/openid_connect/utils.py+++ b/saleor/plugins/openid_connect/utils.py@@ -1,7 +1,7 @@import datetimeimport jsonimport logging-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGimport requestsfrom authlib.jose import JWTClaims, jwt@@ -60,7 +60,7 @@ CSRF_FIELD = "csrf_token"logger = logging.getLogger(__name__)-def fetch_jwks(jwks_url) -> Optional[dict]:+def fetch_jwks(jwks_url) -> dict | None:"""Fetch JSON Web Key Sets from a provider.Fetched keys will be stored in the cache to the reduced amount of possible@@ -80,8 +80,7 @@ def fetch_jwks(jwks_url) -> Optional[dict]:except json.JSONDecodeError as e:content = response.content if response else "Unable to find the response"logger.exception(- "Unable to decode the response from auth service with jwks. "- "Response: %s",+ "Unable to decode the response from auth service with jwks. Response: %s",content,)raise AuthenticationError(@@ -102,8 +101,8 @@ def get_jwks_keys_from_cache_or_fetch(jwks_url: str) -> dict:def get_user_info_from_cache_or_fetch(- user_info_url: str, access_token: str, exp_time: Optional[int]-) -> Optional[dict]:+ user_info_url: str, access_token: str, exp_time: int | None+) -> dict | None:user_info_data = cache.get(f"{PLUGIN_ID}.{access_token}", None)if not user_info_data:@@ -123,7 +122,7 @@ def get_user_info_from_cache_or_fetch(return user_info_data-def get_user_info(user_info_url, access_token) -> Optional[dict]:+def get_user_info(user_info_url, access_token) -> dict | None:try:response = HTTPClient.send_request("GET",@@ -331,7 +330,7 @@ def create_jwt_token(id_payload: CodeIDToken,user: User,access_token: str,- permissions: Optional[list[str]],+ permissions: list[str] | None,owner: str,) -> str:additional_payload = {@@ -392,7 +391,7 @@ def get_parsed_id_token(token_data, jwks_url) -> CodeIDToken:def get_or_create_user_from_payload(payload: dict,oauth_url: str,- last_login: Optional[int] = None,+ last_login: int | None = None,) -> tuple[User, bool, bool]:oidc_metadata_key = f"oidc:{oauth_url}"user_email = payload.get("email")@@ -470,7 +469,7 @@ def _update_user_details(user_first_name: str,user_last_name: str,sub: str,- last_login: Optional[int],+ last_login: int | None,) -> bool:user_sub = user.get_value_from_private_metadata(oidc_key)fields_to_save = set()@@ -563,7 +562,7 @@ def create_tokens_from_oauth_payload(token_data: dict,user: User,claims: CodeIDToken,- permissions: Optional[list[str]],+ permissions: list[str] | None,owner: str,):refresh_token = token_data.get("refresh_token")diff --git a/saleor/plugins/sendgrid/__init__.py b/saleor/plugins/sendgrid/__init__.pyindex aedc69a4f6..a4840ffded 100644--- a/saleor/plugins/sendgrid/__init__.py+++ b/saleor/plugins/sendgrid/__init__.py@@ -1,24 +1,23 @@from dataclasses import dataclass-from typing import Optional@dataclassclass SendgridConfiguration:- api_key: Optional[str]- sender_name: Optional[str]- sender_address: Optional[str]- account_confirmation_template_id: Optional[str]- account_set_customer_password_template_id: Optional[str]- account_delete_template_id: Optional[str]- account_change_email_confirm_template_id: Optional[str]- account_change_email_request_template_id: Optional[str]- account_password_reset_template_id: Optional[str]- invoice_ready_template_id: Optional[str]- order_confirmation_template_id: Optional[str]- order_confirmed_template_id: Optional[str]- order_fulfillment_confirmation_template_id: Optional[str]- order_fulfillment_update_template_id: Optional[str]- order_payment_confirmation_template_id: Optional[str]- order_canceled_template_id: Optional[str]- order_refund_confirmation_template_id: Optional[str]- send_gift_card_template_id: Optional[str]+ api_key: str | None+ sender_name: str | None+ sender_address: str | None+ account_confirmation_template_id: str | None+ account_set_customer_password_template_id: str | None+ account_delete_template_id: str | None+ account_change_email_confirm_template_id: str | None+ account_change_email_request_template_id: str | None+ account_password_reset_template_id: str | None+ invoice_ready_template_id: str | None+ order_confirmation_template_id: str | None+ order_confirmed_template_id: str | None+ order_fulfillment_confirmation_template_id: str | None+ order_fulfillment_update_template_id: str | None+ order_payment_confirmation_template_id: str | None+ order_canceled_template_id: str | None+ order_refund_confirmation_template_id: str | None+ send_gift_card_template_id: str | Nonediff --git a/saleor/plugins/sendgrid/plugin.py b/saleor/plugins/sendgrid/plugin.pyindex 7c36113bc9..245f362880 100644--- a/saleor/plugins/sendgrid/plugin.py+++ b/saleor/plugins/sendgrid/plugin.py@@ -1,6 +1,6 @@import logging+from collections.abc import Callablefrom dataclasses import asdict-from typing import Callable, Unionfrom django.core.exceptions import ValidationError@@ -224,7 +224,7 @@ class SendgridEmailPlugin(BasePlugin):def notify(self,- event: Union[NotifyEventType, str],+ event: NotifyEventType | str,payload_func: Callable[[], dict],previous_value: None,) -> None:diff --git a/saleor/plugins/tests/sample_plugins.py b/saleor/plugins/tests/sample_plugins.pyindex 75d01dc6be..b29d3e889d 100644--- a/saleor/plugins/tests/sample_plugins.py+++ b/saleor/plugins/tests/sample_plugins.py@@ -190,7 +190,7 @@ class PluginSample(BasePlugin):def external_verify(self, data: dict, request: WSGIRequest, previous_value- ) -> tuple[Optional[User], dict]:+ ) -> tuple[User | None, dict]:user = User.objects.get()return user, {"some_data": "data"}@@ -307,7 +307,7 @@ class PluginSample(BasePlugin):def payment_gateway_initialize_session(self,amount: Decimal,- payment_gateways: Optional[list["PaymentGatewayData"]],+ payment_gateways: list["PaymentGatewayData"] | None,source_object: Union["Order", "Checkout"],previous_value: Any,):@@ -465,7 +465,7 @@ class SampleAuthorizationPlugin(BasePlugin):DEFAULT_ACTIVE = TrueCONFIGURATION_PER_CHANNEL = False- def authenticate_user(self, request, previous_value) -> Optional[User]:+ def authenticate_user(self, request, previous_value) -> User | None:# This function will be mocked in testraise NotImplementedError()diff --git a/saleor/plugins/tests/test_manager.py b/saleor/plugins/tests/test_manager.pyindex d9c8d720d8..93a7a8c095 100644--- a/saleor/plugins/tests/test_manager.py+++ b/saleor/plugins/tests/test_manager.py@@ -78,8 +78,7 @@ def test_manager_with_default_configuration_for_channel_plugins(for _channel_slug, plugins in manager.plugins_per_channel.items():assert len(plugins) == 2assert all(- isinstance(plugin, (PluginSample, ChannelPluginSample))- for plugin in plugins+ isinstance(plugin, PluginSample | ChannelPluginSample) for plugin in plugins)# global plugin + plugins for each channeldiff --git a/saleor/plugins/tests/utils.py b/saleor/plugins/tests/utils.pyindex 340627bb66..dfb92510bf 100644--- a/saleor/plugins/tests/utils.py+++ b/saleor/plugins/tests/utils.py@@ -1,9 +1,6 @@-from typing import Union--def get_config_value(- field_name: str, configuration: list[dict[str, Union[str, bool]]]-) -> Union[str, bool, None]:+ field_name: str, configuration: list[dict[str, str | bool]]+) -> str | bool | None:for elem in configuration:if elem["name"] == field_name:return elem["value"]diff --git a/saleor/plugins/user_email/notify_events.py b/saleor/plugins/user_email/notify_events.pyindex 7556b76c39..84aaa711b3 100644--- a/saleor/plugins/user_email/notify_events.py+++ b/saleor/plugins/user_email/notify_events.py@@ -1,4 +1,5 @@-from typing import TYPE_CHECKING, Callable+from collections.abc import Callable+from typing import TYPE_CHECKINGfrom ..email_common import get_email_subject, get_email_template_or_defaultfrom . import constantsdiff --git a/saleor/plugins/user_email/plugin.py b/saleor/plugins/user_email/plugin.pyindex 1ef9e09724..88730c51e9 100644--- a/saleor/plugins/user_email/plugin.py+++ b/saleor/plugins/user_email/plugin.py@@ -1,6 +1,7 @@import logging+from collections.abc import Callablefrom dataclasses import asdict-from typing import TYPE_CHECKING, Callable, Union+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom promise.promise import Promise@@ -357,7 +358,7 @@ class UserEmailPlugin(BasePlugin):def resolve_plugin_configuration(self, request- ) -> Union[PluginConfigurationType, Promise[PluginConfigurationType]]:+ ) -> PluginConfigurationType | Promise[PluginConfigurationType]:# Get email templates from the database and merge them with self.configuration.if not self.db_config:return self.configuration@@ -390,7 +391,7 @@ class UserEmailPlugin(BasePlugin):def notify(self,- event: Union[NotifyEventType, str],+ event: NotifyEventType | str,payload_func: Callable[[], dict],previous_value: None,) -> None:diff --git a/saleor/plugins/webhook/plugin.py b/saleor/plugins/webhook/plugin.pyindex 1cca7e7236..98cfe2ed40 100644--- a/saleor/plugins/webhook/plugin.py+++ b/saleor/plugins/webhook/plugin.py@@ -1,10 +1,10 @@import jsonimport loggingfrom collections import defaultdict-from collections.abc import Iterable+from collections.abc import Callable, Iterablefrom decimal import Decimalfrom functools import partial-from typing import TYPE_CHECKING, Any, Callable, Final, Optional, Union+from typing import TYPE_CHECKING, Any, Final, Optional, Unionimport graphenefrom django.conf import settings@@ -270,7 +270,7 @@ class WebhookPlugin(BasePlugin):user: "User",channel_slug: str,token: str,- redirect_url: Optional[str],+ redirect_url: str | None,previous_value: None,) -> None:if not self.active:@@ -777,7 +777,7 @@ class WebhookPlugin(BasePlugin):self,event_type: str,order: "Order",- webhooks: Optional[Iterable["Webhook"]] = None,+ webhooks: Iterable["Webhook"] | None = None,) -> Iterable["Webhook"]:"""Get webhooks for order events.@@ -1286,7 +1286,7 @@ class WebhookPlugin(BasePlugin):self,order: "Order",invoice: "Invoice",- number: Optional[str],+ number: str | None,previous_value: None,) -> None:if not self.active:@@ -1563,7 +1563,7 @@ class WebhookPlugin(BasePlugin):def fulfillment_approved(self,fulfillment: "Fulfillment",- notify_customer: Optional[bool] = True,+ notify_customer: bool | None = True,previous_value: None = None,) -> None:if not self.active:@@ -2108,7 +2108,7 @@ class WebhookPlugin(BasePlugin):def notify(self,- event: Union[NotifyEventType, str],+ event: NotifyEventType | str,payload_func: Callable,previous_value: None,) -> None:@@ -2767,8 +2767,8 @@ class WebhookPlugin(BasePlugin):webhook: "Webhook",event_type: str,request_data: PaymentMethodTokenizationBaseRequestData,- additional_legacy_payload_data: Optional[dict] = None,- ) -> Optional[dict]:+ additional_legacy_payload_data: dict | None = None,+ ) -> dict | None:payload_data = {"user_id": graphene.Node.to_global_id("User", request_data.user.id),"channel_slug": request_data.channel.slug,@@ -2818,7 +2818,7 @@ class WebhookPlugin(BasePlugin):event_type: str,request_data: PaymentMethodTokenizationBaseRequestData,previous_value: "PaymentMethodTokenizationResponseData",- additional_legacy_payload_data: Optional[dict] = None,+ additional_legacy_payload_data: dict | None = None,):webhook = get_webhooks_for_event(event_type, apps_identifier=[app_identifier]@@ -3036,7 +3036,7 @@ class WebhookPlugin(BasePlugin):amount: Decimal,source_object: Union["Order", "Checkout"],request: SaleorContext,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,):if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -3091,7 +3091,7 @@ class WebhookPlugin(BasePlugin):def payment_gateway_initialize_session(self,amount: Decimal,- payment_gateways: Optional[list[PaymentGatewayData]],+ payment_gateways: list[PaymentGatewayData] | None,source_object: Union["Order", "Checkout"],previous_value,) -> list[PaymentGatewayData]:@@ -3179,8 +3179,7 @@ class WebhookPlugin(BasePlugin):).first()if not webhook:error = (- "Unable to find an active webhook for "- f"`{webhook_event.upper()}` event."+ f"Unable to find an active webhook for `{webhook_event.upper()}` event.")return TransactionSessionResult(app_identifier=transaction_session_data.payment_gateway_data.app_identifier,@@ -3252,9 +3251,9 @@ class WebhookPlugin(BasePlugin):def get_payment_gateways(self,- currency: Optional[str],+ currency: str | None,checkout_info: Optional["CheckoutInfo"],- checkout_lines: Optional[list["CheckoutLineInfo"]],+ checkout_lines: list["CheckoutLineInfo"] | None,previous_value,**kwargs,) -> list["PaymentGateway"]:@@ -3389,7 +3388,7 @@ class WebhookPlugin(BasePlugin):app_identifier: str,payload_gen: Callable,subscriptable_object=None,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,):if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -3440,7 +3439,7 @@ class WebhookPlugin(BasePlugin):lines,app_identifier,previous_value,- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> Optional["TaxData"]:if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -3570,7 +3569,7 @@ class WebhookPlugin(BasePlugin):checkout: "Checkout",available_shipping_methods: list["ShippingMethodData"],previous_value: list[ExcludedShippingMethod],- pregenerated_subscription_payloads: Optional[dict] = None,+ pregenerated_subscription_payloads: dict | None = None,) -> list[ExcludedShippingMethod]:if pregenerated_subscription_payloads is None:pregenerated_subscription_payloads = {}@@ -3588,7 +3587,7 @@ class WebhookPlugin(BasePlugin):pregenerated_subscription_payloads=pregenerated_subscription_payloads,)- def is_event_active(self, event: str, channel=Optional[str]):+ def is_event_active(self, event: str, channel: str | None = None):map_event = {"invoice_request": WebhookEventAsyncType.INVOICE_REQUESTED,"stored_payment_method_request_delete": (diff --git a/saleor/product/managers.py b/saleor/product/managers.pyindex fbf0d5e5d3..dbdbd7aa33 100644--- a/saleor/product/managers.py+++ b/saleor/product/managers.py@@ -1,5 +1,5 @@import datetime-from typing import Optional, Union+from typing import Unionfrom django.contrib.postgres.aggregates import StringAggfrom django.db import models@@ -75,7 +75,7 @@ class ProductsQueryset(models.QuerySet):def visible_to_user(self,requestor: Union["User", "App", None],- channel: Optional[Channel],+ channel: Channel | None,limited_channel_access: bool,):"""Determine which products should be visible to user.@@ -139,7 +139,7 @@ class ProductsQueryset(models.QuerySet):published_at=ExpressionWrapper(query, output_field=DateTimeField()))- def annotate_visible_in_listings(self, channel: Optional[Channel]):+ def annotate_visible_in_listings(self, channel: Channel | None):from .models import ProductChannelListingif not channel:@@ -155,9 +155,7 @@ class ProductsQueryset(models.QuerySet):visible_in_listings=ExpressionWrapper(query, output_field=BooleanField()))- def sort_by_attribute(- self, attribute_pk: Union[int, str], descending: bool = False- ):+ def sort_by_attribute(self, attribute_pk: int | str, descending: bool = False):"""Sort a query set by the values of the given product attribute.:param attribute_pk: The database ID (must be a numeric) of the attribute@@ -296,7 +294,7 @@ class ProductVariantQueryset(models.QuerySet):),)- def available_in_channel(self, channel: Optional[Channel]):+ def available_in_channel(self, channel: Channel | None):from .models import ProductVariantChannelListingif not channel:@@ -318,7 +316,7 @@ class ProductVariantQueryset(models.QuerySet):def visible_to_user(self,requestor: Union["User", "App", None],- channel: Optional[Channel],+ channel: Channel | None,limited_channel_access: bool,):from .models import ALL_PRODUCTS_PERMISSIONS@@ -387,7 +385,7 @@ class CollectionsQueryset(models.QuerySet):)def visible_to_user(- self, requestor: Union["User", "App", None], channel_slug: Optional[str]+ self, requestor: Union["User", "App", None], channel_slug: str | None):from .models import ALL_PRODUCTS_PERMISSIONSdiff --git a/saleor/product/models.py b/saleor/product/models.pyindex ce288ded38..00d5d092f7 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -401,7 +401,7 @@ class ProductVariant(SortableModel, ModelWithMetadata, ModelWithExternalReferencself,channel_listing: "ProductVariantChannelListing",price_override: Optional["Decimal"] = None,- promotion_rules: Optional[Iterable["PromotionRule"]] = None,+ promotion_rules: Iterable["PromotionRule"] | None = None,) -> "Money":"""Return the variant discounted price with applied promotions.@@ -618,7 +618,7 @@ class DigitalContentUrl(models.Model):self.token = str(uuid4()).replace("-", "")super().save(force_insert, force_update, using, update_fields)- def get_absolute_url(self) -> Optional[str]:+ def get_absolute_url(self) -> str | None:url = reverse("digital-product", kwargs={"token": str(self.token)})return build_absolute_uri(url)diff --git a/saleor/product/tasks.py b/saleor/product/tasks.pyindex f5c8767f94..c358492c47 100644--- a/saleor/product/tasks.py+++ b/saleor/product/tasks.py@@ -1,7 +1,6 @@import loggingfrom collections import defaultdictfrom collections.abc import Iterable-from typing import Optionalfrom uuid import UUIDfrom celery.utils.log import get_task_logger@@ -222,9 +221,9 @@ def update_variant_relations_for_active_promotion_rules_task():@allow_writer()def update_products_discounted_prices_for_promotion_task(product_ids: Iterable[int],- start_id: Optional[UUID] = None,+ start_id: UUID | None = None,*,- rule_ids: Optional[list[UUID]] = None,+ rule_ids: list[UUID] | None = None,):# FIXME: Should be removed in Saleor 3.21diff --git a/saleor/product/tests/test_get_variant_selection_attributes.py b/saleor/product/tests/test_get_variant_selection_attributes.pyindex 0eff81bad3..fb8cb11a72 100644--- a/saleor/product/tests/test_get_variant_selection_attributes.py+++ b/saleor/product/tests/test_get_variant_selection_attributes.py@@ -26,7 +26,9 @@ def test_get_variant_selection_attributes(]# for now, instead of skipping test- attrs = zip(attrs, (False, True, True, False, True, False, False, False))+ attrs = zip(+ attrs, (False, True, True, False, True, False, False, False), strict=False+ )# whenresult = [attr for attr, *_ in get_variant_selection_attributes(attrs)]diff --git a/saleor/product/tests/test_product_minimal_variant_price.py b/saleor/product/tests/test_product_minimal_variant_price.pyindex ea89b0f34b..9448c4a8a7 100644--- a/saleor/product/tests/test_product_minimal_variant_price.py+++ b/saleor/product/tests/test_product_minimal_variant_price.py@@ -481,7 +481,7 @@ def test_management_commmand_update_all_products_discounted_price(assert mock_update_discounted_prices_for_promotion.call_count == len(product_list)call_args_list = mock_update_discounted_prices_for_promotion.call_args_list- for (args, _kwargs), product in zip(call_args_list, product_list):+ for (args, _kwargs), product in zip(call_args_list, product_list, strict=False):assert len(args[0]) == 1assert args[0][0].pk == product.pkdiff --git a/saleor/product/utils/__init__.py b/saleor/product/utils/__init__.pyindex e887c24aa9..087b871f9b 100644--- a/saleor/product/utils/__init__.py+++ b/saleor/product/utils/__init__.py@@ -1,6 +1,6 @@import datetimefrom collections.abc import Iterable-from typing import TYPE_CHECKING, Union+from typing import TYPE_CHECKINGfrom uuid import UUIDfrom ...core.taxes import TaxedMoney, zero_taxed_money@@ -20,7 +20,7 @@ if TYPE_CHECKING:def calculate_revenue_for_variant(variant: "ProductVariant",- start_date: Union[datetime.date, datetime.datetime],+ start_date: datetime.date | datetime.datetime,order_lines: Iterable["OrderLine"],orders_dict: dict[UUID, "Order"],currency_code: str,@@ -35,7 +35,7 @@ def calculate_revenue_for_variant(@traced_atomic_transaction()-def delete_categories(categories_ids: list[Union[str, int]], manager):+def delete_categories(categories_ids: list[str | int], manager):"""Delete categories and perform all necessary actions.Set products of deleted categories as unpublished, delete categoriesdiff --git a/saleor/product/utils/availability.py b/saleor/product/utils/availability.pyindex 072019a175..630e9499dd 100644--- a/saleor/product/utils/availability.py+++ b/saleor/product/utils/availability.py@@ -1,6 +1,5 @@from dataclasses import dataclassfrom decimal import Decimal-from typing import Optionalfrom prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange@@ -12,9 +11,9 @@ from ...tax.calculations import calculate_flat_rate_tax@dataclassclass ProductAvailability:on_sale: bool- price_range: Optional[TaxedMoneyRange]- price_range_undiscounted: Optional[TaxedMoneyRange]- discount: Optional[TaxedMoney]+ price_range: TaxedMoneyRange | None+ price_range_undiscounted: TaxedMoneyRange | None+ discount: TaxedMoney | None@dataclass@@ -22,12 +21,12 @@ class VariantAvailability:on_sale: boolprice: TaxedMoneyprice_undiscounted: TaxedMoney- discount: Optional[TaxedMoney]+ discount: TaxedMoney | Nonedef _get_total_discount_from_range(undiscounted: TaxedMoneyRange, discounted: TaxedMoneyRange-) -> Optional[TaxedMoney]:+) -> TaxedMoney | None:"""Calculate the discount amount between two TaxedMoneyRange.Subtract two prices and return their total discount, if any.@@ -38,7 +37,7 @@ def _get_total_discount_from_range(def _get_total_discount(undiscounted: TaxedMoney, discounted: TaxedMoney-) -> Optional[TaxedMoney]:+) -> TaxedMoney | None:"""Calculate the discount amount between two TaxedMoney.Subtract two prices and return their total discount, if any.@@ -53,7 +52,7 @@ def get_product_price_range(*,variants_channel_listing: list[ProductVariantChannelListing],discounted: bool,-) -> Optional[MoneyRange]:+) -> MoneyRange | None:"""Return the range of product prices based on product variants prices.When discounted parameter is True, the range of discounted prices is provided.@@ -88,13 +87,13 @@ def _calculate_product_price_with_taxes(def get_product_availability(*,- product_channel_listing: Optional[ProductChannelListing],+ product_channel_listing: ProductChannelListing | None,variants_channel_listing: list[ProductVariantChannelListing],prices_entered_with_tax: bool,tax_calculation_strategy: str,tax_rate: Decimal,) -> ProductAvailability:- discounted: Optional[TaxedMoneyRange] = None+ discounted: TaxedMoneyRange | None = Nonediscounted_net_range = get_product_price_range(variants_channel_listing=variants_channel_listing, discounted=True)@@ -114,7 +113,7 @@ def get_product_availability(),)- undiscounted: Optional[TaxedMoneyRange] = None+ undiscounted: TaxedMoneyRange | None = Noneundiscounted_net_range = get_product_price_range(variants_channel_listing=variants_channel_listing,discounted=False,@@ -155,11 +154,11 @@ def get_product_availability(def get_variant_availability(*,variant_channel_listing: ProductVariantChannelListing,- product_channel_listing: Optional[ProductChannelListing],+ product_channel_listing: ProductChannelListing | None,prices_entered_with_tax: bool,tax_calculation_strategy: str,tax_rate: Decimal,-) -> Optional[VariantAvailability]:+) -> VariantAvailability | None:if variant_channel_listing.price is None:return Nonediscounted_price_taxed = _calculate_product_price_with_taxes(diff --git a/saleor/product/utils/costs.py b/saleor/product/utils/costs.pyindex 295063e199..a6328a919f 100644--- a/saleor/product/utils/costs.py+++ b/saleor/product/utils/costs.py@@ -1,6 +1,6 @@from collections.abc import Iterablefrom dataclasses import dataclass-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom prices import MoneyRange@@ -74,7 +74,7 @@ def get_cost_price(variant_channel_listing: "ProductVariantChannelListing") -> "def get_margin_for_variant_channel_listing(variant_channel_listing: "ProductVariantChannelListing",-) -> Optional[float]:+) -> float | None:if variant_channel_listing.cost_price is None:return Nonebase_price = variant_channel_listing.pricediff --git a/saleor/product/utils/variants.py b/saleor/product/utils/variants.pyindex 03058f44d6..e9878ed01b 100644--- a/saleor/product/utils/variants.py+++ b/saleor/product/utils/variants.py@@ -1,5 +1,5 @@from collections.abc import Iterable-from typing import TYPE_CHECKING, Optional+from typing import TYPE_CHECKINGfrom django.conf import settingsfrom django.db.models import QuerySet@@ -14,7 +14,7 @@ if TYPE_CHECKING:def generate_and_set_variant_name(- variant: "ProductVariant", sku: Optional[str], save: Optional[bool] = True+ variant: "ProductVariant", sku: str | None, save: bool | None = True):"""Generate ProductVariant's name based on its attributes."""attributes_display = []diff --git a/saleor/product/views.py b/saleor/product/views.pyindex 75c82ec118..11c1869237 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -1,6 +1,5 @@import mimetypesimport os-from typing import Unionfrom django.conf import settingsfrom django.http import FileResponse, HttpResponseNotFound@@ -13,7 +12,7 @@ from .utils.digital_products import ()-def digital_product(request, token: str) -> Union[FileResponse, HttpResponseNotFound]:+def digital_product(request, token: str) -> FileResponse | HttpResponseNotFound:"""Return the direct download link to content if given token is still valid."""qs = DigitalContentUrl.objects.using(diff --git a/saleor/schedulers/schedulers.py b/saleor/schedulers/schedulers.pyindex 9b2e5deaa8..dac4d28a3c 100644--- a/saleor/schedulers/schedulers.py+++ b/saleor/schedulers/schedulers.py@@ -1,7 +1,7 @@import copyimport loggingimport time-from typing import Any, NamedTuple, Optional+from typing import Any, NamedTupleimport celery.beatimport celery.schedules@@ -26,7 +26,7 @@ def setup_celery_logging(loglevel=None, **_kwargs):def is_numeric_value(value):- return isinstance(value, (int, float)) and not isinstance(value, bool)+ return isinstance(value, int | float) and not isinstance(value, bool)class HeapEventType(NamedTuple):@@ -60,7 +60,7 @@ class CustomModelEntry(ModelEntry):class BaseScheduler(celery.beat.Scheduler):"""Define the base scheduler for Celery beat."""- old_schedulers: Optional[Any]+ old_schedulers: Any | Nonedef tick(self,@@ -92,7 +92,7 @@ class BaseScheduler(celery.beat.Scheduler):self.old_schedulers = copy.copy(self.schedule)self.populate_heap()- H: Optional[list[HeapEventType]] = self._heap+ H: list[HeapEventType] | None = self._heapif not H:return max_intervaldiff --git a/saleor/settings.py b/saleor/settings.pyindex 44c1f018bd..fb36969abe 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -3,7 +3,7 @@ import loggingimport osimport os.pathimport warnings-from typing import Optional, cast+from typing import castfrom urllib.parse import urlparseimport dj_database_url@@ -49,7 +49,7 @@ def get_bool_from_env(name, default_value):return value.lower() in ("true", "1")-def get_url_from_env(name, *, schemes=None) -> Optional[str]:+def get_url_from_env(name, *, schemes=None) -> str | None:if name in os.environ:value = os.environ[name]message = f"{value} is an invalid value for {name}"@@ -167,7 +167,7 @@ ENABLE_SSL: bool = get_bool_from_env("ENABLE_SSL", False)# URL on which Saleor is hosted (e.g., https://api.example.com/). This has precedence# over ENABLE_SSL and Shop.domain when generating URLs pointing to itself.-PUBLIC_URL: Optional[str] = get_url_from_env("PUBLIC_URL", schemes=["http", "https"])+PUBLIC_URL: str | None = get_url_from_env("PUBLIC_URL", schemes=["http", "https"])if PUBLIC_URL:if os.environ.get("ENABLE_SSL") is not None:warnings.warn(diff --git a/saleor/shipping/interface.py b/saleor/shipping/interface.pyindex e51555d73f..8dc71ed28f 100644--- a/saleor/shipping/interface.py+++ b/saleor/shipping/interface.py@@ -19,15 +19,15 @@ class ShippingMethodData:id: strprice: Money- name: Optional[str] = None- description: Optional[str] = None- type: Optional[str] = None- maximum_order_price: Optional[Money] = None- minimum_order_price: Optional[Money] = None- minimum_order_weight: Optional[Weight] = None- maximum_order_weight: Optional[Weight] = None- maximum_delivery_days: Optional[int] = None- minimum_delivery_days: Optional[int] = None+ name: str | None = None+ description: str | None = None+ type: str | None = None+ maximum_order_price: Money | None = None+ minimum_order_price: Money | None = None+ minimum_order_weight: Weight | None = None+ maximum_order_weight: Weight | None = None+ maximum_delivery_days: int | None = None+ minimum_delivery_days: int | None = Nonemetadata: dict[str, str] = field(default_factory=dict)private_metadata: dict[str, str] = field(default_factory=dict)tax_class: Optional["TaxClass"] = Nonediff --git a/saleor/shipping/models.py b/saleor/shipping/models.pyindex 9af4e57f3e..bbbad07746 100644--- a/saleor/shipping/models.py+++ b/saleor/shipping/models.py@@ -175,8 +175,8 @@ class ShippingMethodQueryset(models.QuerySet["ShippingMethod"]):channel_id,price: Money,shipping_address: Optional["Address"] = None,- country_code: Optional[str] = None,- lines: Union[list["CheckoutLineInfo"], list["OrderLineInfo"], None] = None,+ country_code: str | None = None,+ lines: list["CheckoutLineInfo"] | list["OrderLineInfo"] | None = None,):if not shipping_address:return Nonediff --git a/saleor/shipping/postal_codes.py b/saleor/shipping/postal_codes.pyindex 35d33f7889..b7a70de836 100644--- a/saleor/shipping/postal_codes.py+++ b/saleor/shipping/postal_codes.py@@ -1,11 +1,11 @@import re-from typing import Any, Optional+from typing import Anyfrom . import PostalCodeRuleInclusionTypedef group_values(pattern, *values):- result: list[Optional[tuple[Any, ...]]] = []+ result: list[tuple[Any, ...] | None] = []for value in values:try:val = re.match(pattern, value)diff --git a/saleor/shipping/tasks.py b/saleor/shipping/tasks.pyindex 127b7b1ad0..2a150bcc9c 100644--- a/saleor/shipping/tasks.py+++ b/saleor/shipping/tasks.py@@ -1,5 +1,4 @@from collections.abc import Iterable-from typing import Unionfrom django.utils import timezone@@ -13,8 +12,8 @@ from ..order.models import Order@app.task@allow_writer()def drop_invalid_shipping_methods_relations_for_given_channels(- shipping_method_ids: Iterable[Union[str, int]],- channel_ids: Iterable[Union[str, int]],+ shipping_method_ids: Iterable[str | int],+ channel_ids: Iterable[str | int],):# unlink shipping methods from order and checkout instances# when method is no longer available in given channelsdiff --git a/saleor/site/models.py b/saleor/site/models.pyindex e34df7691c..ceab38eb1a 100644--- a/saleor/site/models.py+++ b/saleor/site/models.py@@ -1,6 +1,6 @@from email.headerregistry import Addressfrom email.utils import parseaddr-from typing import Final, Optional+from typing import Finalfrom django.conf import settingsfrom django.contrib.sites.models import Site@@ -109,7 +109,7 @@ class SiteSettings(ModelWithMetadata):@propertydef default_from_email(self) -> str:sender_name: str = self.default_mail_sender_name- sender_address: Optional[str] = self.default_mail_sender_address+ sender_address: str | None = self.default_mail_sender_addressif not sender_address:sender_address = settings.DEFAULT_FROM_EMAILdiff --git a/saleor/site/patch_sites.py b/saleor/site/patch_sites.pyindex 523c81b425..e1c6d5ca0f 100644--- a/saleor/site/patch_sites.py+++ b/saleor/site/patch_sites.py@@ -6,7 +6,6 @@ a thread-safe structure and methods that use it underneath."""import threading-from typing import Unionfrom django.contrib.sites.models import Site, SiteManagerfrom django.core.exceptions import ImproperlyConfigured@@ -14,7 +13,7 @@ from django.http.request import split_domain_portlock = threading.Lock()with lock:- THREADED_SITE_CACHE: dict[Union[str, int], Site] = {}+ THREADED_SITE_CACHE: dict[str | int, Site] = {}def new_get_current(self, request=None):diff --git a/saleor/tax/migrations/0005_migrate_vatlayer.py b/saleor/tax/migrations/0005_migrate_vatlayer.pyindex f87b50f8af..cce08f77c7 100644--- a/saleor/tax/migrations/0005_migrate_vatlayer.py+++ b/saleor/tax/migrations/0005_migrate_vatlayer.py@@ -1,6 +1,5 @@# Generated by Django 3.2.14 on 2022-08-18 10:31-from typing import Optionalfrom django.db import migrationsfrom django_countries import countries@@ -12,7 +11,7 @@ VATLAYER_ID = "mirumee.taxes.vatlayer"TAX_CLASS_ZERO_RATE = "No Taxes"-def _clear_country_code(country_code: str) -> Optional[str]:+def _clear_country_code(country_code: str) -> str | None:return countries.alpha2(country_code.strip()) if country_code else Nonediff --git a/saleor/tax/utils.py b/saleor/tax/utils.pyindex b4685d7967..73a740d0ff 100644--- a/saleor/tax/utils.py+++ b/saleor/tax/utils.py@@ -75,7 +75,7 @@ def get_tax_calculation_strategy(def get_tax_app_id(channel_tax_configuration: "TaxConfiguration",country_tax_configuration: Optional["TaxConfigurationPerCountry"],-) -> Optional[str]:+) -> str | None:"""Get tax_app_id value for tax channel configuration.:param channel_tax_configuration: Channel-specific tax configuration.@@ -257,7 +257,7 @@ def get_shipping_tax_class_kwargs_for_order(tax_class: Optional["TaxClass"]):def validate_tax_data(- tax_data: Optional[TaxData],+ tax_data: TaxData | None,lines: Iterable,allow_empty_tax_data: bool = False,):@@ -274,7 +274,7 @@ def validate_tax_data(raise TaxDataError(TaxDataErrorMessage.OVERFLOW)-def check_negative_values_in_tax_data(tax_data: Optional[TaxData]) -> bool:+def check_negative_values_in_tax_data(tax_data: TaxData | None) -> bool:"""Check if tax data contains negative values."""if not tax_data:return False@@ -297,7 +297,7 @@ def check_negative_values_in_tax_data(tax_data: Optional[TaxData]) -> bool:return False-def check_line_number_in_tax_data(tax_data: Optional[TaxData], lines: Iterable) -> bool:+def check_line_number_in_tax_data(tax_data: TaxData | None, lines: Iterable) -> bool:"""Check if tax data contains same line number as input data."""if not tax_data:return False@@ -308,7 +308,7 @@ def check_line_number_in_tax_data(tax_data: Optional[TaxData], lines: Iterable)return False-def check_overflows_in_tax_data(tax_data: Optional[TaxData]) -> bool:+def check_overflows_in_tax_data(tax_data: TaxData | None) -> bool:"""Check if tax rates exceed 100% and line prices are lower than a billion."""if not tax_data:return Falsediff --git a/saleor/tests/e2e/orders/test_bulk_delete_draft_orders.py b/saleor/tests/e2e/orders/test_bulk_delete_draft_orders.pyindex ea158249e3..7022429388 100644--- a/saleor/tests/e2e/orders/test_bulk_delete_draft_orders.py+++ b/saleor/tests/e2e/orders/test_bulk_delete_draft_orders.py@@ -46,7 +46,7 @@ def test_delete_draft_orders_in_bulk_CORE_0248(orders_list = []for i in range(5):- user_email = f"test_user_{i +1}@test.com"+ user_email = f"test_user_{i + 1}@test.com"draft_order_input = {"channelId": channel_id,"userEmail": user_email,diff --git a/saleor/tests/fixtures.py b/saleor/tests/fixtures.pyindex 6c8b1bc29a..0575d66471 100644--- a/saleor/tests/fixtures.py+++ b/saleor/tests/fixtures.py@@ -2,7 +2,6 @@ import datetimefrom contextlib import contextmanagerfrom functools import partialfrom io import BytesIO-from typing import Optionalfrom unittest.mock import MagicMockimport graphene@@ -100,9 +99,7 @@ def capture_queries(pytestconfig):cfg = pytestconfig@contextmanager- def _capture_queries(- num: Optional[int] = None, msg: Optional[str] = None, exact=False- ):+ def _capture_queries(num: int | None = None, msg: str | None = None, exact=False):with CaptureQueriesContext(connection) as ctx:yield ctxif num is not None:diff --git a/saleor/tests/settings.py b/saleor/tests/settings.pyindex fb65b81b39..f3a91d927f 100644--- a/saleor/tests/settings.py+++ b/saleor/tests/settings.py@@ -1,7 +1,6 @@import osimport refrom re import Pattern-from typing import Unionfrom django.utils.functional import SimpleLazyObject@@ -50,7 +49,7 @@ OBSERVABILITY_REPORT_ALL_API_CALLS = FalsePLUGINS = []-PATTERNS_IGNORED_IN_QUERY_CAPTURES: list[Union[Pattern, SimpleLazyObject]] = [+PATTERNS_IGNORED_IN_QUERY_CAPTURES: list[Pattern | SimpleLazyObject] = [lazy_re_compile(r"^SET\s+")]diff --git a/saleor/thumbnail/utils.py b/saleor/thumbnail/utils.pyindex 3004dc357c..76aa2e4e82 100644--- a/saleor/thumbnail/utils.py+++ b/saleor/thumbnail/utils.py@@ -1,7 +1,7 @@import osimport secretsfrom io import BytesIO-from typing import TYPE_CHECKING, Optional, Union+from typing import TYPE_CHECKING, Optionalimport grapheneimport magic@@ -28,7 +28,7 @@ def get_image_or_proxy_url(instance_id: str,object_type: str,size: int,- format: Optional[str],+ format: str | None,):"""Return the thumbnail ULR if thumbnails is provided, otherwise the proxy url."""return (@@ -39,7 +39,7 @@ def get_image_or_proxy_url(def prepare_image_proxy_url(- instance_pk: str, object_type: str, size: int, format: Optional[str]+ instance_pk: str, object_type: str, size: int, format: str | None):instance_id = graphene.Node.to_global_id(object_type, instance_pk)kwargs = {"instance_id": instance_id, "size": size}@@ -48,7 +48,7 @@ def prepare_image_proxy_url(return reverse("thumbnail", kwargs=kwargs)-def get_thumbnail_size(size: Optional[int]) -> int:+def get_thumbnail_size(size: int | None) -> int:"""Return the closest size to the given one of the available sizes."""if size is None:requested_size = DEFAULT_THUMBNAIL_SIZE@@ -60,7 +60,7 @@ def get_thumbnail_size(size: Optional[int]) -> int:return min(THUMBNAIL_SIZES, key=lambda x: abs(x - requested_size))-def get_thumbnail_format(format: Optional[str]) -> Optional[str]:+def get_thumbnail_format(format: str | None) -> str | None:"""Return the thumbnail format if it's supported, otherwise None."""if format is None:return None@@ -72,16 +72,14 @@ def get_thumbnail_format(format: Optional[str]) -> Optional[str]:return format-def get_icon_thumbnail_format(format: Optional[str]) -> Optional[str]:+def get_icon_thumbnail_format(format: str | None) -> str | None:"""Return the icon thumbnail format if it's supported, otherwise None."""if not format or format.lower() == IconThumbnailFormat.ORIGINAL:return Nonereturn format-def prepare_thumbnail_file_name(- file_name: str, size: int, format: Optional[str]-) -> str:+def prepare_thumbnail_file_name(file_name: str, size: int, format: str | None) -> str:file_path, file_ext = file_name.rsplit(".", 1)file_ext = format or file_extreturn file_path + f"_thumbnail_{size}." + file_ext@@ -106,9 +104,9 @@ class ProcessedImage:def __init__(self,- image_source: Union[str, File],+ image_source: str | File,size: int,- format: Optional[str] = None,+ format: str | None = None,storage=default_storage,):self.image_source = image_sourcediff --git a/saleor/thumbnail/validators.py b/saleor/thumbnail/validators.pyindex 4894c2d9c0..fa8791af81 100644--- a/saleor/thumbnail/validators.py+++ b/saleor/thumbnail/validators.py@@ -1,5 +1,4 @@from collections.abc import Collection-from typing import Optionalfrom django.core.exceptions import ValidationErrorfrom PIL import Image, UnidentifiedImageError@@ -37,8 +36,8 @@ def validate_image_exif(img: Image.Image, error_code: str):def validate_image_size(img: Image.Image,error_code: str,- min_size: Optional[int] = None,- max_size: Optional[int] = None,+ min_size: int | None = None,+ max_size: int | None = None,square_required=False,):if min_size and img.size < (min_size, min_size):diff --git a/saleor/thumbnail/views.py b/saleor/thumbnail/views.pyindex 607452da92..3697d25490 100644--- a/saleor/thumbnail/views.py+++ b/saleor/thumbnail/views.py@@ -1,5 +1,5 @@import logging-from typing import NamedTuple, Optional, Union+from typing import NamedTuplefrom django.conf import settingsfrom django.core.exceptions import ObjectDoesNotExist@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)class ModelData(NamedTuple):- model: type[Union[App, AppInstallation, Category, Collection, ProductMedia, User]]+ model: type[App | AppInstallation | Category | Collection | ProductMedia | User]image_field: strthumbnail_field: str@@ -51,9 +51,7 @@ TYPE_TO_MODEL_DATA_MAPPING = {UUID_IDENTIFIABLE_TYPES = ["User", "App", "AppInstallation"]-def handle_thumbnail(- request, instance_id: str, size: str, format: Optional[str] = None-):+def handle_thumbnail(request, instance_id: str, size: str, format: str | None = None):"""Create and return thumbnail for given instance in provided size and format.If the provided size is not in the available resolution list, the thumbnail withdiff --git a/saleor/warehouse/availability.py b/saleor/warehouse/availability.pyindex 1e26ece131..4456efd435 100644--- a/saleor/warehouse/availability.py+++ b/saleor/warehouse/availability.py@@ -42,7 +42,7 @@ class VariantsChannelAvailbilityInfo(NamedTuple):def _get_available_quantity(stocks: StockQuerySet,- checkout_lines: Optional[list["CheckoutLine"]] = None,+ checkout_lines: list["CheckoutLine"] | None = None,check_reservations: bool = False,) -> int:results = stocks.aggregate(@@ -65,7 +65,7 @@ def check_stock_and_preorder_quantity(country_code: str,channel_slug: str,quantity: int,- checkout_lines: Optional[list["CheckoutLine"]] = None,+ checkout_lines: list["CheckoutLine"] | None = None,check_reservations: bool = False,order_line: Optional["OrderLine"] = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,@@ -102,7 +102,7 @@ def check_stock_quantity(country_code: str,channel_slug: str,quantity: int,- checkout_lines: Optional[list["CheckoutLine"]] = None,+ checkout_lines: list["CheckoutLine"] | None = None,check_reservations: bool = False,order_line: Optional["OrderLine"] = None,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,@@ -143,10 +143,10 @@ def check_stock_and_preorder_quantity_bulk(country_code: str,quantities: Iterable[int],channel_slug: str,- global_quantity_limit: Optional[int],+ global_quantity_limit: int | None,delivery_method_info: Optional["DeliveryMethodBase"] = None,- additional_filter_lookup: Optional[dict[str, Any]] = None,- existing_lines: Optional[list["CheckoutLineInfo"]] = None,+ additional_filter_lookup: dict[str, Any] | None = None,+ existing_lines: list["CheckoutLineInfo"] | None = None,replace: bool = False,check_reservations: bool = False,):@@ -195,7 +195,7 @@ def _split_lines_for_trackable_and_preorder(stock_variants, stock_quantities = [], []preorder_variants, preorder_quantities = [], []- for variant, quantity in zip(variants, quantities):+ for variant, quantity in zip(variants, quantities, strict=False):if variant.is_preorder_active():preorder_variants.append(variant)preorder_quantities.append(quantity)@@ -211,8 +211,8 @@ def _split_lines_for_trackable_and_preorder(def _check_quantity_limits(- variant: "ProductVariant", quantity: int, global_quantity_limit: Optional[int]-) -> Optional[NoReturn]:+ variant: "ProductVariant", quantity: int, global_quantity_limit: int | None+) -> NoReturn | None:quantity_limit = variant.quantity_limit_per_customer or global_quantity_limitif quantity_limit is not None and quantity > quantity_limit:@@ -235,10 +235,10 @@ def check_stock_quantity_bulk(country_code: str,quantities: Iterable[int],channel_slug: str,- global_quantity_limit: Optional[int],+ global_quantity_limit: int | None,delivery_method_info: Optional["DeliveryMethodBase"] = None,- additional_filter_lookup: Optional[dict[str, Any]] = None,- existing_lines: Optional[list["CheckoutLineInfo"]] = None,+ additional_filter_lookup: dict[str, Any] | None = None,+ existing_lines: list["CheckoutLineInfo"] | None = None,replace=False,check_reservations: bool = False,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,@@ -290,7 +290,7 @@ def check_stock_quantity_bulk(variants_quantities = {line.variant.pk: line.line.quantity for line in existing_lines or []}- for variant, quantity in zip(variants, quantities):+ for variant, quantity in zip(variants, quantities, strict=False):if not replace:quantity += variants_quantities.get(variant.pk, 0)@@ -372,7 +372,7 @@ def check_preorder_threshold_in_orders(variant: "ProductVariant",quantity: int,channel_slug: str,- checkout_lines: Optional[Iterable["CheckoutLine"]],+ checkout_lines: Iterable["CheckoutLine"] | None,check_reservations: bool,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,):@@ -444,8 +444,8 @@ def check_preorder_threshold_bulk(variants: Iterable["ProductVariant"],quantities: Iterable[int],channel_slug: str,- global_quantity_limit: Optional[int],- existing_lines: Optional[list["CheckoutLineInfo"]] = None,+ global_quantity_limit: int | None,+ existing_lines: list["CheckoutLineInfo"] | None = None,replace: bool = False,check_reservations: bool = False,):@@ -471,7 +471,7 @@ def check_preorder_threshold_bulk(variants_quantities = {line.variant.pk: line.line.quantity for line in existing_lines or []}- for variant, quantity in zip(variants, quantities):+ for variant, quantity in zip(variants, quantities, strict=False):cumulative_quantity = quantityif not replace:cumulative_quantity = quantity + variants_quantities.get(variant.pk, 0)@@ -522,7 +522,7 @@ def get_available_quantity(variant: "ProductVariant",country_code: str,channel_slug: str,- checkout_lines: Optional[list["CheckoutLine"]] = None,+ checkout_lines: list["CheckoutLine"] | None = None,check_reservations: bool = False,) -> int:"""Return available quantity for given product in given country."""@@ -545,7 +545,7 @@ def is_product_in_stock(def get_reserved_stock_quantity(- stocks: StockQuerySet, lines: Optional[list["CheckoutLine"]] = None+ stocks: StockQuerySet, lines: list["CheckoutLine"] | None = None) -> int:result = (Reservation.objects.filter(diff --git a/saleor/warehouse/management.py b/saleor/warehouse/management.pyindex 11c629eaf6..f3dea1720e 100644--- a/saleor/warehouse/management.py+++ b/saleor/warehouse/management.py@@ -1,7 +1,7 @@import mathfrom collections import defaultdictfrom collections.abc import Iterable-from typing import TYPE_CHECKING, Any, NamedTuple, Optional, cast+from typing import TYPE_CHECKING, Any, NamedTuple, castfrom uuid import UUIDfrom django.db import transaction@@ -100,10 +100,10 @@ def allocate_stocks(country_code: str,channel: "Channel",manager: PluginsManager,- collection_point_pk: Optional[UUID] = None,- additional_filter_lookup: Optional[dict[str, Any]] = None,+ collection_point_pk: UUID | None = None,+ additional_filter_lookup: dict[str, Any] | None = None,check_reservations: bool = False,- checkout_lines: Optional[Iterable["CheckoutLine"]] = None,+ checkout_lines: Iterable["CheckoutLine"] | None = None,):"""Allocate stocks for given `order_lines` in given country.@@ -244,7 +244,7 @@ def sort_stocks(stocks: list[dict],channel: "Channel",quantity_allocation_for_stocks: dict[int, int],- collection_point_pk: Optional[UUID] = None,+ collection_point_pk: UUID | None = None,):warehouse_ids = [stock_data["warehouse_id"] for stock_data in stocks]channel_warehouse_ids = ChannelWarehouse.objects.filter(@@ -696,7 +696,7 @@ def allocate_preorders(order_lines_info: list["OrderLineInfo"],channel_slug: str,check_reservations: bool = False,- checkout_lines: Optional[Iterable["CheckoutLine"]] = None,+ checkout_lines: Iterable["CheckoutLine"] | None = None,):"""Allocate preorder variant for given `order_lines` in given channel."""order_lines_info = get_order_lines_with_preorder(order_lines_info)@@ -806,12 +806,12 @@ def get_order_lines_with_preorder(def _create_preorder_allocation(line_info: "OrderLineInfo",- variant_channel_data: tuple[int, Optional[int]],+ variant_channel_data: tuple[int, int | None],variant_global_allocation: int,variants_channel_listings: list[int],quantity_allocation_for_channel: dict[int, int],listings_reservations: dict[int, int],-) -> tuple[Optional[PreorderAllocation], Optional[InsufficientStockData]]:+) -> tuple[PreorderAllocation | None, InsufficientStockData | None]:variant = cast(ProductVariant, line_info.variant)quantity = line_info.quantitychannel_listing_id, channel_quantity_threshold = variant_channel_datadiff --git a/saleor/warehouse/models.py b/saleor/warehouse/models.pyindex b26ce65a3e..570cf51758 100644--- a/saleor/warehouse/models.py+++ b/saleor/warehouse/models.py@@ -2,7 +2,7 @@ import itertoolsimport uuidfrom collections import defaultdictfrom collections.abc import Iterable-from typing import TYPE_CHECKING, Optional, TypedDict, TypeVar, Union, cast+from typing import TYPE_CHECKING, TypedDict, TypeVar, castfrom django.contrib.postgres.indexes import BTreeIndexfrom django.db import models@@ -115,7 +115,7 @@ class WarehouseQueryset(models.QuerySet["Warehouse"]):def applicable_for_click_and_collect_no_quantity_check(self,- lines_qs: Union[QuerySet[CheckoutLine], QuerySet[OrderLine]],+ lines_qs: QuerySet[CheckoutLine] | QuerySet[OrderLine],channel_id: int,):"""Return Warehouses which support click and collect.@@ -164,7 +164,7 @@ class WarehouseQueryset(models.QuerySet["Warehouse"]):def applicable_for_click_and_collect(self,- lines_qs: Union[QuerySet[CheckoutLine], QuerySet[OrderLine]],+ lines_qs: QuerySet[CheckoutLine] | QuerySet[OrderLine],channel_id: int,) -> QuerySet["Warehouse"]:"""Return Warehouses which support click and collect.@@ -187,7 +187,7 @@ class WarehouseQueryset(models.QuerySet["Warehouse"]):# prepare the mapping of variant_id to total quantity of this variant# in the order- line_variant_id_to_total_qty: dict[Optional[int], int] = defaultdict(int)+ line_variant_id_to_total_qty: dict[int | None, int] = defaultdict(int)for line in lines_qs:line_variant_id_to_total_qty[line.variant_id] += line.quantity@@ -202,7 +202,7 @@ class WarehouseQueryset(models.QuerySet["Warehouse"]):)stock_ids = []- variant_id_to_total_stock_qty: dict[Optional[int], int] = defaultdict(int)+ variant_id_to_total_stock_qty: dict[int | None, int] = defaultdict(int)# Filter out the stocks that have enough quantity to fulfill the order# Prepare the mapping of variant_id to the sum of total available quantity of# the given variant from all stocks@@ -377,7 +377,7 @@ class StockQuerySet(models.QuerySet["Stock"]):def for_channel_and_country(self,channel_slug: str,- country_code: Optional[str] = None,+ country_code: str | None = None,include_cc_warehouses: bool = False,):"""Get stocks for given channel and country_code.@@ -572,7 +572,7 @@ class ReservationQuerySet(models.QuerySet[T]):def not_expired(self):return self.filter(reserved_until__gt=timezone.now())- def exclude_checkout_lines(self, checkout_lines: Optional[Iterable[CheckoutLine]]):+ def exclude_checkout_lines(self, checkout_lines: Iterable[CheckoutLine] | None):if checkout_lines:return self.exclude(checkout_line__in=checkout_lines)diff --git a/saleor/warehouse/reservations.py b/saleor/warehouse/reservations.pyindex 2be463f45c..60fb413ad2 100644--- a/saleor/warehouse/reservations.py+++ b/saleor/warehouse/reservations.py@@ -1,7 +1,7 @@import datetimefrom collections import defaultdictfrom collections.abc import Iterable-from typing import TYPE_CHECKING, NamedTuple, Optional+from typing import TYPE_CHECKING, NamedTuplefrom django.conf import settingsfrom django.db.models import F, Sum@@ -396,14 +396,14 @@ def is_reservation_enabled(settings) -> bool:)-def get_reservation_length(site, user) -> Optional[int]:+def get_reservation_length(site, user) -> int | None:if user:return site.settings.reserve_stock_duration_authenticated_userreturn site.settings.reserve_stock_duration_anonymous_userdef get_listings_reservations(- checkout_lines: Optional[Iterable["CheckoutLine"]],+ checkout_lines: Iterable["CheckoutLine"] | None,all_variants_channel_listings,database_connection_name: str = settings.DATABASE_CONNECTION_DEFAULT_NAME,) -> dict[int, int]:diff --git a/saleor/webhook/event_types.py b/saleor/webhook/event_types.pyindex 73154e1082..b1701ca8fd 100644--- a/saleor/webhook/event_types.py+++ b/saleor/webhook/event_types.py@@ -1,4 +1,4 @@-from typing import Any, Optional+from typing import Anyfrom ..permission.enums import (AccountPermissions,@@ -774,7 +774,7 @@ class WebhookEventAsyncType:] + [(event_name, event_data["name"]) for event_name, event_data in EVENT_MAP.items()]- PERMISSIONS: dict[str, Optional[BasePermissionEnum]] = {+ PERMISSIONS: dict[str, BasePermissionEnum | None] = {event_name: event_data["permission"]for event_name, event_data in EVENT_MAP.items()}@@ -917,7 +917,7 @@ class WebhookEventSyncType:CHOICES = [(event_name, event_data["name"]) for event_name, event_data in EVENT_MAP.items()]- PERMISSIONS: dict[str, Optional[BasePermissionEnum]] = {+ PERMISSIONS: dict[str, BasePermissionEnum | None] = {event_name: event_data["permission"]for event_name, event_data in EVENT_MAP.items()}diff --git a/saleor/webhook/observability/buffers.py b/saleor/webhook/observability/buffers.pyindex 4ed1d070bc..b62549daf5 100644--- a/saleor/webhook/observability/buffers.py+++ b/saleor/webhook/observability/buffers.py@@ -1,6 +1,5 @@import mathimport zlib-from typing import Optionalfrom asgiref.local import Localfrom django.conf import settings@@ -55,7 +54,7 @@ class BaseBuffer:"subclasses of BaseBuffer must provide a put_events_multi_buffer() method")- def pop_event(self) -> Optional[bytes]:+ def pop_event(self) -> bytes | None:raise NotImplementedError("subclasses of BaseBuffer must provide a pop_events() method")@@ -91,7 +90,7 @@ class RedisBuffer(BaseBuffer):def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)- self._client: Optional[Redis] = None+ self._client: Redis | None = Nonedef get_connection_pool(self):return ConnectionPool.from_url(@@ -117,7 +116,7 @@ class RedisBuffer(BaseBuffer):return self._clientdef _put_events(- self, key: KEY_TYPE, events: list[bytes], client: Optional[Redis] = None+ self, key: KEY_TYPE, events: list[bytes], client: Redis | None = None) -> int:start_index = -self.max_sizeevents_data = [self.encode(event) for event in events[start_index:]]@@ -167,7 +166,7 @@ class RedisBuffer(BaseBuffer):events.append(self.decode(elem))return events, size - len(events)- def pop_event(self) -> Optional[bytes]:+ def pop_event(self) -> bytes | None:events, _ = self._pop_events(self.key, batch_size=1)return events[0] if events else Nonediff --git a/saleor/webhook/observability/exceptions.py b/saleor/webhook/observability/exceptions.pyindex 4247d7ab91..45771a7783 100644--- a/saleor/webhook/observability/exceptions.py+++ b/saleor/webhook/observability/exceptions.py@@ -1,5 +1,3 @@-from typing import Optional-from .payload_schema import ObservabilityEventTypes@@ -12,7 +10,7 @@ class ConnectionNotConfigured(ObservabilityError):class TruncationError(ObservabilityError):- _event_type: Optional[ObservabilityEventTypes] = None+ _event_type: ObservabilityEventTypes | None = Nonedef __init__(self, operation: str, bytes_limit: int, payload_size: int, **kwargs):self.extra = {diff --git a/saleor/webhook/observability/obfuscation.py b/saleor/webhook/observability/obfuscation.pyindex af915c60d9..bef4b664af 100644--- a/saleor/webhook/observability/obfuscation.py+++ b/saleor/webhook/observability/obfuscation.py@@ -1,4 +1,4 @@-from typing import TYPE_CHECKING, Any, Optional, Union, cast+from typing import TYPE_CHECKING, Any, castfrom graphql import (GraphQLError,@@ -27,13 +27,9 @@ if TYPE_CHECKING:from .utils import GraphQLOperationResponse-GraphQLNode = Union[- Field,- FragmentDefinition,- FragmentSpread,- InlineFragment,- OperationDefinition,-]+GraphQLNode = (+ Field | FragmentDefinition | FragmentSpread | InlineFragment | OperationDefinition+)MASK = "***"@@ -78,7 +74,7 @@ class ContainSensitiveField(ValidationRule):if isinstance(node, FragmentSpread) or not node.selection_set:return Falsefields: dict[str, GraphQLField] = {}- if isinstance(type_def, (GraphQLObjectType, GraphQLInterfaceType)):+ if isinstance(type_def, GraphQLObjectType | GraphQLInterfaceType):fields = type_def.fieldsfor child_node in node.selection_set.selections:if isinstance(child_node, Field):@@ -123,9 +119,9 @@ class ContainSensitiveField(ValidationRule):def enter(self,node: Any,- key: Optional[Union[int, str]],+ key: int | str | None,parent: Any,- path: list[Union[int, str]],+ path: list[int | str],ancestors: list[Any],):if isinstance(node, OperationDefinition):@@ -181,7 +177,7 @@ def anonymize_gql_operation_response(def anonymize_event_payload(- subscription_query: Optional[str],+ subscription_query: str | None,event_type: str, # pylint: disable=unused-argumentpayload: Any,sensitive_fields: SensitiveFieldsMap,diff --git a/saleor/webhook/observability/payload_schema.py b/saleor/webhook/observability/payload_schema.pyindex a4dfeaba43..5367726073 100644--- a/saleor/webhook/observability/payload_schema.py+++ b/saleor/webhook/observability/payload_schema.py@@ -1,7 +1,7 @@import datetimefrom enum import Enumfrom json.encoder import ESCAPE_ASCII, ESCAPE_DCT-from typing import Optional, TypedDict+from typing import TypedDictclass JsonTruncText:@@ -77,7 +77,7 @@ class Webhook(TypedDict):id: strname: strtarget_url: str- subscription_query: Optional[JsonTruncText]+ subscription_query: JsonTruncText | Noneclass ObservabilityEventBase(TypedDict):@@ -85,10 +85,10 @@ class ObservabilityEventBase(TypedDict):class GraphQLOperation(TypedDict):- name: Optional[JsonTruncText]- operation_type: Optional[str]- query: Optional[JsonTruncText]- result: Optional[JsonTruncText]+ name: JsonTruncText | None+ operation_type: str | None+ query: JsonTruncText | None+ result: JsonTruncText | Noneresult_invalid: bool@@ -103,14 +103,14 @@ class ApiCallRequest(TypedDict):class ApiCallResponse(TypedDict):headers: HttpHeaders- status_code: Optional[int]+ status_code: int | Nonecontent_length: intclass ApiCallPayload(ObservabilityEventBase):request: ApiCallRequestresponse: ApiCallResponse- app: Optional[App]+ app: App | Nonegql_operations: list[GraphQLOperation]@@ -133,7 +133,7 @@ class EventDeliveryAttemptRequest(TypedDict):class EventDeliveryAttemptResponse(TypedDict):headers: HttpHeaders- status_code: Optional[int]+ status_code: int | Nonecontent_length: intbody: JsonTruncText@@ -141,9 +141,9 @@ class EventDeliveryAttemptResponse(TypedDict):class EventDeliveryAttemptPayload(ObservabilityEventBase):id: strtime: datetime.datetime- duration: Optional[float]+ duration: float | Nonestatus: str- next_retry: Optional[datetime.datetime]+ next_retry: datetime.datetime | Nonerequest: EventDeliveryAttemptRequestresponse: EventDeliveryAttemptResponseevent_delivery: EventDeliverydiff --git a/saleor/webhook/observability/payloads.py b/saleor/webhook/observability/payloads.pyindex c2d2a89cdb..2f8340ef99 100644--- a/saleor/webhook/observability/payloads.py+++ b/saleor/webhook/observability/payloads.py@@ -2,7 +2,7 @@ import datetimeimport jsonimport uuidfrom collections.abc import Mapping-from typing import TYPE_CHECKING, Any, Optional+from typing import TYPE_CHECKING, Anyimport graphenefrom django.core.serializers.json import DjangoJSONEncoder@@ -88,7 +88,7 @@ GQL_OPERATION_PLACEHOLDER = GraphQLOperation(GQL_OPERATION_PLACEHOLDER_SIZE = len(dump_payload(GQL_OPERATION_PLACEHOLDER))-def serialize_headers(headers: Optional[dict[str, str]]) -> HttpHeaders:+def serialize_headers(headers: dict[str, str] | None) -> HttpHeaders:if headers:return list(filter_and_hide_headers(headers).items())return []@@ -193,7 +193,7 @@ def generate_api_call_payload(@traced_payload_generatordef generate_event_delivery_attempt_payload(attempt: "EventDeliveryAttempt",- next_retry: Optional[datetime.datetime],+ next_retry: datetime.datetime | None,bytes_limit: int,) -> bytes:if not attempt.delivery:diff --git a/saleor/webhook/observability/tests/conftest.py b/saleor/webhook/observability/tests/conftest.pyindex 402b789a5c..284707c3a8 100644--- a/saleor/webhook/observability/tests/conftest.py+++ b/saleor/webhook/observability/tests/conftest.py@@ -1,5 +1,4 @@import json-from typing import Optionalfrom unittest.mock import patchimport fakeredis@@ -23,9 +22,9 @@ KEY, MAX_SIZE, BATCH_SIZE = get_buffer_name(), 10, 5def gql_operation_factory():def factory(query_string: str,- operation_name: Optional[str] = None,- variables: Optional[dict] = None,- result: Optional[dict] = None,+ operation_name: str | None = None,+ variables: dict | None = None,+ result: dict | None = None,result_invalid=False,) -> GraphQLOperationResponse:query = backend.document_from_string(schema, query_string)diff --git a/saleor/webhook/observability/utils.py b/saleor/webhook/observability/utils.pyindex 4be574dcae..209b7a1ca6 100644--- a/saleor/webhook/observability/utils.py+++ b/saleor/webhook/observability/utils.py@@ -1,12 +1,12 @@import datetimeimport functoolsimport logging-from collections.abc import Generator+from collections.abc import Callable, Generatorfrom contextlib import contextmanagerfrom dataclasses import dataclassfrom functools import partialfrom time import monotonic-from typing import TYPE_CHECKING, Callable, Optional+from typing import TYPE_CHECKINGfrom asgiref.local import Localfrom django.conf import settings@@ -42,7 +42,7 @@ class WebhookData:id: intsaleor_domain: strtarget_url: str- secret_key: Optional[str] = None+ secret_key: str | None = Nonedef get_buffer_name() -> str:@@ -82,8 +82,8 @@ def get_webhooks(timeout=CACHE_TIMEOUT) -> list[WebhookData]:return webhooks_data-def task_next_retry_date(retry_error: "Retry") -> Optional[datetime.datetime]:- if isinstance(retry_error.when, (int, float)):+def task_next_retry_date(retry_error: "Retry") -> datetime.datetime | None:+ if isinstance(retry_error.when, int | float):return timezone.now() + datetime.timedelta(seconds=retry_error.when)if isinstance(retry_error.when, datetime.datetime):return retry_error.when@@ -116,17 +116,17 @@ def pop_events_with_remaining_size() -> tuple[list[bytes], int]:@dataclassclass GraphQLOperationResponse:- name: Optional[str] = None- query: Optional[GraphQLDocument] = None- variables: Optional[dict] = None- result: Optional[dict] = None+ name: str | None = None+ query: GraphQLDocument | None = None+ variables: dict | None = None+ result: dict | None = Noneresult_invalid: bool = Falseclass ApiCall:def __init__(self, request: "HttpRequest"):self.gql_operations: list[GraphQLOperationResponse] = []- self.response: Optional[HttpResponse] = None+ self.response: HttpResponse | None = Noneself._reported = Falseself.request = request@@ -188,7 +188,7 @@ def report_view(method):def report_event_delivery_attempt(- attempt: "EventDeliveryAttempt", next_retry: Optional[datetime.datetime] = None+ attempt: "EventDeliveryAttempt", next_retry: datetime.datetime | None = None):if not settings.OBSERVABILITY_ACTIVE:returndiff --git a/saleor/webhook/payload_serializers.py b/saleor/webhook/payload_serializers.pyindex fbe1dc3fcf..42cbac571d 100644--- a/saleor/webhook/payload_serializers.py+++ b/saleor/webhook/payload_serializers.py@@ -1,6 +1,6 @@from collections import OrderedDictfrom collections.abc import Iterable-from typing import Any, Optional+from typing import Anyimport graphenefrom django.core.serializers.json import Serializer as JSONSerializer@@ -67,7 +67,7 @@ class PayloadSerializer(JSONSerializer):obj_id = graphene.Node.to_global_id(obj._meta.object_name, getattr(obj, self.pk_field_name))- data: dict[str, Optional[Any]] = {}+ data: dict[str, Any | None] = {}if self.dump_type_name:data["type"] = str(obj._meta.object_name)data[self.obj_id_name] = obj_iddiff --git a/saleor/webhook/payloads.py b/saleor/webhook/payloads.pyindex 2f9831e178..2b054f895c 100644--- a/saleor/webhook/payloads.py+++ b/saleor/webhook/payloads.py@@ -421,8 +421,8 @@ def _calculate_removed(@traced_payload_generatordef generate_sale_payload(promotion: "Promotion",- previous_catalogue: Optional[defaultdict[str, set[str]]] = None,- current_catalogue: Optional[defaultdict[str, set[str]]] = None,+ previous_catalogue: defaultdict[str, set[str]] | None = None,+ current_catalogue: defaultdict[str, set[str]] | None = None,requestor: Optional["RequestorOrLazyObject"] = None,):if previous_catalogue is None:@@ -1081,7 +1081,7 @@ def generate_payment_payload(@allow_writer()@traced_payload_generatordef generate_list_gateways_payload(- currency: Optional[str], checkout: Optional["Checkout"]+ currency: str | None, checkout: Optional["Checkout"]):if checkout:# Deserialize checkout payload to dict and generate a new payload including@@ -1139,7 +1139,7 @@ def _generate_sample_order_payload(event_name):@allow_writer()@traced_payload_generator-def generate_sample_payload(event_name: str) -> Optional[dict]:+def generate_sample_payload(event_name: str) -> dict | None:checkout_events = [WebhookEventAsyncType.CHECKOUT_UPDATED,WebhookEventAsyncType.CHECKOUT_CREATED,diff --git a/saleor/webhook/serializers.py b/saleor/webhook/serializers.pyindex cf8ba04ea0..1955c07ee0 100644--- a/saleor/webhook/serializers.py+++ b/saleor/webhook/serializers.py@@ -1,7 +1,7 @@import datetimefrom collections import defaultdictfrom decimal import Decimal-from typing import TYPE_CHECKING, Any, Optional, Union+from typing import TYPE_CHECKING, Anyimport graphenefrom prices import Money@@ -136,9 +136,7 @@ def serialize_product_attributes(product: "Product") -> list[dict]:attr_slug = attr_value.slugvalue: dict[str,- Optional[- Union[str, datetime.datetime, datetime.date, bool, dict[str, Any]]- ],+ str | datetime.datetime | datetime.date | bool | dict[str, Any] | None,] = {"name": attr_value.name,"slug": attr_slug,@@ -196,9 +194,7 @@ def serialize_variant_attributes(variant: "ProductVariant") -> list[dict]:attr_slug = attr_value.slugvalue: dict[str,- Optional[- Union[str, datetime.datetime, datetime.date, bool, dict[str, Any]]- ],+ str | datetime.datetime | datetime.date | bool | dict[str, Any] | None,] = {"name": attr_value.name,"slug": attr_slug,diff --git a/saleor/webhook/tests/fixtures/webhook.py b/saleor/webhook/tests/fixtures/webhook.pyindex 4cff01c7c8..90a7c23085 100644--- a/saleor/webhook/tests/fixtures/webhook.py+++ b/saleor/webhook/tests/fixtures/webhook.py@@ -1,5 +1,3 @@-from typing import Union-import pytestfrom ....app.models import App@@ -339,7 +337,7 @@ def setup_order_webhooks(}"""- def _setup(additional_order_event: Union[str, list[str]]):+ def _setup(additional_order_event: str | list[str]):tax_app, shipping_app, additional_app = App.objects.bulk_create([App(diff --git a/saleor/webhook/tests/test_tax_webhook_tasks.py b/saleor/webhook/tests/test_tax_webhook_tasks.pyindex 995b957215..ab53a1427b 100644--- a/saleor/webhook/tests/test_tax_webhook_tasks.py+++ b/saleor/webhook/tests/test_tax_webhook_tasks.py@@ -110,7 +110,9 @@ def test_trigger_tax_webhook_sync_multiple_webhooks_last(assert mock_request.call_count == 3assert not EventDelivery.objects.exists()- for call, webhook in zip(mock_request.mock_calls, tax_checkout_webhooks):+ for call, webhook in zip(+ mock_request.mock_calls, tax_checkout_webhooks, strict=False+ ):delivery = call.args[0]assert delivery.status == EventDeliveryStatus.PENDINGassert delivery.event_type == event_typediff --git a/saleor/webhook/tests/test_webhook_ip_filtering.py b/saleor/webhook/tests/test_webhook_ip_filtering.pyindex 5998f21215..4dc776fef2 100644--- a/saleor/webhook/tests/test_webhook_ip_filtering.py+++ b/saleor/webhook/tests/test_webhook_ip_filtering.py@@ -13,9 +13,9 @@ def test_rejects_private_ips(webhook, monkeypatch):webhook.target_url = "https://10.0.0.0/test"webhook.save(update_fields=["target_url"])- assert (- not EventDeliveryAttempt.objects.exists()- ), "should not have any pre-existing attempts"+ assert not EventDeliveryAttempt.objects.exists(), (+ "should not have any pre-existing attempts"+ )# Trigger the webhooktrigger_webhooks_async(diff --git a/saleor/webhook/tests/test_webhook_serializers.py b/saleor/webhook/tests/test_webhook_serializers.pyindex 8e5dc8dcef..be77205aaf 100644--- a/saleor/webhook/tests/test_webhook_serializers.py+++ b/saleor/webhook/tests/test_webhook_serializers.py@@ -212,7 +212,7 @@ def test_serialize_checkout_lines(# thencheckout_with_items_for_cc.refresh_from_db()- for data, line_info in zip(checkout_lines_data, checkout_lines):+ for data, line_info in zip(checkout_lines_data, checkout_lines, strict=False):variant = line_info.line.variantproduct = variant.productvariant_channel_listing = line_info.channel_listing@@ -252,7 +252,7 @@ def test_serialize_checkout_lines_with_promotion(checkout_with_item_on_promotion# thencheckout.refresh_from_db()assert len(checkout_lines) == 1- for data, line_info in zip(checkout_lines_data, checkout_lines):+ for data, line_info in zip(checkout_lines_data, checkout_lines, strict=False):variant = line_info.line.variantproduct = variant.productvariant_channel_listing = line_info.channel_listing@@ -306,7 +306,7 @@ def test_serialize_checkout_lines_for_tax_calculation()# then- for data, line_info in zip(checkout_lines_data, lines):+ for data, line_info in zip(checkout_lines_data, lines, strict=False):line = line_info.linevariant = line.variantproduct = variant.product@@ -366,7 +366,7 @@ def test_serialize_checkout_lines_for_tax_calculation_with_promotion()# then- for data, line_info in zip(checkout_lines_data, lines):+ for data, line_info in zip(checkout_lines_data, lines, strict=False):line = line_info.linevariant = line.variantproduct = variant.productdiff --git a/saleor/webhook/tests/test_webhook_tasks.py b/saleor/webhook/tests/test_webhook_tasks.pyindex a2b55439d2..1a38a743f4 100644--- a/saleor/webhook/tests/test_webhook_tasks.py+++ b/saleor/webhook/tests/test_webhook_tasks.py@@ -29,7 +29,7 @@ def test_get_webhooks_for_event_webhook_ordering(webhooks_factory):webhooks = list(get_webhooks_for_event(event_type))# then- for prev_webhook, next_webhook in zip(webhooks, webhooks[1:]):+ for prev_webhook, next_webhook in zip(webhooks, webhooks[1:], strict=False):assert prev_webhook.app_id <= next_webhook.app_idif prev_webhook.app_id == next_webhook.app_id:assert prev_webhook.pk < next_webhook.pkdiff --git a/saleor/webhook/transport/__init__.py b/saleor/webhook/transport/__init__.pyindex 52b14e76c3..b33a02da98 100644--- a/saleor/webhook/transport/__init__.py+++ b/saleor/webhook/transport/__init__.py@@ -1,11 +1,10 @@import hashlibimport hmac-from typing import Optionalfrom ...core.jwt_manager import get_jwt_manager-def signature_for_payload(body: bytes, secret_key: Optional[str]):+def signature_for_payload(body: bytes, secret_key: str | None):if not secret_key:return get_jwt_manager().jws_encode(body)hash = hmac.new(bytes(secret_key, "utf-8"), body, hashlib.sha256)diff --git a/saleor/webhook/transport/asynchronous/transport.py b/saleor/webhook/transport/asynchronous/transport.pyindex 913daf4ea7..afc227fe62 100644--- a/saleor/webhook/transport/asynchronous/transport.py+++ b/saleor/webhook/transport/asynchronous/transport.py@@ -2,9 +2,9 @@ import datetimeimport jsonimport loggingfrom collections import defaultdict-from collections.abc import Sequence+from collections.abc import Callable, Sequencefrom dataclasses import asdict, dataclass-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Anyfrom urllib.parse import urlparsefrom celery import group@@ -61,10 +61,8 @@ MAX_WEBHOOK_EVENTS_IN_DB_BULK = 100@dataclassclass WebhookPayloadData:subscribable_object: Any- legacy_data_generator: Optional[Callable[[], str]] = None- data: Optional[str] = (- None # deprecated, legacy_data_generator should be used instead- )+ legacy_data_generator: Callable[[], str] | None = None+ data: str | None = None # deprecated, legacy_data_generator should be used insteaddef create_deliveries_for_multiple_subscription_objects(@@ -73,8 +71,8 @@ def create_deliveries_for_multiple_subscription_objects(webhooks,requestor=None,allow_replica=False,- pre_save_payloads: Optional[dict] = None,- request_time: Optional[datetime.datetime] = None,+ pre_save_payloads: dict | None = None,+ request_time: datetime.datetime | None = None,) -> list[EventDelivery]:"""Create event deliveries with payloads based on multiple subscription objects.@@ -194,8 +192,8 @@ def create_deliveries_for_subscriptions(webhooks: Sequence["Webhook"],requestor=None,allow_replica=False,- pre_save_payloads: Optional[dict] = None,- request_time: Optional[datetime.datetime] = None,+ pre_save_payloads: dict | None = None,+ request_time: datetime.datetime | None = None,) -> list[EventDelivery]:"""Create a list of event deliveries with payloads based on subscription query.@@ -476,7 +474,7 @@ def generate_deferred_payloads(self,event_delivery_ids: list,deferred_payload_data: dict,- send_webhook_queue: Optional[str] = None,+ send_webhook_queue: str | None = None,):deliveries = list(get_multiple_deliveries_for_webhooks(event_delivery_ids)[0].values()diff --git a/saleor/webhook/transport/list_stored_payment_methods.py b/saleor/webhook/transport/list_stored_payment_methods.pyindex 05d7bd83f4..67fb9401c1 100644--- a/saleor/webhook/transport/list_stored_payment_methods.py+++ b/saleor/webhook/transport/list_stored_payment_methods.py@@ -1,5 +1,4 @@import logging-from typing import Optionalimport graphenefrom django.core.cache import cache@@ -26,7 +25,7 @@ logger = logging.getLogger(__name__)def get_credit_card_info(app: App, credit_card_info: dict-) -> Optional[PaymentMethodCreditCardInfo]:+) -> PaymentMethodCreditCardInfo | None:required_fields = ["brand","lastDigits",@@ -83,7 +82,7 @@ def get_credit_card_info(def get_payment_method_from_response(app: "App", payment_method: dict, currency: str-) -> Optional[PaymentMethodData]:+) -> PaymentMethodData | None:payment_method_external_id = payment_method.get("id")if not payment_method_external_id:logger.warning(@@ -151,7 +150,7 @@ def get_list_stored_payment_methods_from_response(def get_response_for_stored_payment_method_request_delete(- response_data: Optional[dict],+ response_data: dict | None,) -> "StoredPaymentMethodRequestDeleteResponseData":if response_data is None:result = StoredPaymentMethodRequestDeleteResult.FAILED_TO_DELIVER@@ -192,7 +191,7 @@ def invalidate_cache_for_stored_payment_methods(def get_response_for_payment_gateway_initialize_tokenization(- response_data: Optional[dict],+ response_data: dict | None,) -> "PaymentGatewayInitializeTokenizationResponseData":data = Noneif response_data is None:@@ -214,7 +213,7 @@ def get_response_for_payment_gateway_initialize_tokenization(def get_response_for_payment_method_tokenization(- response_data: Optional[dict], app: "App"+ response_data: dict | None, app: "App") -> "PaymentMethodTokenizationResponseData":data = Nonepayment_method_id = Nonediff --git a/saleor/webhook/transport/shipping.py b/saleor/webhook/transport/shipping.pyindex 8f6a83503d..447d95ee88 100644--- a/saleor/webhook/transport/shipping.py+++ b/saleor/webhook/transport/shipping.py@@ -2,7 +2,8 @@ import base64import jsonimport loggingfrom collections import defaultdict-from typing import Any, Callable, Optional, Union+from collections.abc import Callable+from typing import Any, Unionfrom django.db.models import QuerySetfrom graphql import GraphQLError@@ -117,10 +118,10 @@ def get_excluded_shipping_methods_or_fetch(webhooks: QuerySet,event_type: str,payload: str,- subscribable_object: Optional[Union["Order", "Checkout"]],+ subscribable_object: Union["Order", "Checkout"] | None,allow_replica: bool,- requestor: Optional[RequestorOrLazyObject],- pregenerated_subscription_payloads: Optional[dict] = None,+ requestor: RequestorOrLazyObject | None,+ pregenerated_subscription_payloads: dict | None = None,) -> dict[str, list[ExcludedShippingMethod]]:"""Return data of all excluded shipping methods.@@ -159,10 +160,10 @@ def get_excluded_shipping_data(event_type: str,previous_value: list[ExcludedShippingMethod],payload_fun: Callable[[], str],- subscribable_object: Optional[Union["Order", "Checkout"]],+ subscribable_object: Union["Order", "Checkout"] | None,allow_replica: bool,- requestor: Optional[RequestorOrLazyObject] = None,- pregenerated_subscription_payloads: Optional[dict] = None,+ requestor: RequestorOrLazyObject | None = None,+ pregenerated_subscription_payloads: dict | None = None,) -> list[ExcludedShippingMethod]:"""Exclude not allowed shipping methods by sync webhook.diff --git a/saleor/webhook/transport/synchronous/transport.py b/saleor/webhook/transport/synchronous/transport.pyindex c6ec51a029..7ec4ccca50 100644--- a/saleor/webhook/transport/synchronous/transport.py+++ b/saleor/webhook/transport/synchronous/transport.py@@ -1,7 +1,8 @@import jsonimport logging+from collections.abc import Callablefrom json import JSONDecodeError-from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar+from typing import TYPE_CHECKING, Any, TypeVarfrom urllib.parse import urlparsefrom django.conf import settings@@ -95,7 +96,7 @@ def handle_transaction_request_task(self, delivery_id, request_event_id) -> Nonedef _send_webhook_request_sync(delivery, timeout=settings.WEBHOOK_SYNC_TIMEOUT, attempt=None-) -> tuple[WebhookResponse, Optional[dict[Any, Any]]]:+) -> tuple[WebhookResponse, dict[Any, Any] | None]:event_payload = delivery.payloaddata = event_payload.get_payload()webhook = delivery.webhook@@ -154,8 +155,7 @@ def _send_webhook_request_sync()if response.status == EventDeliveryStatus.SUCCESS:logger.debug(- "[Webhook] Success response from %r."- "Successful DeliveryAttempt id: %r",+ "[Webhook] Success response from %r.Successful DeliveryAttempt id: %r",sanitize_url_for_logging(webhook.target_url),attempt.id,)@@ -170,7 +170,7 @@ def _send_webhook_request_sync(def send_webhook_request_sync(delivery, timeout=settings.WEBHOOK_SYNC_TIMEOUT-) -> Optional[dict[Any, Any]]:+) -> dict[Any, Any] | None:response, response_data = _send_webhook_request_sync(delivery, timeout)return response_data if response.status == EventDeliveryStatus.SUCCESS else None@@ -186,8 +186,8 @@ def trigger_webhook_sync_if_not_cached(cache_timeout=None,request=None,requestor=None,- pregenerated_subscription_payload: Optional[dict] = None,-) -> Optional[dict]:+ pregenerated_subscription_payload: dict | None = None,+) -> dict | None:"""Get response for synchronous webhook.- Send a synchronous webhook request if cache is expired.@@ -226,9 +226,9 @@ def create_delivery_for_subscription_sync_event(requestor=None,request=None,allow_replica=False,- pregenerated_payload: Optional[dict] = None,+ pregenerated_payload: dict | None = None,with_save=True,-) -> Optional[EventDelivery]:+) -> EventDelivery | None:"""Generate webhook payload based on subscription query and create delivery object.It uses a defined subscription query, defined for webhook to explicitly determine@@ -299,8 +299,8 @@ def trigger_webhook_sync(timeout=None,request=None,requestor=None,- pregenerated_subscription_payload: Optional[dict] = None,-) -> Optional[dict[Any, Any]]:+ pregenerated_subscription_payload: dict | None = None,+) -> dict[Any, Any] | None:"""Send a synchronous webhook request."""if webhook.subscription_query:delivery = create_delivery_for_subscription_sync_event(@@ -333,12 +333,12 @@ def trigger_webhook_sync(def trigger_all_webhooks_sync(event_type: str,generate_payload: Callable,- parse_response: Callable[[Any], Optional[R]],+ parse_response: Callable[[Any], R | None],subscribable_object=None,requestor=None,allow_replica=False,- pregenerated_subscription_payloads: Optional[dict] = None,-) -> Optional[R]:+ pregenerated_subscription_payloads: dict | None = None,+) -> R | None:"""Send all synchronous webhook request for given event type.Requests are send sequentially.diff --git a/saleor/webhook/transport/utils.py b/saleor/webhook/transport/utils.pyindex 62085645d2..ab22e50c21 100644--- a/saleor/webhook/transport/utils.py+++ b/saleor/webhook/transport/utils.py@@ -3,11 +3,12 @@ import decimalimport hashlibimport jsonimport logging+from collections.abc import Callablefrom contextlib import contextmanagerfrom dataclasses import dataclassfrom enum import Enumfrom time import time-from typing import Any, Callable, Optional, Union+from typing import Any, Optionalfrom urllib.parse import unquote, urlparse, urlunparsefrom uuid import UUID@@ -65,17 +66,17 @@ class WebhookSchemes(str, Enum):@dataclassclass PaymentAppData:- app_pk: Optional[int]- app_identifier: Optional[str]+ app_pk: int | None+ app_identifier: str | Nonename: str@dataclassclass WebhookResponse:content: str- request_headers: Optional[dict] = None- response_headers: Optional[dict] = None- response_status_code: Optional[int] = None+ request_headers: dict | None = None+ response_headers: dict | None = None+ response_status_code: int | None = Nonestatus: str = EventDeliveryStatus.SUCCESSduration: float = 0.0@@ -89,10 +90,10 @@ class RequestorModelName:@dataclassclass DeferredPayloadData:model_name: str- object_id: Union[int, UUID]- requestor_model_name: Optional[str]- requestor_object_id: Optional[Union[int, UUID]]- request_time: Optional[datetime.datetime]+ object_id: int | UUID+ requestor_model_name: str | None+ requestor_object_id: int | UUID | None+ request_time: datetime.datetime | Nonedef prepare_deferred_payload_data(@@ -140,7 +141,7 @@ def send_webhook_using_http(signature,event_type,timeout=settings.WEBHOOK_TIMEOUT,- custom_headers: Optional[dict[str, str]] = None,+ custom_headers: dict[str, str] | None = None,) -> WebhookResponse:"""Send a webhook request using http / https protocol.@@ -449,7 +450,7 @@ def catch_duration_time():@allow_writer()def create_attempt(delivery: "EventDelivery",- task_id: Optional[str] = None,+ task_id: str | None = None,with_save: bool = True,):attempt = EventDeliveryAttempt(@@ -545,7 +546,7 @@ def save_unsuccessful_delivery_attempt(attempt: "EventDeliveryAttempt"):def parse_tax_data(response_data: Any,-) -> Optional[TaxData]:+) -> TaxData | None:try:return _unsafe_parse_tax_data(response_data)except (TypeError, KeyError, decimal.DecimalException):@@ -656,7 +657,7 @@ def from_payment_app_id(app_gateway_id: str) -> Optional["PaymentAppData"]:return None-def get_current_tax_app() -> Optional[App]:+def get_current_tax_app() -> App | None:"""Return currently used tax app or None, if there aren't any."""return (App.objects.order_by("pk")diff --git a/saleor/webhook/utils.py b/saleor/webhook/utils.pyindex 56b40478e2..6471454162 100644--- a/saleor/webhook/utils.py+++ b/saleor/webhook/utils.py@@ -17,7 +17,7 @@ if TYPE_CHECKING:def get_filter_for_single_webhook_event(event_type: str,apps_ids: Optional["list[int]"] = None,- apps_identifier: Optional[list[str]] = None,+ apps_identifier: list[str] | None = None,):permissions = {}required_permission = WebhookEventAsyncType.PERMISSIONS.get(@@ -60,7 +60,7 @@ def get_webhooks_for_event(event_type: str,webhooks: Optional["QuerySet[Webhook]"] = None,apps_ids: Optional["list[int]"] = None,- apps_identifier: Optional[list[str]] = None,+ apps_identifier: list[str] | None = None,) -> "QuerySet[Webhook]":"""Get active webhooks from the database for an event."""