简体   繁体   English

在类内部具有有效代码的Pylint错误

[英]Pylint error with valid code inside class

I have set up an reentrant lock (RLock) in a class like so inside the init function: 我已经在init函数中的类中设置了可重入锁(RLock):

self.lock= threading.RLock() 

If I try to get a count of the locks like so: 如果我尝试像这样获得锁的数量:

self.lock._RLock__count 

I get this error with pylint: 我收到pylint错误:

E:581,15: Instance of '_RLock' has no '_RLock__count' member (no-member)

The code works fine, I only have a problem passing pylint testing, do I have to tell it to ignore this like a dynamic attribute? 代码工作正常,我只有通过pylint测试时遇到问题,是否必须告诉它像动态属性那样忽略它?

似乎是pylint的限制,我使用以下注释/命令在本地禁用了该错误,并且一切正常:

# pylint: disable=E1101

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM