Skip to content

Commit 26ec2b0

Browse files
committed
Remove "cached_property" from Units class
1 parent c791640 commit 26ec2b0

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

sc2/units.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import annotations
33

44
import random
5-
from functools import cached_property
65
from itertools import chain
76
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, List, Optional, Set, Tuple, Union
87

@@ -633,15 +632,14 @@ def same_unit(self, other: Union[UnitTypeId, Iterable[UnitTypeId]]) -> Units:
633632
unit_alias_types
634633
)
635634

636-
@cached_property
635+
@property
637636
def center(self) -> Point2:
638637
""" Returns the central position of all units. """
639638
assert self, "Units object is empty"
640-
amount = self.amount
641639
return Point2(
642640
(
643-
sum(unit._proto.pos.x for unit in self) / amount,
644-
sum(unit._proto.pos.y for unit in self) / amount,
641+
sum(unit._proto.pos.x for unit in self) / self.amount,
642+
sum(unit._proto.pos.y for unit in self) / self.amount,
645643
)
646644
)
647645

0 commit comments

Comments
 (0)