Skip to content

Commit c2676a9

Browse files
committed
Update mypy stubs
1 parent 81a6800 commit c2676a9

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

domdf_python_tools/iterative.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,24 @@
3333
import itertools
3434
import textwrap
3535
from operator import itemgetter
36-
from typing import Any, Callable, Iterable, Iterator, List, Optional, Sequence, Sized, Tuple, Type, TypeVar, Union
36+
from typing import (
37+
Any,
38+
Callable,
39+
Iterable,
40+
Iterator,
41+
List,
42+
Optional,
43+
Sequence,
44+
Sized,
45+
Tuple,
46+
Type,
47+
TypeVar,
48+
Union,
49+
cast
50+
)
3751

3852
# 3rd party
39-
from natsort import natsorted, ns # type: ignore
53+
from natsort import natsorted, ns
4054

4155
# this package
4256
from domdf_python_tools.utils import magnitude
@@ -249,7 +263,7 @@ def natmin(seq: Iterable[_T], key: Optional[Callable[[Any], Any]] = None, alg: i
249263
:param alg: This option is used to control which algorithm :mod:`natsort` uses when sorting.
250264
"""
251265

252-
return natsorted(seq, key=key, alg=alg)[0]
266+
return natsorted(seq, key=key, alg=cast(ns, alg))[0]
253267

254268

255269
def natmax(seq: Iterable[_T], key: Optional[Callable[[Any], Any]] = None, alg: int = ns.DEFAULT) -> _T:
@@ -265,7 +279,7 @@ def natmax(seq: Iterable[_T], key: Optional[Callable[[Any], Any]] = None, alg: i
265279
:param alg: This option is used to control which algorithm :mod:`natsort` uses when sorting.
266280
"""
267281

268-
return natsorted(seq, key=key, alg=alg)[-1]
282+
return natsorted(seq, key=key, alg=cast(ns, alg))[-1]
269283

270284

271285
_group = Tuple[float, ...]

stubs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
git+https://github.com/domdfcoding/pytest-regressions-stubs
2+
git+https://github.com/domdfcoding/natsort-stubs

0 commit comments

Comments
 (0)