Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanator committed Oct 31, 2024
1 parent 97b098d commit 586eb4f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions python/langsmith/_internal/_serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ def _simple_default(obj):
# https://github.com/ijl/orjson#serialize
if isinstance(obj, datetime.datetime):
return obj.isoformat()
if isinstance(obj, uuid.UUID):
elif isinstance(obj, uuid.UUID):
return str(obj)
if isinstance(obj, dict):
return {_simple_default(key): value for key, value in obj.items()}
if hasattr(obj, "model_dump") and callable(obj.model_dump):
return obj.model_dump(mode="json")
elif hasattr(obj, "dict") and callable(obj.dict):
return obj.dict()
elif hasattr(obj, "_asdict") and callable(obj._asdict):
return obj._asdict()
elif isinstance(obj, BaseException):
return {"error": type(obj).__name__, "message": str(obj)}
elif isinstance(obj, (set, frozenset, collections.deque)):
Expand Down Expand Up @@ -90,8 +82,8 @@ def _serialize_json(obj: Any) -> Any:
"model_dump",
{"exclude_none": True, "mode": "json"},
), # Pydantic V2 with non-serializable fields
("to_dict", {}), # dataclasses-json
("dict", {}), # Pydantic V1 with non-serializable field
("to_dict", {}), # dataclasses-json
]
for attr, kwargs in serialization_methods:
if (
Expand Down

0 comments on commit 586eb4f

Please sign in to comment.