Skip to content

Instantly share code, notes, and snippets.

@Kl0ven
Last active December 7, 2020 12:52
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 Kl0ven/407cb37a0f478c0eb8ac783a2d030c97 to your computer and use it in GitHub Desktop.
Save Kl0ven/407cb37a0f478c0eb8ac783a2d030c97 to your computer and use it in GitHub Desktop.
[Python snippets provisionning labs] #python
def if_any_raise_any(dict, base_dict, base_dict_name):
if any(v is None for v in dict.values()):
msg = "{} key(s) are missing from {}, {}: {}".format(
','.join(k for k, v in dict.items() if v is None), base_dict_name, base_dict_name, base_dict)
logger.error(msg)
raise KeyError(msg)
keys = [k for k in [self.key1, self.key2, self.key3] if (k is not None and len(k) > 0)]
str = '.'.join([k for k in [self.key1, self.key2, self.key3] if (k is not None and len(k) > 0)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment