Skip to content

Commit

Permalink
chore: 升级依赖库
Browse files Browse the repository at this point in the history
  • Loading branch information
FHU-yezi committed Mar 14, 2024
1 parent 4b7920a commit d342607
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 178 deletions.
6 changes: 3 additions & 3 deletions jobs/jianshu/lottery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from jkit.jianshu_lottery import JianshuLottery, JianshuLotteryWinRecord
from jkit.lottery import Lottery, LotteryWinRecord
from prefect import flow, get_run_logger
from prefect.states import Completed, State

Expand All @@ -14,7 +14,7 @@
)


async def process_item(item: JianshuLotteryWinRecord, /) -> LotteryWinRecordDocument:
async def process_item(item: LotteryWinRecord, /) -> LotteryWinRecordDocument:
await JianshuUserDocument.insert_or_update_one(
slug=item.user_info.slug,
updated_at=item.time,
Expand Down Expand Up @@ -48,7 +48,7 @@ async def flow_func() -> State:
logger.warning("数据库中没有记录")

data: List[LotteryWinRecordDocument] = []
async for item in JianshuLottery().iter_win_records():
async for item in Lottery().iter_win_records():
if item.id == stop_id:
break

Expand Down
10 changes: 5 additions & 5 deletions jobs/jpep/ftn_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def process_item(
await UserDocument.insert_or_update_one(
updated_at=fetch_time,
id=item.publisher_info.id,
name=item.publisher_info.name, # type: ignore
hashed_name=item.publisher_info.hashed_name, # type: ignore
avatar_url=item.publisher_info.avatar_url, # type: ignore
name=item.publisher_info.name,
hashed_name=item.publisher_info.hashed_name,
avatar_url=item.publisher_info.avatar_url,
)

latest_credit_value = await CreditHistoryDocument.get_latest_value(
Expand All @@ -56,7 +56,7 @@ async def process_item(
CreditHistoryDocument(
time=fetch_time,
user_id=item.publisher_info.id,
value=item.publisher_info.credit, # type: ignore
value=item.publisher_info.credit,
)
)

Expand All @@ -73,7 +73,7 @@ async def process_item(
tradable=item.tradable_amount,
minimum_trade=item.minimum_trade_amount,
),
publisher_id=item.publisher_info.id, # type: ignore
publisher_id=item.publisher_info.id,
).validate()


Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/article_earning_ranking_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List, Optional

from jkit._constraints import (
from jkit.msgspec_constraints import (
ArticleSlug,
NonEmptyStr,
PositiveFloat,
Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/assets_ranking_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List, Optional

from jkit._constraints import (
from jkit.msgspec_constraints import (
NonNegativeFloat,
PositiveFloat,
PositiveInt,
Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/daily_update_ranking_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List

from jkit._constraints import (
from jkit.msgspec_constraints import (
PositiveInt,
UserSlug,
)
Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/lottery_win_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List

from jkit._constraints import (
from jkit.msgspec_constraints import (
NonEmptyStr,
PositiveInt,
UserSlug,
Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/lp_recommend_article_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List

from jkit._constraints import (
from jkit.msgspec_constraints import (
ArticleSlug,
NonEmptyStr,
NonNegativeFloat,
Expand Down
2 changes: 1 addition & 1 deletion models/jianshu/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum
from typing import Any, ClassVar, Dict, List, Optional

from jkit._constraints import PositiveInt, UserName, UserSlug, UserUploadedUrl
from jkit.msgspec_constraints import PositiveInt, UserName, UserSlug, UserUploadedUrl
from pymongo import IndexModel

from utils.db import JIANSHU_DB
Expand Down
2 changes: 1 addition & 1 deletion models/jpep/credit_history.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List, Optional

from jkit._constraints import NonNegativeInt, PositiveInt
from jkit.msgspec_constraints import NonNegativeInt, PositiveInt
from pymongo import IndexModel

from utils.db import JPEP_DB
Expand Down
2 changes: 1 addition & 1 deletion models/jpep/ftn_trade_order.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import ClassVar, List, Literal

from jkit._constraints import (
from jkit.msgspec_constraints import (
NonNegativeInt,
PositiveFloat,
PositiveInt,
Expand Down
2 changes: 1 addition & 1 deletion models/jpep/user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional

from jkit._constraints import NonNegativeInt, PositiveInt
from jkit.msgspec_constraints import NonNegativeInt, PositiveInt
from pymongo import IndexModel

from utils.db import JPEP_DB
Expand Down
Loading

0 comments on commit d342607

Please sign in to comment.