Skip to content

Commit

Permalink
fix: Typing hint for builder decorator (#740)
Browse files Browse the repository at this point in the history
* fix: Typing hint for builder

Maintain that the Callable type received is the same as the Callable returned

* style: Black PyPika
  • Loading branch information
gavindsouza authored Sep 22, 2023
1 parent a1b0c82 commit ea9cc5b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pypika/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Optional, Type
from typing import Any, Callable, List, Optional, Type, TypeVar

__author__ = "Timothy Heys"
__email__ = "[email protected]"
Expand Down Expand Up @@ -36,7 +36,10 @@ class FunctionException(Exception):
pass


def builder(func: Callable) -> Callable:
C = TypeVar("C")


def builder(func: C) -> C:
"""
Decorator for wrapper "builder" functions. These are functions on the Query class or other classes used for
building queries which mutate the query and return self. To make the build functions immutable, this decorator is
Expand Down

0 comments on commit ea9cc5b

Please sign in to comment.