summaryrefslogtreecommitdiff
path: root/type_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'type_utils.py')
-rw-r--r--type_utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/type_utils.py b/type_utils.py
index 7b79af0..ee52444 100644
--- a/type_utils.py
+++ b/type_utils.py
@@ -7,6 +7,11 @@ logger = logging.getLogger(__name__)
def unwrap_optional(x: Optional[Any]) -> Any:
+ """Unwrap an Optional[Type] argument returning a Type value back.
+ If the Optional[Type] argument is None, however, raise an exception.
+ Use this to satisfy most type checkers that a value that could
+ be None isn't so as to drop the Optional.
+ """
if x is None:
msg = 'Argument to unwrap_optional was unexpectedly None'
logger.critical(msg)