From aa03a2504bb79d965646a3b080c940bb23454fff Mon Sep 17 00:00:00 2001 From: D-Sivakumar Sriumapathy Date: Tue, 3 Dec 2024 19:53:06 +0000 Subject: [PATCH] fixing linting errors --- bertopic/representation/_cohere.py | 1 - bertopic/representation/_langchain.py | 1 - bertopic/representation/_openai.py | 3 +-- bertopic/representation/_utils.py | 7 +++---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bertopic/representation/_cohere.py b/bertopic/representation/_cohere.py index b38c1dca..a0c74434 100644 --- a/bertopic/representation/_cohere.py +++ b/bertopic/representation/_cohere.py @@ -128,7 +128,6 @@ def __init__( self.prompts_ = [] - def extract_topics( self, topic_model, diff --git a/bertopic/representation/_langchain.py b/bertopic/representation/_langchain.py index 93f8fbf7..e7588df4 100644 --- a/bertopic/representation/_langchain.py +++ b/bertopic/representation/_langchain.py @@ -150,7 +150,6 @@ def __init__( self.tokenizer = tokenizer validate_truncate_document_parameters(self.tokenizer, self.doc_length) - def extract_topics( self, topic_model, diff --git a/bertopic/representation/_openai.py b/bertopic/representation/_openai.py index 2fa184b4..e05a9c66 100644 --- a/bertopic/representation/_openai.py +++ b/bertopic/representation/_openai.py @@ -8,7 +8,7 @@ from bertopic.representation._utils import ( retry_with_exponential_backoff, truncate_document, - validate_truncate_document_parameters + validate_truncate_document_parameters, ) @@ -183,7 +183,6 @@ def __init__( if not self.generator_kwargs.get("stop") and not chat: self.generator_kwargs["stop"] = "\n" - def extract_topics( self, topic_model, diff --git a/bertopic/representation/_utils.py b/bertopic/representation/_utils.py index c2a33107..255c8fbe 100644 --- a/bertopic/representation/_utils.py +++ b/bertopic/representation/_utils.py @@ -58,8 +58,9 @@ def decode(self, doc_chunks): return truncated_document return document + def validate_truncate_document_parameters(tokenizer, doc_length) -> Union[None, ValueError]: - """validates parameters that are used in the function `truncate_document`""" + """Validates parameters that are used in the function `truncate_document`.""" if tokenizer is None and doc_length is not None: raise ValueError( "Please select from one of the valid options for the `tokenizer` parameter: \n" @@ -67,9 +68,7 @@ def validate_truncate_document_parameters(tokenizer, doc_length) -> Union[None, "If `tokenizer` is of type callable ensure it has methods to encode and decode a document \n" ) elif tokenizer is not None and doc_length is None: - raise ValueError( - "If `tokenizer` is provided, `doc_length` of type int must be provided as well." - ) + raise ValueError("If `tokenizer` is provided, `doc_length` of type int must be provided as well.") def retry_with_exponential_backoff(