Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9fae59d

Browse filesBrowse files
author
Joan Fontanals
authored
Merge branch 'main' into dependabot/pip/aiohttp-3.9.4
2 parents 107b07d + 46d5082 commit 9fae59d
Copy full SHA for 9fae59d

File tree

Expand file treeCollapse file tree

15 files changed

+857
-170
lines changed
Filter options
Expand file treeCollapse file tree

15 files changed

+857
-170
lines changed

‎.github/workflows/add_license.yml

Copy file name to clipboardExpand all lines: .github/workflows/add_license.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v3
1717
with:
18-
python-version: 3.10
18+
python-version: "3.10"
1919

2020
- name: Run add_license.sh and check for changes
2121
id: add_license

‎.github/workflows/ci.yml

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
- name: Test
120120
id: test
121121
run: |
122-
poetry run pytest -m "not (tensorflow or benchmark or index or jax)" --cov=docarray --cov-report=xml ${{ matrix.test-path }} --ignore=tests/integrations/store/test_jac.py
122+
poetry run pytest -m "not (tensorflow or benchmark or index or jax)" --cov=docarray --cov-report=xml -v -s ${{ matrix.test-path }} --ignore=tests/integrations/store/test_jac.py
123123
echo "flag it as docarray for codeoverage"
124124
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
125125
timeout-minutes: 30
@@ -167,7 +167,7 @@ jobs:
167167
- name: Test
168168
id: test
169169
run: |
170-
poetry run pytest -m 'proto' --cov=docarray --cov-report=xml tests
170+
poetry run pytest -m 'proto' --cov=docarray --cov-report=xml -v -s tests
171171
echo "flag it as docarray for codeoverage"
172172
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
173173
timeout-minutes: 30
@@ -217,7 +217,7 @@ jobs:
217217
- name: Test
218218
id: test
219219
run: |
220-
poetry run pytest -m 'index and not elasticv8' --cov=docarray --cov-report=xml tests/index/${{ matrix.db_test_folder }}
220+
poetry run pytest -m 'index and not elasticv8' --cov=docarray --cov-report=xml -v -s tests/index/${{ matrix.db_test_folder }}
221221
echo "flag it as docarray for codeoverage"
222222
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
223223
timeout-minutes: 30
@@ -267,7 +267,7 @@ jobs:
267267
- name: Test
268268
id: test
269269
run: |
270-
poetry run pytest -m 'index and elasticv8' --cov=docarray --cov-report=xml tests
270+
poetry run pytest -m 'index and elasticv8' --cov=docarray --cov-report=xml -v -s tests
271271
echo "flag it as docarray for codeoverage"
272272
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
273273
timeout-minutes: 30
@@ -316,7 +316,7 @@ jobs:
316316
- name: Test
317317
id: test
318318
run: |
319-
poetry run pytest -m 'tensorflow' --cov=docarray --cov-report=xml tests
319+
poetry run pytest -m 'tensorflow' --cov=docarray --cov-report=xml -v -s tests
320320
echo "flag it as docarray for codeoverage"
321321
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
322322
timeout-minutes: 30
@@ -362,7 +362,7 @@ jobs:
362362
- name: Test
363363
id: test
364364
run: |
365-
poetry run pytest -m 'jax' --cov=docarray --cov-report=xml tests
365+
poetry run pytest -m 'jax' --cov=docarray --cov-report=xml -v -s tests
366366
echo "flag it as docarray for codeoverage"
367367
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
368368
timeout-minutes: 30
@@ -406,7 +406,7 @@ jobs:
406406
- name: Test
407407
id: test
408408
run: |
409-
poetry run pytest -m 'benchmark' --cov=docarray --cov-report=xml tests
409+
poetry run pytest -m 'benchmark' --cov=docarray --cov-report=xml -v -s tests
410410
echo "flag it as docarray for codeoverage"
411411
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
412412
timeout-minutes: 30

‎docarray/index/backends/helper.py

Copy file name to clipboardExpand all lines: docarray/index/backends/helper.py
+38-1Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Tuple, Type, cast
1+
from typing import Any, Dict, List, Tuple, Type, cast, Set
22

33
from docarray import BaseDoc, DocList
44
from docarray.index.abstract import BaseDocIndex
@@ -20,6 +20,43 @@ def inner(self, *args, **kwargs):
2020
return inner
2121

2222

23+
def _collect_query_required_args(method_name: str, required_args: Set[str] = None):
24+
"""
25+
Returns a function that ensures required keyword arguments are provided.
26+
27+
:param method_name: The name of the method for which the required arguments are being checked.
28+
:type method_name: str
29+
:param required_args: A set containing the names of required keyword arguments. Defaults to None.
30+
:type required_args: Optional[Set[str]]
31+
:return: A function that checks for required keyword arguments before executing the specified method.
32+
Raises ValueError if positional arguments are provided.
33+
Raises TypeError if any required keyword argument is missing.
34+
:rtype: Callable
35+
"""
36+
37+
if required_args is None:
38+
required_args = set()
39+
40+
def inner(self, *args, **kwargs):
41+
if args:
42+
raise ValueError(
43+
f"Positional arguments are not supported for "
44+
f"`{type(self)}.{method_name}`. "
45+
f"Use keyword arguments instead."
46+
)
47+
48+
missing_args = required_args - set(kwargs.keys())
49+
if missing_args:
50+
raise ValueError(
51+
f"`{type(self)}.{method_name}` is missing required argument(s): {', '.join(missing_args)}"
52+
)
53+
54+
updated_query = self._queries + [(method_name, kwargs)]
55+
return type(self)(updated_query)
56+
57+
return inner
58+
59+
2360
def _execute_find_and_filter_query(
2461
doc_index: BaseDocIndex, query: List[Tuple[str, Dict]], reverse_order: bool = False
2562
) -> FindResult:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.