Skip to content

Commit

Permalink
Fix counter typing
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi committed May 1, 2024
1 parent 0ed0de3 commit fcb849a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion WebHostLib/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def render_generic_multiworld_tracker(tracker_data: TrackerData, enabled_tracker

if "Factorio" in network_data_package["games"]:
def render_Factorio_multiworld_tracker(tracker_data: TrackerData, enabled_trackers: List[str]):
inventories: Dict[TeamPlayer, collections.Counter[str]] = {
inventories: Dict[TeamPlayer, Counter[str]] = {
(team, player): collections.Counter({
tracker_data.item_id_to_name["Factorio"][item_id]: count
for item_id, count in tracker_data.get_player_inventory_counts(team, player).items()
Expand Down
5 changes: 3 additions & 2 deletions test/benchmark/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def run_locations_benchmark():
import sys

from time_it import TimeIt
from typing import Counter

from Utils import init_logging
from BaseClasses import MultiWorld, CollectionState, Location
Expand All @@ -23,7 +24,7 @@ class BenchmarkRunner:

if sys.version_info >= (3, 9):
@staticmethod
def format_times_from_counter(counter: collections.Counter[str], top: int = 5) -> str:
def format_times_from_counter(counter: Counter[str], top: int = 5) -> str:
return "\n".join(f" {time:.4f} in {name}" for name, time in counter.most_common(top))
else:
@staticmethod
Expand All @@ -42,7 +43,7 @@ def location_test(self, test_location: Location, state: CollectionState, state_n

def main(self):
for game in sorted(AutoWorld.AutoWorldRegister.world_types):
summary_data: typing.Dict[str, collections.Counter[str]] = {
summary_data: typing.Dict[str, Counter[str]] = {
"empty_state": collections.Counter(),
"all_state": collections.Counter(),
}
Expand Down

0 comments on commit fcb849a

Please sign in to comment.