Open bimalkant-lauhny opened 6 years ago
Why does the workaround work?
The workaround did not work for me. I got this error then:
E1102: app.jinja_env is not callable (not-callable)
I used this pylintrc
to disable this check:
[tool.pylint."messages control"]
disable = no-member
The solution until we make astroid better at understanding flask code is to use the generated-members
option see https://pylint.pycqa.org/en/latest/user_guide/messages/error/no-member.html.
Steps to reproduce
pylint hello.py
(after installing flask 1.0.2), wherehello.py
is a simple flask app as below:@app.route('/') def hello_world(): return 'Hello, World!'
Expected behavior
It should give no error because
add_extension
andfilters
are members ofFlask.jinja_env
.pylint --version output
Check the docs below for
jinja environment
Flask.jinja_env Flask.jinja_env.filters jinja2.Environment.add_extension
jinja_env
is a cached property. Somewhat like this.workaround
apart from disabling, if we change code as follows, pylint shows no errors.