mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-22 07:32:25 +02:00
f87608a16f
Fixes #5554 This PR removes unused utility classes and functions from the prebuilt tests directory to clean up dead code. Changes include: - Removed unused classes from `libs/prebuilt/tests/any_str.py`: - Deleted FloatBetween, AnyDict, AnyVersion, and UnsortedSequence - Kept only AnyStr class - Removed unused functions from `libs/prebuilt/tests/messages.py`: - Deleted _AnyIdDocument and _AnyIdAIMessageChunk - Kept _AnyIdHumanMessage and _AnyIdToolMessage - Removed unused classes from `libs/prebuilt/tests/memory_assert.py`: - Deleted NoopSerializer, MemorySaverAssertCheckpointMetadata, and MemorySaverNoPending - Kept MemorySaverAssertImmutable Verification: - Manually checked for no remaining references to removed code - Maintained existing import structures - Preserved functionality of the prebuilt test suite The changes reduce code complexity and remove unnecessary utility classes that were not being used in the test suite. --------- Co-authored-by: open-swe-dev[bot] <open-swe-dev@users.noreply.github.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
19 lines
487 B
Python
19 lines
487 B
Python
import re
|
|
from typing import Union
|
|
|
|
|
|
class AnyStr(str):
|
|
def __init__(self, prefix: Union[str, re.Pattern] = "") -> None:
|
|
super().__init__()
|
|
self.prefix = prefix
|
|
|
|
def __eq__(self, other: object) -> bool:
|
|
return isinstance(other, str) and (
|
|
other.startswith(self.prefix)
|
|
if isinstance(self.prefix, str)
|
|
else self.prefix.match(other)
|
|
)
|
|
|
|
def __hash__(self) -> int:
|
|
return hash((str(self), self.prefix))
|