pylint

Suppress warning for both pycharm and pylint

六月ゝ 毕业季﹏ 提交于 2019-12-05 01:25:18
I use PyCharm to write code and I also have CI server configured to run PyLint on every PR. The problem is PyCharm and PyLint use different comments for warning suppression: # noinspection PyMethodMayBeStatic # pylint: disable=no-self-use I don't like having two comments for both PyCharm and PyLint. Is there a way to configure PyLint to understand PyCharm comments or to configure PyCharm to understand PyLint comments? Is there a way to configure PyLint to understand PyCharm comments or to configure PyCharm to understand PyLint comments? No. At least not currently that i am aware of. You could

Hide some maybe-no-member Pylint errors

浪尽此生 提交于 2019-12-05 00:43:51
The following Python fragment code gets analyzed by Pylint : if type(result) is array.array: read = result.tobytes() ... with the following error for the last line: E:401,22: Instance of 'int' has no 'tobytes' member\ (but some types could not be inferred) (maybe-no-member) The result variable is received from an external function. How can I change (correct) the code to make Pylint understand? Or how can I tell it that the result of the function can have other types than int? Or how can I tell it to ignore that particular line? (I favor an answer in this order of the questions) sthenault For

PyLint 1.0.0 with PyDev + Eclipse: “include-ids” option no longer allowed, breaks Eclipse integration

余生长醉 提交于 2019-12-04 23:05:50
问题 As noted in this question: How do I get Pylint message IDs to show up after pylint-1.0.0? pylint 1.0.0 no longer accepts "include-ids" option. (It returns "lint.py: error: no such option: --include-ids"). Unfortunately, in the integation with PyDev/Eclipse, there is this little nugget: "The --include-ids=y is always included...". How to disable that argument so that Pylint will work with Eclipse? [I know, other alternatives include installing an older version of Pylint or running pylint from

pylint doesn't point to virtualenv python

家住魔仙堡 提交于 2019-12-04 22:29:04
I am pretty new to python and currenty I am trying to use pylint for checking code quality. I am getting a problem. My pylint doesn't point to virtualenv python interpreter. Here is the output that I get when I run pylint --version $ pylint --version pylint 0.21.1, astng 0.20.1, common 0.50.3 Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] In virtualenv I have python 2.7 installed. Will appretiate you help if someone can point me to how to solve that. A cheap trick is to run (the global) pylint using the virtualenv python. You can do this using python $

Pylint Error Message: “E1101: Module 'lxml.etree' has no 'strip_tags' member'”

天涯浪子 提交于 2019-12-04 11:12:05
问题 I am experimenting with lxml and python for the first time for a personal project, and I am attempting to strip tags from a bit of source code using etree.strip_tags(). For some reason, I keep getting the error message: "E1101: Module 'lxml.etree' has no 'strip_tags' member'". I'm not sure why this is happening. Here's the relevant portion of my code: from lxml import etree ... DOC = etree.strip_tags(DOC_URL, 'html') print DOC Any ideas? Thanks. 回答1: The reason for this is that pylint by

How can I install the pylint for python2.7?

依然范特西╮ 提交于 2019-12-04 10:57:14
I try to install the pylint for the python2.7 which in ubuntu 18.04, but it raises an error with this words: pip install pylint Collecting pylint Using cached https://pypi.tuna.tsinghua.edu.cn/packages/04/1f/1d3929051b45c3e4015178c5fe5bbee735fb4e362e0fc4f0fbf3f68647ad/pylint-2.1.1.tar.gz pylint requires Python '>=3.4.*' but the running Python is 2.7.15 I have been used the pip3 installed the pylint successfully for python3.6. So, how can I install the pylint for python2.7? pylint still maintains support for Python 2 until maybe next year or so. But you need to install 1.9.X instead of 2.X . It

Pylint: Disable specific warnings for specific folder

早过忘川 提交于 2019-12-04 10:09:16
问题 We have a Python project laid out like this: project/ ├── .pylintrc ├── module1.py ├── module2.py └── tests/ ├── test_module1.py └── test_module2.py Our unit and function tests reside in the folder called tests/ . When it comes to tests the pylint warnings missing-docstring , invalid-name and protected-access are not relevant. On the other hand, these warnings are very useful for the actual code in the project. My question is whether it is possible to add ignores for missing-docstring ,

Automated docstring and comments spell check

丶灬走出姿态 提交于 2019-12-04 08:57:53
问题 Consider the following sample code: # -*- coding: utf-8 -*- """Test module.""" def test(): """Tets function""" return 10 pylint gives it 10 of 10, flake8 doesn't find any warnings: $ pylint test.py ... Global evaluation ----------------- Your code has been rated at 10.00/10 ... $ flake8 test.py $ But, as you may see, there is a typo in the test function's docstring. And, your editor would probably highlight it automagically, for example, here's how Pycharm does it: Thanks to the https:/

Save list in a file

南楼画角 提交于 2019-12-04 07:17:41
问题 I have to write a script that will read a file tempo_rogue_guide_utf8 , find several words in its text and save them in a new file (one form by line). I was told to use JSON but I can't seem to make it work. The expected output should be saved in the new file like this: you can remove you want to do you can activate you can keep Also, I keep having the message unexpected character after line continuation character after the ...IGNORECASE) in the code below: def main(): try: my_file = open(

Alternatives to imp.find_module?

泄露秘密 提交于 2019-12-04 06:58:55
Background I've grown tired of the issue with pylint not being able to import files when you use namespace packages and divide your code-base into separate folders. As such I started digging into the astNG source-code which has been identified as the source of the trouble (see bugreport 8796 on astng). At the heart of the issue seems to be the use of pythons own imp.find_module in the process of finding imports. What happens is that the import's first (sub)package - a in import a.b.c - is fed to find_module with a None path. Whatever path comes back is then fed into find_module the next pass