From c7f9f44f99f2e4a07867783af558252e3596892f Mon Sep 17 00:00:00 2001 From: Raju Komati Date: Sat, 29 Apr 2023 15:08:10 +0530 Subject: refactored the code --- gpt4free/forefront/typing.py | 2 +- gpt4free/quora/__init__.py | 6 +++--- gpt4free/quora/api.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gpt4free/forefront/typing.py b/gpt4free/forefront/typing.py index d6026e04..23e90903 100644 --- a/gpt4free/forefront/typing.py +++ b/gpt4free/forefront/typing.py @@ -23,4 +23,4 @@ class ForeFrontResponse(BaseModel): model: str choices: List[Choice] usage: Usage - text: str \ No newline at end of file + text: str diff --git a/gpt4free/quora/__init__.py b/gpt4free/quora/__init__.py index 31526e0c..f548ff41 100644 --- a/gpt4free/quora/__init__.py +++ b/gpt4free/quora/__init__.py @@ -377,10 +377,10 @@ class Poe: raise RuntimeError('Sorry, the model you provided does not exist. Please check and try again.') self.model = MODELS[model] self.cookie_path = cookie_path - self.cookie = self.__load_cookie(driver, download_driver, driver_path=driver_path) + self.cookie = self.__load_cookie(driver, driver_path=driver_path) self.client = PoeClient(self.cookie) - def __load_cookie(self, driver: str, download_driver: bool, driver_path: Optional[str] = None) -> str: + def __load_cookie(self, driver: str, driver_path: Optional[str] = None) -> str: if (cookie_file := Path(self.cookie_path)).exists(): with cookie_file.open() as fp: cookie = json.load(fp) @@ -468,4 +468,4 @@ class Poe: print(f'Successfully created bot with name: {response["bot"]["displayName"]}') def list_bots(self) -> list: - return list(self.client.bot_names.values()) \ No newline at end of file + return list(self.client.bot_names.values()) diff --git a/gpt4free/quora/api.py b/gpt4free/quora/api.py index 697f6663..c48eb273 100644 --- a/gpt4free/quora/api.py +++ b/gpt4free/quora/api.py @@ -225,7 +225,7 @@ class Client: r = request_with_retries(self.session.post, self.gql_url, data=payload, headers=headers) data = r.json() - if data["data"] == None: + if data["data"] is None: logger.warn(f'{query_name} returned an error: {data["errors"][0]["message"]} | Retrying ({i + 1}/20)') time.sleep(2) continue @@ -316,7 +316,7 @@ class Client: return # indicate that the response id is tied to the human message id - elif key != "pending" and value == None and message["state"] != "complete": + elif key != "pending" and value is None and message["state"] != "complete": self.active_messages[key] = message["messageId"] self.message_queues[key].put(message) return @@ -402,7 +402,7 @@ class Client: logger.info(f"Downloading {count} messages from {chatbot}") messages = [] - if cursor == None: + if cursor is None: chat_data = self.get_bot(self.bot_names[chatbot]) if not chat_data["messagesConnection"]["edges"]: return [] -- cgit v1.2.3