python - Pylint 和 Tornado - 在 @tornado.web.authenticated 上失败

标签 python tornado pylint

Pylint 遇到 @tornado.web.authenticated 时崩溃

class Handler1(tornado.web.RequestHandler):
    def get(self):
        return 'hello'

class Handler2(tornado.web.RequestHandler):
    @tornado.web.authenticated
    def get(self):
        return 'hello'

Pylint 在包含 Handler1 的文件上运行。 Pylint 在包含 Handler2 报告的文件上崩溃:decorator.expr.name == node.name): AttributeError: 'Getattr' object has no attribute 'name'

Traceback (most recent call last):
   File "/Users/andy/dev/virtualenv/thanks-app/bin/pylint", line 4, in <module>
    lint.Run(sys.argv[1:])
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/lint.py", line 879, in __init__
    linter.check(args)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/lint.py", line 502, in check
    self.check_astng_module(astng, walker, rawcheckers)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/lint.py", line 574, in check_astng_module
    walker.walk(astng)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/utils.py", line 528, in walk
    self.walk(child)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/utils.py", line 528, in walk
    self.walk(child)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/utils.py", line 525, in walk
    cb(astng)
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/checkers/base.py", line 161, in visit_function
    if not redefined_by_decorator(node):
   File "/Users/andy/dev/virtualenv/thanks-app/lib/python2.7/site-packages/pylint/checkers/base.py", line 116, in redefined_by_decorator
    decorator.expr.name == node.name):
 AttributeError: 'Getattr' object has no attribute 'name'

是否有特定的 Pylint 检查可以禁用以阻止此崩溃的发生?

我正在使用:

  • pylint 0.25.1
  • Python 2.7.1

最佳答案

此错误已在 pylint 存储库中修复,并将很快发布(0.26 应该在下周发布)。因此,要么使用结账(hg clone http://hg.logilab.org/pylint),要么等到下周

关于python - Pylint 和 Tornado - 在 @tornado.web.authenticated 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12514214/

相关文章:

python - 从演示文稿文件中提取图像

python - Pylint 与 Django

Python:将时间模块转换为字符串

python - 在 systemctl 停止服务时正确退出 python 脚本

python - 我对运行 Django 测试有点困惑

mongodb - 在 MongoDB 中缓存重复查询结果

javascript - Tornado 和 JavaScript 库的问题

python - 如何在python Tornado 上加载html图像文件

python - Pylint 的 "Too few public methods"消息是什么意思?

python - 为什么 Pylint 反对单字符变量名?