pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.33k stars 1.14k forks source link

False-positive E1101 with tensorflow.Summary().value #2024

Open bersbersbers opened 6 years ago

bersbersbers commented 6 years ago

This is slightly different than #2021: it raises the same error, but this time, the type of the variable appears to be correct. I myself wonder how this code runs without error, but it does. (This is where I got it from: https://github.com/keras-team/keras/issues/6692#issuecomment-372458636)

Steps to reproduce

>cat bug.py
"""Code runs without error"""
import tensorflow as tf
print(tf.Summary().value)
print("Done")

>python bug.py
[]
Done

>pylint bug.py
No config file found, using default configuration
************* Module bug
E:  3, 6: Instance of 'Summary' has no 'value' member; maybe 'Value'? (no-member)

--------------------------------------------------------------------
Your code has been rated at -6.67/10 (previous run: -6.67/10, +0.00)

Current behavior

Error E1101

Expected behavior

No error

pylint --version output

No config file found, using default configuration pylint 1.8.4, astroid 1.6.3 Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]

Tensorflow package used is tensorflow-gpu (1.8.0rc0)

PCManticore commented 6 years ago

Thanks for the report! I presume tensorflow does some metaprogramming that pylint doesn't yet comprehend. This would be a perfect candidate for an astroid brain tip, which is the usual solution whenever we encounter a library that uses metaprogramming concepts that pylint is not capable of understanding.