Skip to content

Commit 3703a0a

Browse files
committed
typing: use int for fold
Change the `fold`` parameter/property annotations from `Literal[0, 1]` to `int` to match the stdlib/typeshed API. This avoids unnecessary type checker errors when passing fold values between datetime and jdatetime. https://github.com/python/typeshed/blob/main/stdlib/datetime.pyi#L284
1 parent b363288 commit 3703a0a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

jdatetime/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def __init__(
685685
microsecond: int | None = None,
686686
tzinfo: tzinfo | None = None,
687687
*,
688-
fold: typing.Literal[0, 1] = 0,
688+
fold: int = 0,
689689
**kwargs,
690690
):
691691
date.__init__(self, year, month, day, **kwargs)
@@ -893,7 +893,7 @@ def tzinfo(self) -> py_datetime.tzinfo | None:
893893
return self.__time.tzinfo
894894

895895
@property
896-
def fold(self) -> typing.Literal[0, 1]:
896+
def fold(self) -> int:
897897
return self._fold
898898

899899
@staticmethod
@@ -949,7 +949,7 @@ def replace(
949949
second: int | None = None,
950950
microsecond: int | None = None,
951951
tzinfo: py_datetime.tzinfo | None = True,
952-
fold: typing.Literal[0, 1] | None = None,
952+
fold: int | None = None,
953953
) -> datetime:
954954
"""Return datetime with new specified fields."""
955955
t_year = self.year

0 commit comments

Comments
 (0)