From 0e016797bb7f0249015c9bce104a986fc5387d20 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 23 Nov 2019 20:44:22 +0000 Subject: [PATCH] Typing: Change signatures to co-variant Mapping from Dict --- volatility/framework/interfaces/symbols.py | 6 +++--- volatility/framework/symbols/intermed.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/volatility/framework/interfaces/symbols.py b/volatility/framework/interfaces/symbols.py index ad570b559..946b1ec8b 100644 --- a/volatility/framework/interfaces/symbols.py +++ b/volatility/framework/interfaces/symbols.py @@ -5,7 +5,7 @@ import bisect import collections.abc from abc import abstractmethod, ABC -from typing import Any, Dict, Iterable, List, Optional, Tuple, Type +from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Mapping from volatility.framework import constants, exceptions, interfaces from volatility.framework.interfaces import configuration, objects @@ -80,7 +80,7 @@ class BaseSymbolTableInterface: name: str, native_types: 'NativeTableInterface', table_mapping: Optional[Dict[str, str]] = None, - class_types: Optional[Dict[str, Type[objects.ObjectInterface]]] = None) -> None: + class_types: Optional[Mapping[str, Type[objects.ObjectInterface]]] = None) -> None: """ Args: @@ -266,7 +266,7 @@ class SymbolTableInterface(BaseSymbolTableInterface, configuration.ConfigurableI name: str, native_types: 'NativeTableInterface', table_mapping: Optional[Dict[str, str]] = None, - class_types: Optional[Dict[str, Type[objects.ObjectInterface]]] = None) -> None: + class_types: Optional[Mapping[str, Type[objects.ObjectInterface]]] = None) -> None: """Instantiates an SymbolTable based on an IntermediateSymbolFormat JSON file. This is validated against the appropriate schema. The validation can be disabled by passing validate = False, but this should almost never be done. diff --git a/volatility/framework/symbols/intermed.py b/volatility/framework/symbols/intermed.py index c7d507606..5035ea82e 100644 --- a/volatility/framework/symbols/intermed.py +++ b/volatility/framework/symbols/intermed.py @@ -83,7 +83,7 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface): native_types: interfaces.symbols.NativeTableInterface = None, table_mapping: Optional[Dict[str, str]] = None, validate: bool = True, - class_types: Optional[Dict[str, Type[interfaces.objects.ObjectInterface]]] = None) -> None: + class_types: Optional[Mapping[str, Type[interfaces.objects.ObjectInterface]]] = None) -> None: """Instantiates a SymbolTable based on an IntermediateSymbolFormat JSON file. This is validated against the appropriate schema. The validation can be disabled by passing validate = False, but this should almost never be done.