Skip to content

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

Various small fixes (#11128)

Patryk Zawadzki872bbd8c10a7
diff --git a/.editorconfig b/.editorconfig
index c6cbe4a4da..9da05d7ecf 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,27 +8,9 @@ insert_final_newline = true
trim_trailing_whitespace = true
[*.py]
+profile = black
indent_size = 4
-continuation_indent_size = 8
-combine_as_imports = true
max_line_length = 88
-multi_line_output = 4
-quote_type = single
-
-[*.js]
-indent_size = 2
-
-[*.jsx]
-indent_size = 2
-
-[*.scss]
-indent_size = 2
-
-[*.ts]
-indent_size = 2
-
-[*.tsx]
-indent_size = 2
[*.yml]
indent_size = 2
diff --git a/.isort.cfg b/.isort.cfg
index 475aa858b6..e7030b0165 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -7,10 +7,5 @@ skip =
migrations
node_modules
-# Vertical Hanging Indent
-multi_line_output = 3
-include_trailing_comma = True
-
-line_length = 88
known_first_party = saleor
known_third_party = Adyen,PIL,authorizenet,babel,before_after,boto3,botocore,braintree,celery,cryptography,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,posuto,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,uvicorn,versatileimagefield,weasyprint
diff --git a/.vscode/settings.json b/.vscode/settings.json
index ba123bce80..2fb2f98b57 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,5 +3,6 @@
"python.testing.pytestEnabled": true,
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
- "python.linting.mypyEnabled": true
+ "python.linting.mypyEnabled": true,
+ "python.analysis.typeCheckingMode": "basic"
}
diff --git a/poetry.lock b/poetry.lock
index 66343e85f0..6aab27da7c 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -252,14 +252,14 @@ uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "boto3"
-version = "1.25.4"
+version = "1.26.0"
description = "The AWS SDK for Python"
category = "main"
optional = false
python-versions = ">= 3.7"
[package.dependencies]
-botocore = ">=1.28.4,<1.29.0"
+botocore = ">=1.29.0,<1.30.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.6.0,<0.7.0"
@@ -268,7 +268,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
-version = "1.28.4"
+version = "1.29.0"
description = "Low-level, data-driven core of boto 3."
category = "main"
optional = false
@@ -946,7 +946,7 @@ testing = ["pre-commit"]
[[package]]
name = "faker"
-version = "15.1.1"
+version = "15.1.3"
description = "Faker is a Python package that generates fake data for you."
category = "main"
optional = false
@@ -1057,7 +1057,7 @@ grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0dev)"]
[[package]]
name = "google-auth"
-version = "2.13.0"
+version = "2.14.0"
description = "Google Authentication Library"
category = "main"
optional = false
@@ -1810,7 +1810,7 @@ testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "posuto"
-version = "2022.10.0"
+version = "2022.11.0"
description = "Japanese Postal Code Data"
category = "main"
optional = false
@@ -2301,7 +2301,7 @@ python-versions = "*"
[[package]]
name = "pytz"
-version = "2022.5"
+version = "2022.6"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
@@ -2673,6 +2673,14 @@ category = "dev"
optional = false
python-versions = "*"
+[[package]]
+name = "types-mock"
+version = "4.0.15.2"
+description = "Typing stubs for mock"
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "types-pkg-resources"
version = "0.1.3"
@@ -2691,7 +2699,7 @@ python-versions = "*"
[[package]]
name = "types-pytz"
-version = "2022.5.0.0"
+version = "2022.6.0.1"
description = "Typing stubs for pytz"
category = "dev"
optional = false
@@ -2701,7 +2709,7 @@ python-versions = "*"
name = "types-redis"
version = "4.3.21.3"
description = "Typing stubs for redis"
-category = "main"
+category = "dev"
optional = false
python-versions = "*"
@@ -2938,7 +2946,7 @@ test = ["pytest"]
[metadata]
lock-version = "1.1"
python-versions = "~3.9"
-content-hash = "90d6d8c78556dc47da65679b691f63256ebf9787969c44be779c5ea4e5e5677d"
+content-hash = "35a9fefb3cee74e3cb60512695e582b7c0f4cc98263621f4b97204b6d1bc0d7c"
[metadata.files]
adyen = [
@@ -3062,12 +3070,12 @@ black = [
{file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"},
]
boto3 = [
- {file = "boto3-1.25.4-py3-none-any.whl", hash = "sha256:4bbfe9540673940f5a3dea505c5469f48708a56fb588640adb8b6ab7d5f425be"},
- {file = "boto3-1.25.4.tar.gz", hash = "sha256:03e5055d64a596f7a95ed0ca9fda1b67b7aed00d428e4ccef97f2f82b72ec875"},
+ {file = "boto3-1.26.0-py3-none-any.whl", hash = "sha256:0a19d07a39d69b8e84e24d75474bbf4e737b1749d0c665503dfc2446f321e1f0"},
+ {file = "boto3-1.26.0.tar.gz", hash = "sha256:8f0e4eb5c26f927c09bc03302d38156af578b816f1e4f8ca4f0f734d134b9d4f"},
]
botocore = [
- {file = "botocore-1.28.4-py3-none-any.whl", hash = "sha256:09387978a75e7108aa15e8d67bfeb7938cce3d7043339c971daf4277dc4db804"},
- {file = "botocore-1.28.4.tar.gz", hash = "sha256:ade670506c9e837f61d590873a11c5d06ab9a8492b8d5b853d6c4059ecddc03d"},
+ {file = "botocore-1.29.0-py3-none-any.whl", hash = "sha256:c706640f8cf9297d2af87fc711394631afc14aaa225c7554e220964b5047b47d"},
+ {file = "botocore-1.29.0.tar.gz", hash = "sha256:f25dc0827005f81abf4b890a20c71f64ee40ea9e9795df38a242fdeed79e0a89"},
]
braintree = [
{file = "braintree-4.17.1-py2.py3-none-any.whl", hash = "sha256:96410e2d1898cef5bb928b9f9b841e55ff8571ab0eb9b86ec13286ba87aba279"},
@@ -3335,6 +3343,29 @@ cryptography = [
{file = "cryptography-38.0.3-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320"},
{file = "cryptography-38.0.3-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722"},
{file = "cryptography-38.0.3-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f"},
+ {file = "cryptography-38.0.3-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828"},
+ {file = "cryptography-38.0.3-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959"},
+ {file = "cryptography-38.0.3-cp36-abi3-manylinux_2_24_x86_64.whl", hash = "sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2"},
+ {file = "cryptography-38.0.3-cp36-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c"},
+ {file = "cryptography-38.0.3-cp36-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0"},
+ {file = "cryptography-38.0.3-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748"},
+ {file = "cryptography-38.0.3-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146"},
+ {file = "cryptography-38.0.3-cp36-abi3-win32.whl", hash = "sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0"},
+ {file = "cryptography-38.0.3-cp36-abi3-win_amd64.whl", hash = "sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220"},
+ {file = "cryptography-38.0.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd"},
+ {file = "cryptography-38.0.3-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55"},
+ {file = "cryptography-38.0.3-pp37-pypy37_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b"},
+ {file = "cryptography-38.0.3-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36"},
+ {file = "cryptography-38.0.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d"},
+ {file = "cryptography-38.0.3-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7"},
+ {file = "cryptography-38.0.3-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249"},
+ {file = "cryptography-38.0.3-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50"},
+ {file = "cryptography-38.0.3-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0"},
+ {file = "cryptography-38.0.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8"},
+ {file = "cryptography-38.0.3-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436"},
+ {file = "cryptography-38.0.3-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548"},
+ {file = "cryptography-38.0.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a"},
+ {file = "cryptography-38.0.3.tar.gz", hash = "sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd"},
]
cssselect2 = [
{file = "cssselect2-0.7.0-py3-none-any.whl", hash = "sha256:fd23a65bfd444595913f02fc71f6b286c29261e354c41d722ca7a261a49b5969"},
@@ -3471,8 +3502,8 @@ execnet = [
{file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"},
]
faker = [
- {file = "Faker-15.1.1-py3-none-any.whl", hash = "sha256:096c15e136adb365db24d8c3964fe26bfc68fe060c9385071a339f8c14e09c8a"},
- {file = "Faker-15.1.1.tar.gz", hash = "sha256:a741b77f484215c3aab2604100669657189548f440fcb2ed0f8b7ee21c385629"},
+ {file = "Faker-15.1.3-py3-none-any.whl", hash = "sha256:bd922a6ad210bb96a5b31987e10918851131c9670429172d5bfb3a5ede238a79"},
+ {file = "Faker-15.1.3.tar.gz", hash = "sha256:1bfb1b447cd45169a74a09f821cee47f51548508b62a29f6dfdab1d001d448a4"},
]
fakeredis = [
{file = "fakeredis-1.10.0-py3-none-any.whl", hash = "sha256:0be420a79fabda234963a2730c4ce609a6d44a598e8dd253ce97785bef944285"},
@@ -3499,8 +3530,8 @@ google-api-core = [
{file = "google_api_core-2.10.2-py3-none-any.whl", hash = "sha256:34f24bd1d5f72a8c4519773d99ca6bf080a6c4e041b4e9f024fe230191dda62e"},
]
google-auth = [
- {file = "google-auth-2.13.0.tar.gz", hash = "sha256:9352dd6394093169157e6971526bab9a2799244d68a94a4a609f0dd751ef6f5e"},
- {file = "google_auth-2.13.0-py2.py3-none-any.whl", hash = "sha256:99510e664155f1a3c0396a076b5deb6367c52ea04d280152c85ac7f51f50eb42"},
+ {file = "google-auth-2.14.0.tar.gz", hash = "sha256:cf24817855d874ede2efd071aa22125445f555de1685b739a9782fcf408c2a3d"},
+ {file = "google_auth-2.14.0-py2.py3-none-any.whl", hash = "sha256:1ad5b0e6eba5f69645971abb3d2c197537d5914070a8c6d30299dfdb07c5c700"},
]
google-cloud-core = [
{file = "google-cloud-core-2.3.2.tar.gz", hash = "sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a"},
@@ -4131,7 +4162,7 @@ pluggy = [
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"},
]
posuto = [
- {file = "posuto-2022.10.0.tar.gz", hash = "sha256:683196b620178fc153876b854fdeebde7c9337cbf5cae92c7275431194721d59"},
+ {file = "posuto-2022.11.0.tar.gz", hash = "sha256:5b32d4db8c9bd707ce19abc3ce1f2986ef75b968631c21e044745c5c03c05de5"},
]
pre-commit = [
{file = "pre_commit-2.20.0-py2.py3-none-any.whl", hash = "sha256:51a5ba7c480ae8072ecdb6933df22d2f812dc897d5fe848778116129a681aac7"},
@@ -4310,8 +4341,8 @@ pytimeparse = [
{file = "pytimeparse-1.1.8.tar.gz", hash = "sha256:e86136477be924d7e670646a98561957e8ca7308d44841e21f5ddea757556a0a"},
]
pytz = [
- {file = "pytz-2022.5-py2.py3-none-any.whl", hash = "sha256:335ab46900b1465e714b4fda4963d87363264eb662aab5e65da039c25f1f5b22"},
- {file = "pytz-2022.5.tar.gz", hash = "sha256:c4d88f472f54d615e9cd582a5004d1e5f624854a6a27a6211591c251f22a6914"},
+ {file = "pytz-2022.6-py2.py3-none-any.whl", hash = "sha256:222439474e9c98fced559f1709d89e6c9cbf8d79c794ff3eb9f8800064291427"},
+ {file = "pytz-2022.6.tar.gz", hash = "sha256:e89512406b793ca39f5971bc999cc538ce125c0e51c27941bef4568b460095e2"},
]
pywatchman = [
{file = "pywatchman-1.4.1.tar.gz", hash = "sha256:d0047eb275deafb0011eda0a1a815fbd9742478c3d2b5ad6956d300e447dc2f9"},
@@ -4487,6 +4518,10 @@ types-freezegun = [
{file = "types-freezegun-1.1.10.tar.gz", hash = "sha256:cb3a2d2eee950eacbaac0673ab50499823365ceb8c655babb1544a41446409ec"},
{file = "types_freezegun-1.1.10-py3-none-any.whl", hash = "sha256:fadebe72213e0674036153366205038e1f95c8ca96deb4ef9b71ddc15413543e"},
]
+types-mock = [
+ {file = "types-mock-4.0.15.2.tar.gz", hash = "sha256:83fe479741adb92210c3c92f006fe058297d5051e93c2cec36f1a9e0bae16e9e"},
+ {file = "types_mock-4.0.15.2-py3-none-any.whl", hash = "sha256:39d489b6d9361b75448677680a3087701c0cfab61260363cfc0f646d2bf0a8b2"},
+]
types-pkg-resources = [
{file = "types-pkg_resources-0.1.3.tar.gz", hash = "sha256:834a9b8d3dbea343562fd99d5d3359a726f6bf9d3733bccd2b4f3096fbab9dae"},
{file = "types_pkg_resources-0.1.3-py2.py3-none-any.whl", hash = "sha256:0cb9972cee992249f93fff1a491bf2dc3ce674e5a1926e27d4f0866f7d9b6d9c"},
@@ -4496,8 +4531,8 @@ types-python-dateutil = [
{file = "types_python_dateutil-2.8.19.2-py3-none-any.whl", hash = "sha256:3f4dbe465e7e0c6581db11fd7a4855d1355b78712b3f292bd399cd332247e9c0"},
]
types-pytz = [
- {file = "types-pytz-2022.5.0.0.tar.gz", hash = "sha256:0c163b15d3e598e6cc7074a99ca9ec72b25dc1b446acc133b827667af0b7b09a"},
- {file = "types_pytz-2022.5.0.0-py3-none-any.whl", hash = "sha256:a8e1fe6a1b270fbfaf2553b20ad0f1316707cc320e596da903bb17d7373fed2d"},
+ {file = "types-pytz-2022.6.0.1.tar.gz", hash = "sha256:d078196374d1277e9f9984d49373ea043cf2c64d5d5c491fbc86c258557bd46f"},
+ {file = "types_pytz-2022.6.0.1-py3-none-any.whl", hash = "sha256:bea605ce5d5a5d52a8e1afd7656c9b42476e18a0f888de6be91587355313ddf4"},
]
types-redis = [
{file = "types-redis-4.3.21.3.tar.gz", hash = "sha256:2e1f184056188c8754ded0b5173dc01824d2bfe41975fe318068a68beedfb62c"},
diff --git a/pyproject.toml b/pyproject.toml
index 669c77160d..29f51d8e6d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -72,7 +72,6 @@ documentation = "https://docs.saleor.io/"
graphene = "<3.0"
uvicorn = {extras = ["standard"], version = "^0.19.0"}
Authlib = "^1.0.0"
- types-redis = "^4.2.6"
[tool.poetry.dependencies.celery]
version = ">=4.4.5,<6.0.0"
@@ -113,6 +112,8 @@ documentation = "https://docs.saleor.io/"
pytest-xdist = "^3.0.2"
mypy = "^0.982"
pywatchman = "^1.4.1"
+ types-mock = "^4.0.15.2"
+ types-redis = "^4.2.6"
types-requests = "^2.28.2"
types-pytz = "^2022.1.1"
types-pkg-resources = "^0.1.3"
@@ -124,7 +125,6 @@ documentation = "https://docs.saleor.io/"
types-freezegun = "^1.1.7"
types-six = "^1.16.17"
fakeredis = "^1.8"
- types-redis = "^4.2.6"
[tool.black]
target_version = [ "py35", "py36", "py37", "py38" ]
diff --git a/requirements.txt b/requirements.txt
index f789cdfc9f..1fc517c9c7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,8 +14,8 @@ babel==2.10.3 ; python_version >= "3.9" and python_version < "3.10"
bcrypt==4.0.1 ; python_version >= "3.9" and python_version < "3.10"
beautifulsoup4==4.7.1 ; python_version >= "3.9" and python_version < "3.10"
billiard==3.6.4.0 ; python_version >= "3.9" and python_version < "3.10"
-boto3==1.25.4 ; python_version >= "3.9" and python_version < "3.10"
-botocore==1.28.4 ; python_version >= "3.9" and python_version < "3.10"
+boto3==1.26.0 ; python_version >= "3.9" and python_version < "3.10"
+botocore==1.29.0 ; python_version >= "3.9" and python_version < "3.10"
braintree==4.17.1 ; python_version >= "3.9" and python_version < "3.10"
brotli==1.0.9 ; platform_python_implementation == "CPython" and python_version >= "3.9" and python_version < "3.10"
brotlicffi==1.0.9.2 ; platform_python_implementation != "CPython" and python_version >= "3.9" and python_version < "3.10"
@@ -56,12 +56,12 @@ django[bcrypt]==3.2.16 ; python_version >= "3.9" and python_version < "3.10"
draftjs-sanitizer==1.0.0 ; python_version >= "3.9" and python_version < "3.10"
enmerkar==0.7.1 ; python_version >= "3.9" and python_version < "3.10"
et-xmlfile==1.1.0 ; python_version >= "3.9" and python_version < "3.10"
-faker==15.1.1 ; python_version >= "3.9" and python_version < "3.10"
+faker==15.1.3 ; python_version >= "3.9" and python_version < "3.10"
fonttools[woff]==4.38.0 ; python_version >= "3.9" and python_version < "3.10"
freezegun==1.2.2 ; python_version >= "3.9" and python_version < "3.10"
google-api-core==2.10.2 ; python_version >= "3.9" and python_version < "3.10"
google-api-core[grpc]==2.10.2 ; python_version >= "3.9" and python_version < "3.10"
-google-auth==2.13.0 ; python_version >= "3.9" and python_version < "3.10"
+google-auth==2.14.0 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-core==2.3.2 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-pubsub==2.13.10 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-storage==2.5.0 ; python_version >= "3.9" and python_version < "3.10"
@@ -104,7 +104,7 @@ packaging==21.3 ; python_version >= "3.9" and python_version < "3.10"
petl==1.7.11 ; python_version >= "3.9" and python_version < "3.10"
phonenumberslite==8.12.57 ; python_version >= "3.9" and python_version < "3.10"
pillow==9.3.0 ; python_version >= "3.9" and python_version < "3.10"
-posuto==2022.10.0 ; python_version >= "3.9" and python_version < "3.10"
+posuto==2022.11.0 ; python_version >= "3.9" and python_version < "3.10"
prices==1.1.1 ; python_version >= "3.9" and python_version < "3.10"
promise==2.3 ; python_version >= "3.9" and python_version < "3.10"
prompt-toolkit==3.0.31 ; python_version >= "3.9" and python_version < "3.10"
@@ -128,7 +128,7 @@ python-json-logger==2.0.4 ; python_version >= "3.9" and python_version < "3.10"
python-magic-bin==0.4.14 ; python_version >= "3.9" and python_version < "3.10" and sys_platform == "win32"
python-magic==0.4.27 ; python_version >= "3.9" and python_version < "3.10"
pytimeparse==1.1.8 ; python_version >= "3.9" and python_version < "3.10"
-pytz==2022.5 ; python_version >= "3.9" and python_version < "3.10"
+pytz==2022.6 ; python_version >= "3.9" and python_version < "3.10"
pyxb==1.2.5 ; python_version >= "3.9" and python_version < "3.10"
pyyaml==6.0 ; python_version >= "3.9" and python_version < "3.10"
razorpay==1.3.0 ; python_version >= "3.9" and python_version < "3.10"
@@ -153,7 +153,6 @@ threadloop==1.0.2 ; python_version >= "3.9" and python_version < "3.10"
thrift==0.16.0 ; python_version >= "3.9" and python_version < "3.10"
tinycss2==1.2.1 ; python_version >= "3.9" and python_version < "3.10"
tornado==6.2 ; python_version >= "3.9" and python_version < "3.10"
-types-redis==4.3.21.3 ; python_version >= "3.9" and python_version < "3.10"
typing-extensions==4.4.0 ; python_version >= "3.9" and python_version < "3.10"
tzdata==2022.6 ; python_version >= "3.9" and python_version < "3.10"
urllib3==1.26.12 ; python_version >= "3.9" and python_version < "3.10"
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 62fb37c979..3707e4add8 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -19,8 +19,8 @@ beautifultable==0.7.0 ; python_version >= "3.9" and python_version < "3.10"
before-after==1.0.1 ; python_version >= "3.9" and python_version < "3.10"
billiard==3.6.4.0 ; python_version >= "3.9" and python_version < "3.10"
black==22.10.0 ; python_version >= "3.9" and python_version < "3.10"
-boto3==1.25.4 ; python_version >= "3.9" and python_version < "3.10"
-botocore==1.28.4 ; python_version >= "3.9" and python_version < "3.10"
+boto3==1.26.0 ; python_version >= "3.9" and python_version < "3.10"
+botocore==1.29.0 ; python_version >= "3.9" and python_version < "3.10"
braintree==4.17.1 ; python_version >= "3.9" and python_version < "3.10"
brotli==1.0.9 ; platform_python_implementation == "CPython" and python_version >= "3.9" and python_version < "3.10"
brotlicffi==1.0.9.2 ; platform_python_implementation != "CPython" and python_version >= "3.9" and python_version < "3.10"
@@ -75,7 +75,7 @@ enmerkar==0.7.1 ; python_version >= "3.9" and python_version < "3.10"
et-xmlfile==1.1.0 ; python_version >= "3.9" and python_version < "3.10"
exceptiongroup==1.0.0 ; python_version >= "3.9" and python_version < "3.10"
execnet==1.9.0 ; python_version >= "3.9" and python_version < "3.10"
-faker==15.1.1 ; python_version >= "3.9" and python_version < "3.10"
+faker==15.1.3 ; python_version >= "3.9" and python_version < "3.10"
fakeredis==1.10.0 ; python_version >= "3.9" and python_version < "3.10"
filelock==3.8.0 ; python_version >= "3.9" and python_version < "3.10"
flake8==4.0.1 ; python_version >= "3.9" and python_version < "3.10"
@@ -83,7 +83,7 @@ fonttools[woff]==4.38.0 ; python_version >= "3.9" and python_version < "3.10"
freezegun==1.2.2 ; python_version >= "3.9" and python_version < "3.10"
google-api-core==2.10.2 ; python_version >= "3.9" and python_version < "3.10"
google-api-core[grpc]==2.10.2 ; python_version >= "3.9" and python_version < "3.10"
-google-auth==2.13.0 ; python_version >= "3.9" and python_version < "3.10"
+google-auth==2.14.0 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-core==2.3.2 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-pubsub==2.13.10 ; python_version >= "3.9" and python_version < "3.10"
google-cloud-storage==2.5.0 ; python_version >= "3.9" and python_version < "3.10"
@@ -142,7 +142,7 @@ phonenumberslite==8.12.57 ; python_version >= "3.9" and python_version < "3.10"
pillow==9.3.0 ; python_version >= "3.9" and python_version < "3.10"
platformdirs==2.5.2 ; python_version >= "3.9" and python_version < "3.10"
pluggy==1.0.0 ; python_version >= "3.9" and python_version < "3.10"
-posuto==2022.10.0 ; python_version >= "3.9" and python_version < "3.10"
+posuto==2022.11.0 ; python_version >= "3.9" and python_version < "3.10"
pre-commit==2.20.0 ; python_version >= "3.9" and python_version < "3.10"
prices==1.1.1 ; python_version >= "3.9" and python_version < "3.10"
promise==2.3 ; python_version >= "3.9" and python_version < "3.10"
@@ -183,7 +183,7 @@ python-json-logger==2.0.4 ; python_version >= "3.9" and python_version < "3.10"
python-magic-bin==0.4.14 ; python_version >= "3.9" and python_version < "3.10" and sys_platform == "win32"
python-magic==0.4.27 ; python_version >= "3.9" and python_version < "3.10"
pytimeparse==1.1.8 ; python_version >= "3.9" and python_version < "3.10"
-pytz==2022.5 ; python_version >= "3.9" and python_version < "3.10"
+pytz==2022.6 ; python_version >= "3.9" and python_version < "3.10"
pywatchman==1.4.1 ; python_version >= "3.9" and python_version < "3.10"
pyxb==1.2.5 ; python_version >= "3.9" and python_version < "3.10"
pyyaml==6.0 ; python_version >= "3.9" and python_version < "3.10"
@@ -217,9 +217,10 @@ tomlkit==0.11.6 ; python_version >= "3.9" and python_version < "3.10"
tornado==6.2 ; python_version >= "3.9" and python_version < "3.10"
types-certifi==2021.10.8.3 ; python_version >= "3.9" and python_version < "3.10"
types-freezegun==1.1.10 ; python_version >= "3.9" and python_version < "3.10"
+types-mock==4.0.15.2 ; python_version >= "3.9" and python_version < "3.10"
types-pkg-resources==0.1.3 ; python_version >= "3.9" and python_version < "3.10"
types-python-dateutil==2.8.19.2 ; python_version >= "3.9" and python_version < "3.10"
-types-pytz==2022.5.0.0 ; python_version >= "3.9" and python_version < "3.10"
+types-pytz==2022.6.0.1 ; python_version >= "3.9" and python_version < "3.10"
types-redis==4.3.21.3 ; python_version >= "3.9" and python_version < "3.10"
types-requests==2.28.11.2 ; python_version >= "3.9" and python_version < "3.10"
types-six==1.16.21 ; python_version >= "3.9" and python_version < "3.10"
diff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.py
index ecc94a9f52..3f18945d07 100644
--- a/saleor/core/utils/__init__.py
+++ b/saleor/core/utils/__init__.py
@@ -95,7 +95,7 @@ def to_local_currency(price, currency):
def generate_unique_slug(
- instance: Type[Model],
+ instance: Model,
slugable_value: str,
slug_field_name: str = "slug",
*,
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.py
index 6cd9baed05..00dca1b7c8 100644
--- a/saleor/core/utils/random_data.py
+++ b/saleor/core/utils/random_data.py
@@ -517,7 +517,7 @@ def create_address(save=True, **kwargs):
)
if address.country == "US":
- state = fake.state_abbr()
+ state = fake.state_abbr(include_territories=False)
address.country_area = state
address.postal_code = fake.postalcode_in_state(state)
else:
diff --git a/saleor/graphql/core/tests/test_core.py b/saleor/graphql/core/tests/test_core.py
index 044d4b184b..15a658cbc3 100644
--- a/saleor/graphql/core/tests/test_core.py
+++ b/saleor/graphql/core/tests/test_core.py
@@ -248,14 +248,13 @@ def test_validate_image_file():
img_data = BytesIO()
image = Image.new("RGB", size=(1, 1))
image.save(img_data, format="JPEG")
- img = SimpleUploadedFile("product.jpg", img_data.getvalue(), "image/jpeg")
field = "image"
# when
- result = validate_image_file(img, field, ProductErrorCode)
+ img = SimpleUploadedFile("product.jpg", img_data.getvalue(), "image/jpeg")
# then
- assert not result
+ validate_image_file(img, field, ProductErrorCode)
def test_validate_image_file_invalid_content_type():
@@ -367,18 +366,17 @@ def test_validate_image_url_valid_image_response(monkeypatch):
Mock(return_value=valid_image_response_mock),
)
field = "image"
- dummy_url = "http://example.com/valid_url.jpg"
# when
- result = validate_image_url(
+ dummy_url = "http://example.com/valid_url.jpg"
+
+ # then
+ validate_image_url(
dummy_url,
field,
- ProductErrorCode.INVALID,
+ ProductErrorCode.INVALID.value,
)
- # then
- assert result is None
-
def test_validate_image_url_invalid_mimetype_response(monkeypatch):
# given
@@ -396,7 +394,7 @@ def test_validate_image_url_invalid_mimetype_response(monkeypatch):
validate_image_url(
dummy_url,
field,
- ProductErrorCode.INVALID,
+ ProductErrorCode.INVALID.value,
)
# then
@@ -419,7 +417,7 @@ def test_validate_image_url_response_without_content_headers(monkeypatch):
validate_image_url(
dummy_url,
field,
- ProductErrorCode.INVALID,
+ ProductErrorCode.INVALID.value,
)
# then
diff --git a/saleor/graphql/core/utils/__init__.py b/saleor/graphql/core/utils/__init__.py
index 67eb401682..19884c44f8 100644
--- a/saleor/graphql/core/utils/__init__.py
+++ b/saleor/graphql/core/utils/__init__.py
@@ -130,7 +130,7 @@ def _validate_image_format(file, field_name, error_class):
def validate_slug_and_generate_if_needed(
- instance: Type["Model"],
+ instance: "Model",
slugable_field: str,
cleaned_input: dict,
slug_field_name: str = "slug",
@@ -196,7 +196,9 @@ def validate_if_int_or_uuid(id):
def from_global_id_or_error(
- global_id: str, only_type: Union[ObjectType, str] = None, raise_error: bool = False
+ global_id: str,
+ only_type: Union[ObjectType, str, None] = None,
+ raise_error: bool = False,
):
"""Resolve global ID or raise GraphQLError.
@@ -226,7 +228,7 @@ def from_global_id_or_error(
def from_global_id_or_none(
- global_id, only_type: Union[ObjectType, str] = None, raise_error: bool = False
+ global_id, only_type: Union[ObjectType, str, None] = None, raise_error: bool = False
):
if not global_id:
return None
diff --git a/saleor/graphql/core/validators/query_cost.py b/saleor/graphql/core/validators/query_cost.py
index 687941eef7..931aeb9edc 100644
--- a/saleor/graphql/core/validators/query_cost.py
+++ b/saleor/graphql/core/validators/query_cost.py
@@ -1,6 +1,6 @@
from functools import reduce
from operator import add, mul
-from typing import Any, Dict, List, Optional, Type, Union, cast
+from typing import Any, Dict, List, Optional, Union, cast
from graphql import (
GraphQLError,
@@ -257,9 +257,8 @@ def report_error(context: ValidationContext, error: Exception):
def cost_analysis_message(maximum_cost: int, cost: int) -> str:
- return "The query exceeds the maximum cost of %d. Actual cost is %d" % (
- maximum_cost,
- cost,
+ return (
+ f"The query exceeds the maximum cost of {maximum_cost}. Actual cost is {cost}"
)
@@ -274,8 +273,8 @@ def cost_validator(
default_complexity: int = 1,
variables: Optional[Dict] = None,
cost_map: Optional[Dict[str, Dict[str, Any]]] = None,
-) -> Type[ValidationRule]:
- validator = CostValidator(
+) -> CostValidator:
+ return CostValidator(
maximum_cost=maximum_cost,
default_cost=default_cost,
default_complexity=default_complexity,
@@ -283,8 +282,6 @@ def cost_validator(
cost_map=cost_map,
)
- return cast(Type[ValidationRule], validator)
-
def validate_query_cost(
schema,
diff --git a/setup.cfg b/setup.cfg
index 59feb41658..fa8c7a1332 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,6 +30,7 @@ exclude =
__pycache__/,
node_modules/,
*/migrations/
+extend-ignore = E203
ignore = H101,H238,H301,H306,W503
max-complexity = 31
max-line-length = 88