From 472930556e525e8633525fcdeff979910cbf475f Mon Sep 17 00:00:00 2001 From: Julien Perrochet Date: Tue, 31 Oct 2023 19:01:03 +0100 Subject: [PATCH] [uss_qualifier] make start/end time optional parameters of make_volume_4d and its callers --- monitoring/monitorlib/mutate/rid.py | 4 ++-- monitoring/monitorlib/rid_v1.py | 16 ++++++++++++---- monitoring/monitorlib/rid_v2.py | 18 +++++++++++++----- .../scenarios/astm/netrid/dss_wrapper.py | 8 ++++---- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/monitoring/monitorlib/mutate/rid.py b/monitoring/monitorlib/mutate/rid.py index 1661fd41ee..09fbe25cf0 100644 --- a/monitoring/monitorlib/mutate/rid.py +++ b/monitoring/monitorlib/mutate/rid.py @@ -97,8 +97,8 @@ def upsert_subscription( area_vertices: List[s2sphere.LatLng], alt_lo: float, alt_hi: float, - start_time: datetime.datetime, - end_time: datetime.datetime, + start_time: Optional[datetime.datetime], + end_time: Optional[datetime.datetime], uss_base_url: str, subscription_id: str, rid_version: RIDVersion, diff --git a/monitoring/monitorlib/rid_v1.py b/monitoring/monitorlib/rid_v1.py index 60780ce1d9..08a51ce168 100644 --- a/monitoring/monitorlib/rid_v1.py +++ b/monitoring/monitorlib/rid_v1.py @@ -23,8 +23,8 @@ def make_volume_4d( vertices: List[s2sphere.LatLng], alt_lo: float, alt_hi: float, - start_time: datetime.datetime, - end_time: datetime.datetime, + start_time: Optional[datetime.datetime], + end_time: Optional[datetime.datetime], ) -> Volume4D: return ImplicitDict.parse( { @@ -38,8 +38,16 @@ def make_volume_4d( "altitude_lo": alt_lo, "altitude_hi": alt_hi, }, - "time_start": StringBasedDateTime(start_time), - "time_end": StringBasedDateTime(end_time), + **( + {"time_start": StringBasedDateTime(start_time)} + if start_time is not None + else {} + ), + **( + {"time_end": StringBasedDateTime(end_time)} + if end_time is not None + else {} + ), }, Volume4D, ) diff --git a/monitoring/monitorlib/rid_v2.py b/monitoring/monitorlib/rid_v2.py index fbad7f5947..0183f03755 100644 --- a/monitoring/monitorlib/rid_v2.py +++ b/monitoring/monitorlib/rid_v2.py @@ -1,5 +1,5 @@ import datetime -from typing import List +from typing import List, Optional import s2sphere from implicitdict import ImplicitDict, StringBasedDateTime @@ -33,8 +33,8 @@ def make_volume_4d( vertices: List[s2sphere.LatLng], alt_lo: float, alt_hi: float, - start_time: datetime.datetime, - end_time: datetime.datetime, + start_time: Optional[datetime.datetime], + end_time: Optional[datetime.datetime], ) -> Volume4D: return ImplicitDict.parse( { @@ -48,8 +48,16 @@ def make_volume_4d( "altitude_lower": make_altitude(alt_lo), "altitude_upper": make_altitude(alt_hi), }, - "time_start": make_time(start_time), - "time_end": make_time(end_time), + **( + {"time_start": StringBasedDateTime(start_time)} + if start_time is not None + else {} + ), + **( + {"time_end": StringBasedDateTime(end_time)} + if end_time is not None + else {} + ), }, Volume4D, ) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py b/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py index d18ef2b063..d5e14263ca 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py @@ -775,8 +775,8 @@ def put_sub_expect_response_code( area_vertices: List[s2sphere.LatLng], alt_lo: float, alt_hi: float, - start_time: datetime.datetime, - end_time: datetime.datetime, + start_time: Optional[datetime.datetime], + end_time: Optional[datetime.datetime], expected_error_codes: Set[int], uss_base_url: str, sub_id: str, @@ -823,8 +823,8 @@ def put_sub( area_vertices: List[s2sphere.LatLng], alt_lo: float, alt_hi: float, - start_time: datetime.datetime, - end_time: datetime.datetime, + start_time: Optional[datetime.datetime], + end_time: Optional[datetime.datetime], uss_base_url: str, sub_id: str, sub_version: Optional[str] = None,