Skip to content

Commit 1bde36c

Browse files
authored
Latest tooling and deps (#842)
1 parent df401d1 commit 1bde36c

File tree

11 files changed

+126
-130
lines changed

11 files changed

+126
-130
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ repos:
2323
- id: mixed-line-ending
2424
- id: trailing-whitespace
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.9.1
26+
rev: v0.9.4
2727
hooks:
2828
- id: ruff
2929
args: [--fix, --exit-non-zero-on-fix]
3030
- repo: https://github.com/psf/black-pre-commit-mirror
31-
rev: 24.10.0
31+
rev: 25.1.0
3232
hooks:
3333
- id: black
3434
- repo: https://github.com/rbubley/mirrors-prettier
@@ -40,7 +40,7 @@ repos:
4040
hooks:
4141
- id: toml-sort-fix
4242
- repo: https://github.com/codespell-project/codespell
43-
rev: v2.3.0
43+
rev: v2.4.1
4444
hooks:
4545
- id: codespell
4646
additional_dependencies: [".[toml]"]
@@ -55,15 +55,15 @@ repos:
5555
hooks:
5656
- id: check-mailmap
5757
- repo: https://github.com/henryiii/validate-pyproject-schema-store
58-
rev: 2025.01.10
58+
rev: 2025.02.03
5959
hooks:
6060
- id: validate-pyproject
6161
- repo: https://github.com/astral-sh/uv-pre-commit
62-
rev: 0.4.30
62+
rev: 0.5.26
6363
hooks:
6464
- id: uv-lock
6565
- repo: https://github.com/renovatebot/pre-commit-hooks
66-
rev: 39.100.1
66+
rev: 39.158.1
6767
hooks:
6868
- id: renovate-config-validator
6969
args: [--strict]

paperqa/agents/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def make_clinical_trial_status(
154154

155155
# SEE: https://regex101.com/r/L0L5MH/1
156156
CLINICAL_STATUS_SEARCH_REGEX_PATTERN: str = (
157-
r"Status: Paper Count=(\d+) \| Relevant Papers=(\d+)(?:\s\|\sClinical Trial Count=(\d+)\s"
158-
r"\|\sRelevant Clinical Trials=(\d+))?\s\|\sCurrent Evidence=(\d+)"
157+
r"Status: Paper Count=(\d+) \| Relevant Papers=(\d+)(?:\s\|\sClinical Trial"
158+
r" Count=(\d+)\s\|\sRelevant Clinical Trials=(\d+))?\s\|\sCurrent Evidence=(\d+)"
159159
)
160160

161161

paperqa/agents/tools.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ async def gather_evidence(self, question: str, state: EnvironmentState) -> str:
277277
)
278278

279279
return (
280-
f"Added {l1 - l0} pieces of evidence, {l1_relevant - l0_relevant} of which were"
281-
f" relevant.{best_evidence}\n\n" + status
280+
f"Added {l1 - l0} pieces of evidence, {l1_relevant - l0_relevant} of which"
281+
f" were relevant.{best_evidence}\n\n" + status
282282
)
283283

284284

@@ -649,9 +649,9 @@ async def clinical_trials_search(self, query: str, state: EnvironmentState) -> s
649649
self.previous_searches[query] += self.search_count
650650
if error_message is None:
651651
return (
652-
f"Found clinical trial search results from search {offset} to {offset + new_result_count}"
653-
f" among {total_result_count} total results."
654-
f" {state.status}"
652+
f"Found clinical trial search results from search {offset} to"
653+
f" {offset + new_result_count} among {total_result_count} total"
654+
f" results. {state.status}"
655655
)
656656
return f"Error in clinical trial query syntax: {error_message}"
657657

paperqa/llms.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ async def similarity_search(
284284
class QdrantVectorStore(VectorStore):
285285
client: Any = Field(
286286
default=None,
287-
description="Instance of `qdrant_client.AsyncQdrantClient`. Defaults to an in-memory instance.",
287+
description=(
288+
"Instance of `qdrant_client.AsyncQdrantClient`. Defaults to an in-memory"
289+
" instance."
290+
),
288291
)
289292
collection_name: str = Field(default_factory=lambda: f"paper-qa-{uuid.uuid4().hex}")
290293
vector_name: str | None = Field(default=None)
@@ -329,7 +332,8 @@ def validate_client(self):
329332

330333
if self.client and not isinstance(self.client, AsyncQdrantClient):
331334
raise TypeError(
332-
f"'client' should be an instance of AsyncQdrantClient. Got `{type(self.client)}`"
335+
"'client' should be an instance of AsyncQdrantClient. Got"
336+
f" `{type(self.client)}`"
333337
)
334338

335339
if not self.client:

paperqa/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,9 @@ class AgentSettings(BaseModel):
484484
agent_evidence_n: int = Field(
485485
default=1,
486486
ge=1,
487-
description="Top n ranked evidences shown to the "
488-
"agent after the GatherEvidence tool.",
487+
description=(
488+
"Top n ranked evidences shown to the agent after the GatherEvidence tool."
489+
),
489490
)
490491
timeout: float = Field(
491492
default=500.0,

paperqa/sources/clinical_trials.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,19 @@ def parse_clinical_trial(json_data: dict[str, Any]) -> str:
191191
"=" * 25,
192192
f"NCT Number: {identification.get('nctId', 'Not provided')}",
193193
f"Title: {identification.get('briefTitle', 'Not provided')}",
194-
f"Organization: {identification.get('organization', {}).get('fullName', 'Not provided')}",
194+
(
195+
"Organization:"
196+
f" {identification.get('organization', {}).get('fullName', 'Not provided')}"
197+
),
195198
# Status Information
196199
"\nSTUDY STATUS",
197200
"=" * 13,
198201
f"Overall Status: {status.get('overallStatus', 'Not provided')}",
199202
f"Start Date: {status.get('startDateStruct', {}).get('date', 'Not provided')}",
200-
f"Completion Date: {status.get('completionDateStruct', {}).get('date', 'Not provided')}",
203+
(
204+
"Completion Date:"
205+
f" {status.get('completionDateStruct', {}).get('date', 'Not provided')}"
206+
),
201207
# Study Description
202208
"\nSTUDY DESCRIPTION",
203209
"=" * 17,
@@ -207,7 +213,10 @@ def parse_clinical_trial(json_data: dict[str, Any]) -> str:
207213
"=" * 13,
208214
f"Study Type: {design.get('studyType', 'Not provided')}",
209215
f"Phase: {', '.join(design.get('phases', ['Not provided']))}",
210-
f"Enrollment: {design.get('enrollmentInfo', {}).get('count', 'Not provided')} participants",
216+
(
217+
"Enrollment:"
218+
f" {design.get('enrollmentInfo', {}).get('count', 'Not provided')} participants"
219+
),
211220
# Eligibility
212221
"\nELIGIBILITY CRITERIA",
213222
"=" * 19,

paperqa/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def filter_content_for_user(self) -> None:
234234
class Answer(PQASession):
235235
def __init__(self, *args, **kwargs):
236236
warnings.warn(
237-
"The 'Answer' class is deprecated and will be removed in future versions. Use 'PQASession' instead.",
237+
"The 'Answer' class is deprecated and will be removed in future versions."
238+
" Use 'PQASession' instead.",
238239
DeprecationWarning,
239240
stacklevel=2,
240241
)

paperqa/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ def extract_thought(content: str | None) -> str:
501501
"dataset": "misc", # No direct equivalent, so 'misc' is used
502502
"component": "misc", # No direct equivalent, so 'misc' is used
503503
"report": "techreport",
504-
"report-series": "techreport", # 'series' implies multiple tech reports, but each is still a 'techreport'
504+
"report-series": ( # 'series' implies multiple tech reports, but each is still a 'techreport'
505+
"techreport"
506+
),
505507
"standard": "misc", # No direct equivalent, so 'misc' is used
506508
"standard-series": "misc", # No direct equivalent, so 'misc' is used
507509
"edited-book": "book", # Edited books are considered books in BibTeX
@@ -514,7 +516,9 @@ def extract_thought(content: str | None) -> str:
514516
"book-section": "inbook", # Sections in books can be considered as 'inbook'
515517
"book-part": "inbook", # Parts of books can be considered as 'inbook'
516518
"book-track": "inbook", # Tracks in books can be considered as 'inbook'
517-
"reference-entry": "inbook", # Entries in reference books can be considered as 'inbook'
519+
"reference-entry": ( # Entries in reference books can be considered as 'inbook'
520+
"inbook"
521+
),
518522
"dissertation": "phdthesis", # Dissertations are usually PhD thesis
519523
"posted-content": "misc", # No direct equivalent, so 'misc' is used
520524
"peer-review": "misc", # No direct equivalent, so 'misc' is used

tests/test_clients.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ async def test_s2_only_fields_filtering() -> None:
376376
assert s2_details
377377
assert s2_details.authors, "Authors should be populated"
378378
assert set(s2_details.other["client_source"]) == {"semantic_scholar"}
379-
assert s2_details.citation == (
380-
"Andrés M Bran, Sam Cox, Oliver Schilter, Carlo Baldassari, Andrew D."
379+
assert (
380+
s2_details.citation
381+
== "Andrés M Bran, Sam Cox, Oliver Schilter, Carlo Baldassari, Andrew D."
381382
" White, and P. Schwaller. Augmenting large language models with chemistry"
382383
" tools. ArXiv, Unknown year. URL:"
383384
" https://doi.org/10.48550/arxiv.2304.05376,"
@@ -429,7 +430,8 @@ async def test_crossref_journalquality_fields_filtering() -> None:
429430
)
430431
nejm_crossref_details = await crossref_client.query(
431432
title=(
432-
"Beta-Blocker Interruption or Continuation after Myocardial Infarction" # codespell:ignore
433+
"Beta-Blocker Interruption or Continuation after Myocardial"
434+
" Infarction" # codespell:ignore
433435
),
434436
fields=["title", "doi", "authors", "journal"],
435437
)

tests/test_configs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def test_matches_filter_criteria(doc_class, doc_data, filter_criteria, expected_
174174
def test_citation_prompt_current_year():
175175
expected_year_text = f"the current year is {get_year()}"
176176

177-
assert (
178-
expected_year_text in citation_prompt
179-
), f"Citation prompt should contain '{expected_year_text}' but got: {citation_prompt}"
177+
assert expected_year_text in citation_prompt, (
178+
f"Citation prompt should contain '{expected_year_text}' but got:"
179+
f" {citation_prompt}"
180+
)

0 commit comments

Comments
 (0)