island: Use dict's `get()` method to shorten

`get_config_schema_per_attack_technique()` in
config_schema_per_attack_technique.py
This commit is contained in:
Shreya Malviya 2021-09-24 12:30:11 +05:30
parent 2cc00205f1
commit 4a65ac37ef
1 changed files with 4 additions and 5 deletions

View File

@ -22,11 +22,10 @@ def get_config_schema_per_attack_technique() -> Dict[str, Dict[str, List[str]]]:
definition_type = definitions[definition]["title"]
for field in definitions[definition]["anyOf"]:
config_field = field["title"]
if "attack_techniques" in field:
for attack_technique in field["attack_techniques"]:
_add_config_field_to_reverse_schema(
definition_type, config_field, attack_technique, reverse_schema
)
for attack_technique in field.get("attack_techniques", []):
_add_config_field_to_reverse_schema(
definition_type, config_field, attack_technique, reverse_schema
)
return reverse_schema