Skip to content

Commit

Permalink
made fix local
Browse files Browse the repository at this point in the history
  • Loading branch information
talgat committed Jan 26, 2024
1 parent 7ae047b commit 0edea78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions tarn/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Self = Any
# we will try to support both versions 1 and 2 while they are more or less popular
try:
from pydantic import BaseModel as _BaseModel, field_validator as _field_validator, model_validator
from pydantic import BaseModel, field_validator as _field_validator, model_validator

def field_validator(*args, always=None, **kwargs):
# we just ignore `always`
Expand All @@ -39,11 +39,6 @@ def model_validate(cls, data):
def model_dump(obj, **kwargs):
return obj.model_dump(**kwargs)

class BaseModel(_BaseModel):
model_config = {
'validate_default': True,
}

class NoExtra(BaseModel):
model_config = {
'extra': 'forbid',
Expand Down
3 changes: 2 additions & 1 deletion tarn/location/disk_dict/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class HashConfig(NoExtra):

@model_validator(mode='before')
def normalize_kwargs(cls, values):
print('kek', values)
kwargs = {}
for field_name in list(values):
if field_name not in ('name', 'kwargs'):
Expand Down Expand Up @@ -52,7 +53,7 @@ def build(self):
class ToolConfig(NoExtra):
name: str
args: Tuple = ()
kwargs: Optional[Dict[str, Any]] = None
kwargs: Optional[Dict[str, Any]] = Field(None, validate_default=True)

@field_validator('kwargs', always=True)
def normalize_kwargs(cls, v):
Expand Down

0 comments on commit 0edea78

Please sign in to comment.