mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-02 09:26:12 +08:00
⬆️ auto update by pre-commit hooks (#416)
* ⬆️ auto update by pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.9) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) - [github.com/psf/black: 23.9.1 → 23.12.1](https://github.com/psf/black/compare/23.9.1...23.12.1) - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8) - [github.com/pre-commit/mirrors-eslint: v8.50.0 → v9.0.0-alpha.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.50.0...v9.0.0-alpha.0) * 💄 auto fix by pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7aac4010e3
commit
f6ee4a4c1b
@ -7,26 +7,26 @@ ci:
|
||||
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.0.292
|
||||
rev: v0.1.9
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
stages: [commit]
|
||||
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
rev: 5.13.2
|
||||
hooks:
|
||||
- id: isort
|
||||
stages: [commit]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.9.1
|
||||
rev: 23.12.1
|
||||
hooks:
|
||||
- id: black
|
||||
stages: [commit]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.0.3
|
||||
rev: v4.0.0-alpha.8
|
||||
hooks:
|
||||
- id: prettier
|
||||
types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
|
||||
@ -34,7 +34,7 @@ repos:
|
||||
stages: [commit]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v8.50.0
|
||||
rev: v9.0.0-alpha.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
additional_dependencies:
|
||||
|
@ -99,33 +99,27 @@ class Config(metaclass=Singleton):
|
||||
# update
|
||||
assert not isinstance(user_data, list)
|
||||
subs: list = user_data.get("subs", [])
|
||||
subs.append(
|
||||
{
|
||||
subs.append({
|
||||
"target": target,
|
||||
"target_type": target_type,
|
||||
"target_name": target_name,
|
||||
"cats": cats,
|
||||
"tags": tags,
|
||||
})
|
||||
self.user_target.update({"subs": subs}, query)
|
||||
else:
|
||||
# insert
|
||||
self.user_target.insert({
|
||||
"user": user,
|
||||
"user_type": user_type,
|
||||
"subs": [{
|
||||
"target": target,
|
||||
"target_type": target_type,
|
||||
"target_name": target_name,
|
||||
"cats": cats,
|
||||
"tags": tags,
|
||||
}
|
||||
)
|
||||
self.user_target.update({"subs": subs}, query)
|
||||
else:
|
||||
# insert
|
||||
self.user_target.insert(
|
||||
{
|
||||
"user": user,
|
||||
"user_type": user_type,
|
||||
"subs": [
|
||||
{
|
||||
"target": target,
|
||||
"target_type": target_type,
|
||||
"target_name": target_name,
|
||||
"cats": cats,
|
||||
"tags": tags,
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
}],
|
||||
})
|
||||
self.update_send_cache()
|
||||
|
||||
def list_subscribe(self, user, user_type) -> list[SubscribeContent]:
|
||||
@ -186,14 +180,12 @@ class Config(metaclass=Singleton):
|
||||
for user in self.user_target.all():
|
||||
for sub in user.get("subs", []):
|
||||
if sub.get("target_type") not in supported_target_type:
|
||||
to_del.append(
|
||||
{
|
||||
"user": user["user"],
|
||||
"user_type": user["user_type"],
|
||||
"target": sub["target"],
|
||||
"target_type": sub["target_type"],
|
||||
}
|
||||
)
|
||||
to_del.append({
|
||||
"user": user["user"],
|
||||
"user_type": user["user_type"],
|
||||
"target": sub["target"],
|
||||
"target_type": sub["target_type"],
|
||||
})
|
||||
continue
|
||||
res[sub["target_type"]][sub["target"]].append(User(user["user"], user["user_type"]))
|
||||
cat_res[sub["target_type"]][sub["target"]]["{}-{}".format(user["user_type"], user["user"])] = sub[
|
||||
|
@ -5,6 +5,7 @@ Revises:
|
||||
Create Date: 2022-03-21 19:18:13.762626
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: c97c445e2bdb
|
||||
Create Date: 2022-03-27 21:50:10.911649
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: 5f3370328e44
|
||||
Create Date: 2023-01-15 19:04:54.987491
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
@ -5,6 +5,7 @@ Revises: a333d6224193
|
||||
Create Date: 2022-05-31 22:05:13.235981
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: aceef470d69c
|
||||
Create Date: 2023-03-20 00:39:30.199915
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
|
@ -5,6 +5,7 @@ Revises: a5466912fad0
|
||||
Create Date: 2023-03-20 11:08:42.883556
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
|
@ -5,6 +5,7 @@ Revises: 67c38b3f39c2
|
||||
Create Date: 2023-03-20 15:38:20.220599
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: 4a46ba54a3f3
|
||||
Create Date: 2022-03-29 21:01:38.213153
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: 632b8086bc2b
|
||||
Create Date: 2023-03-20 01:14:42.623789
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.orm import Session
|
||||
|
@ -5,6 +5,7 @@ Revises: bd92923c218f
|
||||
Create Date: 2023-03-09 19:10:42.168133
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
@ -5,6 +5,7 @@ Revises: 5da28f6facb3
|
||||
Create Date: 2023-03-02 14:04:16.492133
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import select
|
||||
|
@ -5,6 +5,7 @@ Revises: 0571870f5222
|
||||
Create Date: 2022-03-26 19:46:50.910721
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
@ -5,6 +5,7 @@ Revises: 8d3863e9d74b
|
||||
Create Date: 2023-08-25 00:20:51.511329
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.orm import Session
|
||||
|
@ -1,4 +1,5 @@
|
||||
""" 提供获取 Bot 的方法 """
|
||||
|
||||
from typing import Any
|
||||
from collections import defaultdict
|
||||
|
||||
|
@ -540,22 +540,18 @@ async def test_batch_fetch_new_message(app: App):
|
||||
|
||||
platform_obj = BatchNewMessage(ProcessContext(), None) # type:ignore
|
||||
|
||||
res1 = await platform_obj.batch_fetch_new_post(
|
||||
[
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
SubUnit(Target("target3"), [user2]),
|
||||
]
|
||||
)
|
||||
res1 = await platform_obj.batch_fetch_new_post([
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
SubUnit(Target("target3"), [user2]),
|
||||
])
|
||||
assert len(res1) == 0
|
||||
|
||||
res2 = await platform_obj.batch_fetch_new_post(
|
||||
[
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
SubUnit(Target("target3"), [user2]),
|
||||
]
|
||||
)
|
||||
res2 = await platform_obj.batch_fetch_new_post([
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
SubUnit(Target("target3"), [user2]),
|
||||
])
|
||||
assert len(res2) == 3
|
||||
send_set = set()
|
||||
for platform_target, posts in res2:
|
||||
@ -617,20 +613,16 @@ async def test_batch_fetch_compare_status(app: App):
|
||||
user1 = UserSubInfo(TargetQQGroup(group_id=123), [1, 2, 3], [])
|
||||
user2 = UserSubInfo(TargetQQGroup(group_id=234), [1, 2, 3], [])
|
||||
|
||||
res1 = await batch_status_change.batch_fetch_new_post(
|
||||
[
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
]
|
||||
)
|
||||
res1 = await batch_status_change.batch_fetch_new_post([
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
])
|
||||
assert len(res1) == 0
|
||||
|
||||
res2 = await batch_status_change.batch_fetch_new_post(
|
||||
[
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
]
|
||||
)
|
||||
res2 = await batch_status_change.batch_fetch_new_post([
|
||||
SubUnit(Target("target1"), [user1]),
|
||||
SubUnit(Target("target2"), [user1, user2]),
|
||||
])
|
||||
|
||||
send_set = set()
|
||||
for platform_target, posts in res2:
|
||||
|
@ -83,12 +83,10 @@ async def test_scheduler_batch_api(init_scheduler, mocker: MockerFixture):
|
||||
|
||||
await scheduler_dict[BilibiliSchedConf].exec_fetch()
|
||||
|
||||
batch_fetch_mock.assert_called_once_with(
|
||||
[
|
||||
(T_Target("t1"), [UserSubInfo(user=TargetQQGroup(group_id=123), categories=[], tags=[])]),
|
||||
(T_Target("t2"), [UserSubInfo(user=TargetQQGroup(group_id=123), categories=[], tags=[])]),
|
||||
]
|
||||
)
|
||||
batch_fetch_mock.assert_called_once_with([
|
||||
(T_Target("t1"), [UserSubInfo(user=TargetQQGroup(group_id=123), categories=[], tags=[])]),
|
||||
(T_Target("t2"), [UserSubInfo(user=TargetQQGroup(group_id=123), categories=[], tags=[])]),
|
||||
])
|
||||
|
||||
|
||||
async def test_scheduler_with_time(app: App, init_scheduler, mocker: MockerFixture):
|
||||
|
Loading…
x
Reference in New Issue
Block a user