From 6687a187dd5396d728ab0218ace3798598c3fcc5 Mon Sep 17 00:00:00 2001 From: KaylaSeeley Date: Sun, 10 Nov 2024 21:55:35 +0000 Subject: [PATCH] ran black --- metaflow/parameters.py | 2 +- metaflow/plugins/events_decorator.py | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/metaflow/parameters.py b/metaflow/parameters.py index 8c672fce965..5bc14ba61ad 100644 --- a/metaflow/parameters.py +++ b/metaflow/parameters.py @@ -167,7 +167,7 @@ def _check_type(self, val, deploy_time): % (self.parameter_name, self.field) ) - if isinstance(self.parameter_type, list): + if isinstance(self.parameter_type, list): if not any(isinstance(val, x) for x in self.parameter_type): msg += "Expected a %s." % TYPES[self.parameter_type] raise ParameterFieldTypeMismatch(msg) diff --git a/metaflow/plugins/events_decorator.py b/metaflow/plugins/events_decorator.py index 8ad347bf720..a94cd60788d 100644 --- a/metaflow/plugins/events_decorator.py +++ b/metaflow/plugins/events_decorator.py @@ -105,7 +105,7 @@ def flow_init( ): new_name = DeployTimeField( "event_name", - None, + str, None, self.attributes["event"]["name"], False, @@ -126,11 +126,11 @@ def flow_init( "of size 2" % self.attributes["event"]["name"] ) self.attributes["event"]["parameters"] = new_param_value - elif callable(param_value) and not isinstance( + elif callable(param_value) and not isinstance( # can be list or dict param_value, DeployTimeField ): new_param_value = DeployTimeField( - "param", None, None, param_value, False + "param", [list, dict], None, param_value, False ) self.attributes["event"]["parameters"] = new_param_value self.triggers.append(self.attributes["event"]) @@ -138,7 +138,7 @@ def flow_init( self.attributes["event"], DeployTimeField ): trig = DeployTimeField( - "event", None, None, self.attributes["event"], False + "event", dict, None, self.attributes["event"], False ) self.triggers.append(trig) else: @@ -168,7 +168,7 @@ def flow_init( event["name"], DeployTimeField ): new_name = DeployTimeField( - "event_name", None, None, event["name"], False + "event_name", str, None, event["name"], False ) event["name"] = new_name param_value = event.get("parameters", {}) @@ -193,13 +193,13 @@ def flow_init( param_value, DeployTimeField ): new_param_value = DeployTimeField( - "param", None, None, param_value, False + "param", [list, dict], None, param_value, False ) event["parameters"] = new_param_value self.triggers.append(event) elif callable(event) and not isinstance(event, DeployTimeField): trig = DeployTimeField( - "event", None, None, self.attributes["event"], False + "event", dict, None, self.attributes["event"], False ) self.triggers.append(trig) else: @@ -286,7 +286,9 @@ def format_deploytime_value(self): "It should be a list/tuple of strings and lists/tuples " "of size 2" % self.attributes["event"]["name"] ) + trigger_params = new_trigger_params + trigger["parameters"] = trigger_params trigger_name = trigger.get("name") # Case where just the name is a function (always a str) @@ -424,7 +426,7 @@ def flow_init( self.attributes["flow"], DeployTimeField ): trig = DeployTimeField( - "fq_name", None, None, self.attributes["flow"], False + "fq_name", [str, dict], None, self.attributes["flow"], False ) self.triggers.append(trig) else: