Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ updates:
labels:
- "chore"
- "dependencies"
- "github-actions"
- "github_actions"
8 changes: 4 additions & 4 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

locked-tests:
needs: lint
name: Pixi-Locked Unit Tests
name: Pixi-Locked Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -54,7 +54,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: true
cache-write: false
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: true
cache-write: false
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -61,7 +61,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: true
cache-write: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: false # Don't use cache because we use the ``pdoc`` environment
environments: pdoc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
pixi-version: v0.62.2
locked: true
cache: false
environments: pbuild
Expand Down
3 changes: 1 addition & 2 deletions compass/extraction/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ async def _extract_with_ngram_check(
if not original_text:
msg = (
"Document missing original ordinance text! No extraction "
"performed (Document source: %s)",
source,
f"performed (Document source: {source})"
)
warn(msg, COMPASSWarning)
return doc
Expand Down
12 changes: 8 additions & 4 deletions compass/extraction/small_wind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
"filetype:pdf {jurisdiction} wind energy conversion system ordinances",
"wind energy conversion system ordinances {jurisdiction}",
"{jurisdiction} wind WECS ordinance",
"Where can I find the legal text for small wind energy "
"turbine zoning ordinances in {jurisdiction}?",
"What is the specific legal information regarding zoning "
"ordinances for small wind turbines in {jurisdiction}?",
(
"Where can I find the legal text for small wind energy "
"turbine zoning ordinances in {jurisdiction}?"
),
(
"What is the specific legal information regarding zoning "
"ordinances for small wind turbines in {jurisdiction}?"
),
]

BEST_SMALL_WIND_ORDINANCE_WEBSITE_URL_KEYWORDS = {
Expand Down
14 changes: 9 additions & 5 deletions compass/extraction/solar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
"filetype:pdf {jurisdiction} solar energy conversion system ordinances",
"solar energy conversion system ordinances {jurisdiction}",
"{jurisdiction} solar energy farm ordinance",
"Where can I find the legal text for commercial solar energy "
"conversion system zoning ordinances in {jurisdiction}?",
"What is the specific legal information regarding zoning "
"ordinances for commercial solar energy conversion systems in "
"{jurisdiction}?",
(
"Where can I find the legal text for commercial solar energy "
"conversion system zoning ordinances in {jurisdiction}?"
),
(
"What is the specific legal information regarding zoning "
"ordinances for commercial solar energy conversion systems in "
"{jurisdiction}?"
),
]

BEST_SOLAR_ORDINANCE_WEBSITE_URL_KEYWORDS = {
Expand Down
14 changes: 9 additions & 5 deletions compass/extraction/wind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
"filetype:pdf {jurisdiction} wind energy conversion system ordinances",
"wind energy conversion system ordinances {jurisdiction}",
"{jurisdiction} wind WECS ordinance",
"Where can I find the legal text for commercial wind energy "
"conversion system zoning ordinances in {jurisdiction}?",
"What is the specific legal information regarding zoning "
"ordinances for commercial wind energy conversion systems in "
"{jurisdiction}?",
(
"Where can I find the legal text for commercial wind energy "
"conversion system zoning ordinances in {jurisdiction}?"
),
(
"What is the specific legal information regarding zoning "
"ordinances for commercial wind energy conversion systems in "
"{jurisdiction}?"
),
]

BEST_WIND_ORDINANCE_WEBSITE_URL_KEYWORDS = {
Expand Down
2 changes: 1 addition & 1 deletion compass/llm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
By default, ``1000``.
"""
self.name = name
self.llm_call_kwargs = {"timeout": 300, "temperature": 0}
self.llm_call_kwargs = {"timeout": 300}
self.llm_call_kwargs.update(llm_call_kwargs or {})
self.llm_service_rate_limit = llm_service_rate_limit
self.text_splitter_chunk_size = text_splitter_chunk_size
Expand Down
8 changes: 2 additions & 6 deletions compass/services/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def _read_pdf_ocr(pdf_bytes, tesseract_cmd, **kwargs):

def _read_pdf_file(pdf_fp, **kwargs):
"""Utility func so that pdftotext.PDF doesn't have to be pickled"""
with Path(pdf_fp).open("rb") as fh:
pdf_bytes = fh.read()

pdf_bytes = Path(pdf_fp).read_bytes()
pages = read_pdf(pdf_bytes, verbose=False)
return PDFDocument(pages, **kwargs), pdf_bytes

Expand All @@ -105,9 +103,7 @@ def _read_pdf_file_ocr(pdf_fp, tesseract_cmd, **kwargs):
if tesseract_cmd:
_configure_pytesseract(tesseract_cmd)

with Path(pdf_fp).open("rb") as fh:
pdf_bytes = fh.read()

pdf_bytes = Path(pdf_fp).read_bytes()
pages = read_pdf_ocr(pdf_bytes, verbose=False)
doc = PDFDocument(_try_decode_ocr_pages(pages), **kwargs)
doc.attrs["from_ocr"] = True
Expand Down
4 changes: 1 addition & 3 deletions compass/services/threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,7 @@ def _compute_jurisdiction_cost(usage_tracker):

def _read_html_file(html_fp, **kwargs):
"""Default read HTML function (runs in main thread)"""
with Path(html_fp).open("r", encoding="utf-8") as fh:
text = fh.read()

text = Path(html_fp).read_text(encoding="utf-8")
return HTMLDocument([text], **kwargs), text


Expand Down
8 changes: 5 additions & 3 deletions compass/validation/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ def setup_graph_correct_document_type(**kwargs):
G.add_edge("is_pres", "is_draft", condition=llm_response_starts_with_no)

is_draft_prompt = [
"Does this text appear to be from a document that is currently "
"being edited or formatted, such as a draft or work in progress?\n"
"\n**Important**:\n"
(
"Does this text appear to be from a document that is currently "
"being edited or formatted, such as a draft or work in progress?\n"
"\n**Important**:\n"
)
]
if doc_is_from_ocr:
is_draft_prompt.append(
Expand Down
Loading