mirror of
https://github.com/tgorordo/carousel.git
synced 2026-06-12 20:42:13 -07:00
random sync
This commit is contained in:
parent
7b53685b00
commit
6cdc579270
6 changed files with 933 additions and 144 deletions
5
justfile
5
justfile
|
|
@ -1,3 +1,6 @@
|
||||||
|
list:
|
||||||
|
just --list
|
||||||
|
|
||||||
run:
|
run:
|
||||||
uv run carousel
|
uv run carousel
|
||||||
|
|
||||||
|
|
@ -20,7 +23,7 @@ compile:
|
||||||
clean:
|
clean:
|
||||||
uv run pyclean src test
|
uv run pyclean src test
|
||||||
uv run ruff clean
|
uv run ruff clean
|
||||||
rm -rf main.spec cli.spec gui.spec build dist .pytest_cache .hypothesis .benchmarks
|
rm -rf main.spec cli.spec gui.spec build dist .pytest_cache .hypothesis .benchmarks __marimo__
|
||||||
|
|
||||||
wipe:
|
wipe:
|
||||||
just clean
|
just clean
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,16 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
|
"faker>=37.1.0",
|
||||||
"hypothesis>=6.130.8",
|
"hypothesis>=6.130.8",
|
||||||
|
"marimo[recommended]>=0.13.6",
|
||||||
"pyclean>=3.1.0",
|
"pyclean>=3.1.0",
|
||||||
"pyinstaller>=6.12.0",
|
"pyinstaller>=6.12.0",
|
||||||
"pyright>=1.1.398",
|
"pyright>=1.1.398",
|
||||||
"pytest>=8.3.5",
|
"pytest>=8.3.5",
|
||||||
"pytest-benchmark>=5.1.0",
|
"pytest-benchmark>=5.1.0",
|
||||||
"ruff>=0.11.2",
|
"ruff>=0.11.2",
|
||||||
|
"ty>=0.0.0a5",
|
||||||
]
|
]
|
||||||
srv = [
|
srv = [
|
||||||
"legacy-cgi>=2.6.3",
|
"legacy-cgi>=2.6.3",
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,16 @@ def deferred_acceptance(applicant_rankings, reviewer_rankings):
|
||||||
|
|
||||||
# while check_unstable(match, applicant_rankings, reviewer_rankings):
|
# while check_unstable(match, applicant_rankings, reviewer_rankings):
|
||||||
while match.select(pl.any_horizontal(pl.all().has_nulls())).item():
|
while match.select(pl.any_horizontal(pl.all().has_nulls())).item():
|
||||||
# TODO null applicant preferences that rejected
|
# null applicant preferences that rejected
|
||||||
|
offers = offers.with_columns(
|
||||||
rejected_applicants = offers.select(
|
pl.when(
|
||||||
pl.col("applicant").is_in(match.row(0)).alias("matched")
|
pl.col("applicant").is_in(match.row(0)).not_(),
|
||||||
|
pl.col(c).is_null().not_(),
|
||||||
|
)
|
||||||
|
.then(pl.lit(None))
|
||||||
|
.otherwise(c)
|
||||||
|
.alias(c)
|
||||||
|
for c in offers.select(pl.col("pref*")).columns
|
||||||
)
|
)
|
||||||
|
|
||||||
return match
|
return match
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env -S uv run python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
|
||||||
55
test/nbs/hovses.py
Normal file
55
test/nbs/hovses.py
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
import marimo
|
||||||
|
|
||||||
|
__generated_with = "0.13.6"
|
||||||
|
app = marimo.App(width="medium")
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell(hide_code=True)
|
||||||
|
def _(mo):
|
||||||
|
mo.md(r"""# Caltech Hovse Rotation Example""")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell(hide_code=True)
|
||||||
|
def _(mo):
|
||||||
|
mo.md(r"""## Imports""")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell
|
||||||
|
def _():
|
||||||
|
import marimo as mo
|
||||||
|
import polars as pl, polars.selectors as pls
|
||||||
|
import numpy as np, faker as fk
|
||||||
|
import carousel as crsl
|
||||||
|
return crsl, mo, pl
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell(hide_code=True)
|
||||||
|
def _(mo):
|
||||||
|
mo.md(r"""## Generating Rotation Rankings""")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell
|
||||||
|
def _(crsl, pl):
|
||||||
|
ar = pl.DataFrame({ "": ["A", "B", "C", "D"], "a": [1, 2, 3, 4], "b": [1, 4, 3, 2], "c": [2, 1, 3, 4], "d": [4, 2, 3, 1]})
|
||||||
|
rr = pl.DataFrame({ "": ["a", "b", "c", "d"], "A": [3, 4, 2, 1], "B": [3, 1, 4, 2], "C": [2, 3, 4, 1], "D": [3, 2, 1, 4]})
|
||||||
|
m = pl.DataFrame({"A": ["c"], "B": ["d"], "C": ["a"], "D": ["b"]})
|
||||||
|
crsl.check_stable(m, ar, rr)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell
|
||||||
|
def _():
|
||||||
|
hovses = ["Blacker", "Dabney", "Ricketts", "Fleming", "Page", "Lloyd", "Venerable", "Avery"]
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell
|
||||||
|
def _():
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue