Skip to content

Commit 1791684

Browse files
authored
get_many() no longer returns missing documents (#82)
* get_many() no longer returns missing documents * Fixing lint * Fixing lint
1 parent 456beac commit 1791684

6 files changed

Lines changed: 17 additions & 13 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
- id: flake8
3535

3636
- repo: https://github.com/pre-commit/mirrors-mypy
37-
rev: v1.10.0
37+
rev: v1.15.0
3838
hooks:
3939
- id: mypy
4040
files: ^arangoasync/

arangoasync/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _validate(self) -> None:
115115
"verify_iat": True,
116116
"verify_exp": True,
117117
"verify_signature": False,
118-
},
118+
}, # type: ignore[arg-type]
119119
)
120120

121121
self._token_exp = jwt_payload["exp"]

arangoasync/collection.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ async def get_many(
934934
documents: Sequence[str | T],
935935
allow_dirty_read: Optional[bool] = None,
936936
ignore_revs: Optional[bool] = None,
937-
) -> Result[V]:
937+
) -> Result[Jsons]:
938938
"""Return multiple documents ignoring any missing ones.
939939
940940
Args:
@@ -977,10 +977,14 @@ async def get_many(
977977
data=self._doc_serializer.dumps(documents),
978978
)
979979

980-
def response_handler(resp: Response) -> V:
980+
def response_handler(resp: Response) -> Jsons:
981981
if not resp.is_success:
982982
raise DocumentGetError(resp, request)
983-
return self._doc_deserializer.loads_many(resp.raw_body)
983+
return [
984+
doc
985+
for doc in self.deserializer.loads_many(resp.raw_body)
986+
if "_id" in doc
987+
]
984988

985989
return await self._executor.execute(request, response_handler)
986990

arangoasync/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.6"
1+
__version__ = "1.1.0"

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"packaging>=23.1",
4141
"aiohttp>=3.9",
4242
"multidict>=6.0",
43-
"pyjwt>=2.8.0",
43+
"pyjwt>=2.10.0",
4444
]
4545

4646
[tool.setuptools.dynamic]
@@ -51,8 +51,8 @@ dev = [
5151
"aiofiles>=24.1.0",
5252
"black==26.1.0",
5353
"flake8==7.3.0",
54-
"isort>=5.10",
55-
"mypy>=1.10",
54+
"isort>=5.10.1",
55+
"mypy==1.15.0",
5656
"pre-commit>=3.7",
5757
"pytest>=8.2",
5858
"pytest-asyncio>=0.23.8",
@@ -92,5 +92,6 @@ profile = "black"
9292
[tool.mypy]
9393
warn_return_any = true
9494
warn_unused_configs = true
95+
warn_unused_ignores = false
9596
ignore_missing_imports = true
9697
strict = true

tests/test_document.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ async def test_document_get_many(doc_col, bad_col, docs):
223223
keys = [doc["_key"] for doc in docs]
224224
keys.append("invalid_key")
225225
many = await doc_col.get_many(keys)
226-
assert len(many) == len(keys)
227-
assert "error" in many[-1]
226+
assert len(many) == len(keys) - 1
227+
assert "error" not in many[-1]
228228

229229
# Test with full documents
230230
many = await doc_col.get_many(docs)
@@ -237,8 +237,7 @@ async def test_document_get_many(doc_col, bad_col, docs):
237237
assert len(many) == 1
238238
assert "error" not in many[0]
239239
many = await doc_col.get_many([bad_rev[0]], ignore_revs=False)
240-
assert len(many) == 1
241-
assert "error" in many[0]
240+
assert len(many) == 0
242241

243242
# Empty list
244243
many = await doc_col.get_many([])

0 commit comments

Comments
 (0)