Skip to content

Commit

Permalink
fix: 修复由于 msgspec 运行时类型校验导致的异常
Browse files Browse the repository at this point in the history
  • Loading branch information
FHU-yezi committed Dec 2, 2024
1 parent e8a6145 commit a6777f5
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 51 deletions.
8 changes: 2 additions & 6 deletions models/jianshu/article_earning_ranking_record.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from datetime import date

from sshared.postgres import Table
from sshared.strict_struct import NonEmptyStr, PositiveFloat, PositiveInt

from utils.db import jianshu_pool

if TYPE_CHECKING:
from datetime import date

from sshared.strict_struct import NonEmptyStr, PositiveFloat, PositiveInt


class ArticleEarningRankingRecord(Table, frozen=True):
date: date
Expand Down
5 changes: 1 addition & 4 deletions models/jianshu/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

from datetime import datetime
from enum import Enum
from typing import TYPE_CHECKING

from sshared.postgres import Table
from sshared.strict_struct import NonEmptyStr, PositiveInt

from utils.db import jianshu_pool

if TYPE_CHECKING:
from sshared.strict_struct import NonEmptyStr, PositiveInt


class StatusEnum(Enum):
NORMAL = "NORMAL"
Expand Down
8 changes: 2 additions & 6 deletions models/jianshu/user_assets_ranking_record.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from datetime import date

from sshared.postgres import Table
from sshared.strict_struct import NonEmptyStr, NonNegativeFloat, PositiveInt

from utils.db import jianshu_pool

if TYPE_CHECKING:
from datetime import date

from sshared.strict_struct import NonEmptyStr, NonNegativeFloat, PositiveInt


class UserAssetsRankingRecord(Table, frozen=True):
date: date
Expand Down
14 changes: 5 additions & 9 deletions models/jpep/credit_record.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from datetime import datetime

from sshared.postgres import Table
from sshared.strict_struct import (
NonNegativeInt,
PositiveInt,
)

from utils.db import jpep_pool

if TYPE_CHECKING:
from datetime import datetime

from sshared.strict_struct import (
NonNegativeInt,
PositiveInt,
)


class CreditRecord(Table, frozen=True):
time: datetime
Expand Down
8 changes: 2 additions & 6 deletions models/jpep/ftn_order.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import TYPE_CHECKING

from sshared.postgres import Table
from sshared.strict_struct import PositiveInt

from utils.db import jpep_pool

if TYPE_CHECKING:
from datetime import datetime

from sshared.strict_struct import PositiveInt


class TypeEnum(Enum):
BUY = "BUY"
Expand Down
11 changes: 4 additions & 7 deletions models/jpep/user.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
from __future__ import annotations

from datetime import datetime
from typing import TYPE_CHECKING

from sshared.postgres import Table
from sshared.strict_struct import (
NonEmptyStr,
PositiveInt,
)

from utils.db import jpep_pool

if TYPE_CHECKING:
from sshared.strict_struct import (
NonEmptyStr,
PositiveInt,
)


class User(Table, frozen=True):
id: PositiveInt
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ license = { file = "LICENSE" }
authors = [{ name = "FHU-yezi", email = "[email protected]" }]
requires-python = ">=3.9"
dependencies = [
"httpx<0.28.0",
"jkit>=3.0.0a16",
"prefect<3.0.0",
"psycopg[binary]>=3.2.0",
"sshared[config,postgres]>=0.18.0",
"sshared[config, postgres]>=0.19.0",
]

[tool.uv]
Expand Down Expand Up @@ -46,7 +46,6 @@ lint.select = [
"SIM",
"SLF",
"T20",
"TC",
"TID",
"TRY",
"UP",
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ rpds-py==0.21.0
rsa==4.9
ruamel-yaml==0.18.6
ruamel-yaml-clib==0.2.12 ; python_full_version < '3.13' and platform_python_implementation == 'CPython'
ruff==0.7.3
ruff==0.8.0
shellingham==1.5.4
six==1.16.0
sniffio==1.3.1
sqlalchemy==2.0.35
sshared==0.18.0
sshared==0.19.1
text-unidecode==1.3
time-machine==2.16.0 ; python_full_version >= '3.12' and implementation_name != 'pypy'
toml==0.10.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ shellingham==1.5.4
six==1.16.0
sniffio==1.3.1
sqlalchemy==2.0.35
sshared==0.18.0
sshared==0.19.1
text-unidecode==1.3
time-machine==2.16.0 ; python_full_version >= '3.12' and implementation_name != 'pypy'
toml==0.10.2
Expand Down
14 changes: 7 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a6777f5

Please sign in to comment.