Use parameterized typing.Mapping in ResourceFile definition

Previously the un-parameterized collections.abc.Mapping was used, which
makes type checking less accurate, as the exact key/value types are not
known.
This commit is contained in:
dgelessus 2019-09-29 15:42:19 +02:00
parent 0ac6e8a3c4
commit 449bf4dd71
1 changed files with 2 additions and 2 deletions

View File

@ -197,11 +197,11 @@ class Resource(object):
else:
return self.data_raw
class ResourceFile(collections.abc.Mapping):
class ResourceFile(typing.Mapping[bytes, typing.Mapping[int, Resource]]):
"""A resource file reader operating on a byte stream."""
# noinspection PyProtectedMember
class _LazyResourceMap(collections.abc.Mapping):
class _LazyResourceMap(typing.Mapping[int, Resource]):
"""Internal class: Lazy mapping of resource IDs to resource objects, returned when subscripting a ResourceFile."""
_resfile: "ResourceFile"