本文整理汇总了Python中pylint.lint.PyLinter.python3_porting_mode方法的典型用法代码示例。如果您正苦于以下问题:Python PyLinter.python3_porting_mode方法的具体用法?Python PyLinter.python3_porting_mode怎么用?Python PyLinter.python3_porting_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylint.lint.PyLinter
的用法示例。
在下文中一共展示了PyLinter.python3_porting_mode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_pylint
# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import python3_porting_mode [as 别名]
def check_pylint(self):
"""
Check using pylint.
"""
options = self.options.get('pylint', self.file_path).copy()
if not options['enabled']:
return
del options['enabled']
if not self._compiled_tree:
# We failed to compile the tree.
return
from pylint.lint import PyLinter, fix_import_path
from pylint.reporters import CollectingReporter
linter = PyLinter()
linter.load_default_plugins()
linter.set_reporter(CollectingReporter())
if options['py3k']:
linter.python3_porting_mode()
del options['py3k']
rcfile = options.get('rcfile', None)
del options['rcfile']
if rcfile:
linter.read_config_file(config_file=rcfile)
linter.load_config_file()
else:
linter.load_configuration_from_config(options)
# PyLint does its own import and parsing, so we only pass the file
# name and the precompiled tree.
with fix_import_path(self.file_path):
linter.check(self.file_path)
for message in linter.reporter.messages:
self.message(
message.line,
'%s:%s %s' % (
message.msg_id,
message.symbol,
message.msg,
),
code=message.msg_id,
icon='info',
category='pylint',
)