Skip to content

Commit f76d828

Browse files
author
Joan Fontanals Martinez
committed
fix: apply black and some ruff
1 parent cab933e commit f76d828

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

docarray/documents/text.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ class MultiModalDoc(BaseDocument):
6565
mmdoc.text_doc.text = mmdoc.text_doc.url.load()
6666
6767
This Document can be compared against another Document of the same type or a string. When compared against
68-
another object of the same type, the pydantic BaseModel equality check will apply which checks the equality of every
69-
attribute, including `id`. When compared against a str, it will check the equality of the `text` attribute against the
68+
another object of the same type, the pydantic BaseModel equality check will apply which checks
69+
the equality of every attribute, including `id`.
70+
When compared against a str, it will check the equality of the `text` attribute against the
7071
given string.
7172
7273
.. code-block:: python

docarray/utils/lookup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def lookup(key, val, doc: 'BaseDocument') -> bool:
8787
return value in val
8888
elif last == 'nin':
8989
val = guard_iter(val)
90-
return not (value in val)
90+
return value not in val
9191
elif last == 'startswith':
9292
val = guard_str(val)
9393
return iff_not_none(value, lambda y: y.startswith(val))
@@ -198,7 +198,7 @@ def evaluate(self, doc: 'BaseDocument'):
198198
:param doc : the document to match
199199
:return: returns true if lookup passed
200200
"""
201-
print(f' evaluate document Lookupnode')
201+
print('evaluate document Lookupnode')
202202
results = map(lambda x: x.evaluate(doc), self.children)
203203
result = any(results) if self.op == 'or' else all(results)
204204
return not result if self.negate else result

docarray/utils/query_parser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
if TYPE_CHECKING: # pragma: no cover
66
from docarray import BaseDocument
77

8-
LOGICAL_OPERATORS: Dict[str, Union[str, bool]] = {'$and': 'and', '$or': 'or', '$not': True}
8+
LOGICAL_OPERATORS: Dict[str, Union[str, bool]] = {
9+
'$and': 'and',
10+
'$or': 'or',
11+
'$not': True,
12+
}
913

1014
COMPARISON_OPERATORS = {
1115
'$lt': 'lt',
@@ -31,7 +35,9 @@
3135
}
3236

3337

34-
def _parse_lookups(data: Union[Dict, List] = {}, root_node: Optional[LookupTreeElem] = None):
38+
def _parse_lookups(
39+
data: Union[Dict, List] = {}, root_node: Optional[LookupTreeElem] = None
40+
):
3541
if isinstance(data, dict):
3642
for key, value in data.items():
3743

0 commit comments

Comments
 (0)