diff --git a/game/ato/closestairfields.py b/game/ato/closestairfields.py index 4dd0032e..821b05a8 100644 --- a/game/ato/closestairfields.py +++ b/game/ato/closestairfields.py @@ -1,4 +1,5 @@ """Objective adjacency lists.""" + from __future__ import annotations from typing import Dict, Iterator, List, Optional, TYPE_CHECKING diff --git a/game/ato/flightplans/airlift.py b/game/ato/flightplans/airlift.py index a6fc968a..f9b9fcc4 100644 --- a/game/ato/flightplans/airlift.py +++ b/game/ato/flightplans/airlift.py @@ -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, ) diff --git a/game/ato/flightplans/flightplan.py b/game/ato/flightplans/flightplan.py index c1a51085..8cf1cbe8 100644 --- a/game/ato/flightplans/flightplan.py +++ b/game/ato/flightplans/flightplan.py @@ -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 diff --git a/game/ato/flightplans/formation.py b/game/ato/flightplans/formation.py index 407743e0..02b31852 100644 --- a/game/ato/flightplans/formation.py +++ b/game/ato/flightplans/formation.py @@ -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: diff --git a/game/ato/flightplans/ibuilder.py b/game/ato/flightplans/ibuilder.py index fbdd1216..31459f39 100644 --- a/game/ato/flightplans/ibuilder.py +++ b/game/ato/flightplans/ibuilder.py @@ -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: diff --git a/game/ato/flightplans/loiter.py b/game/ato/flightplans/loiter.py index 65698002..23489661 100644 --- a/game/ato/flightplans/loiter.py +++ b/game/ato/flightplans/loiter.py @@ -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: diff --git a/game/ato/flightplans/uizonedisplay.py b/game/ato/flightplans/uizonedisplay.py index 8d880c87..9aa83946 100644 --- a/game/ato/flightplans/uizonedisplay.py +++ b/game/ato/flightplans/uizonedisplay.py @@ -14,5 +14,4 @@ class UiZone: class UiZoneDisplay(abc.ABC): @abc.abstractmethod - def ui_zone(self) -> UiZone: - ... + def ui_zone(self) -> UiZone: ... diff --git a/game/ato/flightplans/waypointbuilder.py b/game/ato/flightplans/waypointbuilder.py index de5e8710..fbaf503d 100644 --- a/game/ato/flightplans/waypointbuilder.py +++ b/game/ato/flightplans/waypointbuilder.py @@ -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", diff --git a/game/ato/flightstate/flightstate.py b/game/ato/flightstate/flightstate.py index 2c6c8887..e0f1a534 100644 --- a/game/ato/flightstate/flightstate.py +++ b/game/ato/flightstate/flightstate.py @@ -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 diff --git a/game/ato/flightstate/inflight.py b/game/ato/flightstate/inflight.py index 00b391f4..ddd67728 100644 --- a/game/ato/flightstate/inflight.py +++ b/game/ato/flightstate/inflight.py @@ -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() diff --git a/game/ato/iflightroster.py b/game/ato/iflightroster.py index 685bfad7..38fff1df 100644 --- a/game/ato/iflightroster.py +++ b/game/ato/iflightroster.py @@ -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: ... diff --git a/game/ato/loadouts.py b/game/ato/loadouts.py index 8b3f692a..ccc4324c 100644 --- a/game/ato/loadouts.py +++ b/game/ato/loadouts.py @@ -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 = { diff --git a/game/callsigns.py b/game/callsigns.py index 34af6b14..14c78915 100644 --- a/game/callsigns.py +++ b/game/callsigns.py @@ -1,4 +1,5 @@ """Support for working with DCS group callsigns.""" + import logging import re from typing import Any diff --git a/game/commander/tasks/frontlinestancetask.py b/game/commander/tasks/frontlinestancetask.py index 0eaa6aa4..c6240262 100644 --- a/game/commander/tasks/frontlinestancetask.py +++ b/game/commander/tasks/frontlinestancetask.py @@ -21,8 +21,7 @@ class FrontLineStanceTask(TheaterCommanderTask, ABC): @property @abstractmethod - def stance(self) -> CombatStance: - ... + def stance(self) -> CombatStance: ... @staticmethod def management_allowed(state: TheaterState) -> bool: @@ -49,8 +48,7 @@ class FrontLineStanceTask(TheaterCommanderTask, ABC): @property @abstractmethod - def have_sufficient_front_line_advantage(self) -> bool: - ... + def have_sufficient_front_line_advantage(self) -> bool: ... @property def ground_force_balance(self) -> float: diff --git a/game/commander/tasks/packageplanningtask.py b/game/commander/tasks/packageplanningtask.py index 6780e64e..d5f7606a 100644 --- a/game/commander/tasks/packageplanningtask.py +++ b/game/commander/tasks/packageplanningtask.py @@ -57,8 +57,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]): coalition.ato.add_package(self.package) @abstractmethod - def propose_flights(self) -> None: - ... + def propose_flights(self) -> None: ... def propose_flight( self, @@ -122,9 +121,9 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]): target_ranges: list[ tuple[Union[IadsGroundObject, NavalGroundObject], Distance] ] = [] - all_iads: Iterator[ - Union[IadsGroundObject, NavalGroundObject] - ] = itertools.chain(state.enemy_air_defenses, state.enemy_ships) + all_iads: Iterator[Union[IadsGroundObject, NavalGroundObject]] = ( + itertools.chain(state.enemy_air_defenses, state.enemy_ships) + ) for target in all_iads: distance = meters(target.distance_to(self.target)) if range_type is RangeType.Detection: @@ -158,9 +157,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]): return ( 1.0 if target.task in [GroupTask.LORAD, GroupTask.MERAD] - else 0.5 - if target.task == GroupTask.AAA - else 0.9 + else 0.5 if target.task == GroupTask.AAA else 0.9 ) def iter_detecting_iads( diff --git a/game/commander/tasks/theatercommandertask.py b/game/commander/tasks/theatercommandertask.py index 5daa6b6c..473f67c9 100644 --- a/game/commander/tasks/theatercommandertask.py +++ b/game/commander/tasks/theatercommandertask.py @@ -12,5 +12,4 @@ if TYPE_CHECKING: class TheaterCommanderTask(PrimitiveTask[TheaterState]): @abstractmethod - def execute(self, coalition: Coalition) -> None: - ... + def execute(self, coalition: Coalition) -> None: ... diff --git a/game/commander/theatercommander.py b/game/commander/theatercommander.py index 0bc63828..23f64a6f 100644 --- a/game/commander/theatercommander.py +++ b/game/commander/theatercommander.py @@ -52,6 +52,7 @@ even though it is a primitive task used by many other tasks. https://en.wikipedia.org/wiki/Hierarchical_task_network """ + from __future__ import annotations from datetime import datetime diff --git a/game/commander/theaterstate.py b/game/commander/theaterstate.py index e3ca334e..4c49314d 100644 --- a/game/commander/theaterstate.py +++ b/game/commander/theaterstate.py @@ -203,7 +203,7 @@ class TheaterState(WorldState["TheaterState"]): threat_zones=game.threat_zone_for(not player), vulnerable_control_points=vulnerable_control_points, control_point_priority_queue=ordered_capturable_points, - priority_cp=ordered_capturable_points[0] - if ordered_capturable_points - else None, + priority_cp=( + ordered_capturable_points[0] if ordered_capturable_points else None + ), ) diff --git a/game/dcs/groundunittype.py b/game/dcs/groundunittype.py index 39b33f22..2b0aff47 100644 --- a/game/dcs/groundunittype.py +++ b/game/dcs/groundunittype.py @@ -60,9 +60,9 @@ class GroundUnitType(UnitType[Type[VehicleType]]): reversed_heading: bool = False _by_name: ClassVar[dict[str, GroundUnitType]] = {} - _by_unit_type: ClassVar[ - dict[type[VehicleType], list[GroundUnitType]] - ] = defaultdict(list) + _by_unit_type: ClassVar[dict[type[VehicleType], list[GroundUnitType]]] = ( + defaultdict(list) + ) def __setstate__(self, state: dict[str, Any]) -> None: # Save compat: the `name` field has been renamed `variant_id`. diff --git a/game/dcs/lasercodeconfig.py b/game/dcs/lasercodeconfig.py index 01c63fe2..c7566d9f 100644 --- a/game/dcs/lasercodeconfig.py +++ b/game/dcs/lasercodeconfig.py @@ -17,12 +17,10 @@ class LaserCodeConfig(ABC): ) @abstractmethod - def iter_prop_ids(self) -> Iterator[str]: - ... + def iter_prop_ids(self) -> Iterator[str]: ... @abstractmethod - def property_dict_for_code(self, code: int) -> dict[str, int]: - ... + def property_dict_for_code(self, code: int) -> dict[str, int]: ... class SinglePropertyLaserCodeConfig(LaserCodeConfig): diff --git a/game/flightplan/waypointstrategy.py b/game/flightplan/waypointstrategy.py index d91bf3f6..e5a06543 100644 --- a/game/flightplan/waypointstrategy.py +++ b/game/flightplan/waypointstrategy.py @@ -28,14 +28,12 @@ def point_at_heading(p: Point, heading: Heading, distance: Distance) -> Point: class Prerequisite(ABC): @abstractmethod - def is_satisfied(self) -> bool: - ... + def is_satisfied(self) -> bool: ... @abstractmethod def describe_debug_info( self, to_geojson: Callable[[BaseGeometry], dict[str, Any]] - ) -> dict[str, Any]: - ... + ) -> dict[str, Any]: ... class DistancePrerequisite(Prerequisite): diff --git a/game/htn.py b/game/htn.py index ae145262..b0f1ff90 100644 --- a/game/htn.py +++ b/game/htn.py @@ -11,8 +11,7 @@ WorldStateT = TypeVar("WorldStateT", bound="WorldState[Any]") class WorldState(ABC, Generic[WorldStateT]): @abstractmethod - def clone(self) -> WorldStateT: - ... + def clone(self) -> WorldStateT: ... class Task(Generic[WorldStateT]): @@ -24,18 +23,17 @@ Method = Sequence[Task[WorldStateT]] class PrimitiveTask(Task[WorldStateT], Generic[WorldStateT], ABC): @abstractmethod - def preconditions_met(self, state: WorldStateT) -> bool: - ... + def preconditions_met(self, state: WorldStateT) -> bool: ... @abstractmethod - def apply_effects(self, state: WorldStateT) -> None: - ... + def apply_effects(self, state: WorldStateT) -> None: ... class CompoundTask(Task[WorldStateT], Generic[WorldStateT], ABC): @abstractmethod - def each_valid_method(self, state: WorldStateT) -> Iterator[Method[WorldStateT]]: - ... + def each_valid_method( + self, state: WorldStateT + ) -> Iterator[Method[WorldStateT]]: ... PrimitiveTaskT = TypeVar("PrimitiveTaskT", bound=PrimitiveTask[Any]) diff --git a/game/infos/information.py b/game/infos/information.py index efc3fb96..727aab56 100644 --- a/game/infos/information.py +++ b/game/infos/information.py @@ -10,9 +10,11 @@ class Information: def __str__(self) -> str: return "[{}][{}] {} {}".format( - self.timestamp.strftime("%Y-%m-%d %H:%M:%S") - if self.timestamp is not None - else "", + ( + self.timestamp.strftime("%Y-%m-%d %H:%M:%S") + if self.timestamp is not None + else "" + ), self.turn, self.title, self.text, diff --git a/game/lasercodes/ilasercoderegistry.py b/game/lasercodes/ilasercoderegistry.py index e59a9d66..3f48285f 100644 --- a/game/lasercodes/ilasercoderegistry.py +++ b/game/lasercodes/ilasercoderegistry.py @@ -9,9 +9,7 @@ if TYPE_CHECKING: class ILaserCodeRegistry(ABC): @abstractmethod - def alloc_laser_code(self) -> LaserCode: - ... + def alloc_laser_code(self) -> LaserCode: ... @abstractmethod - def release_code(self, code: LaserCode) -> None: - ... + def release_code(self, code: LaserCode) -> None: ... diff --git a/game/logging_config.py b/game/logging_config.py index 0a42b817..195a6f68 100644 --- a/game/logging_config.py +++ b/game/logging_config.py @@ -1,4 +1,5 @@ """Logging APIs.""" + import logging import logging.config import os diff --git a/game/missiongenerator/briefinggenerator.py b/game/missiongenerator/briefinggenerator.py index f8e5245d..733a4676 100644 --- a/game/missiongenerator/briefinggenerator.py +++ b/game/missiongenerator/briefinggenerator.py @@ -1,6 +1,7 @@ """ Briefing generation logic """ + from __future__ import annotations import os diff --git a/game/missiongenerator/kneeboard.py b/game/missiongenerator/kneeboard.py index b7124b00..3444018c 100644 --- a/game/missiongenerator/kneeboard.py +++ b/game/missiongenerator/kneeboard.py @@ -22,6 +22,7 @@ https://forums.eagle.ru/showthread.php?t=206360 claims that kneeboard pages can only be added per airframe, so PvP missions where each side have the same aircraft will be able to see the enemy's kneeboard for the same airframe. """ + import datetime import math import textwrap diff --git a/game/missiongenerator/tgogenerator.py b/game/missiongenerator/tgogenerator.py index 73acdc64..adc58a77 100644 --- a/game/missiongenerator/tgogenerator.py +++ b/game/missiongenerator/tgogenerator.py @@ -5,6 +5,7 @@ groups, statics, missile sites, and AA sites for the mission. Each of these objectives is defined in the Theater by a TheaterGroundObject. These classes create the pydcs groups and statics for those areas and add them to the mission. """ + from __future__ import annotations import logging @@ -1362,9 +1363,9 @@ class TgoGenerator: self.ground_spawns_large: dict[ ControlPoint, list[Tuple[StaticGroup, Point]] ] = defaultdict(list) - self.ground_spawns: dict[ - ControlPoint, list[Tuple[StaticGroup, Point]] - ] = defaultdict(list) + self.ground_spawns: dict[ControlPoint, list[Tuple[StaticGroup, Point]]] = ( + defaultdict(list) + ) self.mission_data = mission_data def generate(self) -> None: @@ -1383,9 +1384,9 @@ class TgoGenerator: self.m, cp, self.game, self.radio_registry, self.tacan_registry ) ground_spawn_roadbase_gen.generate() - self.ground_spawns_roadbase[ - cp - ] = ground_spawn_roadbase_gen.ground_spawns_roadbase + self.ground_spawns_roadbase[cp] = ( + ground_spawn_roadbase_gen.ground_spawns_roadbase + ) random.shuffle(self.ground_spawns_roadbase[cp]) # Generate Large Ground Spawn slots diff --git a/game/pretense/pretensetgogenerator.py b/game/pretense/pretensetgogenerator.py index 3d02298c..9c36ac39 100644 --- a/game/pretense/pretensetgogenerator.py +++ b/game/pretense/pretensetgogenerator.py @@ -5,6 +5,7 @@ groups, statics, missile sites, and AA sites for the mission. Each of these objectives is defined in the Theater by a TheaterGroundObject. These classes create the pydcs groups and statics for those areas and add them to the mission. """ + from __future__ import annotations import random @@ -819,9 +820,9 @@ class PretenseTgoGenerator(TgoGenerator): self.ground_spawns_roadbase: dict[ ControlPoint, list[Tuple[StaticGroup, Point]] ] = defaultdict(list) - self.ground_spawns: dict[ - ControlPoint, list[Tuple[StaticGroup, Point]] - ] = defaultdict(list) + self.ground_spawns: dict[ControlPoint, list[Tuple[StaticGroup, Point]]] = ( + defaultdict(list) + ) self.mission_data = mission_data def generate(self) -> None: @@ -848,9 +849,9 @@ class PretenseTgoGenerator(TgoGenerator): self.m, cp, self.game, self.radio_registry, self.tacan_registry ) ground_spawn_roadbase_gen.generate() - self.ground_spawns_roadbase[ - cp - ] = ground_spawn_roadbase_gen.ground_spawns_roadbase + self.ground_spawns_roadbase[cp] = ( + ground_spawn_roadbase_gen.ground_spawns_roadbase + ) random.shuffle(self.ground_spawns_roadbase[cp]) # Generate STOL pads diff --git a/game/purchaseadapter.py b/game/purchaseadapter.py index 5b1968bc..5576e0dd 100644 --- a/game/purchaseadapter.py +++ b/game/purchaseadapter.py @@ -48,12 +48,10 @@ class PurchaseAdapter(Generic[ItemType]): return self.pending_delivery_quantity(item) < 0 @abstractmethod - def current_quantity_of(self, item: ItemType) -> int: - ... + def current_quantity_of(self, item: ItemType) -> int: ... @abstractmethod - def pending_delivery_quantity(self, item: ItemType) -> int: - ... + def pending_delivery_quantity(self, item: ItemType) -> int: ... def expected_quantity_next_turn(self, item: ItemType) -> int: return self.current_quantity_of(item) + self.pending_delivery_quantity(item) @@ -65,36 +63,28 @@ class PurchaseAdapter(Generic[ItemType]): return self.can_sell(item) or self.has_pending_orders(item) @abstractmethod - def can_sell(self, item: ItemType) -> bool: - ... + def can_sell(self, item: ItemType) -> bool: ... @abstractmethod - def do_purchase(self, item: ItemType) -> None: - ... + def do_purchase(self, item: ItemType) -> None: ... @abstractmethod - def do_cancel_purchase(self, item: ItemType) -> None: - ... + def do_cancel_purchase(self, item: ItemType) -> None: ... @abstractmethod - def do_sale(self, item: ItemType) -> None: - ... + def do_sale(self, item: ItemType) -> None: ... @abstractmethod - def do_cancel_sale(self, item: ItemType) -> None: - ... + def do_cancel_sale(self, item: ItemType) -> None: ... @abstractmethod - def price_of(self, item: ItemType) -> int: - ... + def price_of(self, item: ItemType) -> int: ... @abstractmethod - def name_of(self, item: ItemType, multiline: bool = False) -> str: - ... + def name_of(self, item: ItemType, multiline: bool = False) -> str: ... @abstractmethod - def unit_type_of(self, item: ItemType) -> UnitType[Any]: - ... + def unit_type_of(self, item: ItemType) -> UnitType[Any]: ... class AircraftPurchaseAdapter(PurchaseAdapter[Squadron]): diff --git a/game/radio/CallsignContainer.py b/game/radio/CallsignContainer.py index 2a51e424..68029b6f 100644 --- a/game/radio/CallsignContainer.py +++ b/game/radio/CallsignContainer.py @@ -16,5 +16,4 @@ class CallsignContainer: @property @abstractmethod - def available_callsigns(self) -> List[str]: - ... + def available_callsigns(self) -> List[str]: ... diff --git a/game/radio/radios.py b/game/radio/radios.py index 44041375..4722a2fe 100644 --- a/game/radio/radios.py +++ b/game/radio/radios.py @@ -1,4 +1,5 @@ """Radio frequency types and allocators.""" + from __future__ import annotations import itertools diff --git a/game/radio/tacan.py b/game/radio/tacan.py index c9200391..60fa10d7 100644 --- a/game/radio/tacan.py +++ b/game/radio/tacan.py @@ -1,4 +1,5 @@ """TACAN channel handling.""" + from __future__ import annotations import re diff --git a/game/runways.py b/game/runways.py index 17476731..0b965a95 100644 --- a/game/runways.py +++ b/game/runways.py @@ -1,4 +1,5 @@ """Runway information and selection.""" + from __future__ import annotations import logging diff --git a/game/savecompat.py b/game/savecompat.py index 36185e69..cd0a2797 100644 --- a/game/savecompat.py +++ b/game/savecompat.py @@ -1,4 +1,5 @@ """Tools for aiding in save compat removal after compatibility breaks.""" + from collections.abc import Callable from typing import TypeVar diff --git a/game/sidc.py b/game/sidc.py index 6fcef144..5b435915 100644 --- a/game/sidc.py +++ b/game/sidc.py @@ -10,6 +10,7 @@ from the output. https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN https://www.spatialillusions.com/milsymbol/docs/milsymbol-APP6d.html """ + from __future__ import annotations from abc import ABC, abstractmethod @@ -330,18 +331,15 @@ class SymbolIdentificationCode: class SidcDescribable(ABC): @property @abstractmethod - def standard_identity(self) -> StandardIdentity: - ... + def standard_identity(self) -> StandardIdentity: ... @property @abstractmethod - def sidc_status(self) -> Status: - ... + def sidc_status(self) -> Status: ... @property @abstractmethod - def symbol_set_and_entity(self) -> tuple[SymbolSet, Entity]: - ... + def symbol_set_and_entity(self) -> tuple[SymbolSet, Entity]: ... def sidc(self) -> SymbolIdentificationCode: symbol_set, entity = self.symbol_set_and_entity diff --git a/game/sim/combat/frozencombat.py b/game/sim/combat/frozencombat.py index 332c107f..45be3a0b 100644 --- a/game/sim/combat/frozencombat.py +++ b/game/sim/combat/frozencombat.py @@ -40,20 +40,16 @@ class FrozenCombat(ABC): events: GameUpdateEvents, time: datetime, elapsed_time: timedelta, - ) -> None: - ... + ) -> None: ... @abstractmethod - def because(self) -> str: - ... + def because(self) -> str: ... @abstractmethod - def describe(self) -> str: - ... + def describe(self) -> str: ... @abstractmethod - def iter_flights(self) -> Iterator[Flight]: - ... + def iter_flights(self) -> Iterator[Flight]: ... def update_flight_states(self) -> None: for flight in self.iter_flights(): diff --git a/game/sim/combat/joinablecombat.py b/game/sim/combat/joinablecombat.py index 84c19c40..18ed9d12 100644 --- a/game/sim/combat/joinablecombat.py +++ b/game/sim/combat/joinablecombat.py @@ -18,8 +18,7 @@ class JoinableCombat(FrozenCombat, ABC): self.flights = flights @abstractmethod - def joinable_by(self, flight: Flight) -> bool: - ... + def joinable_by(self, flight: Flight) -> bool: ... def join(self, flight: Flight) -> None: assert isinstance(flight.state, InFlight) diff --git a/game/sim/missionresultsprocessor.py b/game/sim/missionresultsprocessor.py index 79f2d681..e0bb273d 100644 --- a/game/sim/missionresultsprocessor.py +++ b/game/sim/missionresultsprocessor.py @@ -343,9 +343,11 @@ class MissionResultsProcessor: settings = source.coalition.game.settings reserves = max( 1, - settings.reserves_procurement_target - if source.captured - else settings.reserves_procurement_target_red, + ( + settings.reserves_procurement_target + if source.captured + else settings.reserves_procurement_target_red + ), ) total_units = source.base.total_armor reserves_factor = (reserves - 1) / total_units # slight underestimation diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index 04fde9eb..3c68f417 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -525,8 +525,7 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): @property @abstractmethod - def heading(self) -> Heading: - ... + def heading(self) -> Heading: ... def __str__(self) -> str: return self.name @@ -690,8 +689,7 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): @property @abstractmethod - def can_deploy_ground_units(self) -> bool: - ... + def can_deploy_ground_units(self) -> bool: ... @abstractmethod def total_aircraft_parking(self, parking_type: ParkingType) -> int: @@ -986,8 +984,7 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): return None @abstractmethod - def can_operate(self, aircraft: AircraftType) -> bool: - ... + def can_operate(self, aircraft: AircraftType) -> bool: ... def unclaimed_parking(self, parking_type: ParkingType) -> int: return ( @@ -1001,8 +998,7 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): theater: ConflictTheater, conditions: Conditions, dynamic_runways: Dict[str, RunwayData], - ) -> RunwayData: - ... + ) -> RunwayData: ... def stub_runway_data(self) -> RunwayData: return RunwayData( @@ -1019,13 +1015,11 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): @property @abstractmethod - def runway_is_destroyable(self) -> bool: - ... + def runway_is_destroyable(self) -> bool: ... @property @abstractmethod - def runway_status(self) -> RunwayStatus: - ... + def runway_status(self) -> RunwayStatus: ... @property def runway_can_be_repaired(self) -> bool: @@ -1199,13 +1193,11 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC): @property @abstractmethod - def category(self) -> str: - ... + def category(self) -> str: ... @property @abstractmethod - def status(self) -> ControlPointStatus: - ... + def status(self) -> ControlPointStatus: ... class Airfield(ControlPoint, CTLD): diff --git a/game/theater/frontline.py b/game/theater/frontline.py index a1dfe807..47a0b88d 100644 --- a/game/theater/frontline.py +++ b/game/theater/frontline.py @@ -107,7 +107,7 @@ class FrontLine(MissionTarget): yield from [ FlightType.CAS, FlightType.AEWC, - FlightType.REFUELING + FlightType.REFUELING, # TODO: FlightType.TROOP_TRANSPORT # TODO: FlightType.EVAC ] diff --git a/game/theater/transitnetwork.py b/game/theater/transitnetwork.py index 458d8812..49694c9a 100644 --- a/game/theater/transitnetwork.py +++ b/game/theater/transitnetwork.py @@ -47,9 +47,9 @@ class TransitConnection(Enum): class TransitNetwork: def __init__(self) -> None: - self.nodes: Dict[ - ControlPoint, Dict[ControlPoint, TransitConnection] - ] = defaultdict(dict) + self.nodes: Dict[ControlPoint, Dict[ControlPoint, TransitConnection]] = ( + defaultdict(dict) + ) def has_destinations(self, control_point: ControlPoint) -> bool: return bool(self.nodes[control_point]) diff --git a/game/transfers.py b/game/transfers.py index c8c91b83..e498d16b 100644 --- a/game/transfers.py +++ b/game/transfers.py @@ -29,6 +29,7 @@ transports and processing the turn's transit actions. Routing is handled by TransitNetwork. """ + from __future__ import annotations import logging @@ -499,9 +500,9 @@ TransportType = TypeVar("TransportType", bound=MultiGroupTransport) class TransportMap(Generic[TransportType]): def __init__(self) -> None: # Dict of origin -> destination -> transport. - self.transports: dict[ - ControlPoint, dict[ControlPoint, TransportType] - ] = defaultdict(dict) + self.transports: dict[ControlPoint, dict[ControlPoint, TransportType]] = ( + defaultdict(dict) + ) def create_transport( self, origin: ControlPoint, destination: ControlPoint diff --git a/game/unitmap.py b/game/unitmap.py index 088d49ce..f96542dc 100644 --- a/game/unitmap.py +++ b/game/unitmap.py @@ -1,4 +1,5 @@ """Maps generated units back to their Retribution types.""" + from __future__ import annotations import itertools diff --git a/game/weather/weather.py b/game/weather/weather.py index bfd29665..4e9e3c00 100644 --- a/game/weather/weather.py +++ b/game/weather/weather.py @@ -101,8 +101,7 @@ class Weather(ABC): @property @abstractmethod - def archetype(self) -> WeatherArchetype: - ... + def archetype(self) -> WeatherArchetype: ... @property def pressure_adjustment(self) -> float: diff --git a/game/weather/windspeedgenerators.py b/game/weather/windspeedgenerators.py index 2afce3d6..ae2f29fc 100644 --- a/game/weather/windspeedgenerators.py +++ b/game/weather/windspeedgenerators.py @@ -25,8 +25,7 @@ class WeibullWindSpeedParameters: class WindSpeedGenerator(ABC): @abstractmethod - def random_wind(self) -> WindConditions: - ... + def random_wind(self) -> WindConditions: ... @staticmethod def from_data(data: dict[str, Any]) -> WindSpeedGenerator: diff --git a/qt_ui/dialogs.py b/qt_ui/dialogs.py index 6c715b0f..86b0e352 100644 --- a/qt_ui/dialogs.py +++ b/qt_ui/dialogs.py @@ -1,4 +1,5 @@ """Application-wide dialog management.""" + from typing import Optional from game.ato.flight import Flight diff --git a/qt_ui/models.py b/qt_ui/models.py index eaa24a01..c90a0153 100644 --- a/qt_ui/models.py +++ b/qt_ui/models.py @@ -1,4 +1,5 @@ """Qt data models for game objects.""" + from __future__ import annotations import datetime diff --git a/qt_ui/widgets/QFlightSizeSpinner.py b/qt_ui/widgets/QFlightSizeSpinner.py index 0ec0bd63..42614626 100644 --- a/qt_ui/widgets/QFlightSizeSpinner.py +++ b/qt_ui/widgets/QFlightSizeSpinner.py @@ -1,4 +1,5 @@ """Spin box for selecting the number of aircraft in a flight.""" + from PySide6.QtWidgets import QSpinBox diff --git a/qt_ui/widgets/QLabeledWidget.py b/qt_ui/widgets/QLabeledWidget.py index 69522e09..c5a1c672 100644 --- a/qt_ui/widgets/QLabeledWidget.py +++ b/qt_ui/widgets/QLabeledWidget.py @@ -1,4 +1,5 @@ """A layout containing a widget with an associated label.""" + from typing import Optional from PySide6.QtCore import Qt diff --git a/qt_ui/widgets/ato.py b/qt_ui/widgets/ato.py index 7eb42a81..5c745129 100644 --- a/qt_ui/widgets/ato.py +++ b/qt_ui/widgets/ato.py @@ -1,4 +1,5 @@ """Widgets for displaying air tasking orders.""" + import logging from copy import deepcopy from typing import Optional diff --git a/qt_ui/widgets/clientslots.py b/qt_ui/widgets/clientslots.py index 5af9fd10..238775ec 100644 --- a/qt_ui/widgets/clientslots.py +++ b/qt_ui/widgets/clientslots.py @@ -1,4 +1,5 @@ """Widgets for displaying client slots.""" + from PySide6.QtWidgets import QLabel from qt_ui.models import AtoModel diff --git a/qt_ui/widgets/combos/QAircraftTypeSelector.py b/qt_ui/widgets/combos/QAircraftTypeSelector.py index 41afa1f7..cf6d5967 100644 --- a/qt_ui/widgets/combos/QAircraftTypeSelector.py +++ b/qt_ui/widgets/combos/QAircraftTypeSelector.py @@ -1,4 +1,5 @@ """Combo box for selecting aircraft types.""" + from PySide6.QtWidgets import QComboBox from game.dcs.aircrafttype import AircraftType diff --git a/qt_ui/widgets/combos/QArrivalAirfieldSelector.py b/qt_ui/widgets/combos/QArrivalAirfieldSelector.py index 02215603..287454af 100644 --- a/qt_ui/widgets/combos/QArrivalAirfieldSelector.py +++ b/qt_ui/widgets/combos/QArrivalAirfieldSelector.py @@ -1,4 +1,5 @@ """Combo box for selecting a departure airfield.""" + from typing import Iterable, Optional from PySide6.QtWidgets import QComboBox diff --git a/qt_ui/windows/mission/QEditFlightDialog.py b/qt_ui/windows/mission/QEditFlightDialog.py index 806ce2aa..c9720712 100644 --- a/qt_ui/windows/mission/QEditFlightDialog.py +++ b/qt_ui/windows/mission/QEditFlightDialog.py @@ -1,4 +1,5 @@ """Dialog window for editing flights.""" + from PySide6.QtWidgets import ( QDialog, QVBoxLayout, diff --git a/qt_ui/windows/mission/QPackageDialog.py b/qt_ui/windows/mission/QPackageDialog.py index 26d8a3c6..864e250f 100644 --- a/qt_ui/windows/mission/QPackageDialog.py +++ b/qt_ui/windows/mission/QPackageDialog.py @@ -1,4 +1,5 @@ """Dialogs for creating and editing ATO packages.""" + import logging from typing import Optional diff --git a/qt_ui/windows/mission/flight/SquadronSelector.py b/qt_ui/windows/mission/flight/SquadronSelector.py index 906ae1c4..1a8716ac 100644 --- a/qt_ui/windows/mission/flight/SquadronSelector.py +++ b/qt_ui/windows/mission/flight/SquadronSelector.py @@ -1,4 +1,5 @@ """Combo box for selecting squadrons.""" + from typing import Optional from PySide6.QtWidgets import QComboBox diff --git a/qt_ui/windows/mission/flight/payload/missingpropertydataerror.py b/qt_ui/windows/mission/flight/payload/missingpropertydataerror.py index d46f307f..951892bd 100644 --- a/qt_ui/windows/mission/flight/payload/missingpropertydataerror.py +++ b/qt_ui/windows/mission/flight/payload/missingpropertydataerror.py @@ -1,2 +1 @@ -class MissingPropertyDataError(RuntimeError): - ... +class MissingPropertyDataError(RuntimeError): ...