Git Product home page Git Product logo

bbot's Introduction

Bingjie YAN / 北屿 (beiyuouo)

homepageblognavcvgithubbilizhihulinkedin


Welcome to my github profile!

  • 🔭 I’m a postgraduate student @ICT.CAS.
  • 🌱 My current research interests focus on federated learning, edge computing, and distributed systems >more.
  • 📫 You can reach me at [email protected].
  • 🎨 I am glad to share and communicate with you.
  • ❤️ Also love AI for art.
  • Patreon donate button Buy Me A Coffee donate button PayPal donate button

🤹‍♀️ Recent Blog

Date Title
2024-02-12 杂记:20240212
2023-08-09 分布式机器学习中的效率分析
2023-08-07 分布式机器学习中的收敛性分析 (Part 4)
2023-07-25 深度学习中的收敛性分析 (Part 3)
2023-07-24 深度学习中的收敛性分析 (Part 2)

🤾‍♂️ Funny Soul

Date Title
2024-04-28 想看🤔 血腥列车
2024-04-23 想看🤔 怒火战猴
2024-03-10 看过😎 三大队 ⭐⭐⭐⭐
2024-03-08 看过😎 周处除三害 ⭐⭐⭐⭐
2024-02-17 想看🤔 毒液3

bbot's People

Contributors

beiyuouo avatar bingj-yan avatar deepsourcebot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bbot's Issues

v2节点

请问一下订阅是哪家机场啊?卡卡云?

[esports] 赛程插件计算日期差的方式有错误

_query.py

day_delta = (query_day - datetime.datetime.today()).days

query_day是不包含时分秒信息的,而datetime.datetime.today()包含时分秒信息,这样先做差后取天的结果就会有不足一天的情况从而被舍掉,导致计算出来的天数差-1(比如query_day为20号datetime.datetime.today()为19号中午12点,这样做差会得到0天12小时,取days为0,和实际1不符)

建议改为

day_delta = query_day.day - datetime.datetime.today().day (丢人)

(query_day.date() - datetime.datetime.now().date()).days

========================================================
另外,在我改好后命令输入赛程 ^[0-9]$时,会返回两条信息,一条今天,一条计算后的那天,不知道就是这么设计的还是bug

命令输入赛程 [4位数,比如0221]时,会正常返回一条信息,就是那天的赛程,但是控制台报错

02-20 14:47:11 [ERROR] nonebot | Running matcher <Matcher from esports, type=message, priority=1, temp=False> failed.
Traceback (most recent call last):
File "bot.py", line 39, in
nonebot.run(app="bot:app")
File "/home/.local/lib/python3.8/site-packages/nonebot/init.py", line 217, in run
get_driver().run(host, port, *args, **kwargs)
File "/home/.local/lib/python3.8/site-packages/nonebot/drivers/fastapi.py", line 118, in run
uvicorn.run(app or self.server_app,
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 362, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 390, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/home/.local/lib/python3.8/site-packages/nonebot/message.py", line 170, in run_matcher
await matcher.run(bot, event, state)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 496, in run
await self.run_handler(handler, bot, event, state
)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 481, in run_handler
await handler(
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 365, in wrapper
await matcher.run_handler(func, bot, event, state)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 481, in run_handler
await handler(
File "src/plugins/esports/_query.py", line 80, in handle_event
query_day = datetime.datetime.strptime(args, "%Y%m%d")
File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '21' does not match format '%Y%m%d'

命令输入赛程 [8位数,比如20210222]时,会返回两条信息,一条是 21020202赛程:比赛数据也不对,另一条是20210222赛程,并且控制台也会报错

02-20 14:47:44 [ERROR] nonebot | Running matcher <Matcher from esports, type=message, priority=1, temp=False> failed.
Traceback (most recent call last):
File "bot.py", line 39, in
nonebot.run(app="bot:app")
File "/home/.local/lib/python3.8/site-packages/nonebot/init.py", line 217, in run
get_driver().run(host, port, *args, **kwargs)
File "/home/.local/lib/python3.8/site-packages/nonebot/drivers/fastapi.py", line 118, in run
uvicorn.run(app or self.server_app,
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 362, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 390, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/home/.local/lib/python3.8/site-packages/nonebot/message.py", line 170, in run_matcher
await matcher.run(bot, event, state)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 496, in run
await self.run_handler(handler, bot, event, state
)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 481, in run_handler
await handler(
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 365, in wrapper
await matcher.run_handler(func, bot, event, state)
File "/home/.local/lib/python3.8/site-packages/nonebot/matcher.py", line 481, in run_handler
await handler(
File "src/plugins/esports/_query.py", line 80, in handle_event
query_day = datetime.datetime.strptime(args, "%Y%m%d")
File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '22' does not match format '%Y%m%d'

==========================
我现在有点懵(X_X),手头环境也不方便debug,所以只能来发issue啦

[esports] 赛程插件的周日判断逻辑有问题

emmmm,hello大大我又来了😂

这次是赛程插件的spiderWanplusLolDateList.py文件

        # 统计需要追溯的日期所在的周的时间戳
        need_date_list = list()  # 需要抓取的时间戳列表(所有的周日+最早的一天)
        for curr_date_str in all_date_list:
            curr_date = datetime.datetime.strptime(curr_date_str, "%Y%m%d")
            if curr_date.weekday() == 0:  # 若时间戳为周日
                need_date_list.append(curr_date_str)
        need_date_list.append(all_date_list[-1])  # 添加最早的一天
        # print("需要抓取的时间戳总数:", len(need_date_list))

关于if curr_date.weekday() == 0:这行,datetime.weekday() == 6指的才是周日,0为周一

  • datetime.isoweekday() 返回的1-7代表周一到周日
  • datetime.weekday() 返回的0-6代表周一到周日
  • 而标准格式种%w 1-6表示周一到周六,0代表周日

而且这段代码会导致日期为周一(例如"20210301")时,构造的need_date_list==["20210301", "20210301"],传入接口就会返回两组相同的数据。相应的,qq那边也会推送重复信息。

=================================================
另外,我不明白为什么要判断是否周日以及此段代码在esports插件中的作用。按照esports的时间差调用方式,start_dateend_date只能是同一天,all_date_list中也就只能有一个元素,那么这段代码就没有什么意义还会引发bug

我的处理是直接删掉这段代码:

need_date_list = all_date_list

如果这段代码有具体作用的话请麻烦告知一下谢谢啦🙏

规范命名

建议规范一下命名,尽量不要用拼音。代码写得挺不错的,值得参考。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.