作为一名python初学者,我一直在努力让在IronPython下运行的pylint运行一些脚本。我已经设法安装并报告了一些结果,但是每当我运行它时我都会收到AssertionError,并且在多个脚本上都是相同的。
我正在使用默认的rcfile保存来添加disable=C0103,C0301,C0303
。
输出:
<string>:1: DeprecationWarning: object.__new__() takes no parameters
************* Module testscript
C: 1, 0: Missing module docstring (missing-docstring)
C: 11, 0: Missing function docstring (missing-docstring)
C: 19, 0: Missing function docstring (missing-docstring)
R: 19, 0: Too many local variables (24/15) (too-many-locals)
Traceback (most recent call last):
File "C:\Program Files (x86)\IronPython 2.7\Scripts\pylint", line 3, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\__init__.py", line 21, in run_pylint
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 982, in __init__
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 578, in check
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 664, in check_astroid_module
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 659, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\checkers\format.py", line 309, in visit_default
AssertionError: If()
注意到309行的visit_default函数,如果有用的话:
@check_messages('C0321' ,'C03232', 'C0323', 'C0324')
def visit_default(self, node):
"""check the node line number and check it if not yet done"""
if not node.is_statement:
return
if not node.root().pure_python:
return # XXX block visit of child nodes
prev_sibl = node.previous_sibling()
if prev_sibl is not None:
prev_line = prev_sibl.fromlineno
309>else:
prev_line = node.parent.statement().fromlineno
line = node.fromlineno
assert line, node
if prev_line == line and self._visited_lines.get(line) != 2:
# py2.5 try: except: finally:
if not (isinstance(node, nodes.TryExcept)
and isinstance(node.parent, nodes.TryFinally)
and node.fromlineno == node.parent.fromlineno):
self.add_message('C0321', node=node)
self._visited_lines[line] = 2
return
if line in self._visited_lines:
return
try:
tolineno = node.blockstart_tolineno
except AttributeError:
tolineno = node.tolineno
assert tolineno, node
lines = []
for line in xrange(line, tolineno + 1):
self._visited_lines[line] = 1
try:
lines.append(self._lines[line].rstrip())
except KeyError:
lines.append('')
try:
msg_def = check_line('\n'.join(lines))
if msg_def:
self.add_message(msg_def[0], node=node, args=msg_def[1])
except KeyError:
# FIXME: internal error !
pass
答案 0 :(得分:1)
这可能是pylint中的问题,或者更确切地说是pylint对IronPython的支持。
IronPython是一个Python实现,但它与其他实现完全不同,因为它通常不与Python标准库一起使用。
您可以尝试将此问题发送到logilab项目邮件列表,看看他们是否有任何建议。