Skip to content

Commit 3824d7e

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 d024cc1 commit 3824d7e

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
@@ -680,7 +680,7 @@ def __init__(
680680
microsecond: int | None = None,
681681
tzinfo: tzinfo | None = None,
682682
*,
683-
fold: typing.Literal[0, 1] = 0,
683+
fold: int = 0,
684684
**kwargs,
685685
):
686686
date.__init__(self, year, month, day, **kwargs)
@@ -888,7 +888,7 @@ def tzinfo(self) -> py_datetime.tzinfo | None:
888888
return self.__time.tzinfo
889889

890890
@property
891-
def fold(self) -> typing.Literal[0, 1]:
891+
def fold(self) -> int:
892892
return self._fold
893893

894894
@staticmethod
@@ -944,7 +944,7 @@ def replace(
944944
second: int | None = None,
945945
microsecond: int | None = None,
946946
tzinfo: py_datetime.tzinfo | None = True,
947-
fold: typing.Literal[0, 1] | None = None,
947+
fold: int | None = None,
948948
) -> datetime:
949949
"""Return datetime with new specified fields."""
950950
t_year = self.year

0 commit comments

Comments
 (0)