projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change settings in flake8 and black.
[python_utils.git]
/
logical_search.py
diff --git
a/logical_search.py
b/logical_search.py
index 4295aa0892fd0a67e8af778aa92f92a30d58e436..76c2f86264be3fc49960166fe7a1b702f90e6c4b 100644
(file)
--- a/
logical_search.py
+++ b/
logical_search.py
@@
-168,9
+168,7
@@
class Corpus(object):
def invert_docid_set(self, original: Set[str]) -> Set[str]:
"""Invert a set of docids."""
def invert_docid_set(self, original: Set[str]) -> Set[str]:
"""Invert a set of docids."""
- return set(
- [docid for docid in self.documents_by_docid.keys() if docid not in original]
- )
+ return set([docid for docid in self.documents_by_docid.keys() if docid not in original])
def get_doc(self, docid: str) -> Optional[Document]:
"""Given a docid, retrieve the previously added Document."""
def get_doc(self, docid: str) -> Optional[Document]:
"""Given a docid, retrieve the previously added Document."""
@@
-250,9
+248,7
@@
class Corpus(object):
operation = Operation.from_token(token)
operand_count = operation.num_operands()
if len(node_stack) < operand_count:
operation = Operation.from_token(token)
operand_count = operation.num_operands()
if len(node_stack) < operand_count:
- raise ParseError(
- f"Incorrect number of operations for {operation}"
- )
+ raise ParseError(f"Incorrect number of operations for {operation}")
for _ in range(operation.num_operands()):
args.append(node_stack.pop())
node = Node(corpus, operation, args)
for _ in range(operation.num_operands()):
args.append(node_stack.pop())
node = Node(corpus, operation, args)
@@
-342,9
+338,7
@@
class Node(object):
try:
key, value = tag.split(":")
except ValueError as v:
try:
key, value = tag.split(":")
except ValueError as v:
- raise ParseError(
- f'Invalid key:value syntax at "{tag}"'
- ) from v
+ raise ParseError(f'Invalid key:value syntax at "{tag}"') from v
if value == "*":
r = self.corpus.get_docids_with_property(key)
else:
if value == "*":
r = self.corpus.get_docids_with_property(key)
else: