island: Simplify logic when creating reverse schema

Co-authored-by: Mike Salvatore <mike.s.salvatore@gmail.com>
This commit is contained in:
Shreya Malviya 2021-09-27 22:13:37 +05:30 committed by GitHub
parent 0804cecb64
commit 72caf5a80a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -31,7 +31,6 @@ def get_config_schema_per_attack_technique(schema: Dict) -> Dict[str, Dict[str,
def _add_config_field_to_reverse_schema( def _add_config_field_to_reverse_schema(
definition_type: str, config_field: str, attack_technique: str, reverse_schema: Dict definition_type: str, config_field: str, attack_technique: str, reverse_schema: Dict
) -> None: ) -> None:
if attack_technique in reverse_schema: reverse_schema.setdefault(attack_technique, {})
reverse_schema[attack_technique].setdefault(definition_type, []).append(config_field) reverse_schema[attack_technique].setdefault(definition_type, [])
else: reverse_schema[attack_technique][definition_type].append(config_field)
reverse_schema[attack_technique] = {definition_type: [config_field]}