From 9dc545206cae44aa5f4f36f188a142ad3d7ea23c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 19:49:16 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- python/egglog/builtins.py | 1 - python/egglog/examples/matrix.py | 6 ------ python/egglog/exp/array_api.py | 14 -------------- python/egglog/exp/array_api_numba.py | 1 - python/egglog/exp/program_gen.py | 12 ------------ 5 files changed, 34 deletions(-) diff --git a/python/egglog/builtins.py b/python/egglog/builtins.py index 484d0656..457150a3 100644 --- a/python/egglog/builtins.py +++ b/python/egglog/builtins.py @@ -587,4 +587,3 @@ def py_exec(code: StringLike, globals: object = PyObject.dict(), locals: object """ Copies the locals, execs the Python code, and returns the locals with any updates. """ - ... diff --git a/python/egglog/examples/matrix.py b/python/egglog/examples/matrix.py index ffbb1264..0b626f4b 100644 --- a/python/egglog/examples/matrix.py +++ b/python/egglog/examples/matrix.py @@ -50,7 +50,6 @@ def identity(cls, dim: Dim) -> Matrix: # type: ignore[empty-body] """ Create an identity matrix of the given dimension. """ - ... @egraph.method(egg_fn="NamedMat") @classmethod @@ -58,28 +57,24 @@ def named(cls, name: StringLike) -> Matrix: # type: ignore[empty-body] """ Create a named matrix. """ - ... @egraph.method(egg_fn="MMul") def __matmul__(self, other: Matrix) -> Matrix: # type: ignore[empty-body] """ Matrix multiplication. """ - ... @egraph.method(egg_fn="nrows") def nrows(self) -> Dim: # type: ignore[empty-body] """ Number of rows in the matrix. """ - ... @egraph.method(egg_fn="ncols") def ncols(self) -> Dim: # type: ignore[empty-body] """ Number of columns in the matrix. """ - ... @egraph.function(egg_fn="Kron") @@ -89,7 +84,6 @@ def kron(a: Matrix, b: Matrix) -> Matrix: # type: ignore[empty-body] https://en.wikipedia.org/wiki/Kronecker_product#Definition """ - ... A, B, C, D = vars_("A B C D", Matrix) diff --git a/python/egglog/exp/array_api.py b/python/egglog/exp/array_api.py index 76af0f8f..03d54228 100644 --- a/python/egglog/exp/array_api.py +++ b/python/egglog/exp/array_api.py @@ -570,7 +570,6 @@ def dtype(self) -> DType: """ Default dtype for this scalar value """ - ... @property def to_bool(self) -> Boolean: @@ -587,7 +586,6 @@ def to_truthy_value(self) -> Value: https://data-apis.org/array-api/2022.12/API_specification/generated/array_api.any.html """ - ... converter(Int, Value, Value.int) @@ -673,7 +671,6 @@ def possible_values(values: Value) -> TupleValue: """ A value that is one of the values in the tuple. """ - ... @array_api_module.class_ @@ -841,7 +838,6 @@ def T(self) -> NDArray: # noqa: N802 """ https://data-apis.org/array-api/2022.12/API_specification/generated/array_api.array.T.html#array_api.array.T """ - ... @classmethod def vector(cls, values: TupleValue) -> NDArray: @@ -851,7 +847,6 @@ def index(self, indices: TupleInt) -> Value: """ Return the value at the given indices. """ - ... @array_api_module.function @@ -859,7 +854,6 @@ def ndarray_index(x: NDArray) -> IndexKey: """ Indexes by a masked array """ - ... converter(NDArray, IndexKey, ndarray_index) @@ -1048,7 +1042,6 @@ def sum(x: NDArray, axis: OptionalIntOrTuple = OptionalIntOrTuple.none) -> NDArr """ https://data-apis.org/array-api/2022.12/API_specification/generated/array_api.sum.html?highlight=sum """ - ... @array_api_module.register @@ -1235,7 +1228,6 @@ def svd(x: NDArray, full_matrices: Boolean = TRUE) -> TupleNDArray: """ https://data-apis.org/array-api/2022.12/extensions/generated/array_api.linalg.svd.html """ - ... @array_api_module.register @@ -1282,7 +1274,6 @@ def broadcast_index(from_shape: TupleInt, to_shape: TupleInt, index: TupleInt) - """ Returns the index in the original array of the given index in the broadcasted array. """ - ... @array_api_module.function @@ -1290,7 +1281,6 @@ def broadcast_shapes(shape1: TupleInt, shape2: TupleInt) -> TupleInt: """ Returns the shape of the broadcasted array. """ - ... @array_api_module.register @@ -1424,7 +1414,6 @@ def assume_dtype(x: NDArray, dtype: DType) -> None: """ Asserts that the dtype of x is dtype. """ - ... @array_api_module.register @@ -1441,7 +1430,6 @@ def assume_shape(x: NDArray, shape: TupleInt) -> None: """ Asserts that the shape of x is shape. """ - ... @array_api_module.register @@ -1458,7 +1446,6 @@ def assume_isfinite(x: NDArray) -> None: """ Asserts that the scalar ndarray is non null and not infinite. """ - ... @array_api_module.register @@ -1479,7 +1466,6 @@ def assume_value_one_of(x: NDArray, values: TupleValue) -> None: """ A value that is one of the values in the tuple. """ - ... @array_api_module.register diff --git a/python/egglog/exp/array_api_numba.py b/python/egglog/exp/array_api_numba.py index 63468b6f..e59889a0 100644 --- a/python/egglog/exp/array_api_numba.py +++ b/python/egglog/exp/array_api_numba.py @@ -43,7 +43,6 @@ def count_values(x: NDArray, values: NDArray) -> TupleValue: """ Returns a tuple of the count of each of the values in the array. """ - ... @array_api_numba_module.register diff --git a/python/egglog/exp/program_gen.py b/python/egglog/exp/program_gen.py index d478b8ab..a173a188 100644 --- a/python/egglog/exp/program_gen.py +++ b/python/egglog/exp/program_gen.py @@ -25,59 +25,50 @@ def __init__(self, expr: StringLike, is_identifier: BoolLike = Bool(False)) -> N """ Create a program based on a string expression. """ - ... def __add__(self, other: ProgramLike) -> Program: """ Concats the strings of the two expressions and also the statements. """ - ... @program_gen_module.method(unextractable=True) def statement(self, statement: ProgramLike) -> Program: """ Uses the expression of the statement and adds that as a statement to the program. """ - ... def assign(self) -> Program: """ Returns a new program with the expression assigned to a gensym. """ - ... def function_two(self, arg1: ProgramLike, arg2: ProgramLike, name: StringLike = String("__fn")) -> Program: """ Returns a new program defining a function with two arguments. """ - ... def expr_to_statement(self) -> Program: """ Returns a new program with the expression as a statement and the new expression empty. """ - ... @property def expr(self) -> String: """ Returns the expression of the program, if it's been compiled """ - ... @property def statements(self) -> String: """ Returns the statements of the program, if it's been compiled """ - ... @property def next_sym(self) -> i64: """ Returns the next gensym to use. This is set after calling `compile(i)` on a program. """ - ... @program_gen_module.method(default=Unit()) def compile(self, next_sym: i64 = i64(0)) -> Unit: @@ -93,7 +84,6 @@ def parent(self) -> Program: Only keeps the original parent, not any additional ones, so that each set of statements is only added once. """ - ... @program_gen_module.method(default=Unit()) def eval_py_object(self, globals: object) -> Unit: @@ -108,14 +98,12 @@ def py_object(self) -> PyObject: """ Returns the python object of the program, if it's been evaluated. """ - ... @property def is_identifer(self) -> Bool: """ Returns whether the expression is an identifier. Used so that we don't re-assign any identifiers. """ - ... converter(String, Program, Program)