Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Bump dependencies (#15528)

Marcin Gębalac3494323313e
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ee102315b3..63e5fb6018 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -11,7 +11,7 @@ repos:
exclude_types: [svg]
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.2.2
+ rev: v0.3.0
hooks:
- id: ruff
- id: ruff-format
@@ -29,7 +29,7 @@ repos:
- id: deptry
- repo: https://github.com/returntocorp/semgrep
- rev: v1.62.0
+ rev: v1.63.0
hooks:
- id: semgrep
language_version: python3.9
diff --git a/poetry.lock b/poetry.lock
index 2461806933..43c4396eb2 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
[[package]]
name = "adyen"
@@ -146,13 +146,13 @@ files = [
[[package]]
name = "azure-core"
-version = "1.30.0"
+version = "1.30.1"
description = "Microsoft Azure Core Library for Python"
optional = false
python-versions = ">=3.7"
files = [
- {file = "azure-core-1.30.0.tar.gz", hash = "sha256:6f3a7883ef184722f6bd997262eddaf80cfe7e5b3e0caaaf8db1695695893d35"},
- {file = "azure_core-1.30.0-py3-none-any.whl", hash = "sha256:3dae7962aad109610e68c9a7abb31d79720e1d982ddf61363038d175a5025e89"},
+ {file = "azure-core-1.30.1.tar.gz", hash = "sha256:26273a254131f84269e8ea4464f3560c731f29c0c1f69ac99010845f239c1a8f"},
+ {file = "azure_core-1.30.1-py3-none-any.whl", hash = "sha256:7c5ee397e48f281ec4dd773d67a0a47a0962ed6fa833036057f9ea067f688e74"},
]
[package.dependencies]
@@ -321,17 +321,17 @@ files = [
[[package]]
name = "boto3"
-version = "1.34.49"
+version = "1.34.54"
description = "The AWS SDK for Python"
optional = false
python-versions = ">= 3.8"
files = [
- {file = "boto3-1.34.49-py3-none-any.whl", hash = "sha256:ce8d1de03024f52a1810e8d71ad4dba3a5b9bb48b35567191500e3432a9130b4"},
- {file = "boto3-1.34.49.tar.gz", hash = "sha256:96b9dc85ce8d52619b56ca7b1ac1423eaf0af5ce132904bcc8aa81396eec2abf"},
+ {file = "boto3-1.34.54-py3-none-any.whl", hash = "sha256:f201b6a416f809283d554c652211eecec9fe3a52ed4063dab3f3e7aea7571d9c"},
+ {file = "boto3-1.34.54.tar.gz", hash = "sha256:8b3f5cc7fbedcbb22271c328039df8a6ab343001e746e0cdb24774c426cadcf8"},
]
[package.dependencies]
-botocore = ">=1.34.49,<1.35.0"
+botocore = ">=1.34.54,<1.35.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.10.0,<0.11.0"
@@ -340,13 +340,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
-version = "1.34.49"
+version = "1.34.54"
description = "Low-level, data-driven core of boto 3."
optional = false
python-versions = ">= 3.8"
files = [
- {file = "botocore-1.34.49-py3-none-any.whl", hash = "sha256:4ed9d7603a04b5bb5bd5de63b513bc2c8a7e8b1cd0088229c5ceb461161f43b6"},
- {file = "botocore-1.34.49.tar.gz", hash = "sha256:d89410bc60673eaff1699f3f1fdcb0e3a5e1f7a6a048c0d88c3ce5c3549433ec"},
+ {file = "botocore-1.34.54-py3-none-any.whl", hash = "sha256:bf215d93e9d5544c593962780d194e74c6ee40b883d0b885e62ef35fc0ec01e5"},
+ {file = "botocore-1.34.54.tar.gz", hash = "sha256:4061ff4be3efcf53547ebadf2c94d419dfc8be7beec24e9fa1819599ffd936fa"},
]
[package.dependencies]
@@ -515,13 +515,13 @@ cffi = ">=1.0.0"
[[package]]
name = "cachetools"
-version = "5.3.2"
+version = "5.3.3"
description = "Extensible memoizing collections and decorators"
optional = false
python-versions = ">=3.7"
files = [
- {file = "cachetools-5.3.2-py3-none-any.whl", hash = "sha256:861f35a13a451f94e301ce2bec7cac63e881232ccce7ed67fab9b5df4d3beaa1"},
- {file = "cachetools-5.3.2.tar.gz", hash = "sha256:086ee420196f7b2ab9ca2db2520aca326318b68fe5ba8bc4d49cca91add450f2"},
+ {file = "cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945"},
+ {file = "cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105"},
]
[[package]]
@@ -1137,19 +1137,18 @@ files = [
[[package]]
name = "django-celery-beat"
-version = "2.5.0"
+version = "2.6.0"
description = "Database-backed Periodic Tasks."
optional = false
python-versions = "*"
files = [
- {file = "django-celery-beat-2.5.0.tar.gz", hash = "sha256:cd0a47f5958402f51ac0c715bc942ae33d7b50b4e48cba91bc3f2712be505df1"},
- {file = "django_celery_beat-2.5.0-py3-none-any.whl", hash = "sha256:ae460faa5ea142fba0875409095d22f6bd7bcc7377889b85e8cab5c0dfb781fe"},
+ {file = "django-celery-beat-2.6.0.tar.gz", hash = "sha256:f75b2d129731f1214be8383e18fae6bfeacdb55dffb2116ce849222c0106f9ad"},
]
[package.dependencies]
celery = ">=5.2.3,<6.0"
cron-descriptor = ">=1.2.32"
-Django = ">=2.2,<5.0"
+Django = ">=2.2,<5.1"
django-timezone-field = ">=5.0"
python-crontab = ">=2.3.4"
tzdata = "*"
@@ -1511,13 +1510,13 @@ boltons = ">=20.0.0"
[[package]]
name = "faker"
-version = "23.2.1"
+version = "23.3.0"
description = "Faker is a Python package that generates fake data for you."
optional = false
python-versions = ">=3.8"
files = [
- {file = "Faker-23.2.1-py3-none-any.whl", hash = "sha256:0520a6b97e07c658b2798d7140971c1d5bc4bcd5013e7937fe075fd054aa320c"},
- {file = "Faker-23.2.1.tar.gz", hash = "sha256:f07b64d27f67b62c7f0536a72f47813015b3b51cd4664918454011094321e464"},
+ {file = "Faker-23.3.0-py3-none-any.whl", hash = "sha256:117ce1a2805c1bc5ca753b3dc6f9d567732893b2294b827d3164261ee8f20267"},
+ {file = "Faker-23.3.0.tar.gz", hash = "sha256:458d93580de34403a8dec1e8d5e6be2fee96c4deca63b95d71df7a6a80a690de"},
]
[package.dependencies]
@@ -1731,13 +1730,13 @@ grpc = ["grpcio (>=1.38.0,<2.0dev)", "grpcio-status (>=1.38.0,<2.0.dev0)"]
[[package]]
name = "google-cloud-pubsub"
-version = "2.19.6"
+version = "2.19.7"
description = "Google Cloud Pub/Sub API client library"
optional = false
python-versions = ">=3.7"
files = [
- {file = "google-cloud-pubsub-2.19.6.tar.gz", hash = "sha256:4eae4bc98463dbdaead7597f7666ffe14fc62aabed10e3e322c95cb050fa7dbe"},
- {file = "google_cloud_pubsub-2.19.6-py2.py3-none-any.whl", hash = "sha256:9edf5ce5642a19567dd71e47b50e63f12ad8072174c01a027d4b52864c74b27d"},
+ {file = "google-cloud-pubsub-2.19.7.tar.gz", hash = "sha256:da5f1eb217c0727befa7c85b9b95e6a89b32b422d548c9cf9a1e029410270b87"},
+ {file = "google_cloud_pubsub-2.19.7-py2.py3-none-any.whl", hash = "sha256:443cb58e2440729876f3b0d6046c30c7a873aeb247e5e17f161fe967c91b53fb"},
]
[package.dependencies]
@@ -3411,13 +3410,13 @@ files = [
[[package]]
name = "pydyf"
-version = "0.8.0"
+version = "0.9.0"
description = "A low-level PDF generator."
optional = false
python-versions = ">=3.7"
files = [
- {file = "pydyf-0.8.0-py3-none-any.whl", hash = "sha256:901186a2e9f897108139426a6486f5225bdcc9b70be2ec965f25111e42f8ac5d"},
- {file = "pydyf-0.8.0.tar.gz", hash = "sha256:b22b1ef016141b54941ad66ed4e036a7bdff39c0b360993b283875c3f854dd9a"},
+ {file = "pydyf-0.9.0-py3-none-any.whl", hash = "sha256:f0e447d9f69ca20cfa3ab3d17e274e26cc877bb6e36b4a83d196616a089db0dd"},
+ {file = "pydyf-0.9.0.tar.gz", hash = "sha256:d5b244e8fc24119ce7bd5d51ea2d6773c0ff88aa81597db556bc440c6b880610"},
]
[package.extras]
@@ -3483,13 +3482,13 @@ test = ["flake8", "isort", "pytest"]
[[package]]
name = "pytest"
-version = "8.0.2"
+version = "8.1.0"
description = "pytest: simple powerful testing with Python"
optional = false
python-versions = ">=3.8"
files = [
- {file = "pytest-8.0.2-py3-none-any.whl", hash = "sha256:edfaaef32ce5172d5466b5127b42e0d6d35ebbe4453f0e3505d96afd93f6b096"},
- {file = "pytest-8.0.2.tar.gz", hash = "sha256:d4051d623a2e0b7e51960ba963193b09ce6daeb9759a451844a21e4ddedfc1bd"},
+ {file = "pytest-8.1.0-py3-none-any.whl", hash = "sha256:ee32db7af8de4629a455806befa90559f307424c07b8413ccfc30bf5b221dd7e"},
+ {file = "pytest-8.1.0.tar.gz", hash = "sha256:f8fa04ab8f98d185113ae60ea6d79c22f8143b14bc1caeced44a0ab844928323"},
]
[package.dependencies]
@@ -3497,11 +3496,11 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
-pluggy = ">=1.3.0,<2.0"
-tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
+pluggy = ">=1.4,<2.0"
+tomli = {version = ">=1", markers = "python_version < \"3.11\""}
[package.extras]
-testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
+testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]]
name = "pytest-asyncio"
@@ -3703,13 +3702,13 @@ cron-schedule = ["croniter"]
[[package]]
name = "python-dateutil"
-version = "2.8.2"
+version = "2.9.0.post0"
description = "Extensions to the standard Python datetime module"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
- {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"},
- {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"},
+ {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"},
]
[package.dependencies]
@@ -3892,17 +3891,17 @@ requests = "*"
[[package]]
name = "redis"
-version = "5.0.1"
+version = "5.0.2"
description = "Python client for Redis database and key-value store"
optional = false
python-versions = ">=3.7"
files = [
- {file = "redis-5.0.1-py3-none-any.whl", hash = "sha256:ed4802971884ae19d640775ba3b03aa2e7bd5e8fb8dfaed2decce4d0fc48391f"},
- {file = "redis-5.0.1.tar.gz", hash = "sha256:0dab495cd5753069d3bc650a0dde8a8f9edde16fc5691b689a566eda58100d0f"},
+ {file = "redis-5.0.2-py3-none-any.whl", hash = "sha256:4caa8e1fcb6f3c0ef28dba99535101d80934b7d4cd541bbb47f4a3826ee472d1"},
+ {file = "redis-5.0.2.tar.gz", hash = "sha256:3f82cc80d350e93042c8e6e7a5d0596e4dd68715babffba79492733e1f367037"},
]
[package.dependencies]
-async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""}
+async-timeout = ">=4.0.3"
[package.extras]
hiredis = ["hiredis (>=1.0.0)"]
@@ -3962,13 +3961,13 @@ dev = ["mypy (>=1.5.1,<1.6.0)", "pytest (>=7.4.0,<7.5.0)", "trustme (>=1.1.0,<2.
[[package]]
name = "rich"
-version = "13.7.0"
+version = "13.7.1"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
optional = false
python-versions = ">=3.7.0"
files = [
- {file = "rich-13.7.0-py3-none-any.whl", hash = "sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235"},
- {file = "rich-13.7.0.tar.gz", hash = "sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa"},
+ {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"},
+ {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"},
]
[package.dependencies]
@@ -4627,13 +4626,13 @@ files = [
[[package]]
name = "types-pyopenssl"
-version = "24.0.0.20240130"
+version = "24.0.0.20240228"
description = "Typing stubs for pyOpenSSL"
optional = false
python-versions = ">=3.8"
files = [
- {file = "types-pyOpenSSL-24.0.0.20240130.tar.gz", hash = "sha256:c812e5c1c35249f75ef5935708b2a997d62abf9745be222e5f94b9595472ab25"},
- {file = "types_pyOpenSSL-24.0.0.20240130-py3-none-any.whl", hash = "sha256:24a255458b5b8a7fca8139cf56f2a8ad5a4f1a5f711b73a5bb9cb50dc688fab5"},
+ {file = "types-pyOpenSSL-24.0.0.20240228.tar.gz", hash = "sha256:cd990717d8aa3743ef0e73e0f462e64b54d90c304249232d48fece4f0f7c3c6a"},
+ {file = "types_pyOpenSSL-24.0.0.20240228-py3-none-any.whl", hash = "sha256:a472cf877a873549175e81972f153f44e975302a3cf17381eb5f3d41ccfb75a4"},
]
[package.dependencies]
@@ -4703,13 +4702,13 @@ types-urllib3 = "*"
[[package]]
name = "types-six"
-version = "1.16.21.20240106"
+version = "1.16.21.20240301"
description = "Typing stubs for six"
optional = false
python-versions = ">=3.8"
files = [
- {file = "types-six-1.16.21.20240106.tar.gz", hash = "sha256:c83908b4925583e973eb9971ef2bd60dbab647611e10e9cd588d2bef415bfe68"},
- {file = "types_six-1.16.21.20240106-py3-none-any.whl", hash = "sha256:3658c9e36e9cb003e522655b01b9ca39bd0db61b6383b3e7d0d10d14f873b338"},
+ {file = "types-six-1.16.21.20240301.tar.gz", hash = "sha256:c877c0fa3dbe696860e571bfc23f987ce084bf4de13dfed343ef61ed49826686"},
+ {file = "types_six-1.16.21.20240301-py3-none-any.whl", hash = "sha256:4d5bbf07e521f0cb52cc880de71047bc9b5c2a5059211811e15423872d403c4c"},
]
[[package]]
@@ -5008,13 +5007,13 @@ files = [
[[package]]
name = "weasyprint"
-version = "61.0"
+version = "61.1"
description = "The Awesome Document Factory"
optional = false
python-versions = ">=3.8"
files = [
- {file = "weasyprint-61.0-py3-none-any.whl", hash = "sha256:1dd5e929389b7ebcbff3088da7af13ae7ab201dce3a2faca7832b1dd5cec60ea"},
- {file = "weasyprint-61.0.tar.gz", hash = "sha256:d91b11a05426fef1d63de826f30a80521d48c6a356455d338c2c429989fa586d"},
+ {file = "weasyprint-61.1-py3-none-any.whl", hash = "sha256:a5622f2c67d408e5d2e94df0ae07b9bd0fa9bb5e1ee466e2211391807f1ece41"},
+ {file = "weasyprint-61.1.tar.gz", hash = "sha256:7cbc824dc4026d82a97362647755f837dd15799949639cc8a428dd33d385009a"},
]
[package.dependencies]
diff --git a/saleor/account/management/commands/createsuperuser.py b/saleor/account/management/commands/createsuperuser.py
index 20789dd0df..97c6fbc0a9 100644
--- a/saleor/account/management/commands/createsuperuser.py
+++ b/saleor/account/management/commands/createsuperuser.py
@@ -3,6 +3,7 @@
This module was moved for Django Auth directly to Saleor.
"""
+
import getpass
import os
import sys
diff --git a/saleor/checkout/models.py b/saleor/checkout/models.py
index d330c17ce0..533e1ebe26 100644
--- a/saleor/checkout/models.py
+++ b/saleor/checkout/models.py
@@ -1,4 +1,5 @@
"""Checkout-related ORM models."""
+
from collections.abc import Iterable
from datetime import date
from decimal import Decimal
diff --git a/saleor/checkout/payment_utils.py b/saleor/checkout/payment_utils.py
index b9c6ca46f4..b92c83b812 100644
--- a/saleor/checkout/payment_utils.py
+++ b/saleor/checkout/payment_utils.py
@@ -1,4 +1,5 @@
"""Checkout-related utility functions."""
+
from collections.abc import Iterable
from typing import Optional
diff --git a/saleor/checkout/problems.py b/saleor/checkout/problems.py
index 62c6c01122..de10a5fdfa 100644
--- a/saleor/checkout/problems.py
+++ b/saleor/checkout/problems.py
@@ -152,9 +152,9 @@ def get_checkout_lines_problems(
The stocks need to have annotated available_quantity field.
"""
- problems: dict[
- CHECKOUT_LINE_PK_TYPE, list[CHECKOUT_LINE_PROBLEM_TYPE]
- ] = defaultdict(list)
+ problems: dict[CHECKOUT_LINE_PK_TYPE, list[CHECKOUT_LINE_PROBLEM_TYPE]] = (
+ defaultdict(list)
+ )
not_available_lines = get_not_available_lines(lines, product_channel_listings_map)
if not_available_lines:
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.py
index 5cec3662f5..f451ed822a 100644
--- a/saleor/checkout/utils.py
+++ b/saleor/checkout/utils.py
@@ -1,4 +1,5 @@
"""Checkout-related utility functions."""
+
from collections.abc import Iterable
from decimal import Decimal
from typing import TYPE_CHECKING, Optional, Union, cast
diff --git a/saleor/core/languages.py b/saleor/core/languages.py
index 1f766dd4d4..bf673287e3 100644
--- a/saleor/core/languages.py
+++ b/saleor/core/languages.py
@@ -25,7 +25,6 @@ for lid in sorted(locale_identifiers()):
languages.append((lid.replace("_", "-"), Locale.parse(lid).english_name))
"""
-
LANGUAGES = [
("af", "Afrikaans"),
("af-na", "Afrikaans (Namibia)"),
diff --git a/saleor/core/utils/editorjs.py b/saleor/core/utils/editorjs.py
index fb54054d38..24d2df5222 100644
--- a/saleor/core/utils/editorjs.py
+++ b/saleor/core/utils/editorjs.py
@@ -18,18 +18,15 @@ ITEM_TYPE_TO_CLEAN_FUNC_MAP = {
@overload
def clean_editor_js(
definitions: Union[dict, str, None], *, to_string: Literal[True]
-) -> str:
- ...
+) -> str: ...
@overload
-def clean_editor_js(definitions: dict) -> dict:
- ...
+def clean_editor_js(definitions: dict) -> dict: ...
@overload
-def clean_editor_js(definitions: None) -> None:
- ...
+def clean_editor_js(definitions: None) -> None: ...
def clean_editor_js(definitions, *, to_string=False) -> Union[dict, str, None]:
diff --git a/saleor/core/weight.py b/saleor/core/weight.py
index 75573dd1b2..8115d5e017 100644
--- a/saleor/core/weight.py
+++ b/saleor/core/weight.py
@@ -12,6 +12,7 @@ in terms of weight.
In the end, it does not really matter unless you travel between
different planets.
"""
+
from django.contrib.sites.models import Site
from measurement.measures import Weight
diff --git a/saleor/csv/tests/export/products_data/utils.py b/saleor/csv/tests/export/products_data/utils.py
index f52fb651ed..45646fd3b0 100644
--- a/saleor/csv/tests/export/products_data/utils.py
+++ b/saleor/csv/tests/export/products_data/utils.py
@@ -143,14 +143,14 @@ def add_channel_to_expected_variant_data(data, variant, channel_ids, pk=None):
data[pk][price_header] = channel_listing.price_amount
data[pk][currency_header] = channel_listing.currency
data[pk][cost_price] = channel_listing.cost_price_amount
- data[pk][
- preorder_quantity_threshold
- ] = channel_listing.preorder_quantity_threshold
+ data[pk][preorder_quantity_threshold] = (
+ channel_listing.preorder_quantity_threshold
+ )
else:
data[price_header] = channel_listing.price_amount
data[currency_header] = channel_listing.currency
data[cost_price] = channel_listing.cost_price_amount
- data[
- preorder_quantity_threshold
- ] = channel_listing.preorder_quantity_threshold
+ data[preorder_quantity_threshold] = (
+ channel_listing.preorder_quantity_threshold
+ )
return data
diff --git a/saleor/giftcard/utils.py b/saleor/giftcard/utils.py
index 60ff947c96..1cd1630750 100644
--- a/saleor/giftcard/utils.py
+++ b/saleor/giftcard/utils.py
@@ -116,9 +116,9 @@ def fulfill_gift_card_lines(
settings: "SiteSettings",
manager: "PluginsManager",
):
- lines_for_warehouses: defaultdict[
- UUID, list[OrderFulfillmentLineInfo]
- ] = defaultdict(list)
+ lines_for_warehouses: defaultdict[UUID, list[OrderFulfillmentLineInfo]] = (
+ defaultdict(list)
+ )
channel_slug = order.channel.slug
for line in gift_card_lines.prefetch_related(
"allocations__stock", "variant__stocks"
diff --git a/saleor/graphql/channel/mutations/utils.py b/saleor/graphql/channel/mutations/utils.py
index a7eb46aa4d..7109b383a0 100644
--- a/saleor/graphql/channel/mutations/utils.py
+++ b/saleor/graphql/channel/mutations/utils.py
@@ -68,13 +68,13 @@ def clean_input_order_settings(
if "delete_expired_orders_after" in order_settings:
delete_expired_orders_after = order_settings["delete_expired_orders_after"]
- cleaned_input[
- "delete_expired_orders_after"
- ] = clean_delete_expired_orders_after(delete_expired_orders_after)
+ cleaned_input["delete_expired_orders_after"] = (
+ clean_delete_expired_orders_after(delete_expired_orders_after)
+ )
- cleaned_input[
- "prev_include_draft_order_in_voucher_usage"
- ] = instance.include_draft_order_in_voucher_usage
+ cleaned_input["prev_include_draft_order_in_voucher_usage"] = (
+ instance.include_draft_order_in_voucher_usage
+ )
def clean_input_checkout_settings(checkout_settings: dict, cleaned_input: dict):
@@ -88,6 +88,6 @@ def clean_input_payment_settings(payment_settings: dict, cleaned_input: dict):
if default_transaction_strategy := payment_settings.get(
"default_transaction_flow_strategy"
):
- cleaned_input[
- "default_transaction_flow_strategy"
- ] = default_transaction_strategy
+ cleaned_input["default_transaction_flow_strategy"] = (
+ default_transaction_strategy
+ )
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.py
index d8e308cbd8..023e65772e 100644
--- a/saleor/graphql/core/mutations.py
+++ b/saleor/graphql/core/mutations.py
@@ -281,8 +281,7 @@ class BaseMutation(graphene.Mutation):
only_type: type[ModelObjectType[MT]],
qs: Any = None,
code: str = "not_found",
- ) -> MT:
- ...
+ ) -> MT: ...
@overload
@classmethod
@@ -295,8 +294,7 @@ class BaseMutation(graphene.Mutation):
only_type: type[ModelObjectType[MT]],
qs: Any = None,
code: str = "not_found",
- ) -> Optional[MT]:
- ...
+ ) -> Optional[MT]: ...
@overload
@classmethod
@@ -309,8 +307,7 @@ class BaseMutation(graphene.Mutation):
only_type: None,
qs: QuerySet[MT],
code: str = "not_found",
- ) -> MT:
- ...
+ ) -> MT: ...
@overload
@classmethod
@@ -323,8 +320,7 @@ class BaseMutation(graphene.Mutation):
only_type: None = None,
qs: Any = None,
code: str = "not_found",
- ) -> Model:
- ...
+ ) -> Model: ...
@overload
@classmethod
@@ -337,8 +333,7 @@ class BaseMutation(graphene.Mutation):
only_type: Any = None,
qs: Any = None,
code: str = "not_found",
- ) -> Optional[Model]:
- ...
+ ) -> Optional[Model]: ...
@classmethod
def get_node_or_error(
@@ -404,15 +399,13 @@ class BaseMutation(graphene.Mutation):
@classmethod
def get_nodes_or_error(
cls, ids, field, only_type: type[ModelObjectType[MT]], qs=None, schema=None
- ) -> list[MT]:
- ...
+ ) -> list[MT]: ...
@overload
@classmethod
def get_nodes_or_error(
cls, ids, field, only_type: Optional[ObjectType] = None, qs=None, schema=None
- ) -> list[Model]:
- ...
+ ) -> list[Model]: ...
@classmethod
def get_nodes_or_error(cls, ids, field, only_type=None, qs=None, schema=None):
@@ -432,9 +425,9 @@ class BaseMutation(graphene.Mutation):
"""
for old_field, new_field in field_map.items():
try:
- validation_error.error_dict[
- new_field
- ] = validation_error.error_dict.pop(old_field)
+ validation_error.error_dict[new_field] = (
+ validation_error.error_dict.pop(old_field)
+ )
except KeyError:
pass
diff --git a/saleor/graphql/core/utils/__init__.py b/saleor/graphql/core/utils/__init__.py
index f4dd3512d4..6820066dc1 100644
--- a/saleor/graphql/core/utils/__init__.py
+++ b/saleor/graphql/core/utils/__init__.py
@@ -47,8 +47,7 @@ def from_global_id_or_error(
global_id: str,
only_type: Union[ObjectType, str, None] = None,
raise_error: Literal[True] = True,
-) -> tuple[str, str]:
- ...
+) -> tuple[str, str]: ...
@overload
@@ -56,8 +55,7 @@ def from_global_id_or_error(
global_id: str,
only_type: Union[type[ObjectType], str, None] = None,
raise_error: bool = False,
-) -> Union[tuple[str, str], tuple[str, None]]:
- ...
+) -> Union[tuple[str, str], tuple[str, None]]: ...
def from_global_id_or_error(
diff --git a/saleor/graphql/discount/dataloaders.py b/saleor/graphql/discount/dataloaders.py
index b5f927107b..18b5e44439 100644
--- a/saleor/graphql/discount/dataloaders.py
+++ b/saleor/graphql/discount/dataloaders.py
@@ -127,9 +127,9 @@ class VoucherChannelListingByVoucherIdAndChanneSlugLoader(DataLoader):
voucher_channel_listing.voucher_id,
voucher_channel_listing.channel_slug,
)
- voucher_channel_listings_by_voucher_and_channel_map[
- key
- ] = voucher_channel_listing
+ voucher_channel_listings_by_voucher_and_channel_map[key] = (
+ voucher_channel_listing
+ )
return [
voucher_channel_listings_by_voucher_and_channel_map.get(key) for key in keys
]
diff --git a/saleor/graphql/order/bulk_mutations/order_bulk_create.py b/saleor/graphql/order/bulk_mutations/order_bulk_create.py
index 2b23ee5c23..87a370bcca 100644
--- a/saleor/graphql/order/bulk_mutations/order_bulk_create.py
+++ b/saleor/graphql/order/bulk_mutations/order_bulk_create.py
@@ -710,9 +710,9 @@ class OrderBulkCreate(BaseMutation, I18nMixin):
object_storage[f"User.id.{user.id}"] = user
object_storage[f"User.email.{user.email}"] = user
if user.external_reference:
- object_storage[
- f"User.external_reference.{user.external_reference}"
- ] = user
+ object_storage[f"User.external_reference.{user.external_reference}"] = (
+ user
+ )
for variant in variants:
object_storage[f"ProductVariant.id.{variant.id}"] = variant
@@ -733,9 +733,9 @@ class OrderBulkCreate(BaseMutation, I18nMixin):
object_storage[f"GiftCard.code.{gift_card.code}"] = gift_card
for order in orders:
- object_storage[
- f"Order.external_reference.{order.external_reference}"
- ] = order
+ object_storage[f"Order.external_reference.{order.external_reference}"] = (
+ order
+ )
for object in [*warehouses, *shipping_methods, *tax_classes, *apps]:
object_storage[f"{object.__class__.__name__}.id.{object.pk}"] = object
diff --git a/saleor/graphql/order/mutations/order_fulfill.py b/saleor/graphql/order/mutations/order_fulfill.py
index 970e915d07..9b1e42daab 100644
--- a/saleor/graphql/order/mutations/order_fulfill.py
+++ b/saleor/graphql/order/mutations/order_fulfill.py
@@ -249,9 +249,9 @@ class OrderFulfill(BaseMutation):
cls.check_total_quantity_of_items(quantities_for_lines)
- lines_for_warehouses: defaultdict[
- UUID, list[OrderFulfillmentLineInfo]
- ] = defaultdict(list)
+ lines_for_warehouses: defaultdict[UUID, list[OrderFulfillmentLineInfo]] = (
+ defaultdict(list)
+ )
for line, order_line in zip(lines, order_lines):
for stock in line["stocks"]:
if stock["quantity"] > 0:
diff --git a/saleor/graphql/product/bulk_mutations/product_variant_bulk_update.py b/saleor/graphql/product/bulk_mutations/product_variant_bulk_update.py
index cdd20a1f3d..cd63d631a6 100644
--- a/saleor/graphql/product/bulk_mutations/product_variant_bulk_update.py
+++ b/saleor/graphql/product/bulk_mutations/product_variant_bulk_update.py
@@ -216,15 +216,15 @@ class ProductVariantBulkUpdate(BaseMutation):
index_error_map,
):
if listings_data := cleaned_input["channel_listings"].get("create"):
- cleaned_input["channel_listings"][
- "create"
- ] = ProductVariantBulkCreate.clean_channel_listings(
- listings_data,
- product_channel_global_id_to_instance_map,
- None,
- variant_index,
- index_error_map,
- "channelListings.create",
+ cleaned_input["channel_listings"]["create"] = (
+ ProductVariantBulkCreate.clean_channel_listings(
+ listings_data,
+ product_channel_global_id_to_instance_map,
+ None,
+ variant_index,
+ index_error_map,
+ "channelListings.create",
+ )
)
if listings_data := cleaned_input["channel_listings"].get("update"):
listings_to_update = []
diff --git a/saleor/graphql/product/dataloaders/products.py b/saleor/graphql/product/dataloaders/products.py
index 95d4cac2a9..d599332f5f 100644
--- a/saleor/graphql/product/dataloaders/products.py
+++ b/saleor/graphql/product/dataloaders/products.py
@@ -131,9 +131,9 @@ class ProductChannelListingByProductIdAndChannelSlugLoader(
product_channel_listings_map: dict[int, ProductChannelListing] = {}
for product_channel_listing in product_channel_listings.iterator():
- product_channel_listings_map[
- product_channel_listing.product_id
- ] = product_channel_listing
+ product_channel_listings_map[product_channel_listing.product_id] = (
+ product_channel_listing
+ )
return [
(products_id, product_channel_listings_map.get(products_id))
@@ -331,9 +331,9 @@ class VariantChannelListingByVariantIdAndChannelLoader(
variant_channel_listings_map: dict[int, ProductVariantChannelListing] = {}
for variant_channel_listing in variant_channel_listings.iterator():
- variant_channel_listings_map[
- variant_channel_listing.variant_id
- ] = variant_channel_listing
+ variant_channel_listings_map[variant_channel_listing.variant_id] = (
+ variant_channel_listing
+ )
return [
(variant_id, variant_channel_listings_map.get(variant_id))
@@ -402,9 +402,9 @@ class VariantsChannelListingByProductIdAndChannelSlugLoader(
.order_by("pk")
)
- variants_channel_listings_map: dict[
- int, list[ProductVariantChannelListing]
- ] = defaultdict(list)
+ variants_channel_listings_map: dict[int, list[ProductVariantChannelListing]] = (
+ defaultdict(list)
+ )
for variant_channel_listing in variants_channel_listings.iterator():
variants_channel_listings_map[
getattr(variant_channel_listing, "product_id") # annotation
@@ -627,9 +627,9 @@ class CollectionChannelListingByCollectionIdAndChannelSlugLoader(DataLoader):
collections_channel_listing.collection_id,
collections_channel_listing.channel_slug,
)
- collections_channel_listings_by_collection_and_channel_map[
- key
- ] = collections_channel_listing
+ collections_channel_listings_by_collection_and_channel_map[key] = (
+ collections_channel_listing
+ )
return [
collections_channel_listings_by_collection_and_channel_map.get(key, None)
for key in keys
diff --git a/saleor/graphql/product/mutations/channels.py b/saleor/graphql/product/mutations/channels.py
index 1281ae7daa..415356e969 100644
--- a/saleor/graphql/product/mutations/channels.py
+++ b/saleor/graphql/product/mutations/channels.py
@@ -246,10 +246,10 @@ class ProductChannelListingUpdate(BaseChannelListingMutation):
defaults[field] = update_channel[field]
is_available_for_purchase = update_channel.get("is_available_for_purchase")
if is_available_for_purchase is not None:
- defaults[
- "available_for_purchase_at"
- ] = cls.get_available_for_purchase_date(
- is_available_for_purchase, update_channel
+ defaults["available_for_purchase_at"] = (
+ cls.get_available_for_purchase_date(
+ is_available_for_purchase, update_channel
+ )
)
product_channel_listing, _ = ProductChannelListing.objects.update_or_create(
product=product, channel=channel, defaults=defaults
diff --git a/saleor/graphql/product/utils.py b/saleor/graphql/product/utils.py
index c5b8fad9a5..d3f6322e42 100644
--- a/saleor/graphql/product/utils.py
+++ b/saleor/graphql/product/utils.py
@@ -108,9 +108,9 @@ def get_draft_order_lines_data_for_variants(
lines = order_models.OrderLine.objects.filter(
variant__id__in=variant_ids, order__status=OrderStatus.DRAFT
).select_related("order")
- order_to_lines_mapping: dict[
- order_models.Order, list[order_models.OrderLine]
- ] = defaultdict(list)
+ order_to_lines_mapping: dict[order_models.Order, list[order_models.OrderLine]] = (
+ defaultdict(list)
+ )
line_pks = set()
order_pks = set()
for line in lines:
diff --git a/saleor/graphql/shipping/utils.py b/saleor/graphql/shipping/utils.py
index 688764d44a..f045f2cc92 100644
--- a/saleor/graphql/shipping/utils.py
+++ b/saleor/graphql/shipping/utils.py
@@ -8,15 +8,15 @@ from ..core.utils import from_global_id_or_error
@overload
-def get_shipping_model_by_object_id(object_id: str, raise_error=True) -> ShippingMethod:
- ...
+def get_shipping_model_by_object_id(
+ object_id: str, raise_error=True
+) -> ShippingMethod: ...
@overload
def get_shipping_model_by_object_id(
object_id: Optional[str], raise_error=False
-) -> Optional[ShippingMethod]:
- ...
+) -> Optional[ShippingMethod]: ...
def get_shipping_model_by_object_id(object_id, raise_error=True):
diff --git a/saleor/order/events.py b/saleor/order/events.py
index f9c1828ac6..e2e3d5ce7c 100644
--- a/saleor/order/events.py
+++ b/saleor/order/events.py
@@ -850,9 +850,9 @@ def order_line_discount_event(
if line_before_update:
discount_parameters["old_value"] = line_before_update.unit_discount_value
discount_parameters["old_value_type"] = line_before_update.unit_discount_type
- discount_parameters[
- "old_amount_value"
- ] = line_before_update.unit_discount_amount
+ discount_parameters["old_amount_value"] = (
+ line_before_update.unit_discount_amount
+ )
line_data = _line_per_quantity_to_line_object(line.quantity, line)
line_data["discount"] = discount_parameters
diff --git a/saleor/payment/gateways/adyen/tests/webhooks/test_validate_notification.py b/saleor/payment/gateways/adyen/tests/webhooks/test_validate_notification.py
index 339f1afb20..9d27778ce5 100644
--- a/saleor/payment/gateways/adyen/tests/webhooks/test_validate_notification.py
+++ b/saleor/payment/gateways/adyen/tests/webhooks/test_validate_notification.py
@@ -82,9 +82,9 @@ def test_validate_auth_user_when_auth_is_disabled(adyen_plugin):
def test_validate_merchant_account(adyen_plugin, notification_with_hmac_signature):
plugin = adyen_plugin()
config = plugin.config
- notification_with_hmac_signature[
- "merchantAccountCode"
- ] = config.connection_params.get("merchant_account")
+ notification_with_hmac_signature["merchantAccountCode"] = (
+ config.connection_params.get("merchant_account")
+ )
assert validate_merchant_account(notification_with_hmac_signature, config) is True
diff --git a/saleor/payment/transaction_item_calculations.py b/saleor/payment/transaction_item_calculations.py
index d074fb8ecb..eea7bcee97 100644
--- a/saleor/payment/transaction_item_calculations.py
+++ b/saleor/payment/transaction_item_calculations.py
@@ -31,8 +31,7 @@ class RefundEvents(BaseEvent):
@dataclass
-class CancelEvents(BaseEvent):
- ...
+class CancelEvents(BaseEvent): ...
PSPReference = str
diff --git a/saleor/payment/utils.py b/saleor/payment/utils.py
index d9a772ca67..bf256ed990 100644
--- a/saleor/payment/utils.py
+++ b/saleor/payment/utils.py
@@ -416,8 +416,7 @@ def create_transaction(
gateway_response: Optional[GatewayResponse] = None,
error_msg=None,
is_success=False,
-) -> Transaction:
- ...
+) -> Transaction: ...
@overload
@@ -430,8 +429,7 @@ def create_transaction(
gateway_response: GatewayResponse,
error_msg=None,
is_success=False,
-) -> Transaction:
- ...
+) -> Transaction: ...
def create_transaction(
diff --git a/saleor/plugins/admin_email/plugin.py b/saleor/plugins/admin_email/plugin.py
index eefe3755bc..a13fa41194 100644
--- a/saleor/plugins/admin_email/plugin.py
+++ b/saleor/plugins/admin_email/plugin.py
@@ -144,24 +144,24 @@ class AdminEmailPlugin(BasePlugin):
},
}
CONFIG_STRUCTURE.update(DEFAULT_EMAIL_CONFIG_STRUCTURE)
- CONFIG_STRUCTURE["host"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_HOST."
- CONFIG_STRUCTURE["port"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_PORT."
- CONFIG_STRUCTURE["username"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_HOST_USER."
- CONFIG_STRUCTURE["password"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_HOST_PASSWORD."
- CONFIG_STRUCTURE["use_tls"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_USE_TLS."
- CONFIG_STRUCTURE["use_ssl"][
- "help_text"
- ] += " Leave it blank if you want to use system environment - EMAIL_USE_SSL."
+ CONFIG_STRUCTURE["host"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_HOST."
+ )
+ CONFIG_STRUCTURE["port"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_PORT."
+ )
+ CONFIG_STRUCTURE["username"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_HOST_USER."
+ )
+ CONFIG_STRUCTURE["password"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_HOST_PASSWORD."
+ )
+ CONFIG_STRUCTURE["use_tls"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_USE_TLS."
+ )
+ CONFIG_STRUCTURE["use_ssl"]["help_text"] += (
+ " Leave it blank if you want to use system environment - EMAIL_USE_SSL."
+ )
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/saleor/plugins/email_common.py b/saleor/plugins/email_common.py
index a8f2130a6b..875fe295b3 100644
--- a/saleor/plugins/email_common.py
+++ b/saleor/plugins/email_common.py
@@ -122,9 +122,9 @@ DEFAULT_EMAIL_CONFIG_STRUCTURE = {
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','')}"
+ address["street_address"] = (
+ 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")
if include_phone and phone:
diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.py
index 5ae9ee9721..ae05b8c464 100644
--- a/saleor/plugins/manager.py
+++ b/saleor/plugins/manager.py
@@ -184,9 +184,9 @@ class PluginsManager(PaymentInterface):
global_configs[db_plugin_config.identifier] = db_plugin_config
else:
db_plugin_config.channel = channel
- channel_configs[channel][
- db_plugin_config.identifier
- ] = db_plugin_config
+ channel_configs[channel][db_plugin_config.identifier] = (
+ db_plugin_config
+ )
return global_configs, channel_configs
@@ -1957,9 +1957,9 @@ class PluginsManager(PaymentInterface):
.prefetch_related("channel")
.all()
)
- self._plugin_configs_per_channel: defaultdict[
- Channel, dict
- ] = defaultdict(dict)
+ self._plugin_configs_per_channel: defaultdict[Channel, dict] = (
+ defaultdict(dict)
+ )
self._global_plugin_configs = {}
for pc in plugin_configurations:
channel = pc.channel
diff --git a/saleor/site/patch_sites.py b/saleor/site/patch_sites.py
index 2c208dab34..8ea083d4ca 100644
--- a/saleor/site/patch_sites.py
+++ b/saleor/site/patch_sites.py
@@ -4,6 +4,7 @@ Since django.contrib.sites may not be thread-safe when there are
multiple instances of the application server, we're patching it with
a thread-safe structure and methods that use it underneath.
"""
+
import threading
from typing import Union
diff --git a/saleor/warehouse/management.py b/saleor/warehouse/management.py
index 1189ad6d14..5a8ac788f3 100644
--- a/saleor/warehouse/management.py
+++ b/saleor/warehouse/management.py
@@ -486,9 +486,9 @@ def decrease_stock(
variant_and_warehouse_to_stock: dict[int, dict[UUID, Stock]] = defaultdict(dict)
for stock in stocks:
- variant_and_warehouse_to_stock[stock.product_variant_id][
- stock.warehouse_id
- ] = stock
+ variant_and_warehouse_to_stock[stock.product_variant_id][stock.warehouse_id] = (
+ stock
+ )
quantity_allocation_list = list(
Allocation.objects.filter(
@@ -703,17 +703,17 @@ def allocate_preorders(
)
listings_reservations: dict = defaultdict(int)
for reservation in quantity_reservation_list:
- listings_reservations[
- reservation["product_variant_channel_listing"]
- ] += reservation["quantity_reserved_sum"]
+ listings_reservations[reservation["product_variant_channel_listing"]] += (
+ reservation["quantity_reserved_sum"]
+ )
else:
listings_reservations = defaultdict(int)
variants_global_allocations: dict[int, int] = defaultdict(int)
for channel_listing in all_variants_channel_listings:
- variants_global_allocations[
- channel_listing["variant_id"]
- ] += quantity_allocation_for_channel[channel_listing["id"]]
+ variants_global_allocations[channel_listing["variant_id"]] += (
+ quantity_allocation_for_channel[channel_listing["id"]]
+ )
insufficient_stocks: list[InsufficientStockData] = []
allocations: list[PreorderAllocation] = []
diff --git a/saleor/warehouse/reservations.py b/saleor/warehouse/reservations.py
index 5ff9fbdf87..48ef47cc06 100644
--- a/saleor/warehouse/reservations.py
+++ b/saleor/warehouse/reservations.py
@@ -415,8 +415,8 @@ def get_listings_reservations(
listings_reservations: dict = defaultdict(int)
for reservation in quantity_reservation_list:
- listings_reservations[
- reservation["product_variant_channel_listing"]
- ] += reservation["quantity_reserved_sum"]
+ listings_reservations[reservation["product_variant_channel_listing"]] += (
+ reservation["quantity_reserved_sum"]
+ )
return listings_reservations
diff --git a/saleor/wsgi/__init__.py b/saleor/wsgi/__init__.py
index caaace631c..9bdba7097b 100644
--- a/saleor/wsgi/__init__.py
+++ b/saleor/wsgi/__init__.py
@@ -11,6 +11,7 @@ that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
+
import os
from django.core.wsgi import get_wsgi_application