副本编号 LY-20261007-AC63(水印指纹已嵌入) 含 README、.gitignore;排除 .DS_Store / __pycache__ / .pytest_cache
41 lines
884 B
Python
41 lines
884 B
Python
# -*- coding:utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
from typing import List, Union
|
|
|
|
from tyme4py import LoopTyme, AbstractCultureDay
|
|
|
|
|
|
class Dog(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) -> Dog:
|
|
return cls(name)
|
|
|
|
@classmethod
|
|
def from_index(cls, index: int) -> Dog:
|
|
return cls(index)
|
|
|
|
def next(self, n: int) -> Dog:
|
|
return Dog(self.next_index(n))
|
|
|
|
|
|
class DogDay(AbstractCultureDay):
|
|
"""三伏天"""
|
|
|
|
def __init__(self, dog: Dog, day_index: int):
|
|
super().__init__(dog, day_index)
|
|
|
|
def get_dog(self) -> Dog:
|
|
"""
|
|
三伏
|
|
:return: 三伏
|
|
"""
|
|
return self.get_culture()
|