MyPy 的 linter 出现错误,none 在 logging.disable 中
MyPy's linter showing up error, where's none in logging.disable
MyPy 打印出错误“Argument 1 to 'disable' has incompatible type 'str'; expected 'int'
根据 Python 的 wiki 和 运行 的代码,一切都很好,但对 MyPy 来说,情况并非如此。我做错了什么吗?
logging.disable('DEBUG')
日志级别是整数,不是字符串。它们在 logging
模块中定义为常量,您可以导入该模块。例如:
logging.disable(loggging.DEBUG)
MyPy 打印出错误“Argument 1 to 'disable' has incompatible type 'str'; expected 'int' 根据 Python 的 wiki 和 运行 的代码,一切都很好,但对 MyPy 来说,情况并非如此。我做错了什么吗?
logging.disable('DEBUG')
日志级别是整数,不是字符串。它们在 logging
模块中定义为常量,您可以导入该模块。例如:
logging.disable(loggging.DEBUG)