Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy.zeros_like false positive when using shape kwarg #5871

Closed
quantumdot opened this issue Mar 7, 2022 · 0 comments
Closed

numpy.zeros_like false positive when using shape kwarg #5871

quantumdot opened this issue Mar 7, 2022 · 0 comments
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)
Milestone

Comments

@quantumdot
Copy link

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

@quantumdot quantumdot added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 7, 2022
@DanielNoord DanielNoord added Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 7, 2022
mbyrnepr2 added a commit to mbyrnepr2/astroid that referenced this issue Mar 7, 2022
@DanielNoord DanielNoord added this to the 2.13.0 milestone Mar 9, 2022
halstead pushed a commit to openembedded/meta-openembedded that referenced this issue Mar 16, 2022
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue Mar 16, 2022
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue Mar 16, 2022
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue Mar 17, 2022
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue Mar 17, 2022
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
Signed-off-by: tgamblin <[email protected]>
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
Changelog:
=========
Add new (optional) doc_node attribute to nodes.Module, nodes.ClassDef,
and nodes.FunctionDef.

Accessing the doc attribute of nodes.Module, nodes.ClassDef, and
nodes.FunctionDef has been deprecated in favour of the doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Passing the doc argument to the __init__ of nodes.Module, nodes.ClassDef,
and nodes.FunctionDef has been deprecated in favour of the postinit doc_node attribute.
Note: doc_node is an (optional) nodes.Const whereas doc was an (optional) str.

Replace custom cachedproperty with functools.cached_property and deprecate it
for Python 3.8+.

Closes #1410

Set end_lineno and end_col_offset attributes to None for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with None will cause a fallback
to the already supported way of PyPy 3.7.

Add missing shape parameter to numpy zeros_like, ones_like,
and full_like methods.

Closes pylint-dev/pylint#5871

Only pin wrapt on the major version.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
Signed-off-by: tgamblin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants