-
Notifications
You must be signed in to change notification settings - Fork 283
Closed as not planned
Labels
needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.An issue where it's not clear whether there is a bug or we are behaving as expected.
Description
Describe the Bug
from math import dist
colors: dict[str, tuple[int, int, int]] = {}
def nearest(self, red, green, blue):
p = red, green, blue
distances = {name: dist(p, q) for name, q in colors.items()}
return min(distances, key=distances.get, default='')gives
ERROR No matching overload found for function `min` called with arguments: (dict[str, float], key=BoundMethod[dict[str, float], Overload[(self: dict[str, float], key: str, default: None = None, /) -> float | None, (self: dict[str, float], key: str, default: float, /) -> float, [_T](self: dict[str, float], key: str, default: _T, /) -> float | _T]], default=Literal['']) [no-matching-overload]
--> src/pynche/test.py:8:15
|
8 | return min(distances, key=distances.get, default='')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Possible overloads:
(arg1: SupportsRichComparisonT, arg2: SupportsRichComparisonT, /, *_args: SupportsRichComparisonT, *, key: None = None) -> SupportsRichComparisonT
(arg1: _T, arg2: _T, /, *_args: _T, *, key: (_T) -> SupportsRichComparison) -> _T
(iterable: Iterable[SupportsRichComparisonT], /, *, key: None = None) -> SupportsRichComparisonT
(iterable: Iterable[_T], /, *, key: (_T) -> SupportsRichComparison) -> _T
(iterable: Iterable[SupportsRichComparisonT], /, *, key: None = None, default: _T) -> SupportsRichComparisonT | _T [closest match]
(iterable: Iterable[_T1], /, *, key: (_T1) -> SupportsRichComparison, default: _T2) -> _T1 | _T2
INFO 1 error
I'm not quite sure what pyrefly is complaining about, since it definitely is a valid use case, although perhaps a bit odd.
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.An issue where it's not clear whether there is a bug or we are behaving as expected.