ref: Apply ruff rules preview autofix (#4699)
Apply ruff rules preview autofix
This commit is contained in:
parent
534a9dc9cb
commit
598e6bc5ae
25 changed files with 50 additions and 50 deletions
|
|
@ -61,7 +61,7 @@ async def check_if_store_has_api_key(
|
|||
return {"has_api_key": api_key is not None, "is_valid": is_valid}
|
||||
|
||||
|
||||
@router.post("/components/", response_model=CreateComponentResponse, status_code=201)
|
||||
@router.post("/components/", status_code=201)
|
||||
async def share_component(
|
||||
component: StoreComponentCreate,
|
||||
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
|
||||
|
|
@ -123,7 +123,7 @@ async def get_components(
|
|||
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@router.get("/components/{component_id}", response_model=DownloadComponentResponse)
|
||||
@router.get("/components/{component_id}")
|
||||
async def download_component(
|
||||
component_id: UUID,
|
||||
store_api_key: Annotated[str, Depends(get_user_store_api_key)],
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ from .update_page_property import NotionPageUpdate
|
|||
|
||||
__all__ = [
|
||||
"AddContentToPage",
|
||||
"NotionPageCreator",
|
||||
"NotionDatabaseProperties",
|
||||
"NotionListPages",
|
||||
"NotionUserList",
|
||||
"NotionPageContent",
|
||||
"NotionSearch",
|
||||
"NotionPageCreator",
|
||||
"NotionPageUpdate",
|
||||
"NotionSearch",
|
||||
"NotionUserList",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ __all__ = [
|
|||
"AssemblyAIGetSubtitles",
|
||||
"AssemblyAILeMUR",
|
||||
"AssemblyAIListTranscripts",
|
||||
"AssemblyAITranscriptionJobPoller",
|
||||
"AssemblyAITranscriptionJobCreator",
|
||||
"AssemblyAITranscriptionJobPoller",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ __all__ = [
|
|||
"HierarchicalCrewComponent",
|
||||
"HierarchicalTaskComponent",
|
||||
"SequentialCrewComponent",
|
||||
"SequentialTaskComponent",
|
||||
"SequentialTaskAgentComponent",
|
||||
"SequentialTaskComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ __all__ = [
|
|||
"CSVToDataComponent",
|
||||
"DirectoryComponent",
|
||||
"FileComponent",
|
||||
"JSONToDataComponent",
|
||||
"SQLExecutorComponent",
|
||||
"URLComponent",
|
||||
"WebhookComponent",
|
||||
"JSONToDataComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ __all__ = [
|
|||
"AstraVectorizeComponent",
|
||||
"AzureOpenAIEmbeddingsComponent",
|
||||
"CohereEmbeddingsComponent",
|
||||
"EmbeddingSimilarityComponent",
|
||||
"GoogleGenerativeAIEmbeddingsComponent",
|
||||
"HuggingFaceInferenceAPIEmbeddingsComponent",
|
||||
"LMStudioEmbeddingsComponent",
|
||||
|
|
@ -27,7 +28,6 @@ __all__ = [
|
|||
"NVIDIAEmbeddingsComponent",
|
||||
"OllamaEmbeddingsComponent",
|
||||
"OpenAIEmbeddingsComponent",
|
||||
"EmbeddingSimilarityComponent",
|
||||
"TextEmbedderComponent",
|
||||
"VertexAIEmbeddingsComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ __all__ = [
|
|||
"CreateListComponent",
|
||||
"CurrentDateComponent",
|
||||
"IDGeneratorComponent",
|
||||
"OutputParserComponent",
|
||||
"StructuredOutputComponent",
|
||||
"StoreMessageComponent",
|
||||
"MemoryComponent",
|
||||
"OutputParserComponent",
|
||||
"StoreMessageComponent",
|
||||
"StructuredOutputComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -28,32 +28,32 @@ from .vector_store_router import VectorStoreRouterAgentComponent
|
|||
from .xml import XMLAgentComponent
|
||||
|
||||
__all__ = [
|
||||
"CSVAgentComponent",
|
||||
"CharacterTextSplitterComponent",
|
||||
"ConversationChainComponent",
|
||||
"CSVAgentComponent",
|
||||
"FakeEmbeddingsComponent",
|
||||
"HtmlLinkExtractorComponent",
|
||||
"JSONDocumentBuilder",
|
||||
"JsonAgentComponent",
|
||||
"LangChainHubPromptComponent",
|
||||
"LanguageRecursiveTextSplitterComponent",
|
||||
"LLMCheckerChainComponent",
|
||||
"LLMMathChainComponent",
|
||||
"LangChainHubPromptComponent",
|
||||
"LanguageRecursiveTextSplitterComponent",
|
||||
"NaturalLanguageTextSplitterComponent",
|
||||
"OpenAIToolsAgentComponent",
|
||||
"OpenAPIAgentComponent",
|
||||
"RecursiveCharacterTextSplitterComponent",
|
||||
"RetrievalQAComponent",
|
||||
"RunnableExecComponent",
|
||||
"SelfQueryRetrieverComponent",
|
||||
"SpiderTool",
|
||||
"SQLAgentComponent",
|
||||
"SQLDatabaseComponent",
|
||||
"SQLGeneratorComponent",
|
||||
"SelfQueryRetrieverComponent",
|
||||
"SemanticTextSplitterComponent",
|
||||
"SpiderTool",
|
||||
"ToolCallingAgentComponent",
|
||||
"VectoStoreRetrieverComponent",
|
||||
"VectorStoreInfoComponent",
|
||||
"VectorStoreRouterAgentComponent",
|
||||
"XMLAgentComponent",
|
||||
"SemanticTextSplitterComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class JsonAgentComponent(LCAgentComponent):
|
|||
|
||||
def build_agent(self) -> AgentExecutor:
|
||||
path = Path(self.path)
|
||||
if path.suffix in ("yaml", "yml"):
|
||||
if path.suffix in {"yaml", "yml"}:
|
||||
with path.open(encoding="utf-8") as file:
|
||||
yaml_dict = yaml.safe_load(file)
|
||||
spec = JsonSpec(dict_=yaml_dict)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class OpenAPIAgentComponent(LCAgentComponent):
|
|||
|
||||
def build_agent(self) -> AgentExecutor:
|
||||
path = Path(self.path)
|
||||
if path.suffix in ("yaml", "yml"):
|
||||
if path.suffix in {"yaml", "yml"}:
|
||||
with path.open(encoding="utf-8") as file:
|
||||
yaml_dict = yaml.safe_load(file)
|
||||
spec = JsonSpec(dict_=yaml_dict)
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ from .run_flow import RunFlowComponent
|
|||
from .sub_flow import SubFlowComponent
|
||||
|
||||
__all__ = [
|
||||
"ConditionalRouterComponent",
|
||||
"DataConditionalRouterComponent",
|
||||
"FlowToolComponent",
|
||||
"ListenComponent",
|
||||
"NotifyComponent",
|
||||
"PassMessageComponent",
|
||||
"RunFlowComponent",
|
||||
"SubFlowComponent",
|
||||
"ConditionalRouterComponent",
|
||||
"PassMessageComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from .zep import ZepChatMemory
|
|||
__all__ = [
|
||||
"AstraDBChatMemory",
|
||||
"CassandraChatMemory",
|
||||
"Mem0MemoryComponent",
|
||||
"RedisIndexChatMemory",
|
||||
"ZepChatMemory",
|
||||
"Mem0MemoryComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -103,13 +103,13 @@ class Mem0MemoryComponent(LCChatMemoryComponent):
|
|||
|
||||
def ingest_data(self) -> Memory:
|
||||
"""Ingests a new message into Mem0 memory and returns the updated memory instance."""
|
||||
mem0_memory = self.existing_memory if self.existing_memory else self.build_mem0()
|
||||
mem0_memory = self.existing_memory or self.build_mem0()
|
||||
|
||||
if not self.ingest_message or not self.user_id:
|
||||
logger.warning("Missing 'ingest_message' or 'user_id'; cannot ingest data.")
|
||||
return mem0_memory
|
||||
|
||||
metadata = self.metadata if self.metadata else {}
|
||||
metadata = self.metadata or {}
|
||||
|
||||
logger.info("Ingesting message for user_id: %s", self.user_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class AIMLModelComponent(LCModelComponent):
|
|||
|
||||
@override
|
||||
def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):
|
||||
if field_name in ("api_key", "aiml_api_base", "model_name"):
|
||||
if field_name in {"api_key", "aiml_api_base", "model_name"}:
|
||||
aiml = AimlModels()
|
||||
aiml.get_aiml_models()
|
||||
build_config["model_name"]["options"] = aiml.chat_models
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@ from .split_text import SplitTextComponent
|
|||
from .update_data import UpdateDataComponent
|
||||
|
||||
__all__ = [
|
||||
"CombineTextComponent",
|
||||
"CreateDataComponent",
|
||||
"ExtractDataKeyComponent",
|
||||
"DataFilterComponent",
|
||||
"ExtractDataKeyComponent",
|
||||
"JSONCleaner",
|
||||
"MergeDataComponent",
|
||||
"MessageToDataComponent",
|
||||
"ParseDataComponent",
|
||||
"SelectDataComponent",
|
||||
"UpdateDataComponent",
|
||||
"ParseJSONDataComponent",
|
||||
"JSONCleaner",
|
||||
"CombineTextComponent",
|
||||
"SelectDataComponent",
|
||||
"SplitTextComponent",
|
||||
"UpdateDataComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@ __all__ = [
|
|||
"BingSearchAPIComponent",
|
||||
"CalculatorToolComponent",
|
||||
"DuckDuckGoSearchComponent",
|
||||
"ExaSearchToolkit",
|
||||
"GleanSearchAPIComponent",
|
||||
"GoogleSearchAPIComponent",
|
||||
"GoogleSerperAPIComponent",
|
||||
"ExaSearchToolkit",
|
||||
"PythonCodeStructuredTool",
|
||||
"PythonREPLToolComponent",
|
||||
"RetrieverToolComponent",
|
||||
"SearchAPIComponent",
|
||||
"SearXNGToolComponent",
|
||||
"SearchAPIComponent",
|
||||
"SerpAPIComponent",
|
||||
"TavilySearchToolComponent",
|
||||
"WikidataAPIComponent",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class YouTubeTranscriptsComponent(LCToolComponent):
|
|||
else TranscriptFormat.CHUNKS,
|
||||
chunk_size_seconds=self.chunk_size_seconds,
|
||||
language=self.language.split(",") if self.language else ["en"],
|
||||
translation=self.translation if self.translation else None,
|
||||
translation=self.translation or None,
|
||||
)
|
||||
|
||||
transcripts = loader.load()
|
||||
|
|
@ -140,7 +140,7 @@ class YouTubeTranscriptsComponent(LCToolComponent):
|
|||
else TranscriptFormat.CHUNKS,
|
||||
chunk_size_seconds=chunk_size_seconds,
|
||||
language=language.split(",") if language else ["en"],
|
||||
translation=translation if translation else None,
|
||||
translation=translation or None,
|
||||
)
|
||||
|
||||
transcripts = loader.load()
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ __all__ = [
|
|||
"RedisVectorStoreComponent",
|
||||
"SupabaseVectorStoreComponent",
|
||||
"UpstashVectorStoreComponent",
|
||||
"VectaraVectorStoreComponent",
|
||||
"VectaraRagComponent",
|
||||
"VectaraSelfQueryRetriverComponent",
|
||||
"VectaraVectorStoreComponent",
|
||||
"WeaviateVectorStoreComponent",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class EventManager:
|
|||
|
||||
def send_event(self, *, event_type: Literal["message", "error", "warning", "info", "token"], data: LoggableType):
|
||||
try:
|
||||
if isinstance(data, dict) and event_type in ["message", "error", "warning", "info", "token"]:
|
||||
if isinstance(data, dict) and event_type in {"message", "error", "warning", "info", "token"}:
|
||||
data = create_event_by_type(event_type, **data)
|
||||
except TypeError as e:
|
||||
logger.debug(f"Error creating playground event: {e}")
|
||||
|
|
|
|||
|
|
@ -195,13 +195,13 @@ class Edge:
|
|||
def __hash__(self) -> int:
|
||||
return hash(self.__repr__())
|
||||
|
||||
def __eq__(self, __o: object) -> bool:
|
||||
if not isinstance(__o, Edge):
|
||||
def __eq__(self, /, other: object) -> bool:
|
||||
if not isinstance(other, Edge):
|
||||
return False
|
||||
return (
|
||||
self._source_handle == __o._source_handle
|
||||
and self._target_handle == __o._target_handle
|
||||
and self.target_param == __o.target_param
|
||||
self._source_handle == other._source_handle
|
||||
and self._target_handle == other._target_handle
|
||||
and self.target_param == other.target_param
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
|
|
|||
|
|
@ -1072,7 +1072,7 @@ class Graph:
|
|||
else:
|
||||
return graph
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
def __eq__(self, /, other: object) -> bool:
|
||||
if not isinstance(other, Graph):
|
||||
return False
|
||||
return self.__repr__() == other.__repr__()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Finish:
|
|||
def __bool__(self) -> bool:
|
||||
return True
|
||||
|
||||
def __eq__(self, other):
|
||||
def __eq__(self, /, other):
|
||||
return isinstance(other, Finish)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -845,16 +845,16 @@ class Vertex:
|
|||
def __repr__(self) -> str:
|
||||
return f"Vertex(display_name={self.display_name}, id={self.id}, data={self.data})"
|
||||
|
||||
def __eq__(self, __o: object) -> bool:
|
||||
def __eq__(self, /, other: object) -> bool:
|
||||
try:
|
||||
if not isinstance(__o, Vertex):
|
||||
if not isinstance(other, Vertex):
|
||||
return False
|
||||
# We should create a more robust comparison
|
||||
# for the Vertex class
|
||||
ids_are_equal = self.id == __o.id
|
||||
ids_are_equal = self.id == other.id
|
||||
# self.data is a dict and we need to compare them
|
||||
# to check if they are equal
|
||||
data_are_equal = self.data == __o.data
|
||||
data_are_equal = self.data == other.data
|
||||
except AttributeError:
|
||||
return False
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class Data(BaseModel):
|
|||
def __contains__(self, key) -> bool:
|
||||
return key in self.data
|
||||
|
||||
def __eq__(self, other):
|
||||
def __eq__(self, /, other):
|
||||
return isinstance(other, Data) and self.data == other.data
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class Message(Data):
|
|||
value = [value]
|
||||
return value
|
||||
|
||||
def model_post_init(self, __context: Any) -> None:
|
||||
def model_post_init(self, /, _context: Any) -> None:
|
||||
new_files: list[Any] = []
|
||||
for file in self.files or []:
|
||||
if is_image_file(file):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue