8000 BUG: static typing of numpy.clip seems to be missing some kwargs · Issue #24391 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: static typing of numpy.clip seems to be missing some kwargs #24391
Closed
@pedro-w

Description

@pedro-w

Describe the issue:

Using the 'basic type checking' option in VS code I see an error flagged on a numpy call which I believe to be incorrect. I originally posted a bug for pyright and they told me to ask here, as VS code's typing info for numpy comes from the project itself.

Reproduce the code example:

import numpy

numpy.clip(numpy.zeros(1), 0, 255, casting='safe')

Error message:

No overloads for "clip" match the provided arguments
    Argument types: (NDArray[float64], Literal[0], Literal[255], Literal['safe'])

Runtime information:

1.25.2
3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.25.2',
  'python': '3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 '
            '64 bit (AMD64)]',
  'uname': uname_result(system='Windows', node='LAPTOP', release='10', version='10.0.22621', machine='AMD64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2'],
                      'not_found': ['AVX512F',
                                    'AVX512CD',
                                    'AVX512_SKX',
                                    'AVX512_CLX',
                                    'AVX512_CNL',
                                    'AVX512_ICL']}}]
None

Context for the issue:

This issue is cosmetic in the sense that the code will run correctly even if the error shows in the editor.

However if you agree that it looks like the root cause is in the numpy project, I am happy to do a bit more investigation to see if it affects other ufuncs and other keyword args, and hopefully generate a PR to fix everything.

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

      0