Hi PyCQA,
I've done a little searching but have not found a lint check for the
following:
[
'a',
'b'
'c'
]
evaluates to ['a', 'bc'] due to implicit string concatenation, but usually
it's intended to be ['a', 'b', 'c']. If it is meant to be ['a', 'bc'] it's
bad style.
Guido recommends popular lint tools add a rule for this here:
https://groups.google.com/forum/#!msg/python-ideas/jP1YtlyJqxs/FacZu-WK_9AJ
If this check does not exist, I would be willing to create a flake8 plugin
and add it to PyCQA.
Regards,
Razzi
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-cla…
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
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!