Skip to content

Commit 49facf2

Browse files
authored
[lunardate] Add stubs (#14650)
1 parent 5509c51 commit 49facf2

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

stubs/lunardate/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "0.2.*"
2+
upstream_repository = "https://github.com/lidaobing/python-lunardate"

stubs/lunardate/lunardate.pyi

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import datetime
2+
from _typeshed import ConvertibleToInt
3+
from typing import Final, SupportsIndex, overload
4+
5+
__version__: Final[str]
6+
__all__ = ["LunarDate"]
7+
8+
class LunarDate:
9+
year: int
10+
month: int
11+
day: int
12+
isLeapMonth: bool
13+
def __init__(self, year: int, month: int, day: int, isLeapMonth: bool | None = False) -> None: ...
14+
@staticmethod
15+
def leapMonthForYear(year: int) -> int | None: ...
16+
@staticmethod
17+
def fromSolarDate(year: SupportsIndex, month: SupportsIndex, day: SupportsIndex) -> LunarDate: ...
18+
def toSolarDate(self) -> datetime.date: ...
19+
@overload
20+
def __sub__(self, other: LunarDate | datetime.date) -> datetime.timedelta: ...
21+
@overload
22+
def __sub__(self, other: datetime.timedelta) -> LunarDate: ...
23+
def __rsub__(self, other: datetime.date) -> datetime.timedelta: ...
24+
def __add__(self, other: datetime.timedelta) -> LunarDate: ...
25+
def __radd__(self, other: datetime.timedelta) -> LunarDate: ...
26+
def __eq__(self, other: object) -> bool: ...
27+
def __lt__(self, other: LunarDate | datetime.date) -> bool: ...
28+
def __le__(self, other: object) -> bool: ...
29+
def __gt__(self, other: object) -> bool: ...
30+
def __ge__(self, other: LunarDate | datetime.date) -> bool: ...
31+
@classmethod
32+
def today(cls) -> LunarDate: ...
33+
34+
yearInfos: Final[list[int]]
35+
36+
def yearInfo2yearDay(yearInfo: ConvertibleToInt) -> int: ...
37+
38+
yearDays: Final[list[int]]
39+
40+
def day2LunarDate(offset: ConvertibleToInt) -> None: ...

0 commit comments

Comments
 (0)