Skip to content

Commit

Permalink
'Refactored by Sourcery' (#456)
Browse files Browse the repository at this point in the history
Co-authored-by: Sourcery AI <>
  • Loading branch information
sourcery-ai[bot] authored Sep 12, 2023
1 parent 44afafc commit 010b2ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions ebl/corpus/infrastructure/corpus_ngram_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ def update_ngrams(
signs_to_exclude: Optional[Sequence[str]] = None,
) -> None:
aggregation = self.aggregate_chapter_ngrams(chapter_id, N, signs_to_exclude)
data = next(
if data := next(
self._chapters.aggregate(aggregation, allowDiskUse=True),
None,
)
if data:
):
try:
self._ngrams.update_one(
{"_id": data["_id"]}, {"$set": {"ngrams": data["ngrams"]}}
Expand Down
5 changes: 2 additions & 3 deletions ebl/fragmentarium/infrastructure/fragment_ngram_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ def update_ngrams(
signs_to_exclude: Optional[Sequence[str]] = None,
) -> None:
aggregation = self.aggregate_fragment_ngrams(number, N, signs_to_exclude)
data = next(
if data := next(
self._fragments.aggregate(aggregation, allowDiskUse=True),
None,
)
if data:
):
try:
self._ngrams.update_one(
{"_id": data["_id"]}, {"$set": {"ngrams": data["ngrams"]}}
Expand Down

0 comments on commit 010b2ac

Please sign in to comment.