Last active
December 7, 2020 12:52
-
-
Save Kl0ven/407cb37a0f478c0eb8ac783a2d030c97 to your computer and use it in GitHub Desktop.
[Python snippets provisionning labs] #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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