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.
This commit is contained in:
Mike Auty
2020-11-17 22:04:55 +00:00
parent 30de81795c
commit 9150cd971b
+3 -2
View File
@@ -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