Skip to content

BUG: Numpy Typing does not recognize a deque as a valid input for np.max #24265

@chacabuco

Description

@chacabuco

Describe the issue:

When running mypy on the example code one gets the following message:

error: No overload variant matches argument type "deque[int]" [call-overload]

Nonetheless, the code executes correctly. Should collections' deques be a valid input for both np.min and np.max?

When trying to convert a deque to a numpy array the conversions is successful; therefore, shouldn't deques be considered as array_like?

Reproduce the code example:

import numpy as np
from collections import deque

a = deque([0])
np.max(a)

Error message:

error: No overload variant matches argument type "deque[int]"  [call-overload]

Runtime information:

1.23.2
3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions