Skip to content

Commit

Permalink
ran black
Browse files Browse the repository at this point in the history
  • Loading branch information
KaylaSeeley committed Nov 10, 2024
1 parent 155ce29 commit 6687a18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion metaflow/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 10 additions & 8 deletions metaflow/plugins/events_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def flow_init(
):
new_name = DeployTimeField(
"event_name",
None,
str,
None,
self.attributes["event"]["name"],
False,
Expand All @@ -126,19 +126,19 @@ 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"])
elif callable(self.attributes["event"]) and not isinstance(
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:
Expand Down Expand Up @@ -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", {})
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6687a18

Please sign in to comment.