Python 3.x Pylint错误地标记空白;不同意政治公众人物8
Pylint将此行标记为4次错误的空白:Python 3.x Pylint错误地标记空白;不同意政治公众人物8,python-3.x,code-analysis,pylint,pep8,Python 3.x,Code Analysis,Pylint,Pep8,Pylint将此行标记为4次错误的空白: def __init__(self, file_id: int = None, filetype_id: int = None, module_id: int = None, file_name: str = None): 信息: C: 7, 0: No space allowed around keyword argument assignment def __init__(self, file_id: int =
def __init__(self, file_id: int = None, filetype_id: int = None,
module_id: int = None, file_name: str = None):
信息:
C: 7, 0: No space allowed around keyword argument assignment
def __init__(self, file_id: int = None, filetype_id: int = None,
^ (bad-whitespace)
C: 7, 0: No space allowed around keyword argument assignment
def __init__(self, file_id: int = None, filetype_id: int = None,
^ (bad-whitespace)
C: 8, 0: No space allowed around keyword argument assignment
module_id: int = None, file_name: str = None):
^ (bad-whitespace)
C: 8, 0: No space allowed around keyword argument assignment
module_id: int = None, file_name: str = None):
^ (bad-whitespace)
但是在PEP8中它说
将参数注释与默认值组合时,请使用空格
在=符号周围(但仅适用于同时具有
注释和默认值)
这很有道理,因为编写def func(arg:int=4)
看起来很可笑。这看起来不仅仅是将4分配给int,而不是将4分配给arg
此错误占pylint分析的大多数。有没有办法禁用它 这是一个已知的问题()。还没有人有时间来处理这件事。禁用此错误的一种方法是全面使用
pylint--disable=bad whitespace
,至少在问题得到解决之前是这样。对于即将发布的2.0版本,它已经在主版本中修复,请参阅,但不幸的是,在稳定的1.6.5版中没有。这是一个已知问题()。还没有人有时间来处理这件事。禁用此错误的一种方法是全面使用pylint--disable=bad whitespace
,至少在问题得到解决之前是这样。对于即将发布的2.0版本,它已在主版本中修复,请参阅,但不幸的是,在稳定的1.6.5版中没有修复。