本文整理汇总了Python中pylint.lint.PyLinter.expand_files方法的典型用法代码示例。如果您正苦于以下问题:Python PyLinter.expand_files方法的具体用法?Python PyLinter.expand_files怎么用?Python PyLinter.expand_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylint.lint.PyLinter
的用法示例。
在下文中一共展示了PyLinter.expand_files方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expand_files
# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import expand_files [as 别名]
def expand_files(self, modules):
expanded = PyLinter.expand_files(self, modules)
filtered = []
for module in expanded:
if self._files.check_module(module['path']):
filtered.append(module)
return filtered
示例2: process_file
# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import expand_files [as 别名]
def process_file(filename):
"""
Analyze the file with pylint and write the result
to a database
"""
linter = PyLinter()
checkers.initialize(linter)
linter.read_config_file()
linter.quiet = 1
filemods = linter.expand_files((filename, ))
if filemods:
old_stats = config.load_results(filemods[0].get('basename'))
old_score = old_stats.get('global_note', 0.0)
linter.check(filename)
score = eval(linter.config.evaluation, {}, linter.stats)
# Calculate the credit for both scores
if score < 0:
credit = 2.0 * score
elif score < old_score:
credit = -1.5 * (old_score - score)
elif score < MINIMUM_SCORE:
credit = -1.5 * (MINIMUM_SCORE - score)
else:
credit = score - old_score
return score, old_score, credit
示例3: expand_files
# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import expand_files [as 别名]
def expand_files(self, modules):
expanded = PyLinter.expand_files(self, modules)
filtered = []
for module in expanded:
if any([m.search(module['path']) for m in self._ignore]):
continue
filtered.append(module)
return filtered
示例4: expand_files
# 需要导入模块: from pylint.lint import PyLinter [as 别名]
# 或者: from pylint.lint.PyLinter import expand_files [as 别名]
def expand_files(self, modules):
expanded = PyLinter.expand_files(self, modules)
filtered = []
for module in expanded:
rel_path = os.path.relpath(module['path'], self._rootpath)
if any([m.search(rel_path) for m in self._ignore]):
continue
filtered.append(module)
return filtered