Skip to content

Commit

Permalink
Fix type hint for param fields in Index, allowing tuples of any length (
Browse files Browse the repository at this point in the history
  • Loading branch information
iburadempa committed Feb 12, 2023
1 parent d8fef5f commit 19e2824
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tortoise/contrib/mysql/indexes.py
Expand Up @@ -11,7 +11,7 @@ class FullTextIndex(Index):
def __init__(
self,
*expressions: Term,
fields: Optional[Tuple[str]] = None,
fields: Optional[Tuple[str, ...]] = None,
name: Optional[str] = None,
parser_name: Optional[str] = None,
):
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/postgres/indexes.py
Expand Up @@ -13,7 +13,7 @@ class PostgreSQLIndex(PartialIndex):
def __init__(
self,
*expressions: Term,
fields: Optional[Tuple[str]] = None,
fields: Optional[Tuple[str, ...]] = None,
name: Optional[str] = None,
condition: Optional[dict] = None,
):
Expand Down
6 changes: 3 additions & 3 deletions tortoise/indexes.py
Expand Up @@ -16,14 +16,14 @@ class Index:
def __init__(
self,
*expressions: Term,
fields: Optional[Tuple[str]] = None,
fields: Optional[Tuple[str, ...]] = None,
name: Optional[str] = None,
):
"""
All kinds of index parent class, default is BTreeIndex.
:param expressions: The expressions of on which the index is desired.
:param fields: A list or tuple of the name of the fields on which the index is desired.
:param fields: A tuple of names of the fields on which the index is desired.
:param name: The name of the index.
:raises ValueError: If params conflict.
"""
Expand Down Expand Up @@ -69,7 +69,7 @@ class PartialIndex(Index):
def __init__(
self,
*expressions: Term,
fields: Optional[Tuple[str]] = None,
fields: Optional[Tuple[str, ...]] = None,
name: Optional[str] = None,
condition: Optional[dict] = None,
):
Expand Down

0 comments on commit 19e2824

Please sign in to comment.