Skip to content

Commit

Permalink
use abc instead raising error in unqiueIndex class
Browse files Browse the repository at this point in the history
  • Loading branch information
omidekz committed Jun 8, 2024
1 parent 9c8e553 commit 6c02d74
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tortoise/indexes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import abc
from typing import TYPE_CHECKING, Optional, Tuple, Type, Generic, TypeVar


Expand Down Expand Up @@ -80,7 +81,7 @@ def __init__(
T = TypeVar("T")


class UniqueIndexABC(Index, Generic[T]):
class UniqueIndexABC(Index, abc.ABC, Generic[T]):
"""
T type is used for nulls type arg beyond extends
"""
Expand All @@ -98,8 +99,5 @@ def __init__(
if nulls is not None:
self.extra += f" {self.nulls(nulls)}"

def nulls(self, distinct: T):
raise NullsNotHandledInUniqueIndex


class NullsNotHandledInUniqueIndex(NotImplementedError): ...
@abc.abstractmethod
def nulls(cls, distinct: T): ...

0 comments on commit 6c02d74

Please sign in to comment.