langchain-openai[patch]: Add ruff bandit rules to linter (#31788)

This commit is contained in:
Mason Daugherty
2025-06-30 14:01:32 -04:00
committed by GitHub
parent 645e25f624
commit 33c9bf1adc
4 changed files with 23 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ class _SyncHttpxClientWrapper(openai.DefaultHttpxClient):
try:
self.close()
except Exception:
except Exception: # noqa: S110
pass
@@ -37,7 +37,7 @@ class _AsyncHttpxClientWrapper(openai.DefaultAsyncHttpxClient):
try:
# TODO(someday): support non asyncio runtimes here
asyncio.get_running_loop().create_task(self.aclose())
except Exception:
except Exception: # noqa: S110
pass

View File

@@ -310,7 +310,8 @@ class BaseOpenAI(BaseLLM):
generation = chunk
else:
generation += chunk
assert generation is not None
if generation is None:
raise ValueError("Generation is empty after streaming.")
choices.append(
{
"text": generation.text,
@@ -378,7 +379,8 @@ class BaseOpenAI(BaseLLM):
generation = chunk
else:
generation += chunk
assert generation is not None
if generation is None:
raise ValueError("Generation is empty after streaming.")
choices.append(
{
"text": generation.text,