Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Paul Smith
On Wed, 2014-11-26 at 17:14 -0500, Paul Smith wrote: > if os.name == 'nt': > STD_LIB_DIRS.append(os.path.join(sys.prefix, 'dlls')) Also, I don't use this on Windows but this looks odd to me: wouldn't the "dlls" directory appear underneath exec_prefix, not prefix? ___

Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Paul Smith
On Wed, 2014-11-26 at 17:04 -0500, Paul Smith wrote: > If I reset STD_LIB_DIRS like this: > > >>> modutils.STD_LIB_DIRS = ['/opt/python/lib/python2.7', > '/opt/python/x86_64-linux/lib/python2.7'] > > Then I get: > > >>> modutils.is_standard_module('time') > True OK, if I apply the patch below t

Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Paul Smith
On Wed, 2014-11-26 at 22:06 +0100, Torsten Marek wrote: > Hm, this might be a problem with standard library detection on with > self-built Python installations. > Can you give me the output of: > >>> import sys > >>> sys.path > >>> from astroid import modutils > >>> modutils.STD_LIB_DIRS > >>> m

Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Torsten Marek
Hm, this might be a problem with standard library detection on with self-built Python installations. Can you give me the output of: >>> import sys >>> sys.path >>> from astroid import modutils >>> modutils.STD_LIB_DIRS >>> modutils.is_standard_module('time') Thanks! // Torsten 2014-11-26 22:0

Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Torsten Marek
Hi, this might be a bug in astroid, I'll have a look at it later this week. // Torsten 2014-11-26 15:41 GMT+01:00 Paul Smith : > On Wed, 2014-11-26 at 02:03 -0500, Paul Smith wrote: > > Forgot to say, I'm running on GNU/Linux Ubuntu GNOME 14.10 and I've > built all these tools (including python

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Phil Frost
On Wed, Nov 26, 2014 at 12:41 AM, wrote: > Python binds list comprehension variables to the local scope which has > caused some subtle bugs. Is it possible to add a warning for this in > pyflakes? > A guiding principle of pyflakes's design is that it doesn't have warnings. If it complains about

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Skip Montanaro
On Wed, Nov 26, 2014 at 10:51 AM, Keith Derrick wrote: > But it seems to be confused by the second case, flagging "y" as an > invalid variable-name at the assignment point for both versions. > I think that's just because pylint, by default, doesn't like variable names with fewer than three chara

[code-quality] PyLint catching comprehension binding leaks (was: Warn on list comprehension variables used outside list comprehensions?)

2014-11-26 Thread Ian Cordasco
On Wed, Nov 26, 2014 at 10:51 AM, Keith Derrick wrote: > I couldn't find anything in their bug list about this, so thought I'd check. > > Just ran pylint at the command line with pylint 1.4 on this file > (docstrings and import just to suppress miscellaneous complaints) > >> 1''' Test fil

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Keith Derrick
I couldn't find anything in their bug list about this, so thought I'd check. Just ran pylint at the command line with pylint 1.4 on this file (docstrings and import just to suppress miscellaneous complaints) > 1''' Test file for pylint ''' > 2from __future__ import print_functi

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Ian Cordasco
On Wed, Nov 26, 2014 at 9:27 AM, Keith Derrick wrote: > Definitely seems like something that should be warned about. > > For python2 it ought to be an error (which can always be turned off) for > either code snippet. PyFlakes doesn't allow you to ignore errors. Flake8 does so this is a moot point

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Keith Derrick
Definitely seems like something that should be warned about. For python2 it ought to be an error (which can always be turned off) for either code snippet. For python3, I'd say the two line snippet should flag an error - yes, it will fail at run-time, but pydev in eclipse runs pylint and saves m

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Skip Montanaro
> That's not the point of this check. The point of this check is that on > Python 2, the binding to x in the comprehension bleeds outside of the > comprehension scope Got it. Still, this code: > x = 10 > [x for x in range(3)] > print(x + 1) will run differently in Python 2 than Pyth

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Ian Cordasco
On Wed, Nov 26, 2014 at 8:44 AM, Skip Montanaro wrote: > On Wed, Nov 26, 2014 at 8:30 AM, Ian Cordasco > wrote: >> >> The trick here would be ensuring this only applies to Python 2. Take >> for example the following on Python 3: >> >> [x for x in range(3)] >> print(x) >> >> You will get a

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Skip Montanaro
On Wed, Nov 26, 2014 at 8:30 AM, Ian Cordasco wrote: > > The trick here would be ensuring this only applies to Python 2. Take > for example the following on Python 3: > > [x for x in range(3)] > print(x) > > You will get a NameError because x is undefined outside the list > comprehension.

Re: [code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Paul Smith
On Wed, 2014-11-26 at 02:03 -0500, Paul Smith wrote: Forgot to say, I'm running on GNU/Linux Ubuntu GNOME 14.10 and I've built all these tools (including python) myself from source. > Hi all; I just upgraded to a newer version of pylint and now I'm seeing > many spurious E1101 errors. > > Before

Re: [code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread Ian Cordasco
On Tue, Nov 25, 2014 at 11:41 PM, wrote: > Python binds list comprehension variables to the local scope which has > caused some subtle bugs. Is it possible to add a warning for this in > pyflakes? I haven't implemented it yet, but here are the example > tests: > > def test_listCompVariableUsedOut

[code-quality] Lots of E1101 in standard modules after upgrading pylint to 1.4.0

2014-11-26 Thread Paul Smith
Hi all; I just upgraded to a newer version of pylint and now I'm seeing many spurious E1101 errors. Before I was using: * Python 2.7.6 * Pylint 1.1.0 * Astroid 1.0.1 * logilab-common 0.61.0 Now I've upgraded to: * Python 2.7.8 * Pylint 1.4.0 * Astroid 1.3

[code-quality] Warn on list comprehension variables used outside list comprehensions?

2014-11-26 Thread code-quality . wting
Python binds list comprehension variables to the local scope which has caused some subtle bugs. Is it possible to add a warning for this in pyflakes? I haven't implemented it yet, but here are the example tests: def test_listCompVariableUsedOutsideListComp(self): """ Test that a variable d

Re: [code-quality] Problems running pylint 1.4.0

2014-11-26 Thread Skip Montanaro
On Wed, Nov 26, 2014 at 7:39 AM, Skip Montanaro wrote: > Let me see if fixing that solves the problem. My guess is that it will. That was it! Thanks for the excellent hint, Marius. Skip ___ code-quality mailing list code-quality@python.org https://ma

Re: [code-quality] Problems running pylint 1.4.0

2014-11-26 Thread Skip Montanaro
On Wed, Nov 26, 2014 at 4:02 AM, Marius Gedminas wrote: > What's in the #! line of /opt/local/bin/pylint? Ack! I'll bet that's the problem. Our production Python (/opt/local/bin/python) was compiled without debug symbols. Desperate at one point to step through the interpreter's C code, I built

Re: [code-quality] Problems running pylint 1.4.0

2014-11-26 Thread Marius Gedminas
On Tue, Nov 25, 2014 at 02:54:03PM -0600, Skip Montanaro wrote: > We have a rather peculiar software distribution system here at work. I > downloaded, packaged, and installed astroid, logilab-common, and pylint. > When I run pylint now (1.1.0 worked just fine), I get this error: > > Traceback (mos