Skip to content

Commit 2daefe7

Browse files
davidweteringsmvantellingen
authored andcommitted
WIP: update *all* dependencies and regenerate
1 parent 26a38d5 commit 2daefe7

39 files changed

+1421
-215
lines changed

codegen/generate_services.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import textwrap
66
import typing
77
from collections import defaultdict
8-
from re import A
9-
10-
from attr import Attribute
11-
from black import KEYWORDS
128

139
from codegen.generate_abstract import AbstractModuleGenerator
1410
from codegen.service_processor import (

codegen/main.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pathlib import Path
44

55
import astor
6-
import astunparse
76
import black
87
import isort.api
98

@@ -49,7 +48,7 @@ def generate_services_modules(services: ServiceProcessor, types):
4948

5049

5150
def generate():
52-
raml = parse_raml_file("../commercetools-api-reference/api.raml")
51+
raml = parse_raml_file("../commercetools-api-reference/api-specs/api/api.raml")
5352

5453
types = raml["types"].types.values()
5554
services = raml["services"]
@@ -99,18 +98,18 @@ def write_module(filename, ast):
9998
reformat_code(filename)
10099

101100

102-
def reformat_code(filename):
103-
101+
def reformat_code(filename: str):
104102
config = isort.api.Config()
105103
isort.api.sort_file(filename, config=config)
106104

107105
src = Path(filename)
108106
report = black.Report()
107+
mode = black.Mode()
109108
black.reformat_one(
110109
src=src,
111-
line_length=88,
112-
fast=False,
110+
# https://github.com/psf/black/issues/1629 known issue
111+
fast=True,
113112
write_back=black.WriteBack.YES,
114-
mode=black.FileMode.AUTO_DETECT,
113+
mode=mode,
115114
report=report,
116115
)

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ per-file-ignores =
77

88

99
[tool:pytest]
10-
minversion = 3.0
11-
strict = true
10+
minversion = 6.0
1211
testpaths = tests

setup.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
from setuptools import find_packages, setup
44

55
install_requires = [
6-
"requests>=2.7.0",
6+
"requests>=2.25.1",
77
"pytz",
8-
"requests-oauthlib>=1.0.0",
9-
"requests_mock>=0.7.0",
10-
"marshmallow>=3.0.0",
8+
"requests-oauthlib>=1.3.0",
9+
"requests_mock>=1.8.0",
10+
"marshmallow>=3.9.1",
1111
"marshmallow-enum>=1.5.1",
12-
"WebOb>=1.8.0",
13-
"Werkzeug>=0.15.2",
14-
"wrapt>=1.10.0",
12+
"WebOb>=1.8.6",
13+
"Werkzeug>=1.0.1",
14+
"wrapt>=1.12.1",
1515
]
1616

1717
codegen_requires = [
1818
"astunparse==1.6.3",
1919
"astor==0.8.1",
20-
"attrs>=18.2.0",
21-
"black==18.9b0",
22-
"isort[pyproject]==5.2.2",
23-
"PyYAML==3.13",
20+
"attrs>=20.3.0",
21+
"black==20.8b1",
22+
"isort==5.6.4",
23+
"PyYAML==5.3.1",
2424
]
2525

2626
docs_require = [
@@ -30,19 +30,19 @@
3030
]
3131

3232
tests_require = [
33-
"freezegun==0.3.8",
34-
"mock==2.0.0",
35-
"pretend==1.0.8",
36-
"coverage[toml]>=5.0.2",
37-
"pytest-cov==2.5.1",
38-
"pytest==3.1.3",
33+
"freezegun==1.0.0",
34+
"mock==4.0.3",
35+
"pretend==1.0.9",
36+
"coverage[toml]>=5.3",
37+
"pytest-cov==2.10.1",
38+
"pytest==6.2.1",
3939
# Linting
40-
"isort==5.2.2",
41-
"flake8==3.3.0",
40+
"isort==5.6.4",
41+
"flake8==3.8.4",
4242
"flake8-blind-except==0.1.1",
4343
"flake8-debugger==1.4.0",
4444
"flake8-imports==0.1.1",
45-
"mypy==0.761",
45+
"mypy==0.790",
4646
]
4747

4848

src/commercetools/_schemas/_cart.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ class CustomLineItemDraftSchema(marshmallow.Schema):
571571
data_key="externalTaxRate",
572572
)
573573
custom = helpers.LazyNestedField(
574-
nested="commercetools._schemas._type.CustomFieldsSchema",
574+
nested="commercetools._schemas._type.CustomFieldsDraftSchema",
575575
unknown=marshmallow.EXCLUDE,
576576
allow_none=True,
577577
missing=None,
@@ -1268,22 +1268,14 @@ def post_load(self, data, **kwargs):
12681268
class TaxedPriceDraftSchema(marshmallow.Schema):
12691269
"""Marshmallow schema for :class:`commercetools.types.TaxedPriceDraft`."""
12701270

1271-
total_net = helpers.Discriminator(
1272-
discriminator_field=("type", "type"),
1273-
discriminator_schemas={
1274-
"centPrecision": "commercetools._schemas._common.CentPrecisionMoneyDraftSchema",
1275-
"highPrecision": "commercetools._schemas._common.HighPrecisionMoneyDraftSchema",
1276-
},
1271+
total_net = helpers.LazyNestedField(
1272+
nested="commercetools._schemas._common.MoneySchema",
12771273
unknown=marshmallow.EXCLUDE,
12781274
allow_none=True,
12791275
data_key="totalNet",
12801276
)
1281-
total_gross = helpers.Discriminator(
1282-
discriminator_field=("type", "type"),
1283-
discriminator_schemas={
1284-
"centPrecision": "commercetools._schemas._common.CentPrecisionMoneyDraftSchema",
1285-
"highPrecision": "commercetools._schemas._common.HighPrecisionMoneyDraftSchema",
1286-
},
1277+
total_gross = helpers.LazyNestedField(
1278+
nested="commercetools._schemas._common.MoneySchema",
12871279
unknown=marshmallow.EXCLUDE,
12881280
allow_none=True,
12891281
data_key="totalGross",

src/commercetools/_schemas/_cart_discount.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ class CartDiscountSchema(BaseResourceSchema):
195195
value = helpers.Discriminator(
196196
discriminator_field=("type", "type"),
197197
discriminator_schemas={
198-
"absolute": "commercetools._schemas._cart_discount.CartDiscountValueAbsoluteSchema",
199-
"giftLineItem": "commercetools._schemas._cart_discount.CartDiscountValueGiftLineItemSchema",
200-
"relative": "commercetools._schemas._cart_discount.CartDiscountValueRelativeSchema",
198+
"absolute": "commercetools._schemas._cart_discount.CartDiscountValueAbsoluteDraftSchema",
199+
"giftLineItem": "commercetools._schemas._cart_discount.CartDiscountValueGiftLineItemDraftSchema",
200+
"relative": "commercetools._schemas._cart_discount.CartDiscountValueRelativeDraftSchema",
201201
},
202202
unknown=marshmallow.EXCLUDE,
203203
allow_none=True,
@@ -714,20 +714,20 @@ class CartDiscountValueGiftLineItemDraftSchema(CartDiscountValueDraftSchema):
714714
"""Marshmallow schema for :class:`commercetools.types.CartDiscountValueGiftLineItemDraft`."""
715715

716716
product = helpers.LazyNestedField(
717-
nested="commercetools._schemas._product.ProductReferenceSchema",
717+
nested="commercetools._schemas._product.ProductResourceIdentifierSchema",
718718
unknown=marshmallow.EXCLUDE,
719719
allow_none=True,
720720
)
721721
variant_id = marshmallow.fields.Integer(allow_none=True, data_key="variantId")
722722
supply_channel = helpers.LazyNestedField(
723-
nested="commercetools._schemas._channel.ChannelReferenceSchema",
723+
nested="commercetools._schemas._channel.ChannelResourceIdentifierSchema",
724724
unknown=marshmallow.EXCLUDE,
725725
allow_none=True,
726726
missing=None,
727727
data_key="supplyChannel",
728728
)
729729
distribution_channel = helpers.LazyNestedField(
730-
nested="commercetools._schemas._channel.ChannelReferenceSchema",
730+
nested="commercetools._schemas._channel.ChannelResourceIdentifierSchema",
731731
unknown=marshmallow.EXCLUDE,
732732
allow_none=True,
733733
missing=None,

src/commercetools/_schemas/_common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,9 @@ class TypedMoneyDraftSchema(MoneySchema):
812812
"""Marshmallow schema for :class:`commercetools.types.TypedMoneyDraft`."""
813813

814814
type = marshmallow_enum.EnumField(types.MoneyType, by_value=True)
815+
fraction_digits = marshmallow.fields.Integer(
816+
allow_none=True, missing=None, data_key="fractionDigits"
817+
)
815818

816819
class Meta:
817820
unknown = marshmallow.EXCLUDE

0 commit comments

Comments
 (0)