From 69ec16ded335226db558cd32977d28b3add728cc Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Wed, 13 Dec 2017 23:21:31 +0000 Subject: [PATCH] Fix up the signatures for the overloaded __getitem__ method. --- volatility/framework/objects/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index 69ae62f3f..ec80672b5 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -462,8 +462,15 @@ class Array(interfaces.objects.ObjectInterface, abc.Sequence): return 0 raise IndexError("Member not present in array template: {}".format(child)) - def __getitem__(self, i: typing.Union[int, slice]) \ - -> typing.Union[typing.List[interfaces.objects.Template], interfaces.objects.Template]: + @typing.overload + def __getitem__(self, i: int) -> interfaces.objects.Template: + ... + + @typing.overload + def __getitem__(self, s: slice) -> typing.List[interfaces.objects.Template]: + ... + + def __getitem__(self, i): """Returns the i-th item from the array""" result = [] # type: typing.List[interfaces.objects.Template] mask = self._context.memory[self.vol.layer_name].address_mask