diff --git a/adafruit_fona/adafruit_fona.py b/adafruit_fona/adafruit_fona.py index fc838fa..a51bfd5 100644 --- a/adafruit_fona/adafruit_fona.py +++ b/adafruit_fona/adafruit_fona.py @@ -27,10 +27,15 @@ from simpleio import map_range try: - from typing import Optional, Tuple, Union, Literal + from typing import Optional, Tuple, Union from circuitpython_typing import ReadableBuffer from busio import UART from digitalio import DigitalInOut + + try: + from typing import Literal + except ImportError: + from typing_extensions import Literal except ImportError: pass diff --git a/adafruit_fona/fona_3g.py b/adafruit_fona/fona_3g.py index eedad3e..5ebd1e5 100755 --- a/adafruit_fona/fona_3g.py +++ b/adafruit_fona/fona_3g.py @@ -24,9 +24,13 @@ from .adafruit_fona import FONA, REPLY_OK try: - from typing import Optional, Tuple, Union, Literal + from typing import Optional, Tuple, Union from busio import UART from digitalio import DigitalInOut + try: + from typing import Literal + except ImportError: + from typing_extensions import Literal except ImportError: pass