Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate pydantic config #38

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml

Expand All @@ -10,7 +10,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
name: black
Expand All @@ -21,7 +21,7 @@ repos:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.7.1
hooks:
- id: mypy
additional_dependencies: [types-setuptools, types-requests]
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"hypothesis-jsonschema==0.19.0", # Fuzzes based on a json schema
],
"lint": [
"black>=23.9.1,<24", # auto-formatter and linter
"mypy>=1.5.1,<2", # Static type analyzer
"black>=23.11.0,<24", # auto-formatter and linter
"mypy>=1.7.1,<2", # Static type analyzer
"types-requests", # Needed due to mypy typeshed
"types-setuptools", # Needed due to mypy typeshed
"flake8>=6.1.0,<7", # Style linter
Expand Down Expand Up @@ -68,8 +68,8 @@
python_requires=">=3.8,<4",
install_requires=[
"importlib-metadata ; python_version<'3.8'",
"click>=8.1.3,<9",
"pydantic>=2.3.0,<3",
"click>=8.1.7,<9",
"pydantic>=2.5.2,<3",
"pyyaml>=6.0,<7",
"requests>=2.28.1,<3",
],
Expand Down
9 changes: 3 additions & 6 deletions tokenlists/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pydantic import AnyUrl
from pydantic import BaseModel as _BaseModel
from pydantic import PastDatetime, field_validator
from pydantic import ConfigDict, PastDatetime, field_validator

ChainId = int
TagId = str
Expand All @@ -20,8 +20,7 @@ def model_dump(self, *args, **kwargs):

return super().model_dump(*args, **kwargs)

class Config:
froze = True
model_config = ConfigDict(frozen=True)


class BridgeInfo(BaseModel):
Expand Down Expand Up @@ -177,9 +176,7 @@ def __init__(self, *args, **kwargs):
f"Missing reference tags in tokenlist: {token_ref_tags - tokenlist_tags}"
)

class Config:
# NOTE: Not frozen as we may need to dynamically modify this
froze = False
model_config = ConfigDict(frozen=False)

@field_validator("logoURI")
def validate_uri(cls, v: Optional[str]) -> Optional[str]:
Expand Down