pylint: updates for pylint 2.11.1 to pass#2392
Conversation
I would prefer for
If " |
|
Sorry, looks like we might have been doubling up... I'd already pushed changes to fix these errors to |
|
feel free to close unless we want to make master pylint-compatible before merging dev or cherry-picking 9752aa3. |
|
OK, did a bit of tidying up. I kept most of your changes, especially the explicit use of the @maxpietsch, @Lestropie: can I ask you to double-check you're happy with the changes in aa5a354? These are to fix 'unused variable' warnings from my compiler (clang 13.0). |
fd49d7a to
3d4e7ab
Compare
|
Correct me if I am wrong but I don't think we can follow pylint rules by using Python2 with io.open('file', 'r', encoding='utf8') as f: type(f.read())
<type 'unicode'>Python3 with io.open('file', 'r', encoding='utf8') as f: type(f.read())
<class 'str'>In |
I've no idea... I don't know whether the type being a regular |
|
Yep, it's a problem. Just tried to run |
Changes in |
Of the two options
I initially preferred the latter but as the removal of python 2 is more thoroughly addressed in |
|
OK, I have to admit I was wondering how we were going to maintain python 2/3 compatibility and pass all the Other than that:
They are, in that Not a problem on CI yet, but I guess it won't be long before that causes failures if we don't address it. And it is true that while this variable gets incremented in the loop, it ends up completely unused. So either we ditch it or we use it - whichever is most appropriate. But this can (and should) all be done in a separate PR since I have a feeling that it doesn't yet cause any failures... |
|
OK, as far as I can tell, these are all the warnings that we currently get on Of these, I reckon we won't be able to fix |
Compilation may well throw that warning with some version of the code, but you specifically requested a review of commit aa5a354, and that commit introduces that variable. So that commit in isolation couldn't possibly be responsible for solving that unused variable warning. I'm guessing that you stripped out eh variable altogether in a previous commit, then re-introduced it including not only the definition and increment but also the later utilisation. |
|
Making changes to text file / string data handling / encoding on |
No, what I mean is there is an unused variable
Yes, I think you're right. Having looked at the range of changes we'd have to make to fix all the warnings, even if do ignore the encoding and string handling warnings, it's probably best to just disable all (or at least most) of the failing tests on |
|
Closing due to being superseded by #2401. Still wish to go through the code and remove any hacks that were put in place for Python2 compatibility; #2047 is already part of |
See also previous conversation on the topic in #2392, in particular commit aa5a354. The approach here is simply to ditch all the unused variables and associated code identified as having no effect. But it may be desirable to actually fix the code to use the variables as might have originally been intended, particularly for tckedit. I'll push updates to that effect in a subsequent commit.
openrequires an encoding. I useio.openwithutf8enoding wherever the encoding wasn't specified. This works for python 3 but causes issues with python 2. Looks like the only portable solution is to use binary mode and encode/decode everything as 'utf8' but that clutters the code quite a bit. I've done that inconfigurebut in other places I left the Python 3 compatibleio.opencalls. Would you rather deactivate the warning, use explicit encode and decode calls, or are you happy to abandon Python 2 support in this PR?buildandconfigure. Removed these but left them inapp.pyand deactivated the warning there as they seem useful for documentation purposes.consider-using-f-string(many inpopluation_template) andconsider-using-withwarnings.itemsand.keyscleanupanyandallcallsexcept Exception as e:throws so manyunused-variablewarnings aboute. Looks like a pylint bug but deactivated thesenote to self: update master before working on the code