summaryrefslogtreecommitdiff
path: root/coverage/misc.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-01-04 07:03:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-01-04 07:03:10 -0500
commitdbb94d570a2042409400c28ba3069dcb32a45159 (patch)
tree41caedd28b1d5cb99a76d8104566d309724eeeb7 /coverage/misc.py
parentfaa62d3f3d90c15e72040479a9b237ca86bbeae1 (diff)
downloadpython-coveragepy-git-dbb94d570a2042409400c28ba3069dcb32a45159.tar.gz
mypy: summary.py, test_summary.py, tests/coveragetest.py
Diffstat (limited to 'coverage/misc.py')
-rw-r--r--coverage/misc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index a2ac2fed..9b42d841 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -22,7 +22,7 @@ import types
from types import ModuleType
from typing import (
Any, Callable, Dict, Generator, IO, Iterable, List, Mapping, Optional,
- Tuple, TypeVar, Union,
+ Sequence, Tuple, TypeVar, Union,
)
from coverage import env
@@ -361,10 +361,12 @@ def human_sorted(strings: Iterable[str]) -> List[str]:
"""
return sorted(strings, key=_human_key)
+SortableItem = TypeVar("SortableItem", bound=Sequence[Any])
+
def human_sorted_items(
- items: Iterable[Tuple[str, Any]],
+ items: Iterable[SortableItem],
reverse: bool=False,
-) -> List[Tuple[str, Any]]:
+) -> List[SortableItem]:
"""Sort (string, ...) items the way humans expect.
The elements of `items` can be any tuple/list. They'll be sorted by the