pylint

pylint can't find QWidget and QApplication

↘锁芯ラ 提交于 2019-11-26 16:17:50
问题 import sys from PyQt5.QtWidgets import (QApplication, QWidget) app = QApplication(sys.argv) window = QWidget() window.setGeometry(50, 50, 500, 300) window.setWindowTitle('Hello, world') window.show() sys.exit(app.exec_()) I just started to learn pyqt5. I wrote this hello world app, which works. But pylint gives "E0611:No name 'QWidget' in module 'PyQt5.QtWidgets'" and same for QApplication. Is it some kind of bug in pylint? pylint --version No config file found, using default configuration

How do I disable a Pylint warning?

北战南征 提交于 2019-11-26 15:40:51
I'm trying to disable warning C0321 ("more than one statement on a single line" -- I often put if statements with short single-line results on the same line), in Pylint 0.21.1 (if it matters: astng 0.20.1, common 0.50.3, Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)). I've tried adding disable=C0321 in the Pylint configuration file, but Pylint insists on reporting it anyway. Variations on that line (like disable=0321 or disable=C321 ) are flagged as errors, so Pylint does recognize the option properly, it's just ignoring it. Is this a Pylint bug, or am I doing something wrong? Is there any

How do I create a pylintrc file

核能气质少年 提交于 2019-11-26 15:39:50
问题 I am running linux. Can I do something like pylint --generate-rcfile > .pylintrc and then make changes to the resulting .pylintrc file to override the default settings? And if so should it be in my ~/ directory or should I put it in .pylint.d? 回答1: You may put it in: /etc/pylintrc for default global configuration ~/.pylintrc for default user configuration <your project>/pylintrc for default project configuration (used when you'll run pylint <your project> ) wherever you want, then use pylint

PyLint, PyChecker or PyFlakes? [closed]

流过昼夜 提交于 2019-11-26 12:48:58
问题 I would like to get some feedback on these tools on : features; adaptability; ease of use and learning curve. 回答1: Well, I am a bit curious, so I just tested the 3 myself right after asking the question ;-) Ok, this is not a very serious review but here is what I can say : I tried the tools with the default settings (it's important because you can pretty much choose your check rules) on the following script : #!/usr/local/bin/python # by Daniel Rosengren modified by e-satis import sys, time

pylint 1.4 reports E1101(no-member) on all C extensions

南楼画角 提交于 2019-11-26 11:05:39
问题 We\'ve been long-time fans of pylint . Its static analysis has become a critical part of all our python projects and has saved tons of time chasing obscure bugs. But after upgrading from 1.3 -> 1.4, almost all compiled c extensions result in E1101(no-member) errors. Projects that previously run perfectly clean through pylint 1.3 now complain about almost every C extension member with E1101. We\'ve been forced to disable E1101 errors, but this materially detracts from the usefulness of pylint

Should wildcard import be avoided?

社会主义新天地 提交于 2019-11-26 10:32:34
I'm using PyQt and am running into this issue. If my import statements are: from PyQt4.QtCore import * from PyQt4.QtGui import * then pylint gives hundreds of "Unused import" warnings. I'm hesitant to just turn them off, because there might be other unused imports that are actually useful to see. Another option would be to do this: from PyQt4.QtCore import Qt, QPointF, QRectF from PyQt4.QtGui import QGraphicsItem, QGraphicsScene, ... and I end up having 9 classes on the QtGui line. There's a third option, which is: from PyQt4 import QtCore, QtGui and then prefix all the classes with QtCore or

Instance attribute attribute_name defined outside __init__

风流意气都作罢 提交于 2019-11-26 09:19:56
问题 I split up my class constructor by letting it call multiple functions, like this: class Wizard: def __init__(self, argv): self.parse_arguments(argv) self.wave_wand() # declaration omitted def parse_arguments(self, argv): if self.has_correct_argument_count(argv): self.name = argv[0] self.magic_ability = argv[1] else: raise InvalidArgumentsException() # declaration omitted # ... irrelevant functions omitted While my interpreter happily runs my code, Pylint has a complaint: Instance attribute

Avoid Pylint warning E1101: &#39;Instance of .. has no .. member&#39; for class with dynamic attributes

帅比萌擦擦* 提交于 2019-11-26 09:09:25
问题 Imagine a function which dynamically adds attributes to an object using setattr . The reason for doing so is that I want to map some external structure (e.g. a given parameter tree) to an object: my_object = SomeClass() apply_structure(my_object, some_descriptor) my_object.device1.enabled = True Technically this works but of course Pylint rightly complains about \'device1\' being not a member of SomeClass . I could disable the warning but that would be bad (because I still want to get the

How do I disable a Pylint warning?

非 Y 不嫁゛ 提交于 2019-11-26 04:36:22
问题 I\'m trying to disable warning C0321 (\"more than one statement on a single line\" -- I often put if statements with short single-line results on the same line), in Pylint 0.21.1 (if it matters: astng 0.20.1, common 0.50.3, Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)). I\'ve tried adding disable=C0321 in the Pylint configuration file, but Pylint insists on reporting it anyway. Variations on that line (like disable=0321 or disable=C321 ) are flagged as errors, so Pylint does recognize the

Should wildcard import be avoided?

此生再无相见时 提交于 2019-11-26 02:09:59
问题 I\'m using PyQt and am running into this issue. If my import statements are: from PyQt4.QtCore import * from PyQt4.QtGui import * then pylint gives hundreds of \"Unused import\" warnings. I\'m hesitant to just turn them off, because there might be other unused imports that are actually useful to see. Another option would be to do this: from PyQt4.QtCore import Qt, QPointF, QRectF from PyQt4.QtGui import QGraphicsItem, QGraphicsScene, ... and I end up having 9 classes on the QtGui line. There\