From strombrg at gmail.com Tue Aug 1 01:17:39 2017 From: strombrg at gmail.com (Dan Stromberg) Date: Mon, 31 Jul 2017 22:17:39 -0700 Subject: [code-quality] pylint: __implements__ or abc.ABCMeta? Message-ID: I put a little time into exploring __implements__ and abc.ABCMeta today., in combination with pylint. I guess it's about time I started using one or both of them. I'm a little puzzled though. It _seems_ like pylint is ignoring __implements__, while abc.ABCMeta appears to be working the way I'd expect it would. I've put some sample code at http://stromberg.dnsalias.org/svn/pylint-interface-experiment/trunk/ At that URL, pie is an __implements__ experiment, and pabce is an ABC experiment. I found a year-old thread on stackoverflow saying that pylint no longer does __implements__, which seems to fit with what I'm seeing. However, the pylint doc and pylint code (internally) still appear to use __implements__ - so maybe I'm just doing it wrong. The thread: https://stackoverflow.com/questions/20879269/why-pylint-keeps-saying-my-class-is-r0923-interface-not-implemented Assuming they both still work (__implements__ and abc.ABCMeta), which is preferred? Or are they a toss-up? Any suggestions on how to get __implements__ working? Thanks! PS: I'm using: pylint 1.7.1, astroid 1.5.2 Python 3.4.2 (default, Apr 17 2017, 09:05:12) -- Dan Stromberg -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas at tomas.cat Tue Aug 1 08:06:48 2017 From: tomas at tomas.cat (=?UTF-8?B?VG9tw6BzIE7DusOxZXo=?=) Date: Tue, 1 Aug 2017 13:06:48 +0100 Subject: [code-quality] Issues with E1102: "not callable" In-Reply-To: References: Message-ID: Hi I'm fairly new to pylint and I've followed all the suggestions to clean up my code and make it more readable. But there's one error I can't get rid of in this piece of code: def api_put(api_path, payload): """This function makes PUT requests to the api""" if api_path.startswith("http"): url = api_path else: url = SERVICE_URL + api_path The error I'm getting is: [pylint] E1102:api_path.startswith is not callable I checked but there's not much info about it: http://pylint-messages.wikidot.com/messages:e1102 The code works because the argument api_path is a string, so it indeed is callable. Of course if I change it to: if str(api_path).startswith("http"): Then the error disappear. But I already know it is a string, and I've always read you shouldn't type-check in Python. Can anyone shed some light? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at the-compiler.org Tue Aug 1 10:07:12 2017 From: me at the-compiler.org (Florian Bruhin) Date: Tue, 1 Aug 2017 16:07:12 +0200 Subject: [code-quality] Issues with E1102: "not callable" In-Reply-To: References: Message-ID: <20170801140712.sv2ltjkcf6hpdeuh@hooch.localdomain> Hey, On Tue, Aug 01, 2017 at 01:06:48PM +0100, Tom?s N??ez wrote: > The error I'm getting is: > > [pylint] E1102:api_path.startswith is not callable That output seems like a very old pylint version to me. Can you make sure you have pylint 1.7.2 and astroid 1.5.3? Florian -- https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From tomas at tomas.cat Tue Aug 1 11:46:07 2017 From: tomas at tomas.cat (=?UTF-8?B?VG9tw6BzIE7DusOxZXo=?=) Date: Tue, 1 Aug 2017 16:46:07 +0100 Subject: [code-quality] Issues with E1102: "not callable" In-Reply-To: <20170801140712.sv2ltjkcf6hpdeuh@hooch.localdomain> References: <20170801140712.sv2ltjkcf6hpdeuh@hooch.localdomain> Message-ID: Oh, I'm really sorry, you're right. Someone left in our repository a zip with the master git branch from may 2016, and pip thought it was v2.0.0, and was installing it over 1.7.2. I forced v1.7.2 and that message disappeared. Thanks a lot! El dia 1 ag. 2017 15:08, "Florian Bruhin" va escriure: Hey, On Tue, Aug 01, 2017 at 01:06:48PM +0100, Tom?s N??ez wrote: > The error I'm getting is: > > [pylint] E1102:api_path.startswith is not callable That output seems like a very old pylint version to me. Can you make sure you have pylint 1.7.2 and astroid 1.5.3? Florian -- https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From strombrg at gmail.com Wed Aug 2 15:18:15 2017 From: strombrg at gmail.com (Dan Stromberg) Date: Wed, 2 Aug 2017 12:18:15 -0700 Subject: [code-quality] pylint: __implements__ or abc.ABCMeta? In-Reply-To: References: Message-ID: Anyone? It's been 2 days... On Mon, Jul 31, 2017 at 10:17 PM, Dan Stromberg wrote: > > I put a little time into exploring __implements__ and abc.ABCMeta today., > in combination with pylint. > > I guess it's about time I started using one or both of them. > > I'm a little puzzled though. It _seems_ like pylint is ignoring > __implements__, while abc.ABCMeta appears to be working the way I'd expect > it would. > > I've put some sample code at http://stromberg.dnsalias. > org/svn/pylint-interface-experiment/trunk/ At that URL, pie is an > __implements__ experiment, and pabce is an ABC experiment. > > I found a year-old thread on stackoverflow saying that pylint no longer > does __implements__, which seems to fit with what I'm seeing. However, the > pylint doc and pylint code (internally) still appear to use __implements__ > - so maybe I'm just doing it wrong. The thread: https://stackoverflow. > com/questions/20879269/why-pylint-keeps-saying-my-class- > is-r0923-interface-not-implemented > > Assuming they both still work (__implements__ and abc.ABCMeta), which is > preferred? Or are they a toss-up? > > Any suggestions on how to get __implements__ working? > > Thanks! > > PS: I'm using: > pylint 1.7.1, > astroid 1.5.2 > Python 3.4.2 (default, Apr 17 2017, 09:05:12) > > -- > Dan Stromberg > -- Dan Stromberg -------------- next part -------------- An HTML attachment was scrubbed... URL: