Skip to content

Commit

Permalink
Merge pull request #224 from egraphs-good/ruff-update
Browse files Browse the repository at this point in the history
Update ruff
  • Loading branch information
saulshanabrook authored Oct 23, 2024
2 parents d7dfd40 + 5af3a17 commit 1e827ec
Show file tree
Hide file tree
Showing 20 changed files with 25,965 additions and 26,029 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:
skip: [mypy, docs, stubtest]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.7.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
23,986 changes: 11,981 additions & 12,005 deletions docs/explanation/2023_07_presentation.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/explanation/2023_11_09_portland_state.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "7fb27b941602401d91542211134fc71a",
"metadata": {
"notebookRunGroups": {
"groupValue": "1"
Expand Down Expand Up @@ -457,6 +458,7 @@
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"from egglog import *\n",
"\n",
"egraph = EGraph()\n",
Expand All @@ -465,16 +467,13 @@
"# 1. Describe domain with types & functions\n",
"@egraph.class_\n",
"class Num(Expr):\n",
" def __init__(self, i: i64Like) -> None:\n",
" ...\n",
" def __init__(self, i: i64Like) -> None: ...\n",
"\n",
" def __add__(self, other: Num) -> Num:\n",
" ...\n",
" def __add__(self, other: Num) -> Num: ...\n",
"\n",
"\n",
"@egraph.function(cost=20)\n",
"def fib(x: i64Like) -> Num:\n",
" ..."
"def fib(x: i64Like) -> Num: ..."
]
},
{
Expand Down Expand Up @@ -1406,16 +1405,17 @@
"outputs": [],
"source": [
"import timeit\n",
"\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"stmts = {\n",
" \"original\": \"run_lda(X_np, y_np)\",\n",
" \"numba\": \"numba_fn(X_np, y_np)\",\n",
"}\n",
"df = pd.DataFrame.from_dict(\n",
" {name: timeit.repeat(stmt, globals=globals(), number=1, repeat=10) for name, stmt in stmts.items()}\n",
")\n",
"df = pd.DataFrame.from_dict({\n",
" name: timeit.repeat(stmt, globals=globals(), number=1, repeat=10) for name, stmt in stmts.items()\n",
"})\n",
"df_melt = pd.melt(df, var_name=\"function\", value_name=\"time\")"
]
},
Expand Down
5,044 changes: 2,511 additions & 2,533 deletions docs/explanation/2023_11_17_pytensor.ipynb

Large diffs are not rendered by default.

26 changes: 12 additions & 14 deletions docs/explanation/2023_11_pydata_lightning_talk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "7fb27b941602401d91542211134fc71a",
"metadata": {},
"source": [
"```{post} 2023-11-04\n",
Expand All @@ -12,6 +13,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "acae54e37e7d407bbb7b55eff062a284",
"metadata": {
"tags": [
"hide-input"
Expand Down Expand Up @@ -122,26 +124,23 @@
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"from egglog import *\n",
"\n",
"egraph = EGraph()\n",
"\n",
"\n",
"@egraph.class_\n",
"class NDArray(Expr):\n",
" def __init__(self, i: i64Like) -> None:\n",
" ...\n",
" def __init__(self, i: i64Like) -> None: ...\n",
"\n",
" def __add__(self, other: NDArray) -> NDArray:\n",
" ...\n",
" def __add__(self, other: NDArray) -> NDArray: ...\n",
"\n",
" def __mul__(self, other: NDArray) -> NDArray:\n",
" ...\n",
" def __mul__(self, other: NDArray) -> NDArray: ...\n",
"\n",
"\n",
"@egraph.function(cost=2)\n",
"def arange(i: i64Like) -> NDArray:\n",
" ...\n",
"def arange(i: i64Like) -> NDArray: ...\n",
"\n",
"\n",
"# Register rewrite rule that asserts for all values x of type NDArray\n",
Expand Down Expand Up @@ -6754,18 +6753,16 @@
"outputs": [],
"source": [
"import timeit\n",
"\n",
"import pandas as pd\n",
"\n",
"stmts = {\n",
" \"original\": \"run_lda(X_np, y_np)\",\n",
" \"numba\": \"numba_fn(X_np, y_np)\",\n",
"}\n",
"df = pd.DataFrame.from_dict(\n",
" {\n",
" name: timeit.repeat(stmt, globals=globals(), number=1, repeat=10)\n",
" for name, stmt in stmts.items()\n",
" }\n",
")"
"df = pd.DataFrame.from_dict({\n",
" name: timeit.repeat(stmt, globals=globals(), number=1, repeat=10) for name, stmt in stmts.items()\n",
"})"
]
},
{
Expand Down Expand Up @@ -6828,6 +6825,7 @@
},
{
"cell_type": "markdown",
"id": "9a63283cbaf04dbcab1f6479b197f3a8",
"metadata": {},
"source": []
}
Expand Down
Loading

0 comments on commit 1e827ec

Please sign in to comment.