Skip to content

numpy.zeros_like false positive when using shape kwarg #5871

@quantumdot

Description

@quantumdot

Bug description

When calling numpy.zeros_like() and passing the keyword argument shape, pylint complains Unexpected keyword argument 'shape' in function call.

Example:

a = np.array(range(10))
b = np.zeros_like(a, shape=(10,10))

Configuration

No response

Command used

using pylint integration with VSCode.

Pylint output

{
	"type": "error",
	"module": "my_package.proc.proc",
	"obj": "crop_and_rotate",
	"line": 251,
	"column": 15,
	"endLine": 251,
	"endColumn": 52,
	"path": "my_package\\proc\\proc.py",
	"symbol": "unexpected-keyword-arg",
	"message": "Unexpected keyword argument 'shape' in function call",
	"message-id": "E1123"
},

Expected behavior

no error raised

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)]

OS / Environment

Windows, VSCode

Additional dependencies

numpy==1.21.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds astroid Brain 🧠Needs a brain tip in astroid (then an astroid upgrade)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions