-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Description
Steps to reproduce
# test.py
import functools
from typing import Callable, NamedTuple
class Module(NamedTuple):
init: Callable
apply: Callable
def module(module_maker):
@functools.wraps(module_maker)
def fabricate_module(*args, **kwargs):
init, apply = module_maker(*args, **kwargs)
return Module(init, apply)
return fabricate_module
@module
def my_module():
def my_module_init(x_in):
return x_in
def my_module_apply(x_in):
return x_in
return my_module_init, my_module_apply
mod = my_module()
INPUT_X = 0.
mod.init(INPUT_X)
mod.apply(0.)!python test.py
# no errors!pylint test.py --disable "C0114,C0115,C0116"
# outputs:
# test.py:26:0: E1101: Instance of 'tuple' has no 'init' member (no-member)
# test.py:27:0: E1101: Instance of 'tuple' has no 'apply' member (no-member)You can also try it at:
https://colab.research.google.com/drive/1Jsgd_vVWIjVj7gqWKNsi6pOYNsP6l5uV#scrollTo=BfnN70BAt1Mi
Current behavior
pylint is returning a warning that mod does not have init or apply members.
Expected behavior
I would expect pylint to recognize that mod has an init and apply attribute, and not output those problems
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0]
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation