From 49facf2de32ee976e2451fb272c5d7da0fafe5ac Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Wed, 27 Aug 2025 10:20:32 +0000 Subject: [PATCH] [lunardate] Add stubs (#14650) --- stubs/lunardate/METADATA.toml | 2 ++ stubs/lunardate/lunardate.pyi | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 stubs/lunardate/METADATA.toml create mode 100644 stubs/lunardate/lunardate.pyi diff --git a/stubs/lunardate/METADATA.toml b/stubs/lunardate/METADATA.toml new file mode 100644 index 000000000..aa8196792 --- /dev/null +++ b/stubs/lunardate/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.2.*" +upstream_repository = "https://github.com/lidaobing/python-lunardate" diff --git a/stubs/lunardate/lunardate.pyi b/stubs/lunardate/lunardate.pyi new file mode 100644 index 000000000..d1f2f0285 --- /dev/null +++ b/stubs/lunardate/lunardate.pyi @@ -0,0 +1,40 @@ +import datetime +from _typeshed import ConvertibleToInt +from typing import Final, SupportsIndex, overload + +__version__: Final[str] +__all__ = ["LunarDate"] + +class LunarDate: + year: int + month: int + day: int + isLeapMonth: bool + def __init__(self, year: int, month: int, day: int, isLeapMonth: bool | None = False) -> None: ... + @staticmethod + def leapMonthForYear(year: int) -> int | None: ... + @staticmethod + def fromSolarDate(year: SupportsIndex, month: SupportsIndex, day: SupportsIndex) -> LunarDate: ... + def toSolarDate(self) -> datetime.date: ... + @overload + def __sub__(self, other: LunarDate | datetime.date) -> datetime.timedelta: ... + @overload + def __sub__(self, other: datetime.timedelta) -> LunarDate: ... + def __rsub__(self, other: datetime.date) -> datetime.timedelta: ... + def __add__(self, other: datetime.timedelta) -> LunarDate: ... + def __radd__(self, other: datetime.timedelta) -> LunarDate: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: LunarDate | datetime.date) -> bool: ... + def __le__(self, other: object) -> bool: ... + def __gt__(self, other: object) -> bool: ... + def __ge__(self, other: LunarDate | datetime.date) -> bool: ... + @classmethod + def today(cls) -> LunarDate: ... + +yearInfos: Final[list[int]] + +def yearInfo2yearDay(yearInfo: ConvertibleToInt) -> int: ... + +yearDays: Final[list[int]] + +def day2LunarDate(offset: ConvertibleToInt) -> None: ...