diff --git a/certomancer/config_utils.py b/certomancer/config_utils.py index e7a832a..ca35bae 100644 --- a/certomancer/config_utils.py +++ b/certomancer/config_utils.py @@ -20,7 +20,7 @@ 'LabelString', 'pyca_cryptography_present' ] -from typing import get_args, Optional +from typing import Optional _noneType = type(None) @@ -50,6 +50,15 @@ def get_subclass(thing) -> Optional[type]: if isinstance(thing, type): the_type = thing else: + try: + from typing import get_args + except ImportError: + def get_args(tp): + try: + return tp.__args__ + except AttributeError: + return () + # is it an optional? (i.e. Union[X, None]) # if so, retrieve the wrapped type try: