PyInstaller versions prior to 3.2 do not pre-compile ARCHIVE_ITEM_PYSOURCE
Under the same typeCmprsData ('s') PyInstaller versions prior to 3.2 store Python source files (see issue 1847). They shouldn't be prefixed with pyc header.
I didn't (yet) find any way to detect if 's' file is compiled or not (PyInstaller version is unknown from file) - other than reading the first byte to check if it is marshalled code object ('c').
That's correct. Old versions of pyinstaller store the code as-is. As there doesn't seem to have a definite way to find the exact version of PyInstaller, one workaround can be to use some heuristics to differentiate between text vs binary data and save as a .pyc or .py accordingly.
Also pyinstaller 3.2 was released back in 2016. Maybe we can keep the current code and save as .pyc with a warning when finding files of type ARCHIVE_ITEM_PYSOURCE.