Skip to content

Instantly share code, notes, and snippets.

@wordswords
Created December 17, 2019 19:22
Show Gist options
  • Save wordswords/3fba54fdc919797de12a9db00bccf4aa to your computer and use it in GitHub Desktop.
Save wordswords/3fba54fdc919797de12a9db00bccf4aa to your computer and use it in GitHub Desktop.
import yaml
from os.path import expanduser
home = expanduser("~")
my_config = open(home + '/.secrets/codingmode/secrets.d/hue.yml')
my_config_dict = yaml.load(my_config.read(), Loader=yaml.FullLoader)
result = map(lambda x : x['Prompt'] # return prompt associated with variable \
if x['Variable'] \
== 'user_email' \
else \
None \
, my_config_dict)
print(list(r for r in result if r)) # list comprehension, remove all Nones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment