| 1 | From 4ff605d6c55fcf3e9b4777ffbcb0c24ef17ba4ca Mon Sep 17 00:00:00 2001
|
| 2 | From: Arti <[email protected]>
|
| 3 | Date: Mon, 28 Feb 2022 21:19:50 +0100
|
| 4 | Subject: [PATCH] Rename instances of `collections.Iterable` into
|
| 5 | `collections.abc.Iterable` (#2956)
|
| 6 |
|
| 7 | ---
|
| 8 | horizons/ai/aiplayer/combat/unitmanager.py | 4 ++--
|
| 9 | 1 file changed, 2 insertions(+), 2 deletions(-)
|
| 10 |
|
| 11 | diff --git a/horizons/ai/aiplayer/combat/unitmanager.py b/horizons/ai/aiplayer/combat/unitmanager.py
|
| 12 | index 8449d5563c5..57db0d47061 100644
|
| 13 | |
| 14 | |
| 15 | @@ -151,7 +151,7 @@ def _ship_state_rule(self, state_dict, ship_states):
|
| 16 | """
|
| 17 | Rule stating that ship has to be in any of given states.
|
| 18 | """
|
| 19 | - if not isinstance(ship_states, collections.Iterable):
|
| 20 | + if not isinstance(ship_states, collections.abc.Iterable):
|
| 21 | ship_states = (ship_states,)
|
| 22 | return lambda ship: (state_dict[ship] in ship_states)
|
| 23 |
|
| 24 | @@ -178,7 +178,7 @@ def filter_ships(self, ships, rules):
|
| 25 | @param rules: conditions each ship has to meet (AND)
|
| 26 | @type rules: iterable of lambda(ship) or single lambda(ship)
|
| 27 | """
|
| 28 | - if not isinstance(rules, collections.Iterable):
|
| 29 | + if not isinstance(rules, collections.abc.Iterable):
|
| 30 | rules = (rules,)
|
| 31 | return [ship for ship in ships if all((rule(ship) for rule in rules))]
|
| 32 |
|