Skip to content

Commit

Permalink
Fix Python 3.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasValvekens committed Mar 30, 2021
1 parent eb265ec commit 433caf0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion certomancer/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'LabelString', 'pyca_cryptography_present'
]

from typing import get_args, Optional
from typing import Optional

_noneType = type(None)

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 433caf0

Please sign in to comment.