-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function created with partial gives invalid-name warning #1101
Comments
The check that verifies invalid-name doesn't care what the RHS of an assignment is, it is quite dumb and adding additional tips such as this is not worth it at the end of the day. Feel free to customize the const-rgx variable for more lax rules or disable the error locally. |
This problem affects not only partial, but also e.g. types created with by namedtuple, which is a somewhat more central feature than partial. So I can't say that I agree, but thanks for the quick reply. |
Now that pylint does support proper logic for |
Pylint no longer complains about this case from version 2.5.0 and onward as a consequence of #3111 . |
@dandersson Cheers, that's good to hear, and thank you for posting an update about it on this issue! |
@dandersson thanks for this update! |
Great stuff, thanks |
Steps to reproduce
Type in a program such as:
Run pylint on it
Current behavior
It will give you an invalid-name error on the line:
call = partial(subprocess.call, shell=True)
Expected behavior
I don't think this should raise en error.
partial
return a partial object, which is a function (see https://docs.python.org/2/library/functools.html) with a little extra information attached to it, but it is non the less a function. Therefore, I think, that if the return value of partial is assigned a name (even at the module level) it should just adhere to the function naming conventions not constant ones.I realize that special cases are annoying for all the extra code they involve, but I think this one should be worth it.
pylint --version output
pylint 1.6.4
astroid 1.4.8
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1]
The text was updated successfully, but these errors were encountered: