Address mypy typing issues

This commit is contained in:
sabaimran
2023-12-16 09:24:26 +05:30
parent 5f6dcf9f2e
commit 3065cea562
2 changed files with 4 additions and 4 deletions

View File

@@ -401,7 +401,7 @@ class ConversationAdapters:
)
max_results = 3
all_questions = await sync_to_async(list)(all_questions)
all_questions = await sync_to_async(list)(all_questions) # type: ignore
if len(all_questions) < max_results:
return all_questions

View File

@@ -267,7 +267,7 @@ async def text_to_image(message: str) -> Tuple[Optional[str], int]:
)
image = response.data[0].b64_json
except openai.OpenAIError as e:
logger.error(f"Image Generation failed with {e.http_status}: {e.error}")
logger.error(f"Image Generation failed with {e}", exc_info=True)
status_code = 500
return image, status_code
@@ -302,7 +302,7 @@ class ApiUserRateLimiter:
class ConversationCommandRateLimiter:
def __init__(self, trial_rate_limit: int, subscribed_rate_limit: int):
self.cache = defaultdict(lambda: defaultdict(list))
self.cache: Dict[str, Dict[str, List[float]]] = defaultdict(lambda: defaultdict(list))
self.trial_rate_limit = trial_rate_limit
self.subscribed_rate_limit = subscribed_rate_limit
self.restricted_commands = [ConversationCommand.Online, ConversationCommand.Image]
@@ -351,7 +351,7 @@ class ApiIndexedDataLimiter:
if state.billing_enabled is False:
return
subscribed = has_required_scope(request, ["premium"])
incoming_data_size_mb = 0
incoming_data_size_mb = 0.0
deletion_file_names = set()
if not request.user.is_authenticated: