Skip to content

Commit e8010cf

Browse files
committed
lint/typing fixes and change Sentinel-1 to Sentinel-2
1 parent 4c89c64 commit e8010cf

File tree

6 files changed

+19
-25
lines changed

6 files changed

+19
-25
lines changed

planet/clients/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@
1616
from .orders import OrdersClient
1717
from .subscriptions import SubscriptionsClient
1818

19-
__all__ = [
20-
'DataClient',
21-
'OrdersClient',
22-
'SubscriptionsClient'
23-
]
19+
__all__ = ['DataClient', 'OrdersClient', 'SubscriptionsClient']

planet/order_request.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,9 @@ def harmonize_tool(target_sensor: str) -> dict:
448448
'''
449449

450450
try:
451-
target_sensor = specs.get_match(
452-
target_sensor,
453-
specs.HARMONIZE_TOOL_TARGET_SENSORS,
454-
'target_sensor')
451+
target_sensor = specs.get_match(target_sensor,
452+
specs.HARMONIZE_TOOL_TARGET_SENSORS,
453+
'target_sensor')
455454
except specs.SpecificationException as e:
456455
raise ClientError(e)
457456

planet/specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
SUPPORTED_ORDER_TYPES = ['full', 'partial']
3434
SUPPORTED_ARCHIVE_TYPES = ['zip']
3535
SUPPORTED_FILE_FORMATS = ['COG', 'PL_NITF']
36-
HARMONIZE_TOOL_TARGET_SENSORS = ('Sentinel-1')
36+
HARMONIZE_TOOL_TARGET_SENSORS = ('Sentinel-2', )
3737

3838
LOGGER = logging.getLogger(__name__)
3939

planet/subscription_request.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# the License.
1414
"""Functionality for preparing subscription requests."""
1515
from datetime import datetime
16-
from typing import Optional, List
16+
from typing import Any, Dict, Optional, List
1717

1818
from . import geojson, specs
1919
from .exceptions import ClientError
@@ -50,8 +50,8 @@
5050
def build_request(name: str,
5151
source: dict,
5252
delivery: dict,
53-
notifications: dict = None,
54-
tools: List[dict] = None) -> dict:
53+
notifications: Optional[dict] = None,
54+
tools: Optional[List[dict]] = None) -> dict:
5555
"""Prepare a subscriptions request.
5656
5757
@@ -88,11 +88,7 @@ def build_request(name: str,
8888
tools: Tools to apply to the products. Order defines
8989
the toolchain order of operatations.
9090
"""
91-
details = {
92-
"name": name,
93-
"source": source,
94-
"delivery": delivery
95-
}
91+
details = {"name": name, "source": source, "delivery": delivery}
9692

9793
if notifications:
9894
details['notifications'] = notifications
@@ -428,7 +424,7 @@ def reproject_tool(projection: str,
428424
except specs.SpecificationException as e:
429425
raise ClientError(e)
430426

431-
parameters = {"projection": projection, "kernel": kernel}
427+
parameters: Dict[str, Any] = {"projection": projection, "kernel": kernel}
432428
if resolution is not None:
433429
parameters['resolution'] = resolution
434430

tests/unit/test_order_request.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,9 @@ def test_toar_tool():
263263
assert tt_empty == expected_empty
264264

265265

266-
@pytest.mark.parametrize("target_sensor", ["PS2", "Sentinel-2"])
267-
def test_harmonization_tool_success(target_sensor):
268-
ht = order_request.harmonize_tool(target_sensor)
269-
expected = {'harmonize': {'target_sensor': target_sensor}}
266+
def test_harmonization_tool_success():
267+
ht = order_request.harmonize_tool("Sentinel-2")
268+
expected = {'harmonize': {'target_sensor': "Sentinel-2"}}
270269
assert ht == expected
271270

272271

tests/unit/test_subscription_request.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,13 @@ def test_file_format_tool_invalid_format():
229229

230230

231231
def test_harmonize_tool_success():
232-
res = subscription_request.harmonize_tool('PS2')
232+
res = subscription_request.harmonize_tool('Sentinel-2')
233233

234-
expected = {"type": "harmonize", "parameters": {"target_sensor": "PS2"}}
234+
expected = {
235+
"type": "harmonize", "parameters": {
236+
"target_sensor": "Sentinel-2"
237+
}
238+
}
235239
assert res == expected
236240

237241

0 commit comments

Comments
 (0)