dgilland / pydash

The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library.
http://pydash.readthedocs.io
MIT License
1.32k stars 93 forks source link

Typing: find_index only accepts Callable or None #200

Closed mawaliya closed 1 year ago

mawaliya commented 1 year ago

pydash = 7.0.4 python = 3.10.6

The old code of:

data = [{"a": 0, "b": 3},{"a": "1", "c": 5}]
a0 = find_index(data, {"a": 0})

When the type check is on, pylance will complain:

Argument of type "dict[str, str]" cannot be assigned to parameter "predicate" of type "None" in function "find_index"

Expected: To add the type compatability.

dgilland commented 1 year ago

@DeviousStoat ^

DeviousStoat commented 1 year ago

this should fix it

dgilland commented 1 year ago

Fix has been released in v7.0.5: https://pypi.org/project/pydash/7.0.5/