From 193b1926ff801e3192e2f80a3984e85ea9a07e7a Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Sun, 7 Apr 2024 22:28:40 -0700 Subject: [PATCH] Fix python type annotation --- conflict_set.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conflict_set.py b/conflict_set.py index 4731647..0cc250c 100644 --- a/conflict_set.py +++ b/conflict_set.py @@ -2,6 +2,8 @@ import ctypes import enum import os +from typing import Optional + _lib = None for f in ( os.path.dirname(__file__) + "/build/radix_tree/libconflict-set.so.0", @@ -63,7 +65,7 @@ class Result(enum.Enum): TOO_OLD = 2 -def write(begin: bytes, end: bytes | None = None) -> WriteRange: +def write(begin: bytes, end: Optional[bytes] = None) -> WriteRange: b = (ctypes.c_ubyte * len(begin))() b.value = begin if end is None: @@ -75,7 +77,7 @@ def write(begin: bytes, end: bytes | None = None) -> WriteRange: return WriteRange(_Key(b, len(b)), _Key(e, len(e))) -def read(version: int, begin: bytes, end: bytes = None) -> ReadRange: +def read(version: int, begin: bytes, end: Optional[bytes] = None) -> ReadRange: b = (ctypes.c_ubyte * len(begin))() b.value = begin if end is None: