seatgeek / fuzzywuzzy

Fuzzy String Matching in Python
http://chairnerd.seatgeek.com/fuzzywuzzy-fuzzy-string-matching-in-python/
GNU General Public License v2.0
9.21k stars 874 forks source link

Add allow_key decorator to accept object #278

Open dumbPy opened 4 years ago

dumbPy commented 4 years ago

Add allow_key decorator that would allow passing objects into fuzzywuzzy functions.
This should help using fuzzywuzzy in more cleaner way like the test cases added.
similar to how you can pass objects into sort/max/min functions and use a key:Callable[[Any],number] to get the numbers to use.

Would be trivial to add to simple functions like fuzz.ratio. Not added to any functions. That can be discussed further and then decided. Might need more consideration for more complicated functions that don't follow Callable[[str,...],int] signature