diff options
| author | Scott Gasch <[email protected]> | 2021-03-24 18:08:54 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-03-24 18:08:54 -0700 |
| commit | 497fb9e21f45ec08e1486abaee6dfa7b20b8a691 (patch) | |
| tree | 47aa97a0fca36c4e7025cee5ad4e9ec6db49b881 /type_utils.py | |
Initial revision
Diffstat (limited to 'type_utils.py')
| -rw-r--r-- | type_utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/type_utils.py b/type_utils.py new file mode 100644 index 0000000..7b79af0 --- /dev/null +++ b/type_utils.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import logging +from typing import Any, Optional + +logger = logging.getLogger(__name__) + + +def unwrap_optional(x: Optional[Any]) -> Any: + if x is None: + msg = 'Argument to unwrap_optional was unexpectedly None' + logger.critical(msg) + raise AssertionError(msg) + return x |
