Can Pylint error checking be customized?

You can globally disable warnings of a certain class using pylint –disable=W1234 or by using a special PyLint configuration file pylint –rcfile=/path/to/config.file A sample config file is given below: [MESSAGES CONTROL] # C0111 Missing docstring # I0011 Warning locally suppressed using disable-msg # I0012 Warning locally suppressed using disable-msg # W0704 Except doesn’t do anything … Read more

stopping setup.py from installing as egg

Solution 1: I feel like I’m missing something subtle or important (encountering this page years after the question was asked and not finding a satisfying answer) however the following works fine for me: python setup.py install –single-version-externally-managed –root=/ Compressed *.egg files are an invention of setuptools (I’m not a big fan of them although I … Read more

Close pre-existing figures in matplotlib when running from eclipse

You can close a figure by calling matplotlib.pyplot.close, for example: from numpy import * import matplotlib.pyplot as plt from scipy import * t = linspace(0, 0.1,1000) w = 60*2*pi fig = plt.figure() plt.plot(t,cos(w*t)) plt.plot(t,cos(w*t-2*pi/3)) plt.plot(t,cos(w*t-4*pi/3)) plt.show() plt.close(fig) You can also close all open figures by calling matplotlib.pyplot.close(“all”)

pep8 warning on regex string in Python, Eclipse

“\d” is same as “\\d” because there’s no escape sequence for d. But it is not clear for the reader of the code. But, consider \t. “\t” represent tab chracter, while r”\t” represent literal \ and t character. So use raw string when you mean literal \ and d: re.compile(r”\d{3}”) or escape backslash explicitly: re.compile(“\\d{3}”)

PyDev unittesting: How to capture text logged to a logging.Logger in “Captured Output”

The issue is that the unittest runner replaces sys.stdout/sys.stderr before the testing starts, and the StreamHandler is still writing to the original sys.stdout. If you assign the ‘current’ sys.stdout to the handler, it should work (see the code below). import sys import unittest import logging logger = logging.getLogger() logger.level = logging.DEBUG stream_handler = logging.StreamHandler(sys.stdout) logger.addHandler(stream_handler) … Read more