More adaptation for pydcs updates.

This is as much as we can do until pydcs actually adds the py.typed
file. Once that's added there are a few ugly monkey patching corners
that will just need `# type: ignore` for now, but we can't pre-add those
since we have mypy warning us about superfluous ignore comments.
This commit is contained in:
Dan Albert
2021-07-09 14:13:20 -07:00
parent 469dd49def
commit 96c7b87ac7
27 changed files with 238 additions and 207 deletions

View File

@@ -5,14 +5,14 @@ import inspect
import logging
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Dict, Iterator, Optional, Set, Tuple, Union, cast, Any
from typing import Dict, Iterator, Optional, Set, Tuple, cast, Any
from dcs.unitgroup import FlyingGroup
from dcs.weapons_data import Weapons, weapon_ids
from game.dcs.aircrafttype import AircraftType
PydcsWeapon = Dict[str, Any]
PydcsWeapon = Any
PydcsWeaponAssignment = Tuple[int, PydcsWeapon]
@@ -83,7 +83,7 @@ class Pylon:
# configuration.
return weapon in self.allowed or weapon.cls_id == "<CLEAN>"
def equip(self, group: FlyingGroup, weapon: Weapon) -> None:
def equip(self, group: FlyingGroup[Any], weapon: Weapon) -> None:
if not self.can_equip(weapon):
logging.error(f"Pylon {self.number} cannot equip {weapon.name}")
group.load_pylon(self.make_pydcs_assignment(weapon), self.number)