diff --git a/stack/hlsconstructs/step_function.py b/stack/hlsconstructs/step_function.py index bb4a628..05c815e 100644 --- a/stack/hlsconstructs/step_function.py +++ b/stack/hlsconstructs/step_function.py @@ -1,6 +1,6 @@ -import json +from typing import Any, Mapping -from aws_cdk import aws_iam, aws_stepfunctions, core +from aws_cdk import aws_iam, core from hlsconstructs.lambdafunc import Lambda @@ -18,8 +18,7 @@ def __init__( assumed_by=aws_iam.ServicePrincipal("states.amazonaws.com"), ) - def addLambdasToRole(self, arguments): - for key in arguments: - arg = arguments[key] - if type(arg) == Lambda: + def addLambdasToRole(self, arguments: Mapping[str, Any]): + for arg in arguments.values(): + if isinstance(arg, Lambda): self.steps_role.add_to_policy(arg.invoke_policy_statement) diff --git a/stack/stack.py b/stack/stack.py index 9fc7017..de8b121 100644 --- a/stack/stack.py +++ b/stack/stack.py @@ -45,12 +45,7 @@ def getenv(key, default): value = os.getenv(key, default) - if value is None: - value = default - elif type(value) == str: - if len(value) == 0: - value = default - return value + return default if value == "" else value # Optional env settings