Skip to content

Commit

Permalink
fix: ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
willydouhard committed Nov 18, 2024
1 parent 0c42bc6 commit f2baffe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
12 changes: 6 additions & 6 deletions backend/chainlit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ class CodeSettings:
password_auth_callback: Optional[
Callable[[str, str], Awaitable[Optional["User"]]]
] = None
header_auth_callback: Optional[
Callable[[Headers], Awaitable[Optional["User"]]]
] = None
header_auth_callback: Optional[Callable[[Headers], Awaitable[Optional["User"]]]] = (
None
)
oauth_callback: Optional[
Callable[[str, str, Dict[str, str], "User"], Awaitable[Optional["User"]]]
] = None
Expand All @@ -296,9 +296,9 @@ class CodeSettings:
set_chat_profiles: Optional[
Callable[[Optional["User"]], Awaitable[List["ChatProfile"]]]
] = None
set_starters: Optional[
Callable[[Optional["User"]], Awaitable[List["Starter"]]]
] = None
set_starters: Optional[Callable[[Optional["User"]], Awaitable[List["Starter"]]]] = (
None
)
data_layer: Optional[Callable[[], BaseDataLayer]] = None


Expand Down
2 changes: 1 addition & 1 deletion backend/chainlit/haystack/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def on_tool_finish(
tool_result: str,
tool_name: Optional[str] = None,
tool_input: Optional[str] = None,
**kwargs: Any
**kwargs: Any,
) -> None:
# Tool finished, send step with tool_result
tool_step = self.stack.pop()
Expand Down
7 changes: 3 additions & 4 deletions backend/chainlit/llama_index/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,15 @@ def on_event_end(
context_var.get().loop.create_task(step.update())

elif event_type == CBEventType.LLM:
formatted_messages = payload.get(
EventPayload.MESSAGES
) # type: Optional[List[ChatMessage]]
formatted_messages = payload.get(EventPayload.MESSAGES) # type: Optional[List[ChatMessage]]
formatted_prompt = payload.get(EventPayload.PROMPT)
response = payload.get(EventPayload.RESPONSE)

if formatted_messages:
messages = [
GenerationMessage(
role=m.role.value, content=m.content or "" # type: ignore
role=m.role.value, # type: ignore
content=m.content or "",
)
for m in formatted_messages
]
Expand Down
12 changes: 6 additions & 6 deletions backend/chainlit/oauth_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ async def get_user_info(self, token: str):
)
photo_data = await photo_response.aread()
base64_image = base64.b64encode(photo_data)
azure_user[
"image"
] = f"data:{photo_response.headers['Content-Type']};base64,{base64_image.decode('utf-8')}"
azure_user["image"] = (
f"data:{photo_response.headers['Content-Type']};base64,{base64_image.decode('utf-8')}"
)
except Exception:
# Ignore errors getting the photo
pass
Expand Down Expand Up @@ -317,9 +317,9 @@ async def get_user_info(self, token: str):
)
photo_data = await photo_response.aread()
base64_image = base64.b64encode(photo_data)
azure_user[
"image"
] = f"data:{photo_response.headers['Content-Type']};base64,{base64_image.decode('utf-8')}"
azure_user["image"] = (
f"data:{photo_response.headers['Content-Type']};base64,{base64_image.decode('utf-8')}"
)
except Exception:
# Ignore errors getting the photo
pass
Expand Down

0 comments on commit f2baffe

Please sign in to comment.