Previously, the types of instance attributes were annotated with the
first assignment of each attribute. The standard way to annotate
instance attributes is to do so at class level without assigning any
value.
According to https://bugs.python.org/issue35089, typing.io should not
be used anymore, and the types that it contains should be accessed
through the main typing module instead.
For compressed resources, the value of the length attribute can be
accessed much more quickly than the data itself (because it only
requires parsing the header, rather than decompressing the entire
data). This is used to speed up listing of compressed resources on the
command line.
The length_raw attribute is added for symmetry, although it is not
specifically optimized in any case yet.
All decompressors now have exactly the same signature (as a result,
each decompressor now has to check itself that the header type is
correct). This allows the decompressors to be stored in a simple
dictionary, which makes the lookup process much simpler.
In preparation for #3, the compressed resource data headers are parsed
and stored as proper objects. For now these objects are only used
internally by the decompression code, but in the future they can be
exposed.
In most cases the file order is not important and the unsorted output
hurts readability. The performance impact of sorting is relatively
small and barely noticeable even with large resource files.
Previously all non-ASCII characters were hex-escaped on output.
However, many resource files use MacRoman characters in resource names
and sometimes in resource types, so it makes sense to use MacRoman in
the interest of readability.
Previously, when some aspect of a resource's metadata was not present
(e. g. a resource with no name), the description would
explicitly point this out (and e. g. say "unnamed"). Now missing parts
of the metadata are simply omitted from the description, resulting in
cleaner output in many cases.
The resource description formats used by the listings and dumps have
also been unified. Previously the descriptions were structured slightly
differently in each case; this is now no longer the case.
The broken non-seeking read implementation of ResourceFile is removed,
and non-seekable streams are now handled by reading the entire stream
data first and wrapping it in a BytesIO to make it seekable.
The manual selection of seeking/non-seeking reading has been removed as
well, since it is no longer needed and was already nearly useless.