From ff24040de50c3941d16d47a0ba3e3d90af16d3a2 Mon Sep 17 00:00:00 2001 From: Michael Barroco Date: Fri, 4 Aug 2023 17:59:58 +0200 Subject: [PATCH] format --- .../mock_uss/riddp/routes_observation.py | 22 +++++++++++-------- .../resources/netrid/observers.py | 5 ++++- .../netrid/common_dictionary_evaluator.py | 18 +++++++-------- .../common_dictionary_evaluator_test.py | 2 +- .../astm/netrid/display_data_evaluator.py | 2 +- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/monitoring/mock_uss/riddp/routes_observation.py b/monitoring/mock_uss/riddp/routes_observation.py index af892f2897..98534723b7 100644 --- a/monitoring/mock_uss/riddp/routes_observation.py +++ b/monitoring/mock_uss/riddp/routes_observation.py @@ -165,20 +165,24 @@ def riddp_flight_details(flight_id: str) -> Tuple[str, int]: return f'Flight "{flight_id}" not found', 404 rid_version: RIDVersion = webapp.config[KEY_RID_VERSION] - flight_details = fetch.flight_details(flight_info.flights_url, flight_id, True, rid_version, utm_client) + flight_details = fetch.flight_details( + flight_info.flights_url, flight_id, True, rid_version, utm_client + ) if rid_version == RIDVersion.f3411_19: # TODO: Implement details for F3411-19 return flask.jsonify(observation_api.GetDetailsResponse(id=flight_id)) elif rid_version == RIDVersion.f3411_22a: result = observation_api.GetDetailsResponse( - id=flight_id, - operator_id=flight_details.details.v22a_value.get("operator_id"), - uas_id=flight_details.details.v22a_value.get("uas_id"), - operator_location=flight_details.details.v22a_value.get("operator_location"), - operational_status=flight_details.details.v22a_value.get("operational_status"), - ) - return flask.jsonify( - result + id=flight_id, + operator_id=flight_details.details.v22a_value.get("operator_id"), + uas_id=flight_details.details.v22a_value.get("uas_id"), + operator_location=flight_details.details.v22a_value.get( + "operator_location" + ), + operational_status=flight_details.details.v22a_value.get( + "operational_status" + ), ) + return flask.jsonify(result) else: return f"Support for RID version {rid_version} not yet implemented", 501 diff --git a/monitoring/uss_qualifier/resources/netrid/observers.py b/monitoring/uss_qualifier/resources/netrid/observers.py index 19e9e3df63..d1302e14d6 100644 --- a/monitoring/uss_qualifier/resources/netrid/observers.py +++ b/monitoring/uss_qualifier/resources/netrid/observers.py @@ -54,7 +54,10 @@ def observe_flight_details( self, flight_id: str ) -> Tuple[Optional[observation_api.GetDetailsResponse], fetch.Query]: query = fetch.query_and_describe( - self.session, "GET", f"/display_data/{flight_id}", scope=self.rid_version.read_scope + self.session, + "GET", + f"/display_data/{flight_id}", + scope=self.rid_version.read_scope, ) try: result = ( diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py index af8de16d8c..a5d9d8748a 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py @@ -3,10 +3,12 @@ from uas_standards.ansi_cta_2063_a import SerialNumber from uas_standards.astm.f3411 import v22a +from monitoring.monitorlib.fetch.rid import FetchedFlights from monitoring.monitorlib.fetch.rid import ( - FetchedFlights + FetchedUSSFlightDetails, + FetchedUSSFlights, + FlightDetails, ) -from monitoring.monitorlib.fetch.rid import FetchedUSSFlightDetails, FetchedUSSFlights, FlightDetails from monitoring.monitorlib.geo import validate_lat, validate_lng from monitoring.monitorlib.rid import RIDVersion from monitoring.uss_qualifier.common_data_definitions import Severity @@ -45,13 +47,11 @@ def evaluate_sp_details(self, details: FlightDetails, participants: List[str]): details.v22a_value.get("operator_location"), participants ) - def evaluate_dp_details(self, observed_details: Optional[FlightDetails], injected_flight, participants): - self.evaluate_operator_id( - observed_details.get("operator_id"), participants - ) - self.evaluate_uas_id( - observed_details.get("uas_id"), participants - ) + def evaluate_dp_details( + self, observed_details: Optional[FlightDetails], injected_flight, participants + ): + self.evaluate_operator_id(observed_details.get("operator_id"), participants) + self.evaluate_uas_id(observed_details.get("uas_id"), participants) self.evaluate_operator_location( observed_details.get("operator_location"), participants ) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator_test.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator_test.py index 2fb6f88d07..20db870b70 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator_test.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator_test.py @@ -177,4 +177,4 @@ def step_under_test(self: UnitTestScenario): def test_operational_status(): _assert_operational_status("Undeclared", True) # v19 and v22a _assert_operational_status("Emergency", True) # v22a only - _assert_operational_status("Invalid", False) # Invalid \ No newline at end of file + _assert_operational_status("Invalid", False) # Invalid diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py index a7f4035d74..44a848e03c 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py @@ -377,7 +377,7 @@ def _evaluate_normal_observation( mapping.injected_flight, participants=[ observer.participant_id, - mapping.injected_flight.uss_participant_id + mapping.injected_flight.uss_participant_id, ], )