Pre-emptive Python 3.10 compat.

Iterator is no longer exposed directly in collections, but is in
collections.abc.
This commit is contained in:
Dan Albert 2021-11-20 18:49:14 -08:00
parent 66c8b96c9a
commit 12f420f50e
30 changed files with 54 additions and 54 deletions

View File

@ -3,24 +3,24 @@ from __future__ import annotations
import datetime import datetime
import json import json
import logging import logging
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from typing import Optional, Tuple, Dict, Any from typing import Any, Dict, Optional, Tuple
from packaging.version import Version
import yaml import yaml
from packaging.version import Version
from game.profiling import logged_duration from game.profiling import logged_duration
from game.theater import ( from game.theater import (
ConflictTheater,
CaucasusTheater, CaucasusTheater,
NevadaTheater, ConflictTheater,
PersianGulfTheater,
NormandyTheater,
TheChannelTheater,
SyriaTheater,
MarianaIslandsTheater, MarianaIslandsTheater,
NevadaTheater,
NormandyTheater,
PersianGulfTheater,
SyriaTheater,
TheChannelTheater,
) )
from game.version import CAMPAIGN_FORMAT_VERSION from game.version import CAMPAIGN_FORMAT_VERSION
from .campaignairwingconfig import CampaignAirWingConfig from .campaignairwingconfig import CampaignAirWingConfig

View File

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.theater import ControlPoint from game.theater import ControlPoint

View File

@ -2,16 +2,16 @@ from __future__ import annotations
import math import math
import operator import operator
from collections import Iterator, Iterable from collections.abc import Iterable, Iterator
from typing import TypeVar, TYPE_CHECKING from typing import TYPE_CHECKING, TypeVar
from game.theater import ( from game.theater import (
Airfield,
ControlPoint, ControlPoint,
OffMapSpawn,
MissionTarget,
Fob, Fob,
FrontLine, FrontLine,
Airfield, MissionTarget,
OffMapSpawn,
) )
from game.theater.theatergroundobject import ( from game.theater.theatergroundobject import (
BuildingGroundObject, BuildingGroundObject,
@ -19,7 +19,7 @@ from game.theater.theatergroundobject import (
NavalGroundObject, NavalGroundObject,
) )
from game.utils import meters, nautical_miles from game.utils import meters, nautical_miles
from gen.flights.closestairfields import ObjectiveDistanceCache, ClosestAirfields from gen.flights.closestairfields import ClosestAirfields, ObjectiveDistanceCache
if TYPE_CHECKING: if TYPE_CHECKING:
from game import Game from game import Game

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.aewc import PlanAewc from game.commander.tasks.primitive.aewc import PlanAewc
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.primitive.oca import PlanOcaStrike from game.commander.tasks.primitive.oca import PlanOcaStrike

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.strike import PlanStrike from game.commander.tasks.primitive.strike import PlanStrike
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.bai import PlanBai from game.commander.tasks.primitive.bai import PlanBai
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.compound.destroyenemygroundunits import ( from game.commander.tasks.compound.destroyenemygroundunits import (
@ -10,7 +10,7 @@ from game.commander.tasks.compound.reduceenemyfrontlinecapacity import (
from game.commander.tasks.primitive.breakthroughattack import BreakthroughAttack from game.commander.tasks.primitive.breakthroughattack import BreakthroughAttack
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState
from game.htn import CompoundTask, Method from game.htn import CompoundTask, Method
from game.theater import FrontLine, ControlPoint from game.theater import ControlPoint, FrontLine
@dataclass(frozen=True) @dataclass(frozen=True)

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.compound.capturebase import CaptureBase from game.commander.tasks.compound.capturebase import CaptureBase

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.primitive.cas import PlanCas from game.commander.tasks.primitive.cas import PlanCas

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.compound.defendbase import DefendBase from game.commander.tasks.compound.defendbase import DefendBase

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from typing import Union from typing import Union
from game.commander.tasks.primitive.antiship import PlanAntiShip from game.commander.tasks.primitive.antiship import PlanAntiShip

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.primitive.aggressiveattack import AggressiveAttack from game.commander.tasks.primitive.aggressiveattack import AggressiveAttack

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.cas import PlanCas from game.commander.tasks.primitive.cas import PlanCas
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.antishipping import PlanAntiShipping from game.commander.tasks.primitive.antishipping import PlanAntiShipping
from game.commander.tasks.primitive.convoyinterdiction import PlanConvoyInterdiction from game.commander.tasks.primitive.convoyinterdiction import PlanConvoyInterdiction

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.compound.attackairinfrastructure import ( from game.commander.tasks.compound.attackairinfrastructure import (

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.barcap import PlanBarcap from game.commander.tasks.primitive.barcap import PlanBarcap
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.primitive.strike import PlanStrike from game.commander.tasks.primitive.strike import PlanStrike

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from game.commander.tasks.primitive.refueling import PlanRefueling from game.commander.tasks.primitive.refueling import PlanRefueling
from game.commander.theaterstate import TheaterState from game.commander.theaterstate import TheaterState

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from game.commander.tasks.compound.aewcsupport import PlanAewcSupport from game.commander.tasks.compound.aewcsupport import PlanAewcSupport

View File

@ -3,23 +3,22 @@ from __future__ import annotations
import dataclasses import dataclasses
import itertools import itertools
import math import math
from collections import Iterator from collections.abc import Iterator
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Union, Optional from typing import Any, Optional, TYPE_CHECKING, Union
from game.commander.garrisons import Garrisons from game.commander.garrisons import Garrisons
from game.commander.objectivefinder import ObjectiveFinder from game.commander.objectivefinder import ObjectiveFinder
from game.htn import WorldState from game.htn import WorldState
from game.profiling import MultiEventTracer from game.profiling import MultiEventTracer
from game.settings import Settings from game.settings import Settings
from game.squadrons import AirWing from game.theater import ConflictTheater, ControlPoint, FrontLine, MissionTarget
from game.theater import ControlPoint, FrontLine, MissionTarget, ConflictTheater
from game.theater.theatergroundobject import ( from game.theater.theatergroundobject import (
TheaterGroundObject,
NavalGroundObject,
IadsGroundObject,
VehicleGroupGroundObject,
BuildingGroundObject, BuildingGroundObject,
IadsGroundObject,
NavalGroundObject,
TheaterGroundObject,
VehicleGroupGroundObject,
) )
from game.threatzones import ThreatZones from game.threatzones import ThreatZones
from gen.ground_forces.combat_stance import CombatStance from gen.ground_forces.combat_stance import CombatStance

View File

@ -3,7 +3,7 @@ from __future__ import annotations
import itertools import itertools
import logging import logging
import math import math
from collections import Iterator from collections.abc import Iterator
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from enum import Enum from enum import Enum
from typing import Any, List, TYPE_CHECKING, Type, Union, cast from typing import Any, List, TYPE_CHECKING, Type, Union, cast

View File

@ -1,7 +1,8 @@
from __future__ import annotations from __future__ import annotations
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections import Iterator, deque, Sequence from collections import deque
from collections.abc import Iterator, Sequence
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Generic, Optional, TypeVar from typing import Any, Generic, Optional, TypeVar

View File

@ -1,5 +1,5 @@
from collections import Iterator, Iterable from collections.abc import Iterable, Iterator
from typing import Generic, TypeVar, Optional from typing import Generic, Optional, TypeVar
ValueT = TypeVar("ValueT") ValueT = TypeVar("ValueT")

View File

@ -1,4 +1,4 @@
from collections import Iterator from collections.abc import Iterator
from dataclasses import Field, dataclass, field, fields from dataclasses import Field, dataclass, field, fields
from datetime import timedelta from datetime import timedelta
from enum import Enum, unique from enum import Enum, unique

View File

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import itertools import itertools
from collections import Iterator from collections.abc import Iterator
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing_extensions import TYPE_CHECKING from typing_extensions import TYPE_CHECKING

View File

@ -3,7 +3,7 @@ from __future__ import annotations
import itertools import itertools
import math import math
import random import random
from collections import Iterable from collections.abc import Iterable
from dataclasses import dataclass from dataclasses import dataclass
from typing import TypeVar, Union from typing import TypeVar, Union

View File

@ -1,10 +1,10 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from collections import Iterable from collections.abc import Iterable
from typing import Optional, Iterator, TYPE_CHECKING, Mapping from typing import Iterator, Mapping, Optional, TYPE_CHECKING
from game.data.weapons import Weapon, Pylon, WeaponType from game.data.weapons import Pylon, Weapon, WeaponType
from game.dcs.aircrafttype import AircraftType from game.dcs.aircrafttype import AircraftType
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -1,5 +1,5 @@
import logging import logging
from collections import Iterator from collections.abc import Iterator
from contextlib import contextmanager from contextlib import contextmanager
from typing import Type from typing import Type

View File

@ -14,7 +14,7 @@ from dcs.payloads import PayloadDirectories
from game import Game, VERSION, persistency from game import Game, VERSION, persistency
from game.campaignloader.campaign import Campaign from game.campaignloader.campaign import Campaign
from game.data.weapons import WeaponGroup, Pylon, Weapon from game.data.weapons import Pylon, Weapon, WeaponGroup
from game.db import FACTIONS from game.db import FACTIONS
from game.dcs.aircrafttype import AircraftType from game.dcs.aircrafttype import AircraftType
from game.profiling import logged_duration from game.profiling import logged_duration