openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

Pylint fix results in FutureWarning #150

Closed bitsgalore closed 1 year ago

bitsgalore commented 4 years ago

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:

https://github.com/openpreserve/jpylyzer/commit/8aba2c309bbf7ab35fd57257862f9607d3c48001#diff-d356dc96a143dd8d0d9c49ccd38a2cb7

So I would suggest to revert this change back.

bitsgalore commented 4 years ago

UPDATE: this also happens if jpylyzer is run as a script, so it is not specific to the binaries.

bitsgalore commented 4 years ago

Reverted back to original line, which gets rid of the warning:

https://github.com/openpreserve/jpylyzer/commit/8d98ae80ccc4e9a8a482dbb8b173d33b43bffa93

bitsgalore commented 4 years ago

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:

bitsgalore commented 4 years ago

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.

bitsgalore commented 1 year ago

Closing as https://github.com/openpreserve/jpylyzer/issues/179 should have fixed this.