Skip to content

Commit

Permalink
Adjust type annotations to be backwards-compatible with Python 3.7 an…
Browse files Browse the repository at this point in the history
…d 3.8.
  • Loading branch information
lapets committed Dec 7, 2023
1 parent 2f64d7a commit 6f404ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tinybio/tinybio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
a secure multi-party computation protocol.
"""
from __future__ import annotations
from typing import Sequence, Iterable
from typing import Dict, List, Tuple, Sequence, Iterable
import doctest
import math
from modulo import modulo
Expand All @@ -19,7 +19,7 @@
def _encode(
descriptor: Sequence[float],
for_auth: bool = False
) -> dict[tuple[int, int], int]:
) -> Dict[Tuple[int, int], int]:
"""
Encode data for requests to nodes.
"""
Expand Down Expand Up @@ -119,7 +119,7 @@ def authenticate(
[registration_token, authentication_token]
)

class request(list[tuple[int, int]]):
class request(List[Tuple[int, int]]):
"""
Data structure for representing registration and authentication requests.
"""
Expand Down Expand Up @@ -155,13 +155,13 @@ def authentication(descriptor: Sequence[float]) -> request:
"""
return request(_encode(descriptor, True).keys())

class token(dict[tuple[int, int], modulo]):
class token(Dict[Tuple[int, int], modulo]):
"""
Data structure for representing registration and authentication tokens.
"""
@staticmethod
def registration(
masks: Iterable[dict[tuple[int, int], modulo]],
masks: Iterable[Dict[Tuple[int, int], modulo]],
descriptor: Sequence[float]
) -> token:
"""
Expand All @@ -188,7 +188,7 @@ def registration(

@staticmethod
def authentication(
masks: Iterable[dict[tuple[int, int], modulo]],
masks: Iterable[Dict[Tuple[int, int], modulo]],
descriptor: Sequence[float]
) -> token:
"""
Expand Down

0 comments on commit 6f404ba

Please sign in to comment.