Add type annotations to most of the automagic files.

This commit is contained in:
Mike Auty
2017-12-05 00:23:54 +00:00
parent 4f58f0748f
commit 1f444f7b5e
13 changed files with 153 additions and 57 deletions
@@ -1,6 +1,7 @@
import logging
import os
import pickle
import typing
from urllib import parse
from volatility.framework import constants, exceptions, interfaces
@@ -8,6 +9,8 @@ from volatility.framework.symbols import intermed
vollog = logging.getLogger(__name__)
LinuxBanners = typing.Dict[bytes, typing.List[str]]
class LinuxSymbolCache(interfaces.automagic.AutomagicInterface):
"""Runs through all Linux symbols tables and caches their banners"""
@@ -17,8 +20,8 @@ class LinuxSymbolCache(interfaces.automagic.AutomagicInterface):
priority = 0
@classmethod
def load_linux_banners(cls):
linuxbanners = {}
def load_linux_banners(cls) -> LinuxBanners:
linuxbanners: LinuxBanners = {}
if os.path.exists(constants.LINUX_BANNERS_PATH):
with open(constants.LINUX_BANNERS_PATH, "rb") as f:
# We use pickle over JSON because we're dealing with bytes objects