From 91532da029f97392d23a69e35b55bdff6b7ac4e5 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 8 Jun 2023 17:52:57 -0700 Subject: [PATCH] Minor typing cleanup. --- src/pyutils/dict_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pyutils/dict_utils.py b/src/pyutils/dict_utils.py index 3c0be25..a675213 100644 --- a/src/pyutils/dict_utils.py +++ b/src/pyutils/dict_utils.py @@ -11,6 +11,7 @@ from pyutils import dataclass_utils from pyutils.typez.typing import Comparable AnyDict = Dict[Hashable, Any] +DictWithComparableKeys = Dict[Comparable, Any] def init_or_inc( @@ -285,7 +286,7 @@ def min_value(d: AnyDict) -> Any: return item_with_min_value(d)[1] -def max_key(d: Dict[Comparable, Any]) -> Comparable: +def max_key(d: DictWithComparableKeys) -> Comparable: """ Args: d: a dict with comparable keys @@ -303,7 +304,7 @@ def max_key(d: Dict[Comparable, Any]) -> Comparable: return max(d.keys()) -def min_key(d: Dict[Comparable, Any]) -> Comparable: +def min_key(d: DictWithComparableKeys) -> Comparable: """ Args: d: a dict with comparable keys -- 2.46.0