From 9150cd971beacd0980e73be33d45d23456017e50 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Tue, 17 Nov 2020 22:04:55 +0000 Subject: [PATCH] Core: Change base class for FileHandlerInterface Python 3.6 doesn't appear to support IO[bytes] (and this is also from the typing library), so we instead now inherit from RawIOBase. This provides read, but does not come with a constructor (like FileIO) so is suitable for our needs. Fixes issue #376. --- volatility/framework/interfaces/plugins.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/volatility/framework/interfaces/plugins.py b/volatility/framework/interfaces/plugins.py index 15f45e7a4..c3fbbf65a 100644 --- a/volatility/framework/interfaces/plugins.py +++ b/volatility/framework/interfaces/plugins.py @@ -8,10 +8,11 @@ using objects constructed from symbols. """ # Configuration interfaces must be imported separately, since we're part of interfaces and can't import ourselves +import io import logging import os from abc import ABCMeta, abstractmethod -from typing import List, Tuple, Type, IO +from typing import List, Tuple, Type from volatility import framework from volatility.framework import exceptions, constants, interfaces @@ -19,7 +20,7 @@ from volatility.framework import exceptions, constants, interfaces vollog = logging.getLogger(__name__) -class FileHandlerInterface(IO[bytes]): +class FileHandlerInterface(io.RawIOBase): """Class for storing Files in the plugin as a means to output a file when necessary. This can be used as ContextManager that will close/produce the file automatically when exiting the context block