Skip to content

Commit

Permalink
query: Fix type hints to ensure compatibility with Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed May 2, 2024
1 parent 4fe9e41 commit 95cde08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/skytable_py/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

from abc import ABC
from typing import Tuple
# internal
from .exception import ClientException

Expand All @@ -36,7 +37,7 @@ def get_param_count(self) -> int:


class SkyhashParameter(ABC):
def encode_self(self) -> tuple[bytes, int]: pass
def encode_self(self) -> Tuple[bytes, int]: pass


class UInt(SkyhashParameter):
Expand All @@ -45,19 +46,19 @@ def __init__(self, v: int) -> None:
raise ClientException("unsigned int can't be negative")
self.v = v

def encode_self(self) -> tuple[bytes, int]:
def encode_self(self) -> Tuple[bytes, int]:
return (f"\x02{self.v}\n".encode(), 1)


class SInt(SkyhashParameter):
def __init__(self, v: int) -> None:
self.v = v

def encode_self(self) -> tuple[bytes, int]:
def encode_self(self) -> Tuple[bytes, int]:
return (f"\x03{self.v}\n".encode(), 1)


def encode_parameter(parameter: any) -> tuple[bytes, int]:
def encode_parameter(parameter: any) -> Tuple[bytes, int]:
encoded = None
if isinstance(parameter, SkyhashParameter):
return parameter.encode_self()
Expand Down

0 comments on commit 95cde08

Please sign in to comment.