From f462fcc8420abb757146ec053a91fed98e70913b Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 23 Sep 2020 10:13:14 +0300 Subject: [PATCH] Removed unsustainable python type hinting rules --- .../zero_trust/scoutsuite/data_parsing/rule_parsing.py | 9 +++------ .../rule_path_building/abstract_rule_path_creator.py | 7 +++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_parsing.py b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_parsing.py index 3a9f9b58b..ed2530755 100644 --- a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_parsing.py +++ b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_parsing.py @@ -1,8 +1,5 @@ -from typing import Union - from common.utils.code_utils import get_object_value_by_path from common.utils.exceptions import RulePathCreatorNotFound -from monkey_island.cc.services.zero_trust.scoutsuite.consts.ec2_rules import EC2Rules from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators_list import \ RULE_PATH_CREATORS_LIST @@ -10,17 +7,17 @@ from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_buil class RuleParser: @staticmethod - def get_rule_data(scoutsuite_data, rule_name: Union[EC2Rules]): + def get_rule_data(scoutsuite_data, rule_name): rule_path = RuleParser.get_rule_path(rule_name) return get_object_value_by_path(scoutsuite_data, rule_path) @staticmethod - def get_rule_path(rule_name: Union[EC2Rules]): + def get_rule_path(rule_name): creator = RuleParser.get_rule_path_creator(rule_name) return creator.build_rule_path(rule_name) @staticmethod - def get_rule_path_creator(rule_name: Union[EC2Rules]): + def get_rule_path_creator(rule_name): for rule_path_creator in RULE_PATH_CREATORS_LIST: if rule_name in rule_path_creator.supported_rules: return rule_path_creator diff --git a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/abstract_rule_path_creator.py b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/abstract_rule_path_creator.py index f7113fc50..f9672c474 100644 --- a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/abstract_rule_path_creator.py +++ b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/abstract_rule_path_creator.py @@ -1,7 +1,6 @@ from abc import ABC, abstractmethod -from typing import List, Union +from typing import List -from monkey_island.cc.services.zero_trust.scoutsuite.consts.ec2_rules import EC2Rules from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import SERVICES, FINDINGS, SERVICE_TYPES @@ -14,10 +13,10 @@ class AbstractRulePathCreator(ABC): @property @abstractmethod - def supported_rules(self) -> List[Union[EC2Rules]]: + def supported_rules(self) -> List: pass @classmethod - def build_rule_path(cls, rule_name: Union[EC2Rules]) -> List[str]: + def build_rule_path(cls, rule_name) -> List[str]: assert(rule_name in cls.supported_rules) return [SERVICES, cls.service_type.value, FINDINGS, rule_name.value]