Skip to content

Commit

Permalink
feat: 部分属性更名
Browse files Browse the repository at this point in the history
  • Loading branch information
FHU-yezi committed Feb 18, 2024
1 parent e68add0 commit 973b6d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions jkit/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def text_content(self) -> str:
class ArticleAudioInfo(DataObject, **DATA_OBJECT_CONFIG):
id: PositiveInt
name: NonEmptyStr
author: NonEmptyStr
producer: NonEmptyStr
file_url: str # TODO
duration_seconds: PositiveInt
file_size_bytes: PositiveInt
Expand Down Expand Up @@ -349,7 +349,7 @@ async def audio_info(self) -> Optional[ArticleAudioInfo]:
return ArticleAudioInfo(
id=data["id"],
name=data["title"],
author=data["dubber"], # TODO: 命名调整
producer=data["dubber"],
file_url=data["play_url"],
duration_seconds=data["duration"],
file_size_bytes=data["filesize"],
Expand Down
22 changes: 11 additions & 11 deletions jkit/private/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class AssetsTransactionRecord(DataObject, **DATA_OBJECT_CONFIG):
class FPRewardsRecord(DataObject, **DATA_OBJECT_CONFIG):
time: NormalizedDatetime
own_amount: Decimal
referral_amount: Decimal
grand_referral_amount: Decimal
level1_referral_amount: Decimal
level2_referral_amount: Decimal
total_amount: Decimal


Expand All @@ -48,7 +48,7 @@ class BenefitCardsInfo(DataObject, **DATA_OBJECT_CONFIG):
estimated_benefits_percent: Percentage


class UnsentBenfitCardRecord(DataObject, **DATA_OBJECT_CONFIG): # TODO: 名称更改
class UnusedBenfitCardRecord(DataObject, **DATA_OBJECT_CONFIG):
amount: NonNegativeFloat
start_time: NormalizedDatetime
end_time: NormalizedDatetime
Expand Down Expand Up @@ -170,12 +170,12 @@ async def iter_fp_rewards_records(
yield FPRewardsRecord(
time=normalize_datetime(item["time"]),
own_amount=normalize_assets_amount_precise(item["own_reards18"]),
referral_amount=normalize_assets_amount_precise(
level1_referral_amount=normalize_assets_amount_precise(
item["referral_rewards18"]
),
grand_referral_amount=normalize_assets_amount_precise(
level2_referral_amount=normalize_assets_amount_precise(
item["grand_referral_rewards18"]
), # TODO: 命名调整
),
total_amount=normalize_assets_amount_precise(
item["total_amount18"]
),
Expand All @@ -198,9 +198,9 @@ async def benefit_cards_info(self) -> BenefitCardsInfo:
),
)._validate()

async def iter_unsent_benefit_cards( # TODO: 名称更改
async def iter_unused_benefit_cards(
self, *, page_count: int = 10
) -> AsyncGenerator[UnsentBenfitCardRecord, None]:
) -> AsyncGenerator[UnusedBenfitCardRecord, None]:
now_page = 1

while True:
Expand All @@ -215,15 +215,15 @@ async def iter_unsent_benefit_cards( # TODO: 名称更改
return

for item in data["benefit_cards"]:
yield UnsentBenfitCardRecord(
yield UnusedBenfitCardRecord(
amount=float(normalize_assets_amount_precise(item["amount18"])),
start_time=normalize_datetime(item["start_time"]),
end_time=normalize_datetime(item["end_time"]),
)._validate()

now_page += 1

async def iter_active_benefit_cards( # TODO: 名称更改
async def iter_active_benefit_cards(
self, *, page_count: int = 10
) -> AsyncGenerator[ActiveBenfitCardRecord, None]:
now_page = 1
Expand All @@ -249,7 +249,7 @@ async def iter_active_benefit_cards( # TODO: 名称更改

now_page += 1

async def iter_expired_benefit_cards( # TODO: 名称更改
async def iter_expired_benefit_cards(
self, *, page_count: int = 10
) -> AsyncGenerator[ExpiredBenfitCardRecord, None]:
now_page = 1
Expand Down
8 changes: 4 additions & 4 deletions jkit/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def to_collection_obj(self) -> "Collection":
class UserNotebookInfo(DataObject, **DATA_OBJECT_CONFIG):
id: PositiveInt
name: NonEmptyStr
is_book: bool # TODO: 命名修改
is_paid_book: Optional[bool] # TODO: 命名修改
is_serial: bool
is_paid: Optional[bool]

def to_notebook_obj(self) -> "Notebook":
from jkit.notebook import Notebook
Expand Down Expand Up @@ -365,8 +365,8 @@ async def iter_notebooks(
yield UserNotebookInfo(
id=item["id"],
name=item["name"],
is_book=item["book"],
is_paid_book=item.get("paid_book"),
is_serial=item["book"],
is_paid=item.get("paid_book"),
)._validate()

now_page += 1
Expand Down

0 comments on commit 973b6d4

Please sign in to comment.