Update in_memory.py to fix "TypeError: keywords must be strings" (#7202)

Update in_memory.py to fix "TypeError: keywords must be strings" on
certain dictionaries

Simple fix to prevent a "TypeError: keywords must be strings" error I
encountered in my use case.

@baskaryan 

Thanks! Hope useful!

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
Paul Cook 2023-07-05 18:48:38 +02:00 committed by GitHub
parent 38f853dfa3
commit 7cd0936b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ class InMemoryDocstore(Docstore, AddableMixin):
overlapping = set(texts).intersection(self._dict)
if overlapping:
raise ValueError(f"Tried to add ids that already exist: {overlapping}")
self._dict = dict(self._dict, **texts)
self._dict = {**self._dict, **texts}
def search(self, search: str) -> Union[str, Document]:
"""Search via direct lookup."""