公众授权版:normal · 1000 次 · 有效期至 2026-12-31

副本编号 LY-20261007-AC63(水印指纹已嵌入)
含 README、.gitignore;排除 .DS_Store / __pycache__ / .pytest_cache
This commit is contained in:
2026-10-07 17:29:52 +08:00
commit d9da4301cd
772 changed files with 48534 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
# -*- coding:utf-8 -*-
+80
View File
@@ -0,0 +1,80 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import List, Union
from tyme4py import LoopTyme
from tyme4py.culture import Direction, Element
class Dipper(LoopTyme):
"""北斗九星"""
NAMES: List[str] = ['天枢', '天璇', '天玑', '天权', '玉衡', '开阳', '摇光', '洞明', '隐元']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> Dipper:
return cls(name)
@classmethod
def from_index(cls, index: int) -> Dipper:
return cls(index)
def next(self, n: int) -> Dipper:
return Dipper(self.next_index(n))
class NineStar(LoopTyme):
"""九星"""
NAMES: List[str] = ['一', '二', '三', '四', '五', '六', '七', '八', '九']
"""名称"""
COLORS: List[str] = ['白', '黑', '碧', '绿', '黄', '白', '赤', '白', '紫']
"""颜色"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> NineStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> NineStar:
return cls(index)
def next(self, n: int) -> NineStar:
return NineStar(self.next_index(n))
def get_color(self) -> str:
"""
颜色
:return: 颜色
"""
return self.COLORS[self.get_index()]
def get_element(self) -> Element:
"""
五行
:return: 五行
"""
return self.get_direction().get_element()
def get_dipper(self) -> Dipper:
"""
北斗九星
:return: 北斗九星
"""
return Dipper(self.get_index())
def get_direction(self) -> Direction:
"""
方位
:return: 方位
"""
return Direction(self.get_index())
def __str__(self) -> str:
return f'{self.get_name()}{self.get_color()}{self.get_element().get_name()}'
+33
View File
@@ -0,0 +1,33 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import List, Union
from tyme4py import LoopTyme
from tyme4py.culture import Week
class SevenStar(LoopTyme):
"""七曜(七政、七纬、七耀)"""
NAMES: List[str] = ['日', '月', '火', '水', '木', '金', '土']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> SevenStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> SevenStar:
return cls(index)
def next(self, n: int) -> SevenStar:
return SevenStar(super().next_index(n))
def get_week(self) -> Week:
"""
:return:星期
"""
return Week(self.get_index())
+26
View File
@@ -0,0 +1,26 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import List, Union
from tyme4py import LoopTyme
class SixStar(LoopTyme):
"""六曜"""
NAMES: List[str] = ['先胜', '友引', '先负', '佛灭', '大安', '赤口']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> SixStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> SixStar:
return cls(index)
def next(self, n: int) -> SixStar:
return SixStar(self.next_index(n))
+26
View File
@@ -0,0 +1,26 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import List, Union
from tyme4py import LoopTyme
class TenStar(LoopTyme):
"""十神"""
NAMES: List[str] = ['比肩', '劫财', '食神', '伤官', '偏财', '正财', '七杀', '正官', '偏印', '正印']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> TenStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> TenStar:
return cls(index)
def next(self, n: int) -> TenStar:
return TenStar(self.next_index(n))
+61
View File
@@ -0,0 +1,61 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import List, Union
from tyme4py import LoopTyme
from tyme4py.culture import Luck
class TwelveStar(LoopTyme):
"""黄道黑道十二神"""
NAMES: List[str] = ['青龙', '明堂', '天刑', '朱雀', '金匮', '天德', '白虎', '玉堂', '天牢', '玄武', '司命', '勾陈']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> TwelveStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> TwelveStar:
return cls(index)
def next(self, n: int) -> TwelveStar:
return TwelveStar(self.next_index(n))
def get_ecliptic(self) -> Ecliptic:
"""
黄道黑道
:return: 黄道黑道
"""
return Ecliptic([0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1][self.get_index()])
class Ecliptic(LoopTyme):
"""黄道黑道就两种,依次为:黄道、黑道。"""
NAMES: List[str] = ["黄道", "黑道"]
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> Ecliptic:
return cls(name)
@classmethod
def from_index(cls, index: int) -> Ecliptic:
return cls(index)
def next(self, n: int) -> Ecliptic:
return Ecliptic(self.next_index(n))
def get_luck(self) -> Luck:
"""
吉凶
:return: 吉凶
"""
return Luck(self.get_index())
+61
View File
@@ -0,0 +1,61 @@
# -*- coding:utf-8 -*-
from __future__ import annotations
from typing import TYPE_CHECKING, List, Union
from tyme4py import LoopTyme
from tyme4py.culture import Land, Animal, Luck, Zone
if TYPE_CHECKING:
from tyme4py.culture.star.seven import SevenStar
class TwentyEightStar(LoopTyme):
"""二十八宿"""
NAMES: List[str] = ['角', '亢', '氐', '房', '心', '尾', '箕', '斗', '牛', '女', '虚', '危', '室', '壁', '奎', '娄', '胃', '昴', '毕', '觜', '参', '井', '鬼', '柳', '星', '张', '翼', '轸']
"""名称"""
def __init__(self, index_or_name: Union[int, str]):
super().__init__(self.NAMES, index_or_name)
@classmethod
def from_name(cls, name: str) -> TwentyEightStar:
return cls(name)
@classmethod
def from_index(cls, index: int) -> TwentyEightStar:
return cls(index)
def next(self, n: int) -> TwentyEightStar:
return TwentyEightStar(self.next_index(n))
def get_seven_star(self) -> SevenStar:
"""
:return: 七曜
"""
from tyme4py.culture.star.seven import SevenStar
return SevenStar(self.get_index() % 7 + 4)
def get_land(self) -> Land:
"""
:return: 九野
"""
return Land([4, 4, 4, 2, 2, 2, 7, 7, 7, 0, 0, 0, 0, 5, 5, 5, 6, 6, 6, 1, 1, 1, 8, 8, 8, 3, 3, 3][self.get_index()])
def get_zone(self) -> Zone:
"""
:return: 宫
"""
return Zone(self.get_index() // 7)
def get_animal(self) -> Animal:
"""
:return: 动物
"""
return Animal(self.get_index())
def get_luck(self) -> Luck:
"""
:return: 吉凶
"""
return Luck([0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0][self.get_index()])