From 14b22b9d657c55aa5f20acb289f8c18d9cd3e145 Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Thu, 2 Mar 2023 13:17:47 +0100 Subject: [PATCH] Cherry-pick is_empty() fix. Drop KnowledgeBase.__len()__. --- spacy/kb/kb.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/kb/kb.pyx b/spacy/kb/kb.pyx index 9317629e2..61c7e5fde 100644 --- a/spacy/kb/kb.pyx +++ b/spacy/kb/kb.pyx @@ -123,10 +123,10 @@ cdef class KnowledgeBase: Errors.E1044.format(parent="KnowledgeBase", method="generate_from_disk", name=cls.__name__) ) - def __len__(self) -> int: - """Returns number of entities in the KnowledgeBase. - RETURNS (int): Number of entities in the KnowledgeBase. + def is_empty(self) -> bool: + """Returns whether KnowledgeBase is empty. + RETURNS (bool): Whether KnowledgeBase is empty. """ raise NotImplementedError( - Errors.E1044.format(parent="KnowledgeBase", method="__len__", name=self.__name__) + Errors.E1044.format(parent="KnowledgeBase", method="is_empty", name=self.__name__) )