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
6 changes: 3 additions & 3 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [main]

jobs:
pyright:
ty:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -18,5 +18,5 @@ jobs:
- name: Install dependencies
run: uv sync --dev

- name: Run Pyright
run: uv run pyright
- name: Run Ty
run: uv run ty check
7 changes: 6 additions & 1 deletion .zed/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"file_types": {
"jinja2": ["*.html"]
"jinja2": ["*.html"],
},
"lsp": {
"jinja-lsp": {
Expand All @@ -12,4 +12,9 @@
},
},
},
"languages": {
"Python": {
"language_servers": ["ty", "ruff"],
},
},
}
4 changes: 2 additions & 2 deletions car/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import Any, TypedDict, cast

# 3p
from flask import ( # type: ignore # we ignore this so we can better type it later
from flask import (
Flask,
abort,
flash,
Expand Down Expand Up @@ -72,7 +72,7 @@ class Session(TypedDict, total=False):
voters_searched: list[ID]


session: Session
session: Session # type: ignore

SETTINGS_KEYS: Session = {
"use_map": 1,
Expand Down
4 changes: 2 additions & 2 deletions car/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def sort_key(self):


class _DoorWithGeoCode(Door):
lat: float = 0 # type: ignore
lon: float = 0 # type: ignore
lat: float = 0
lon: float = 0


def has_geocode(d: Door) -> TypeIs[_DoorWithGeoCode]:
Expand Down
2 changes: 1 addition & 1 deletion car/script/geocode_doors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sys.path.insert(
0, os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../../geocode")
)
from geocode import get_geocoder # pyright: ignore
from geocode import get_geocoder # type: ignore

geocoder = get_geocoder()
database = Database.get()
Expand Down
6 changes: 3 additions & 3 deletions car/script/targeting_universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ def elections(self):
]

elections = [(x, y) for (x, y) in elections if x is not None]
elections.sort(key=lambda k: k[0].date, reverse=True) # type: ignore
elections.sort(key=lambda k: k[0].date, reverse=True)
return elections

@property
@functools.cache
def last_voted(self):
if self.elections:
return self.elections[0][0].date # type: ignore
return self.elections[0][0].date

return None

Expand All @@ -185,7 +185,7 @@ def last_voted_party_code(self):

code = code.strip()
if code in r and r[code] is None:
r[code] = elec.date # type: ignore
r[code] = elec.date

return r

Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ dependencies = [
]

[dependency-groups]
dev = ["black>=26.5.1", "pyright>=1.1.411", "typing-extensions>=4.16.0"]
dev = [
"black>=26.5.1",
"ty>=0.0.72",
"typing-extensions>=4.16.0",
]

[tool.setuptools]
packages = ["car"]

[tool.pyright]
ignore = ["car/_jinja_globals_stub.py"]
[tool.ty.src]
include = ["car"]
exclude = ["car/_jinja_globals_stub.py"]
[tool.ruff]
exclude = ["car/_jinja_globals_stub.py"]

Expand Down
Loading