Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化代码结构,更改部分常量命名 #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

EillesWan
Copy link
Contributor

本来是除夕过个年,打开邮箱一看,又有人提了我去年就已经修复的问题,有点感慨(?)
于是我再次打开这个项目,在今年的除夕更新如下内容:

  1. 把原本放在 __init__.py 的主类全部移入了 main.py 中,并在 __init__.py 里加了引用和版本字符串
  2. 更新翻译,把原本的 Chinese New Year(CHINESENEWYEAR)Chinese Year Code(CHINESEYEARCODE) 俩常量的翻译改为 Lunar New YearLunar Year CodeLUNARNEWYEAR, LUNARYEARCODE
  3. 使用 Blcak 格式化了文档,constants.py 除外,主要是那玩意格式化完了之后更丑了……
  4. 没了,格式化一下 README 算么[手动狗头]

=========

It is when I want to open some games to play and a notifacation from E-Mail disturb me that a issue has been turned out that is what I have repaired last year the same date.
So I decided to open this repo again and do some changes...

  1. Moved the classes originally in __init__.py into main.py and add __version__ and __all__ into __init__.py.
  2. Updated the translation. Chinese New Year(CHINESENEWYEAR), Chinese Year Code(CHINESEYEARCODE) -> Lunar New Year Lunar Year Code (LUNARNEWYEAR, LUNARYEARCODE)
  3. Formatted the codes via Blcak, except constants.py for it may be more ugly after do the formatting.
  4. Also formatted README.

@EillesWan
Copy link
Contributor Author

刚刚新增了一些代码,主要是把生肖常量、天干地支常量、中文数字常量转移到了constants.py里面去,然后新增了一个__format__方法的覆写,主要解决了 #2 的ISSUE,顺带把today和from_datetime改为了类方法。

@Antares0982
Copy link

您有考虑fork一份换个包名上传到pypi吗,看起来原作者可能没有时间继续维护了:(

@EillesWan
Copy link
Contributor Author

您有考虑fork一份换个包名上传到pypi吗,看起来原作者可能没有时间继续维护了:(

已经完成了一个新的农历日期库,并上传了pypi,叫做zhDateTime
因为我不喜欢GPLv3,所以就自己把农历日期时间重写了一遍,采用协议MPL2.0,用法可以参阅zhDateTime
仓库地址https://gitee.com/EillesWan/zhDateTime

@Antares0982
Copy link

您有考虑fork一份换个包名上传到pypi吗,看起来原作者可能没有时间继续维护了:(

已经完成了一个新的农历日期库,并上传了pypi,叫做zhDateTime。 因为我不喜欢GPLv3,所以就自己把农历日期时间重写了一遍,采用协议MPL2.0,用法可以参阅zhDateTime 仓库地址https://gitee.com/EillesWan/zhDateTime

2024年10月2日格式化出错了

<class 'ValueError'>
农历日期错误:不支持形如 2024年8月30日 的日期表示
traceback:
  File "/nix/store/j6sdxnq98qv4kc06c5zwgdmnal253qfj-python3-3.12.4-env/lib/python3.12/site-packages/telegram/ext/_jobqueue.py", line 971, in _run
    await self.callback(context)

  File "<...>/modules/calendar.py", line 71, in daily_calendar
    await self.send_to(self.get_master_id(), "今天是" + self.get_today() + "," + self.get_lunar())
                                                                                  ^^^^^^^^^^^^^^^^

  File "<...>/modules/calendar.py", line 87, in get_lunar
    lunar_date = zhDateTime.from_solar(today.year, today.month, today.day)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/nix/store/j6sdxnq98qv4kc06c5zwgdmnal253qfj-python3-3.12.4-env/lib/python3.12/site-packages/zhDateTime/main.py", line 569, in from_solar
    return cls(
           ^^^^

  File "/nix/store/j6sdxnq98qv4kc06c5zwgdmnal253qfj-python3-3.12.4-env/lib/python3.12/site-packages/zhDateTime/main.py", line 522, in __init__
    raise ValueError(

@EillesWan
Copy link
Contributor Author

同志,他库的问题请到对应库去反馈啊qwq,这个问题我在今天凌晨1点注意到了,并且做了修理,如果更新到 1.1.1 版本的 zhDateTime 则没有问题了

@Antares0982
Copy link

同志,他库的问题请到对应库去反馈啊qwq,这个问题我在今天凌晨1点注意到了,并且做了修理,如果更新到 1.1.1 版本的 zhDateTime 则没有问题了

我不用gitee,所以就来这反馈了:/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants