From 345aa9f506ed5de45ef9e1ccc774caa84fd3167f Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 8 Jun 2023 20:05:23 -0700 Subject: [PATCH] Get rid of a typing: ignore. --- src/pyutils/math_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyutils/math_utils.py b/src/pyutils/math_utils.py index 8ec47d2..fe1e906 100644 --- a/src/pyutils/math_utils.py +++ b/src/pyutils/math_utils.py @@ -8,7 +8,7 @@ import collections import functools import math from heapq import heappop, heappush -from typing import Dict, List, Optional, Tuple +from typing import Dict, Hashable, List, Optional, Tuple, cast from pyutils import dict_utils from pyutils.typez.typing import Numeric @@ -119,12 +119,12 @@ class NumericPopulation(object): The population mode (most common member in the population) in :math:`O(n)` time. """ - count: Dict[Numeric, int] = collections.defaultdict(int) + count: Dict[Hashable, int] = collections.defaultdict(int) for n in self.lowers: count[-n] += 1 for n in self.highers: count[n] += 1 - return dict_utils.item_with_max_value(count) # type: ignore + return cast(Tuple[Numeric, int], dict_utils.item_with_max_value(count)) def get_stdev(self) -> float: """ -- 2.46.0