Skip to content

Commit 740026a

Browse files
committed
fix typing errors
1 parent ef8fba6 commit 740026a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

planet/order_request.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Functionality for preparing order details for use in creating an order"""
1616
from __future__ import annotations # https://stackoverflow.com/a/33533514
1717
import logging
18-
from typing import Optional, Any, Dict, List
18+
from typing import Optional, Any, Dict, List, Union
1919

2020
from . import geojson, specs
2121
from .exceptions import ClientError
@@ -143,19 +143,21 @@ def notifications(email: Optional[bool] = None,
143143
webhook_per_order: Request a single webhook call per order instead
144144
of one call per each delivered item.
145145
'''
146-
notifications_dict = {}
146+
notifications_dict: Dict[str, Union[dict, bool]] = {}
147147

148148
if webhook_url:
149-
webhook_dict = {
150-
'url': webhook_url
151-
}
149+
webhook_dict: Dict[str, Union[str, bool]] = {
150+
'url': webhook_url,
151+
}
152152
if webhook_per_order is not None:
153-
webhook_dict['per_order'] = webhook_per_order
153+
wpo: bool = webhook_per_order
154+
webhook_dict['per_order'] = wpo
154155

155156
notifications_dict['webhook'] = webhook_dict
156157

157158
if email is not None:
158-
notifications_dict['email'] = email
159+
val: bool = email
160+
notifications_dict['email'] = val
159161

160162
return notifications_dict
161163

tests/unit/test_order_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ def test_product():
119119

120120
def test_notifications():
121121
notifications_config = order_request.notifications(
122-
email='email', webhook_url='webhookurl', webhook_per_order=True)
122+
email=True, webhook_url='webhookurl', webhook_per_order=True)
123123
expected = {
124-
'email': 'email', 'webhook': {
124+
'email': True, 'webhook': {
125125
'url': 'webhookurl', 'per_order': True
126126
}
127127
}

0 commit comments

Comments
 (0)