File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1818
1919from __future__ import annotations
2020
21- from collections .abc import Hashable
21+ from collections .abc import Callable , Hashable
2222
2323from . import _typings as t
2424
@@ -44,12 +44,17 @@ def __eq__(self, other: object) -> bool:
4444_marker : tuple [object ] = (object (),)
4545
4646
47- def make_key (args : tuple [t .Any , ...], kwds : dict [t .Any , t .Any ]) -> Hashable :
47+ def make_key (
48+ args : tuple [t .Any , ...],
49+ kwds : dict [t .Any , t .Any ],
50+ _typ : Callable [[object ], type ] = type ,
51+ _fast_types : set [type ] = {int , str }, # noqa: B006
52+ ) -> Hashable :
4853 key : tuple [t .Any , ...] = args
4954 if kwds :
5055 key += _marker
5156 for item in kwds .items ():
5257 key += item
53- elif len (key ) == 1 and type (key [0 ]) in { int , str } :
58+ elif len (key ) == 1 and _typ (key [0 ]) in _fast_types :
5459 return key [0 ]
5560 return _HK (key )
You can’t perform that action at this time.
0 commit comments