From skip.montanaro at gmail.com Sun Feb 1 23:00:13 2015 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Sun, 1 Feb 2015 16:00:13 -0600 Subject: [code-quality] Pylint 1.4 complains about parenthesized indentation Message-ID: In Emacs, python-mode (both Barry Warsaw's version and the GNU Emacs rewrite) indent line continuations in parens so that the next line begins in the column after the opening paren. They are quite consistent about this. For example: curs.execute("update swimmers" " set usms_id = ?" " where usms_id = ?", (row["NewSwimmerID"], row["OriginalSwimmerID"])) and in an if statement: if ("OriginalSwimmerID" not in rdr.fieldnames or "NewSwimmerID" not in rdr.fieldnames): print("CSV file missing required columns.", file=sys.stderr) return 1 I'm comfortable with that indentation, but with 1.4, pylint started complaining about the second example, because it happens that the indentation of the continuation line matches the block indentation. I can obviously suppress the bad-continuation message, but that would suppress it everywhere, which I don't really want. Is there some way to just restore the pre-1.4 behavior? Thx, Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.malan at aol.com Mon Feb 23 07:59:19 2015 From: david.malan at aol.com (DevOps) Date: Mon, 23 Feb 2015 14:59:19 +0800 Subject: [code-quality] How to support third-party python package Message-ID: Swampy is third-party python package through pip installed, but flake8 don?t detect it. --? Sent with Airmail -------------- next part -------------- An HTML attachment was scrubbed... URL: From graffatcolmingov at gmail.com Mon Feb 23 15:50:45 2015 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 23 Feb 2015 08:50:45 -0600 Subject: [code-quality] How to support third-party python package In-Reply-To: References: Message-ID: On Mon, Feb 23, 2015 at 12:59 AM, DevOps wrote: > Swampy is third-party python package through pip installed, but flake8 > don?t detect it. > > > -- > Sent with Airmail > Hi "DevOps", Your question made little sense without a great deal of context, so I went off in search of context and found https://github.com/scrooloose/syntastic/issues/1333 and https://github.com/klen/pylama/issues/29 and I understand what you're asking now. In the future, please don't make myself or anyone else go through the trouble of determining your question when you could include all of the details in your first post. The problem isn't that flake8 (or more accurately, pyflakes) cannot detect swampy, it's that by importing *, pyflakes through purely static analysis will not be able to tell you when you have unused imports because the symbols imported are not in the text. PyFlakes will not introspect anything on your python path to determine symbols used or anything else like that because that could become computationally expensive. If you want PyFlakes to stop issuing this warning, you should do from swampy.TurtleWorld import thefunction, theotherfunction, ThisClass, ThatOtherClass Depending on what you need from it. Alternatively, just import the submodule like from swampy import TurtleWorld And use qualified references to the functions/classes that are inside it. There is no bug with flake8 (or pyflakes). At best, the wording could be made easier for developers whose first language is not English. At worst, you should look into the myriad of style guides for Python that tell you not to use wildcard imports (like Google's https://code.google.com/p/soc/wiki/PythonStyleGuide#Python_Language_Rules or PEP8 https://www.python.org/dev/peps/pep-0008/#imports). Cheers, Ian -------------- next part -------------- An HTML attachment was scrubbed... URL: From pio.kupczyk at gmail.com Thu Feb 26 21:38:26 2015 From: pio.kupczyk at gmail.com (Piotr Kupczyk) Date: Thu, 26 Feb 2015 21:38:26 +0100 Subject: [code-quality] Is it possilbe to run pyLint on a string Message-ID: I am wondering whether it is possible to run pylint on a string containing code. I checked that it is possible in flake8 i.e. http://flake8.readthedocs.org/en/latest/api.html#flake8.main.check_code Is that possible in pylint? Thanks From skip.montanaro at gmail.com Fri Feb 27 03:34:57 2015 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Thu, 26 Feb 2015 20:34:57 -0600 Subject: [code-quality] Is it possilbe to run pyLint on a string In-Reply-To: References: Message-ID: > I am wondering whether it is possible to run > pylint on a string containing code. You could write the string to a temp file, and run pylint on that file. Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From pio.kupczyk at gmail.com Fri Feb 27 19:37:52 2015 From: pio.kupczyk at gmail.com (Piotr Kupczyk) Date: Fri, 27 Feb 2015 19:37:52 +0100 Subject: [code-quality] Is it possilbe to run pyLint on a string In-Reply-To: References: Message-ID: Hi Skip, thanks for reply. I am actually looking for an option to not create any files (even temporary) at all. Is there still an option to use pylint on a string? Cheers, Piotr. 2015-02-27 3:34 GMT+01:00 Skip Montanaro : >> I am wondering whether it is possible to run >> pylint on a string containing code. > > You could write the string to a temp file, and run pylint on that file. > > Skip From skip.montanaro at gmail.com Fri Feb 27 20:25:37 2015 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Fri, 27 Feb 2015 13:25:37 -0600 Subject: [code-quality] Is it possilbe to run pyLint on a string In-Reply-To: References: Message-ID: On Fri, Feb 27, 2015 at 12:37 PM, Piotr Kupczyk wrote: > thanks for reply. I am actually looking for an option to not create > any files (even temporary) at all. > Is there still an option to use pylint on a string? Now that I'm not responding from my phone, I could more easily poke around the docs and code. Looking at the code, I see nothing which obviously suggests there is a pylint API which accepts a string to be linted. The code in .../pylint/lint.py seems to be very strongly tied to operation on files from the command line. If you want to execute it programmatically, I think you're going to have to write your string to a file, construct a list of strings which mimics sys.argv[1:], then execute from pylint.lint import Run Run(args) and clean up with its finished. Skip