Skip to content

Commit 701b460

Browse files
fix: reading length
1 parent 2cdc778 commit 701b460

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

WDoc/utils/loaders.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,17 @@ def load_one_doc(
545545
)
546546
assert docs[i].metadata["all_hash"], f"Empty all_hash for document: {docs[i]}"
547547

548-
total_reading_length = sum([float(d.metadata["doc_reading_time"]) for d in docs])
549-
assert total_reading_length > 0.1, (
550-
f"Failing doc: total reading length is {total_reading_length:.3f}"
551-
"min which is suspiciously low. Filetype {filetype} with kwargs "
552-
f"'{kwargs}'"
553-
)
548+
try:
549+
total_reading_length = sum([float(d.metadata["doc_reading_time"]) for d in docs])
550+
except Exception:
551+
total_reading_length = None
552+
pass
553+
if total_reding_length is not None:
554+
assert total_reading_length > 0.1, (
555+
f"Failing doc: total reading length is {total_reading_length:.3f}"
556+
"min which is suspiciously low. Filetype {filetype} with kwargs "
557+
f"'{kwargs}'"
558+
)
554559

555560
assert docs, "empty list of loaded documents!"
556561
return docs

0 commit comments

Comments
 (0)