mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-28 15:00:23 +00:00
core: Add various ruff rules (#26836)
Adds - ASYNC - COM - DJ - EXE - FLY - FURB - ICN - INT - LOG - NPY - PD - Q - RSE - SLOT - T10 - TID - YTT Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
committed by
GitHub
parent
5c826faece
commit
16f5fdb38b
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import base64
|
||||
import re
|
||||
from dataclasses import asdict
|
||||
@@ -289,9 +290,14 @@ async def _render_mermaid_using_pyppeteer(
|
||||
img_bytes = await page.screenshot({"fullPage": False})
|
||||
await browser.close()
|
||||
|
||||
def write_to_file(path: str, bytes: bytes) -> None:
|
||||
with open(path, "wb") as file:
|
||||
file.write(bytes)
|
||||
|
||||
if output_file_path is not None:
|
||||
with open(output_file_path, "wb") as file:
|
||||
file.write(img_bytes)
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
None, write_to_file, output_file_path, img_bytes
|
||||
)
|
||||
|
||||
return img_bytes
|
||||
|
||||
|
Reference in New Issue
Block a user