Skip to content

Commit

Permalink
Merge pull request #1 from skytable/fix/python3.8/type_hints
Browse files Browse the repository at this point in the history
query: Fix type hints to ensure compatibility with Python 3.8
  • Loading branch information
ohsayan authored May 2, 2024
2 parents 4fe9e41 + a3e25b2 commit b94722a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.3

Fixed issues with type hints when using Python 3.8.

## 0.1.2

Support negative floating point values in responses.
Expand Down
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 b94722a

Please sign in to comment.