Skip to content

Commit 321b356

Browse files
author
Andrew Brookins
committed
Switch to using Protocols with typing_extensions
1 parent 1e40eb1 commit 321b356

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

aredis_om/model/model.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
Union,
2424
no_type_check,
2525
)
26-
from typing_extensions import get_args, get_origin
2726

2827
import aioredis
2928
from aioredis.client import Pipeline
@@ -33,6 +32,7 @@
3332
from pydantic.main import ModelMetaclass, validate_model
3433
from pydantic.typing import NoArgAnyCallable
3534
from pydantic.utils import Representation
35+
from typing_extensions import Protocol, get_args, get_origin
3636
from ulid import ULID
3737

3838
from ..checks import has_redis_json, has_redisearch
@@ -848,13 +848,14 @@ async def get_item(self, item: int):
848848
return result[0]
849849

850850

851-
class PrimaryKeyCreator(abc.ABC):
851+
class PrimaryKeyCreator(Protocol):
852852
def create_pk(self, *args, **kwargs) -> str:
853853
"""Create a new primary key"""
854854

855855

856856
class UlidPrimaryKey:
857-
"""A client-side generated primary key that follows the ULID spec.
857+
"""
858+
A client-side generated primary key that follows the ULID spec.
858859
https://github.com/ulid/javascript#specification
859860
"""
860861

0 commit comments

Comments
 (0)