Skip to content

Instantly share code, notes, and snippets.

@pdxjohnny
Created June 16, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdxjohnny/6fb0cdb586e3d73f15c538bd715efbda to your computer and use it in GitHub Desktop.
Save pdxjohnny/6fb0cdb586e3d73f15c538bd715efbda to your computer and use it in GitHub Desktop.
DFFML memory support default values TODO
diff --git a/dffml/df/memory.py b/dffml/df/memory.py
index 7d29c84f..f6c7cdfb 100644
--- a/dffml/df/memory.py
+++ b/dffml/df/memory.py
@@ -586,8 +586,27 @@ class MemoryInputNetworkContext(BaseInputNetworkContext):
],
)
)
- # Return if there is no data for an input
+ # There is no data in the network for an input
if not gather[input_name]:
+ # Check if there is a default value for the parameter,
+ # if so use it. That default will either come from the
+ # definition attached to input_name, or it will come
+ # from one of the alternate definition given within the
+ # input flow for the input_name.
+ # TODO
+ to_check = [operation.inputs[input_name]] + alternate_defintions
+ for check in to_check:
+ if has default:
+ gather[input_name].append(
+ Parameter(
+ key=input_name,
+ value=item.value,
+ origin=item,
+ definition=operation.inputs[input_name],
+ )
+ )
+ # If there is no default value, we don't have a complete
+ # paremeter set, so we bail out
return
# Generate all possible permutations of applicable inputs
# Create the parameter set for each
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment