Skip to content

Commit 7f4ea1a

Browse files
committed
switch from strict typing (#15)
* switch from strict typing * updating ci
1 parent 11c2e83 commit 7f4ea1a

File tree

4 files changed

+60
-54
lines changed

4 files changed

+60
-54
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ jobs:
3232
- name: Set up Python ${{ matrix.python-version }}
3333
run: uv python install ${{ matrix.python-version }}
3434
- name: Install the project
35-
run: uv sync --all-extras --dev
35+
run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/"
3636
- name: Run tests
3737
# For example, using `pytest`
3838
run: uv run just coverage
39-
# - name: Upload Coverage to Codecov
40-
# uses: codecov/codecov-action@v4
41-
# with:
42-
# files: coverage.xml # optional
43-
# fail_ci_if_error: true # optional (default = false)
44-
# verbose: true # optional (default = false)
45-
# token: ${{ secrets.CODECOV_TOKEN }} # required
46-
# - name: Archive code coverage results
47-
# if: matrix.python-version == '3.12'
48-
# uses: actions/upload-artifact@v4
49-
# with:
50-
# name: code-coverage-report
51-
# path: coverage.xml
52-
# retention-days: 2
39+
# - name: Upload Coverage to Codecov
40+
# uses: codecov/codecov-action@v4
41+
# with:
42+
# files: coverage.xml # optional
43+
# fail_ci_if_error: true # optional (default = false)
44+
# verbose: true # optional (default = false)
45+
# token: ${{ secrets.CODECOV_TOKEN }} # required
46+
# - name: Archive code coverage results
47+
# if: matrix.python-version == '3.12'
48+
# uses: actions/upload-artifact@v4
49+
# with:
50+
# name: code-coverage-report
51+
# path: coverage.xml
52+
# retention-days: 2
5353
# post:
5454
# runs-on: ubuntu-latest
5555
# needs: build

.github/workflows/isort.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12+
isort:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: isort/isort-action@v1
17+
with:
18+
sortPaths: "src" # only sort files in the src directory
1219
ruff:
1320
runs-on: ubuntu-latest
1421
steps:
@@ -19,3 +26,20 @@ jobs:
1926
steps:
2027
- uses: actions/checkout@v4
2128
- uses: psf/black@stable
29+
pyright:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v6
35+
with:
36+
# Install a specific version of uv.
37+
version: "0.6.14"
38+
enable-cache: true
39+
cache-dependency-glob: "uv.lock"
40+
- name: Install the project
41+
run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/"
42+
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
43+
- uses: jakebailey/pyright-action@v2
44+
with:
45+
pylance-version: latest-release

src/bloqade/geometry/dialects/grid/concrete.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def shape(
8080
frame: Frame,
8181
stmt: stmts.Shape,
8282
):
83-
return (frame.get_typed(stmt.zone, Grid).shape,)
83+
return (frame.get_casted(stmt.zone, Grid).shape,)
8484

8585
@impl(stmts.Get)
8686
def get(
@@ -89,9 +89,9 @@ def get(
8989
frame: Frame,
9090
stmt: stmts.Get,
9191
):
92-
idx = frame.get_typed(stmt.idx, tuple)
92+
idx = frame.get_casted(stmt.idx, tuple)
9393

94-
return (frame.get_typed(stmt.zone, Grid).get(idx),)
94+
return (frame.get_casted(stmt.zone, Grid).get(idx),)
9595

9696
@impl(stmts.GetXPos)
9797
def get_x_pos(
@@ -100,7 +100,7 @@ def get_x_pos(
100100
frame: Frame,
101101
stmt: stmts.GetXPos,
102102
):
103-
return (frame.get_typed(stmt.zone, Grid).x_positions,)
103+
return (frame.get_casted(stmt.zone, Grid).x_positions,)
104104

105105
@impl(stmts.GetYPos)
106106
def get_y_pos(
@@ -109,7 +109,7 @@ def get_y_pos(
109109
frame: Frame,
110110
stmt: stmts.GetYPos,
111111
):
112-
return (frame.get_typed(stmt.zone, Grid).y_positions,)
112+
return (frame.get_casted(stmt.zone, Grid).y_positions,)
113113

114114
@impl(stmts.GetSubGrid)
115115
def get_view(
@@ -118,10 +118,10 @@ def get_view(
118118
frame: Frame,
119119
stmt: stmts.GetSubGrid,
120120
):
121-
x_indices = frame.get_typed(stmt.x_indices, ilist.IList)
122-
y_indices = frame.get_typed(stmt.y_indices, ilist.IList)
121+
x_indices = frame.get_casted(stmt.x_indices, ilist.IList)
122+
y_indices = frame.get_casted(stmt.y_indices, ilist.IList)
123123

124-
return (frame.get_typed(stmt.zone, Grid).get_view(x_indices, y_indices),)
124+
return (frame.get_casted(stmt.zone, Grid).get_view(x_indices, y_indices),)
125125

126126
@impl(stmts.GetXBounds)
127127
def get_x_bounds(
@@ -130,7 +130,7 @@ def get_x_bounds(
130130
frame: Frame,
131131
stmt: stmts.GetXBounds,
132132
):
133-
return (frame.get_typed(stmt.zone, Grid).x_bounds(),)
133+
return (frame.get_casted(stmt.zone, Grid).x_bounds(),)
134134

135135
@impl(stmts.GetYBounds)
136136
def get_y_bounds(
@@ -139,7 +139,7 @@ def get_y_bounds(
139139
frame: Frame,
140140
stmt: stmts.GetYBounds,
141141
):
142-
return (frame.get_typed(stmt.zone, Grid).y_bounds(),)
142+
return (frame.get_casted(stmt.zone, Grid).y_bounds(),)
143143

144144
@impl(stmts.Shift)
145145
def shift(
@@ -148,9 +148,9 @@ def shift(
148148
frame: Frame,
149149
stmt: stmts.Shift,
150150
):
151-
grid = frame.get_typed(stmt.zone, Grid)
152-
x_shift = frame.get_typed(stmt.x_shift, float)
153-
y_shift = frame.get_typed(stmt.y_shift, float)
151+
grid = frame.get_casted(stmt.zone, Grid)
152+
x_shift = frame.get_casted(stmt.x_shift, float)
153+
y_shift = frame.get_casted(stmt.y_shift, float)
154154

155155
return (grid.shift(x_shift, y_shift),)
156156

@@ -161,9 +161,9 @@ def scale(
161161
frame: Frame,
162162
stmt: stmts.Scale,
163163
):
164-
grid = frame.get_typed(stmt.zone, Grid)
165-
x_scale = frame.get_typed(stmt.x_scale, float)
166-
y_scale = frame.get_typed(stmt.y_scale, float)
164+
grid = frame.get_casted(stmt.zone, Grid)
165+
x_scale = frame.get_casted(stmt.x_scale, float)
166+
y_scale = frame.get_casted(stmt.y_scale, float)
167167

168168
return (grid.scale(x_scale, y_scale),)
169169

@@ -174,10 +174,10 @@ def repeat(
174174
frame: Frame,
175175
stmt: stmts.Repeat,
176176
):
177-
grid = frame.get_typed(stmt.zone, Grid)
178-
x_times = frame.get_typed(stmt.x_times, int)
179-
y_times = frame.get_typed(stmt.y_times, int)
180-
x_gap = frame.get_typed(stmt.x_gap, float)
181-
y_gap = frame.get_typed(stmt.y_gap, float)
177+
grid = frame.get_casted(stmt.zone, Grid)
178+
x_times = frame.get_casted(stmt.x_times, int)
179+
y_times = frame.get_casted(stmt.y_times, int)
180+
x_gap = frame.get_casted(stmt.x_gap, float)
181+
y_gap = frame.get_casted(stmt.y_gap, float)
182182

183183
return (grid.repeat(x_times, y_times, x_gap, y_gap),)

0 commit comments

Comments
 (0)