Format with updated black

This commit is contained in:
Raffson
2024-10-12 17:20:44 +02:00
parent 11a9d67b91
commit 5fdf38c663
58 changed files with 164 additions and 187 deletions

View File

@@ -1,4 +1,5 @@
"""Objective adjacency lists."""
from __future__ import annotations
from typing import Dict, Iterator, List, Optional, TYPE_CHECKING

View File

@@ -201,9 +201,11 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
return_ascent = self._create_ascent_or_descent(
builder,
cargo.next_stop.position
if cargo.next_stop != self.flight.arrival
else cargo.origin.position,
(
cargo.next_stop.position
if cargo.next_stop != self.flight.arrival
else cargo.origin.position
),
self.flight.arrival.position,
altitude,
altitude_is_agl,
@@ -211,9 +213,11 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
return_descent = self._create_ascent_or_descent(
builder,
self.flight.arrival.position,
cargo.next_stop.position
if cargo.next_stop != self.flight.arrival
else cargo.origin.position,
(
cargo.next_stop.position
if cargo.next_stop != self.flight.arrival
else cargo.origin.position
),
altitude,
altitude_is_agl,
)

View File

@@ -5,6 +5,7 @@ MissionPlanner. Those only plan basic information like the objective, aircraft
type, and the size of the flight. The FlightPlanBuilder is responsible for
generating the waypoints for the mission.
"""
from __future__ import annotations
import math

View File

@@ -33,8 +33,7 @@ class FormationLayout(LoiterLayout, ABC):
class FormationFlightPlan(LoiterFlightPlan, ABC):
@property
@abstractmethod
def package_speed_waypoints(self) -> set[FlightWaypoint]:
...
def package_speed_waypoints(self) -> set[FlightWaypoint]: ...
@property
def combat_speed_waypoints(self) -> set[FlightWaypoint]:
@@ -77,13 +76,11 @@ class FormationFlightPlan(LoiterFlightPlan, ABC):
@property
@abstractmethod
def join_time(self) -> datetime:
...
def join_time(self) -> datetime: ...
@property
@abstractmethod
def split_time(self) -> datetime:
...
def split_time(self) -> datetime: ...
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> datetime | None:
if waypoint == self.layout.join:

View File

@@ -60,8 +60,7 @@ class IBuilder(ABC, Generic[FlightPlanT, LayoutT]):
return self.flight.departure.theater
@abstractmethod
def build(self, dump_debug_info: bool = False) -> FlightPlanT:
...
def build(self, dump_debug_info: bool = False) -> FlightPlanT: ...
@property
def package(self) -> Package:

View File

@@ -26,8 +26,7 @@ class LoiterFlightPlan(StandardFlightPlan[Any], ABC):
@property
@abstractmethod
def push_time(self) -> datetime:
...
def push_time(self) -> datetime: ...
def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> datetime | None:
if waypoint == self.layout.hold:

View File

@@ -14,5 +14,4 @@ class UiZone:
class UiZoneDisplay(abc.ABC):
@abc.abstractmethod
def ui_zone(self) -> UiZone:
...
def ui_zone(self) -> UiZone: ...

View File

@@ -273,9 +273,11 @@ class WaypointBuilder:
return FlightWaypoint(
"INGRESS",
ingress_type,
objective.position.point_from_heading(heading, nautical_miles(5).meters)
if self.is_helo
else position,
(
objective.position.point_from_heading(heading, nautical_miles(5).meters)
if self.is_helo
else position
),
alt,
alt_type,
description=f"INGRESS on {objective.name}",
@@ -328,9 +330,11 @@ class WaypointBuilder:
return FlightWaypoint(
target.name,
FlightWaypointType.TARGET_POINT,
target.target.ground_object.position
if isinstance(target.target, TheaterGroup)
else target.target.position,
(
target.target.ground_object.position
if isinstance(target.target, TheaterGroup)
else target.target.position
),
meters(0),
"RADIO",
description=description,
@@ -432,9 +436,11 @@ class WaypointBuilder:
"CAS",
FlightWaypointType.CAS,
position,
feet(self.flight.coalition.game.settings.heli_combat_alt_agl)
if self.is_helo
else max(meters(1000), altitude),
(
feet(self.flight.coalition.game.settings.heli_combat_alt_agl)
if self.is_helo
else max(meters(1000), altitude)
),
"RADIO",
description="Provide CAS",
pretty_name="CAS",

View File

@@ -60,14 +60,12 @@ class FlightState(ABC):
@property
@abstractmethod
def cancelable(self) -> bool:
...
def cancelable(self) -> bool: ...
@abstractmethod
def on_game_tick(
self, events: GameUpdateEvents, time: datetime, duration: timedelta
) -> None:
...
) -> None: ...
@property
def in_flight(self) -> bool:
@@ -98,17 +96,14 @@ class FlightState(ABC):
@property
@abstractmethod
def is_waiting_for_start(self) -> bool:
...
def is_waiting_for_start(self) -> bool: ...
@abstractmethod
def estimate_position(self) -> Point:
...
def estimate_position(self) -> Point: ...
@property
@abstractmethod
def spawn_type(self) -> StartType:
...
def spawn_type(self) -> StartType: ...
def a2a_commit_region(self) -> Optional[ThreatPoly]:
return None

View File

@@ -57,16 +57,13 @@ class InFlight(FlightState, ABC):
)
@abstractmethod
def estimate_position(self) -> Point:
...
def estimate_position(self) -> Point: ...
@abstractmethod
def estimate_altitude(self) -> tuple[Distance, str]:
...
def estimate_altitude(self) -> tuple[Distance, str]: ...
@abstractmethod
def estimate_speed(self) -> Speed:
...
def estimate_speed(self) -> Speed: ...
def estimate_fuel_at_current_waypoint(self) -> float:
initial_fuel = super().estimate_fuel()

View File

@@ -9,36 +9,28 @@ if TYPE_CHECKING:
class IFlightRoster(ABC):
@abstractmethod
def iter_pilots(self) -> Iterator[Pilot | None]:
...
def iter_pilots(self) -> Iterator[Pilot | None]: ...
@abstractmethod
def pilot_at(self, idx: int) -> Pilot | None:
...
def pilot_at(self, idx: int) -> Pilot | None: ...
@property
@abstractmethod
def squadron(self) -> Squadron:
...
def squadron(self) -> Squadron: ...
@property
@abstractmethod
def max_size(self) -> int:
...
def max_size(self) -> int: ...
@property
@abstractmethod
def player_count(self) -> int:
...
def player_count(self) -> int: ...
@abstractmethod
def resize(self, new_size: int) -> None:
...
def resize(self, new_size: int) -> None: ...
@abstractmethod
def set_pilot(self, index: int, pilot: Optional[Pilot]) -> None:
...
def set_pilot(self, index: int, pilot: Optional[Pilot]) -> None: ...
@abstractmethod
def clear(self) -> None:
...
def clear(self) -> None: ...

View File

@@ -166,9 +166,11 @@ class Loadout:
# last - the first element in the tuple will be tried first, then the second,
# etc.
loadout_names = {
t: [f"Liberation {t.value}", f"Retribution {t.value}"]
if prefer_liberation_payloads()
else [f"Retribution {t.value}", f"Liberation {t.value}"]
t: (
[f"Liberation {t.value}", f"Retribution {t.value}"]
if prefer_liberation_payloads()
else [f"Retribution {t.value}", f"Liberation {t.value}"]
)
for t in FlightType
}
legacy_names = {