Skip to content

Commit

Permalink
tweaks to DictionaryKeyRead
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Sep 26, 2023
1 parent 5e0c361 commit 93f863c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions SharedProcessors/DictionaryKeyRead.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ def read_dictionary_key(self, input_dictionary, dictionary_key):
def main(self):
"""Execution starts here"""
# get name of dictionary to read from:
input_dictionary = self.env.get("input_dictionary")
input_dictionary_name = self.env.get("input_dictionary", "")
# get actual dictionary object:
input_dictionary = self.env.get(input_dictionary)
input_dictionary = self.env.get(input_dictionary_name, None)
# get name of key:
dictionary_key = self.env.get("dictionary_key")
dictionary_key = self.env.get("dictionary_key", None)
# get name of variable to store output:
output_variable = self.env.get("output_variable")
output_variable = self.env.get("output_variable", None)

value = self.read_dictionary_key(input_dictionary, dictionary_key)

if value is not None:
self.output(f"Read '{dictionary_key}' from the dictionary: {value}")
self.output(
f"Read '{dictionary_key}' from dictionary '{input_dictionary_name}': {value}"
)
self.env[output_variable] = value
self.output_variables[output_variable] = {
"description": "the custom output"
Expand Down
2 changes: 1 addition & 1 deletion Test-Recipes/DictionaryKeyRead.test.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Input:
NAME: DictionaryKeyReadTest
DisplayName: DictionaryKeyRead
Template_version: "0.0.0"
Template_example: "example value1"
Template_example: "example value"
MinimumVersion: "2.3"
Process:
- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppendInput
Expand Down

0 comments on commit 93f863c

Please sign in to comment.