Skip to content

Commit

Permalink
💄 auto fix by pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 11, 2024
1 parent 12fc3f1 commit 3afc444
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion nonebot_bison/platform/bilibili/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def get_tags(self, raw_post: DynRawPost) -> list[Tag]:
return tags

def _text_process(self, dynamic: str, desc: str, title: str) -> _ProcessedText:

# 计算视频标题和视频描述相似度
title_similarity = 0.0 if len(title) == 0 or len(desc) == 0 else text_similarity(title, desc[: len(title)])
if title_similarity > 0.9:
Expand Down
3 changes: 1 addition & 2 deletions nonebot_bison/platform/bilibili/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ def reset_all(self):

def record_backoff_finish_time(self):
self.backoff_finish_time = (
datetime.now()
+ self.backoff_timedelta * self.backoff_count**2
datetime.now() + self.backoff_timedelta * self.backoff_count**2
# + timedelta(seconds=random.randint(1, 60)) # jitter
)
logger.trace(f"set backoff finish time: {self.backoff_finish_time}")
Expand Down
1 change: 0 additions & 1 deletion nonebot_bison/platform/bilibili/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class BilibiliClientManager(CookieClientManager):

_default_cookie_cd = timedelta(seconds=120)

async def _get_cookies(self) -> list[Cookie]:
Expand Down
4 changes: 3 additions & 1 deletion nonebot_bison/platform/ceobecanteen/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ async def snapshot_official_website(self, url: str) -> bytes:
logger.debug(f"snapshot official website url: {url}")

# /html/body/div[1]/div[1]/div/div[1]/div[1]/div
snapshot_selector = "html > body > div:nth-child(1) > div:nth-child(1) > div > div:nth-child(1) > div:nth-child(1) > div" # noqa: E501
snapshot_selector = (
"html > body > div:nth-child(1) > div:nth-child(1) > div > div:nth-child(1) > div:nth-child(1) > div" # noqa: E501
)
# /html/body/div[1]/div[1]/div/div[1]/div[1]/div/div[4]/div/div/div
calculate_selector = "html > body > div:nth-child(1) > div:nth-child(1) > div > div:nth-child(1) > div:nth-child(1) > div > div:nth-child(4) > div > div > div" # noqa: E501
viewport = {"width": 1024, "height": 19990}
Expand Down
1 change: 0 additions & 1 deletion nonebot_bison/platform/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class RssSite(Site):


class RssPost(Post):

async def get_plain_content(self) -> str:
soup = bs(self.content, "html.parser")

Expand Down
1 change: 0 additions & 1 deletion nonebot_bison/sub_manager/add_cookie_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ async def got_target_idx(state: T_State, target_idx: str = ArgPlainText()):

@add_cookie_target_matcher.handle()
async def init_promote_cookie(state: T_State):

# 获取 site 的所有用户 cookie,再排除掉已经关联的 cookie,剩下的就是可以关联的 cookie
cookies = await config.get_cookie(site_name=state["site"].name, is_anonymous=False)
associated_cookies = await config.get_cookie(
Expand Down
5 changes: 1 addition & 4 deletions nonebot_bison/theme/themes/ht2i/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ async def _text_render(self, text: str):
raise ThemeRenderError(f"渲染文本失败: {e}")

async def render(self, post: "Post"):

md_text = ""

md_text += f"## {post.title}\n\n" if post.title else ""
Expand All @@ -51,9 +50,7 @@ async def render(self, post: "Post"):
else:
rp_content = await rp.get_content()

md_text += (
"> \n> " + rp_content if len(rp_content) < 500 else f"{rp_content[:500]}..." + " \n"
)
md_text += "> \n> " + rp_content if len(rp_content) < 500 else f"{rp_content[:500]}..." + " \n"
md_text += "\n\n"

md_text += f"###### 来源: {post.platform.name} {post.nickname or ''}\n"
Expand Down

0 comments on commit 3afc444

Please sign in to comment.