Skip to content

Commit d7e7dfb

Browse files
committed
Run make format
1 parent 8e64fb4 commit d7e7dfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+492
-240
lines changed

src/commercetools/contrib/pytest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def commercetools_http_server(commercetools_api):
3434

3535
def serve():
3636
from werkzeug.serving import run_simple
37+
3738
is_running.set()
3839
server.api_url = "http://localhost:8989"
3940
run_simple("localhost", port=8989, application=server)

src/commercetools/helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
from marshmallow import class_registry, fields, missing
44
from marshmallow.exceptions import StringNotCollectionError, ValidationError
55
from marshmallow.fields import Field
6-
from marshmallow.utils import missing as missing_
76
from marshmallow.utils import RAISE, is_collection
7+
from marshmallow.utils import missing as missing_
88

99
from commercetools.exceptions import CommercetoolsError
1010

1111

1212
class OptionalList(fields.List):
13-
1413
def _serialize(
1514
self, value, attr, obj, **kwargs
1615
) -> typing.Optional[typing.List[typing.Any]]:

src/commercetools/services/api_clients.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,20 @@ def query(
3737
"offset": offset,
3838
}
3939
)
40-
return self._client._get("api-clients", params, schemas.ApiClientPagedQueryResponseSchema)
40+
return self._client._get(
41+
"api-clients", params, schemas.ApiClientPagedQueryResponseSchema
42+
)
4143

4244
def create(self, draft: types.ApiClientDraft) -> types.ApiClient:
4345
return self._client._post(
44-
"api-clients", {}, draft, schemas.ApiClientDraftSchema, schemas.ApiClientSchema
46+
"api-clients",
47+
{},
48+
draft,
49+
schemas.ApiClientDraftSchema,
50+
schemas.ApiClientSchema,
4551
)
4652

47-
def delete_by_id(
48-
self,
49-
id: str,
50-
*,
51-
force_delete: bool = False,
52-
) -> types.ApiClient:
53+
def delete_by_id(self, id: str, *, force_delete: bool = False,) -> types.ApiClient:
5354
return self._client._delete(
5455
endpoint=f"api-clients/{id}",
5556
params={},

src/commercetools/services/cart_discounts.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ class CartDiscountQuerySchema(abstract.AbstractQuerySchema):
1616

1717

1818
class CartDiscountService(abstract.AbstractService):
19-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.CartDiscount]:
19+
def get_by_id(
20+
self, id: str, expand: OptionalListStr = None
21+
) -> Optional[types.CartDiscount]:
2022
query_params = {}
2123
if expand:
2224
query_params["expand"] = expand
23-
return self._client._get(f"cart-discounts/{id}", query_params, schemas.CartDiscountSchema)
25+
return self._client._get(
26+
f"cart-discounts/{id}", query_params, schemas.CartDiscountSchema
27+
)
2428

25-
def get_by_key(self, key: str, expand: OptionalListStr = None) -> Optional[types.CartDiscount]:
29+
def get_by_key(
30+
self, key: str, expand: OptionalListStr = None
31+
) -> Optional[types.CartDiscount]:
2632
query_params = {}
2733
if expand:
2834
query_params["expand"] = expand
29-
return self._client._get(f"cart-discounts/key={key}", query_params, schemas.CartDiscountSchema)
35+
return self._client._get(
36+
f"cart-discounts/key={key}", query_params, schemas.CartDiscountSchema
37+
)
3038

3139
def query(
3240
self,
@@ -49,7 +57,9 @@ def query(
4957
"cart-discounts", params, schemas.CartDiscountPagedQueryResponseSchema
5058
)
5159

52-
def create(self, draft: types.CartDiscountDraft, expand: OptionalListStr = None) -> types.CartDiscount:
60+
def create(
61+
self, draft: types.CartDiscountDraft, expand: OptionalListStr = None
62+
) -> types.CartDiscount:
5363
query_params = {}
5464
if expand:
5565
query_params["expand"] = expand
@@ -106,7 +116,12 @@ def update_by_key(
106116
)
107117

108118
def delete_by_id(
109-
self, id: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = True
119+
self,
120+
id: str,
121+
version: int,
122+
expand: OptionalListStr = None,
123+
*,
124+
force_delete: bool = True,
110125
) -> types.CartDiscount:
111126
params = {"version": version}
112127
if expand:
@@ -120,7 +135,12 @@ def delete_by_id(
120135
)
121136

122137
def delete_by_key(
123-
self, key: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = True
138+
self,
139+
key: str,
140+
version: int,
141+
expand: OptionalListStr = None,
142+
*,
143+
force_delete: bool = True,
124144
) -> types.CartDiscount:
125145
params = {"version": version}
126146
if expand:

src/commercetools/services/carts.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ class CartQuerySchema(abstract.AbstractQuerySchema):
1818

1919

2020
class CartService(abstract.AbstractService):
21-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.Cart]:
21+
def get_by_id(
22+
self, id: str, expand: OptionalListStr = None
23+
) -> Optional[types.Cart]:
2224
query_params = {}
2325
if expand:
2426
query_params["expand"] = expand
2527
return self._client._get(f"carts/{id}", query_params, schemas.CartSchema)
2628

27-
def get_by_customer_id(self, customer_id: str, expand: OptionalListStr = None) -> types.Cart:
29+
def get_by_customer_id(
30+
self, customer_id: str, expand: OptionalListStr = None
31+
) -> types.Cart:
2832
query_params = {"customerId": customer_id}
2933
if expand:
3034
query_params["expand"] = expand
@@ -49,7 +53,9 @@ def query(
4953
)
5054
return self._client._get("carts", params, schemas.CartPagedQueryResponseSchema)
5155

52-
def create(self, draft: types.CartDraft, expand: OptionalListStr = None) -> types.Cart:
56+
def create(
57+
self, draft: types.CartDraft, expand: OptionalListStr = None
58+
) -> types.Cart:
5359
query_params = {}
5460
if expand:
5561
query_params["expand"] = expand

src/commercetools/services/categories.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ class CategoryQuerySchema(abstract.AbstractQuerySchema):
1616

1717

1818
class CategoryService(abstract.AbstractService):
19-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.Category]:
19+
def get_by_id(
20+
self, id: str, expand: OptionalListStr = None
21+
) -> Optional[types.Category]:
2022
query_params = {}
2123
if expand:
2224
query_params["expand"] = expand
23-
return self._client._get(f"categories/{id}", query_params, schemas.CategorySchema)
25+
return self._client._get(
26+
f"categories/{id}", query_params, schemas.CategorySchema
27+
)
2428

2529
def get_by_key(self, key: str, expand: OptionalListStr = None) -> types.Category:
2630
query_params = {}
2731
if expand:
2832
query_params["expand"] = expand
29-
return self._client._get(f"categories/key={key}", query_params, schemas.CategorySchema)
33+
return self._client._get(
34+
f"categories/key={key}", query_params, schemas.CategorySchema
35+
)
3036

3137
def query(
3238
self,
@@ -49,12 +55,18 @@ def query(
4955
"categories", params, schemas.CategoryPagedQueryResponseSchema
5056
)
5157

52-
def create(self, draft: types.CategoryDraft, expand: OptionalListStr = None) -> types.Category:
58+
def create(
59+
self, draft: types.CategoryDraft, expand: OptionalListStr = None
60+
) -> types.Category:
5361
query_params = {}
5462
if expand:
5563
query_params["expand"] = expand
5664
return self._client._post(
57-
"categories", query_params, draft, schemas.CategoryDraftSchema, schemas.CategorySchema
65+
"categories",
66+
query_params,
67+
draft,
68+
schemas.CategoryDraftSchema,
69+
schemas.CategorySchema,
5870
)
5971

6072
def update_by_id(
@@ -102,7 +114,12 @@ def update_by_key(
102114
)
103115

104116
def delete_by_id(
105-
self, id: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = True
117+
self,
118+
id: str,
119+
version: int,
120+
expand: OptionalListStr = None,
121+
*,
122+
force_delete: bool = True,
106123
) -> types.Category:
107124
params = {"version": version}
108125
if expand:
@@ -116,7 +133,12 @@ def delete_by_id(
116133
)
117134

118135
def delete_by_key(
119-
self, key: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = True
136+
self,
137+
key: str,
138+
version: int,
139+
expand: OptionalListStr = None,
140+
*,
141+
force_delete: bool = True,
120142
) -> types.Category:
121143
params = {"version": version}
122144
if expand:

src/commercetools/services/channels.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class ChannelQuerySchema(abstract.AbstractQuerySchema):
1616

1717

1818
class ChannelService(abstract.AbstractService):
19-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.Channel]:
19+
def get_by_id(
20+
self, id: str, expand: OptionalListStr = None
21+
) -> Optional[types.Channel]:
2022
query_params = {}
2123
if expand:
2224
query_params["expand"] = expand
@@ -43,7 +45,9 @@ def query(
4345
"channels", params, schemas.ChannelPagedQueryResponseSchema
4446
)
4547

46-
def create(self, draft: types.ChannelDraft, expand: OptionalListStr = None) -> types.Channel:
48+
def create(
49+
self, draft: types.ChannelDraft, expand: OptionalListStr = None
50+
) -> types.Channel:
4751
query_params = {}
4852
if expand:
4953
query_params["expand"] = expand
@@ -78,7 +82,12 @@ def update_by_id(
7882
)
7983

8084
def delete_by_id(
81-
self, id: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = True
85+
self,
86+
id: str,
87+
version: int,
88+
expand: OptionalListStr = None,
89+
*,
90+
force_delete: bool = True,
8291
) -> types.Channel:
8392
params = {"version": version}
8493
if expand:

src/commercetools/services/customer_groups.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ class CustomerGroupDeleteSchema(abstract.AbstractDeleteSchema):
1414

1515

1616
class CustomerGroupService(abstract.AbstractService):
17-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.CustomerGroup]:
17+
def get_by_id(
18+
self, id: str, expand: OptionalListStr = None
19+
) -> Optional[types.CustomerGroup]:
1820
query_params = {}
1921
if expand:
2022
query_params["expand"] = expand
2123
return self._client._get(
2224
f"customer-groups/{id}", query_params, schemas.CustomerGroupSchema
2325
)
2426

25-
def get_by_key(self, key: str, expand: OptionalListStr = None) -> Optional[types.CustomerGroup]:
27+
def get_by_key(
28+
self, key: str, expand: OptionalListStr = None
29+
) -> Optional[types.CustomerGroup]:
2630
query_params = {}
2731
if expand:
2832
query_params["expand"] = expand
@@ -51,7 +55,9 @@ def query(
5155
"customer-groups", params, schemas.CustomerGroupPagedQueryResponseSchema
5256
)
5357

54-
def create(self, draft: types.CustomerGroupDraft, expand: OptionalListStr = None) -> types.CustomerGroup:
58+
def create(
59+
self, draft: types.CustomerGroupDraft, expand: OptionalListStr = None
60+
) -> types.CustomerGroup:
5561
query_params = {}
5662
if expand:
5763
query_params["expand"] = expand
@@ -108,7 +114,12 @@ def update_by_key(
108114
)
109115

110116
def delete_by_id(
111-
self, id: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = False
117+
self,
118+
id: str,
119+
version: int,
120+
expand: OptionalListStr = None,
121+
*,
122+
force_delete: bool = False,
112123
) -> types.CustomerGroup:
113124
params = {"version": version}
114125
if expand:
@@ -122,7 +133,12 @@ def delete_by_id(
122133
)
123134

124135
def delete_by_key(
125-
self, key: str, version: int, expand: OptionalListStr = None, *, force_delete: bool = False
136+
self,
137+
key: str,
138+
version: int,
139+
expand: OptionalListStr = None,
140+
*,
141+
force_delete: bool = False,
126142
) -> types.CustomerGroup:
127143
params = {"version": version}
128144
if expand:

src/commercetools/services/customers.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ class CustomerQuerySchema(abstract.AbstractQuerySchema):
1616

1717

1818
class CustomerService(abstract.AbstractService):
19-
def get_by_id(self, id: str, expand: OptionalListStr = None) -> Optional[types.Customer]:
19+
def get_by_id(
20+
self, id: str, expand: OptionalListStr = None
21+
) -> Optional[types.Customer]:
2022
query_params = {}
2123
if expand:
2224
query_params["expand"] = expand
23-
return self._client._get(f"customers/{id}", query_params, schemas.CustomerSchema)
25+
return self._client._get(
26+
f"customers/{id}", query_params, schemas.CustomerSchema
27+
)
2428

25-
def get_by_key(self, key: str, expand: OptionalListStr = None) -> Optional[types.Customer]:
29+
def get_by_key(
30+
self, key: str, expand: OptionalListStr = None
31+
) -> Optional[types.Customer]:
2632
query_params = {}
2733
if expand:
2834
query_params["expand"] = expand
29-
return self._client._get(f"customers/key={key}", query_params, schemas.CustomerSchema)
35+
return self._client._get(
36+
f"customers/key={key}", query_params, schemas.CustomerSchema
37+
)
3038

3139
def query(
3240
self,
@@ -49,12 +57,18 @@ def query(
4957
"customers", params, schemas.CustomerPagedQueryResponseSchema
5058
)
5159

52-
def create(self, draft: types.CustomerDraft, expand: OptionalListStr = None) -> types.Customer:
60+
def create(
61+
self, draft: types.CustomerDraft, expand: OptionalListStr = None
62+
) -> types.Customer:
5363
query_params = {}
5464
if expand:
5565
query_params["expand"] = expand
5666
return self._client._post(
57-
"customers", query_params, draft, schemas.CustomerDraftSchema, schemas.CustomerSchema
67+
"customers",
68+
query_params,
69+
draft,
70+
schemas.CustomerDraftSchema,
71+
schemas.CustomerSchema,
5872
)
5973

6074
def update_by_id(

0 commit comments

Comments
 (0)