Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Sep 26, 2024
1 parent ba7f706 commit b996db9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions libs/checkpoint/langgraph/store/memory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict
from datetime import datetime, timezone
from typing import Iterable

from langgraph.store.base import BaseStore, GetOp, Item, Op, PutOp, Result, SearchOp

Expand All @@ -16,7 +17,7 @@ class InMemoryStore(BaseStore):
def __init__(self) -> None:
self._data: dict[tuple[str, ...], dict[str, Item]] = defaultdict(dict)

def batch(self, ops: list[Op]) -> list[Result]:
def batch(self, ops: Iterable[Op]) -> list[Result]:
results: list[Result] = []
for op in ops:
if isinstance(op, GetOp):
Expand Down Expand Up @@ -63,5 +64,5 @@ def batch(self, ops: list[Op]) -> list[Result]:
results.append(None)
return results

async def abatch(self, ops: list[Op]) -> list[Result]:
async def abatch(self, ops: Iterable[Op]) -> list[Result]:
return self.batch(ops)
9 changes: 5 additions & 4 deletions libs/checkpoint/tests/test_store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
from datetime import datetime
from typing import Iterable

import pytest
from pytest_mock import MockerFixture
Expand All @@ -14,18 +15,18 @@ async def test_async_batch_store(mocker: MockerFixture) -> None:
abatch = mocker.stub()

class MockStore(AsyncBatchedBaseStore):
def batch(self, ops: list[Op]) -> list[Result]:
def batch(self, ops: Iterable[Op]) -> list[Result]:
raise NotImplementedError

async def abatch(self, ops: list[Op]) -> list[Result]:
async def abatch(self, ops: Iterable[Op]) -> list[Result]:
assert all(isinstance(op, GetOp) for op in ops)
abatch(ops)
return [
Item(
value={},
scores={},
id=op.id,
namespace=op.namespace,
id=getattr(op, "id", ""),
namespace=getattr(op, "namespace", ()),
created_at=datetime(2024, 9, 24, 17, 29, 10, 128397),
updated_at=datetime(2024, 9, 24, 17, 29, 10, 128397),
last_accessed_at=datetime(2024, 9, 24, 17, 29, 10, 128397),
Expand Down

0 comments on commit b996db9

Please sign in to comment.