mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 06:23:20 +00:00
ruff: add bugbear across packages (#31917)
WIP, other packages will get in next PRs
This commit is contained in:
@@ -98,12 +98,12 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):
|
||||
self.client = client
|
||||
self.async_client = async_client
|
||||
|
||||
except ImportError:
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import huggingface_hub python package. "
|
||||
"Please install it with `pip install huggingface_hub`."
|
||||
)
|
||||
raise ImportError(msg)
|
||||
raise ImportError(msg) from e
|
||||
return self
|
||||
|
||||
def embed_documents(self, texts: list[str]) -> list[list[float]]:
|
||||
|
@@ -115,12 +115,12 @@ class HuggingFacePipeline(BaseLLM):
|
||||
)
|
||||
from transformers import pipeline as hf_pipeline # type: ignore[import]
|
||||
|
||||
except ImportError:
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import transformers python package. "
|
||||
"Please install it with `pip install transformers`."
|
||||
)
|
||||
raise ValueError(msg)
|
||||
raise ValueError(msg) from e
|
||||
|
||||
_model_kwargs = model_kwargs.copy() if model_kwargs else {}
|
||||
if device_map is not None:
|
||||
|
@@ -60,6 +60,7 @@ target-version = "py39"
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"A", # flake8-builtins
|
||||
"B", # flake8-bugbear
|
||||
"ASYNC", # flake8-async
|
||||
"C4", # flake8-comprehensions
|
||||
"COM", # flake8-commas
|
||||
@@ -110,7 +111,6 @@ ignore = [
|
||||
"RUF012", # Doesn't play well with Pydantic
|
||||
"SLF001", # Private member access
|
||||
"UP007", # pyupgrade: non-pep604-annotation-union
|
||||
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
|
Reference in New Issue
Block a user