From 1fbf76b95a6f48768d681d1156fab68fed9bdd97 Mon Sep 17 00:00:00 2001 From: Stijn Seghers Date: Thu, 16 Jan 2020 12:48:48 +1300 Subject: [PATCH] Keep cfnlint import function-local (~1s) Saves about 1s of startup time. --- moto/cloudformation/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moto/cloudformation/utils.py b/moto/cloudformation/utils.py index cd8481002..54c338b9b 100644 --- a/moto/cloudformation/utils.py +++ b/moto/cloudformation/utils.py @@ -6,7 +6,6 @@ import yaml import os import string -from cfnlint import decode, core from moto.core import ACCOUNT_ID @@ -62,6 +61,8 @@ def yaml_tag_constructor(loader, tag, node): def validate_template_cfn_lint(template): + # Importing cfnlint adds a significant overhead, so we keep it local + from cfnlint import decode, core # Save the template to a temporary file -- cfn-lint requires a file filename = "file.tmp"