【问题标题】:Suppresing "Redefining built-in ..." pylint warning抑制“重新定义内置 ...”pylint 警告
【发布时间】:2017-11-19 13:17:14
【问题描述】:

当使用 Python2/3 compatibility 导入时,如

from builtins import bytes

pylint 发出警告:

重新定义内置'bytes'(重新定义内置)

如何为builtins 模块抑制它们?

【问题讨论】:

    标签: python python-3.x pylint


    【解决方案1】:

    从 pylint 1.6 开始,有一个新选项 --redefining-builtins-modules。将builtins 添加到其默认值six.moves,future.builtins 可以解决问题:

    # List of qualified module names which can have objects that can redefine
    # builtins.
    redefining-builtins-modules=six.moves,future.builtins,builtins
    

    【讨论】:

      猜你喜欢
      • 2021-12-01
      • 1970-01-01
      • 2015-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-16
      • 2022-12-03
      相关资源
      最近更新 更多