Skip to content

Commit d67221a

Browse files
authored
Bump ruff version to 0.12 (#8)
1 parent 0da7ad8 commit d67221a

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

langchain/langchain_vectorize/retrievers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ def format_docs(docs):
109109
"""The Vectorize API token."""
110110
environment: Literal["prod", "dev", "local", "staging"] = "prod"
111111
"""The Vectorize API environment."""
112-
organization: Optional[str] = None # noqa: UP007
112+
organization: Optional[str] = None
113113
"""The Vectorize organization ID."""
114-
pipeline_id: Optional[str] = None # noqa: UP007
114+
pipeline_id: Optional[str] = None
115115
"""The Vectorize pipeline ID."""
116116
num_results: int = 5
117117
"""The number of documents to return."""

langchain/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ Issues = "https://github.com/vectorize-io/integrations-python/issues"
3333
dev = [
3434
"mypy>=1.17.1,<1.18",
3535
"pytest>=8.3.3",
36-
"ruff>=0.9.0,<0.10",
36+
"ruff>=0.12.7,<0.13",
3737
]
3838

3939
[tool.ruff.lint]
4040
select = ["ALL"]
4141
ignore = [
42-
"CPY", # Missing copyright
4342
"COM812", # Messes with the formatter
4443
"ISC001", # Messes with the formatter
4544
"PERF203", # Rarely useful
@@ -49,6 +48,7 @@ ignore = [
4948
pydocstyle.convention = "google"
5049
flake8-annotations.allow-star-arg-any = true
5150
flake8-annotations.mypy-init-return = true
51+
pyupgrade.keep-runtime-typing = true
5252

5353
[tool.ruff.lint.per-file-ignores]
5454
"tests/*" = [

langchain/tests/test_retrievers.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
from langchain_vectorize.retrievers import VectorizeRetriever
4949

50+
logger = logging.getLogger(__name__)
51+
5052

5153
@pytest.fixture(scope="session")
5254
def api_token() -> str:
@@ -69,7 +71,7 @@ def org_id() -> str:
6971
@pytest.fixture(scope="session")
7072
def environment() -> Literal["prod", "dev", "local", "staging"]:
7173
env = os.getenv("VECTORIZE_ENV", "prod")
72-
if env not in ["prod", "dev", "local", "staging"]:
74+
if env not in {"prod", "dev", "local", "staging"}:
7375
msg = "Invalid VECTORIZE_ENV environment variable."
7476
raise ValueError(msg)
7577
return env # type: ignore[return-value]
@@ -108,7 +110,7 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
108110
CreateSourceConnectorRequest(FileUpload(name="from api", type="FILE_UPLOAD")),
109111
)
110112
source_connector_id = response.connector.id
111-
logging.info("Created source connector %s", source_connector_id)
113+
logger.info("Created source connector %s", source_connector_id)
112114

113115
uploads_api = UploadsApi(api_client)
114116
upload_response = uploads_api.start_file_upload_to_connector(
@@ -139,23 +141,23 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
139141
msg = "Upload failed:"
140142
raise ValueError(msg)
141143
else:
142-
logging.info("Upload successful")
144+
logger.info("Upload successful")
143145

144146
ai_platforms = AIPlatformConnectorsApi(api_client).get_ai_platform_connectors(
145147
org_id
146148
)
147149
builtin_ai_platform = next(
148150
c.id for c in ai_platforms.ai_platform_connectors if c.type == "VECTORIZE"
149151
)
150-
logging.info("Using AI platform %s", builtin_ai_platform)
152+
logger.info("Using AI platform %s", builtin_ai_platform)
151153

152154
vector_databases = DestinationConnectorsApi(api_client).get_destination_connectors(
153155
org_id
154156
)
155157
builtin_vector_db = next(
156158
c.id for c in vector_databases.destination_connectors if c.type == "VECTORIZE"
157159
)
158-
logging.info("Using destination connector %s", builtin_vector_db)
160+
logger.info("Using destination connector %s", builtin_vector_db)
159161

160162
pipeline_response = pipelines.create_pipeline(
161163
org_id,
@@ -182,14 +184,14 @@ def pipeline_id(api_client: ApiClient, org_id: str) -> Iterator[str]:
182184
),
183185
)
184186
pipeline_id = pipeline_response.data.id
185-
logging.info("Created pipeline %s", pipeline_id)
187+
logger.info("Created pipeline %s", pipeline_id)
186188

187189
yield pipeline_id
188190

189191
try:
190192
pipelines.delete_pipeline(org_id, pipeline_id)
191193
except Exception:
192-
logging.exception("Failed to delete pipeline %s", pipeline_id)
194+
logger.exception("Failed to delete pipeline %s", pipeline_id)
193195

194196

195197
def test_retrieve_init_args(

langchain/uv.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)