Skip to content

Commit

Permalink
fix: improve pydantic v1/v2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Nov 10, 2024
1 parent d01f29a commit 3707049
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edsnlp/pipes/ner/adicap/adicap.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class AdicapMatcher(ContextualMatcher):
ent.label_
# Out: adicap
ent._.adicap.model_dump()
ent._.adicap.dict()
# Out: {'code': 'BHGS0040',
# 'sampling_mode': 'BIOPSIE CHIRURGICALE',
# 'technic': 'HISTOLOGIE ET CYTOLOGIE PAR INCLUSION',
Expand Down
3 changes: 3 additions & 0 deletions edsnlp/pipes/ner/tnm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,6 @@ def dict(
d[k] = v.value

return d

if pydantic.VERSION < "2":
model_dump = pydantic.BaseModel.dict

0 comments on commit 3707049

Please sign in to comment.