Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing Literal fallback #30

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion adafruit_rsa/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
from struct import pack

try:
from typing import Any, Literal, Tuple
from typing import Any, Tuple

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
except ImportError:
pass


__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RSA.git"

Expand Down
7 changes: 6 additions & 1 deletion adafruit_rsa/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
import adafruit_rsa.core

try:
from typing import Any, Tuple, Dict, Callable, Literal
from typing import Any, Tuple, Dict, Callable

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
except ImportError:
pass

Expand Down
7 changes: 6 additions & 1 deletion adafruit_rsa/machine_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
import sys

try:
from typing import Literal, Tuple
from typing import Tuple

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
except ImportError:
pass

Expand Down
7 changes: 6 additions & 1 deletion adafruit_rsa/pkcs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@
from adafruit_rsa import common, transform, core

try:
from typing import Optional, Iterator, Union, Literal
from typing import Optional, Iterator, Union
from adafruit_rsa.key import PublicKey, PrivateKey

try:
from typing import Protocol
except ImportError:
from typing_extensions import Protocol

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal

class _FileLikeObject(Protocol):
"""A file like object that implements the :meth:`read` method"""

Expand Down
5 changes: 4 additions & 1 deletion adafruit_rsa/prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import adafruit_rsa.randnum

try:
from typing import Literal
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
except ImportError:
pass

Expand Down