jpylyzer
jpylyzer copied to clipboard
Pylint fix results in FutureWarning
If I run the new 32-bit Windows executables on an arbitary (set of) JP2(s), the following warning is printed to STDERR:
C:\Temp\JPYLYZ~1.0RC\jpylyzer\jpylyzer\etpatch.py:74: FutureWarning:
The behavior of this method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
This is caused by the if subelement
statement in etpatch's appendIfNotEmpty function:
def appendIfNotEmpty(self, subelement):
"""Append sub-element, but only if subelement is not empty."""
if subelement:
self.append(subelement)
This line was changed recently as part of the Pylint fixes:
So I would suggest to revert this change back.
UPDATE: this also happens if jpylyzer is run as a script, so it is not specific to the binaries.
Reverted back to original line, which gets rid of the warning:
https://github.com/openpreserve/jpylyzer/commit/8d98ae80ccc4e9a8a482dbb8b173d33b43bffa93
UPDATE: similar warnings occurs if the --mix option is used, this time referring to 3 lines in mix.py. On closer inspection it turns out the warnings (including the one in etpatch.py) are only reported with Python 2.7, and not with Python 3.5. Since a Python 3 PyLint version was used this makes sense. So 2 options:
-
Also fix mix.py, which results in more PyLint warnings (but no warnings shown for Python 2.7 nor 3.x)
-
Leave mix.py unchanged and undo last etpatch.py change. This will result in warnings in Py 2.7, but as Py 2.7 will be retired in january 2020 this problem will go away on its own accord.
For now just accept warnings with --mix option under Py 2.7, then after Py 2.7 is dead and buried implement everything according to Pylint for Py 3. To be addressed afterhttps://github.com/openpreserve/jpylyzer/issues/179.
Closing as https://github.com/openpreserve/jpylyzer/issues/179 should have fixed this.