mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-11 04:07:39 +02:00
Plugins: Make open method clearer to use
This highlights that the FileHandler class can also be seen as a method similar to open, and it removes unnecessary context managers, allowing plugins to close files as they wish (they must, however, remember to close the file for it to be committed).
This commit is contained in:
@@ -129,7 +129,7 @@ class PluginInterface(interfaces.configuration.ConfigurableInterface,
|
||||
"""Returns a context manager and thus can be called like open"""
|
||||
return self._file_handler
|
||||
|
||||
def set_file_handler(self, handler: Type[FileHandlerInterface]) -> None:
|
||||
def set_open_method(self, handler: Type[FileHandlerInterface]) -> None:
|
||||
"""Sets the file handler to be used by this plugin."""
|
||||
if not issubclass(handler, FileHandlerInterface):
|
||||
raise ValueError("FileHandler must be a subclass of FileHandlerInterface")
|
||||
|
||||
Reference in New Issue
Block a user