mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-13 12:56:51 +08:00
chore: apply ruff rules on tests and app.py (#3605)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Generator, List
|
||||
from collections.abc import Generator
|
||||
|
||||
import google.generativeai.types.content_types as content_types
|
||||
import google.generativeai.types.generation_types as generation_config_types
|
||||
@@ -6,15 +6,15 @@ import google.generativeai.types.safety_types as safety_types
|
||||
import pytest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from google.ai import generativelanguage as glm
|
||||
from google.ai.generativelanguage_v1beta.types import content as gag_content
|
||||
from google.generativeai import GenerativeModel
|
||||
from google.generativeai.client import _ClientManager, configure
|
||||
from google.generativeai.types import GenerateContentResponse
|
||||
from google.generativeai.types.generation_types import BaseGenerateContentResponse
|
||||
from google.ai.generativelanguage_v1beta.types import content as gag_content
|
||||
|
||||
current_api_key = ''
|
||||
|
||||
class MockGoogleResponseClass(object):
|
||||
class MockGoogleResponseClass:
|
||||
_done = False
|
||||
|
||||
def __iter__(self):
|
||||
@@ -41,7 +41,7 @@ class MockGoogleResponseClass(object):
|
||||
chunks=[]
|
||||
)
|
||||
|
||||
class MockGoogleResponseCandidateClass(object):
|
||||
class MockGoogleResponseCandidateClass:
|
||||
finish_reason = 'stop'
|
||||
|
||||
@property
|
||||
@@ -52,7 +52,7 @@ class MockGoogleResponseCandidateClass(object):
|
||||
]
|
||||
)
|
||||
|
||||
class MockGoogleClass(object):
|
||||
class MockGoogleClass:
|
||||
@staticmethod
|
||||
def generate_content_sync() -> GenerateContentResponse:
|
||||
return GenerateContentResponse(
|
||||
@@ -91,7 +91,7 @@ class MockGoogleClass(object):
|
||||
return 'it\'s google!'
|
||||
|
||||
@property
|
||||
def generative_response_candidates(self) -> List[MockGoogleResponseCandidateClass]:
|
||||
def generative_response_candidates(self) -> list[MockGoogleResponseCandidateClass]:
|
||||
return [MockGoogleResponseCandidateClass()]
|
||||
|
||||
def make_client(self: _ClientManager, name: str):
|
||||
|
||||
Reference in New Issue
Block a user