From 3f01baa6a11a341d6bef48af32c922c465037cd6 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 6 May 2024 10:12:57 +0200 Subject: Revert "Fix circular imports caused by type annotations" This reverts commit f3d55a7bf8052ecd49386ae4bc49f9a44c7a8c20. --- polymatrix/expression/expression.py | 9 ++------- polymatrix/expression/init.py | 13 ------------- polymatrix/expression/mixins/additionexprmixin.py | 7 +------ polymatrix/expression/mixins/blockdiagexprmixin.py | 7 +------ polymatrix/expression/mixins/cacheexprmixin.py | 7 +------ polymatrix/expression/mixins/combinationsexprmixin.py | 7 +------ polymatrix/expression/mixins/degreeexprmixin.py | 6 +----- polymatrix/expression/mixins/derivativeexprmixin.py | 6 +----- polymatrix/expression/mixins/diagexprmixin.py | 7 +------ polymatrix/expression/mixins/divergenceexprmixin.py | 6 +----- polymatrix/expression/mixins/elemmultexprmixin.py | 8 +++----- polymatrix/expression/mixins/evalexprmixin.py | 7 +------ polymatrix/expression/mixins/expressionbasemixin.py | 8 ++------ polymatrix/expression/mixins/eyeexprmixin.py | 10 +++------- polymatrix/expression/mixins/filterexprmixin.py | 7 +------ polymatrix/expression/mixins/fromnumbersexprmixin.py | 7 +------ polymatrix/expression/mixins/fromnumpyexprmixin.py | 8 +------- .../expression/mixins/fromsymmetricmatrixexprmixin.py | 12 +++++------- polymatrix/expression/mixins/fromsympyexprmixin.py | 7 +------ polymatrix/expression/mixins/fromtermsexprmixin.py | 6 +----- polymatrix/expression/mixins/getitemexprmixin.py | 10 +++------- polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py | 8 +------- polymatrix/expression/mixins/integrateexprmixin.py | 7 +------ polymatrix/expression/mixins/legendreseriesmixin.py | 7 +------ polymatrix/expression/mixins/linearinexprmixin.py | 7 +------ polymatrix/expression/mixins/linearmatrixinexprmixin.py | 8 ++------ polymatrix/expression/mixins/linearmonomialsexprmixin.py | 7 +------ polymatrix/expression/mixins/matrixmultexprmixin.py | 6 +----- polymatrix/expression/mixins/maxexprmixin.py | 7 +------ polymatrix/expression/mixins/parametrizeexprmixin.py | 7 +------ polymatrix/expression/mixins/parametrizematrixexprmixin.py | 7 +------ polymatrix/expression/mixins/productexprmixin.py | 6 +----- polymatrix/expression/mixins/quadraticinexprmixin.py | 7 +------ polymatrix/expression/mixins/quadraticmonomialsexprmixin.py | 7 +------ polymatrix/expression/mixins/repmatexprmixin.py | 7 +------ polymatrix/expression/mixins/reshapeexprmixin.py | 8 ++------ polymatrix/expression/mixins/setelementatexprmixin.py | 10 +++------- polymatrix/expression/mixins/squeezeexprmixin.py | 9 ++------- polymatrix/expression/mixins/substituteexprmixin.py | 6 +----- polymatrix/expression/mixins/subtractmonomialsexprmixin.py | 7 +------ polymatrix/expression/mixins/sumexprmixin.py | 8 ++------ polymatrix/expression/mixins/symmetricexprmixin.py | 10 ++++------ polymatrix/expression/mixins/toconstantexprmixin.py | 7 +------ polymatrix/expression/mixins/tosortedvariablesmixin.py | 8 +------- polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py | 10 ++++------ polymatrix/expression/mixins/transposeexprmixin.py | 7 +------ polymatrix/expression/mixins/truncateexprmixin.py | 7 +------ polymatrix/expression/mixins/variablemixin.py | 4 +--- polymatrix/expression/mixins/vstackexprmixin.py | 7 +------ polymatrix/expression/utils/getderivativemonomials.py | 8 ++------ polymatrix/expression/utils/getmonomialindices.py | 8 ++------ polymatrix/expression/utils/getvariableindices.py | 6 +----- 52 files changed, 77 insertions(+), 316 deletions(-) diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py index a0cf093..52c3da6 100644 --- a/polymatrix/expression/expression.py +++ b/polymatrix/expression/expression.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import dataclasses import typing import numpy as np @@ -8,15 +6,15 @@ from abc import ABC, abstractmethod from dataclassabc import dataclassabc from typing_extensions import override -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.variable.abc import Variable import polymatrix.expression.init from polymatrix.utils.getstacklines import get_stack_lines from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.expression.mixins.variablemixin import VariableMixin from polymatrix.expression.op import ( @@ -107,9 +105,6 @@ class Expression(ExpressionBaseMixin, ABC): def __sub__(self, other): return self + (-other) - def __truediv__(self, other: ExpressionBaseMixin): - return self._binary(polymatrix.expression.init.init_division_expr, self, other) - @abstractmethod def copy(self, underlying: ExpressionBaseMixin) -> "Expression": ... diff --git a/polymatrix/expression/init.py b/polymatrix/expression/init.py index 46163aa..82d2f16 100644 --- a/polymatrix/expression/init.py +++ b/polymatrix/expression/init.py @@ -84,19 +84,6 @@ def init_divergence_expr( variables=variables, ) - -def init_division_expr( - left: ExpressionBaseMixin, - right: ExpressionBaseMixin, - stack: tuple[FrameSummary], -): - return polymatrix.expression.impl.DivisionExprImpl( - left=left, - right=right, - stack=stack, - ) - - def init_elem_mult_expr( left: ExpressionBaseMixin, right: ExpressionBaseMixin, diff --git a/polymatrix/expression/mixins/additionexprmixin.py b/polymatrix/expression/mixins/additionexprmixin.py index 9ad4851..a51bae5 100644 --- a/polymatrix/expression/mixins/additionexprmixin.py +++ b/polymatrix/expression/mixins/additionexprmixin.py @@ -1,16 +1,11 @@ -from __future__ import annotations - import abc import math -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.index import PolyMatrixDict from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.expression.utils.broadcastpolymatrix import broadcast_poly_matrix diff --git a/polymatrix/expression/mixins/blockdiagexprmixin.py b/polymatrix/expression/mixins/blockdiagexprmixin.py index 1b58c6c..dece9c3 100644 --- a/polymatrix/expression/mixins/blockdiagexprmixin.py +++ b/polymatrix/expression/mixins/blockdiagexprmixin.py @@ -1,16 +1,11 @@ -from __future__ import annotations - import abc import itertools import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.index import PolyDict +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/cacheexprmixin.py b/polymatrix/expression/mixins/cacheexprmixin.py index 374cf95..7947a74 100644 --- a/polymatrix/expression/mixins/cacheexprmixin.py +++ b/polymatrix/expression/mixins/cacheexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixAsDictMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/combinationsexprmixin.py b/polymatrix/expression/mixins/combinationsexprmixin.py index fb27f70..56a1d64 100644 --- a/polymatrix/expression/mixins/combinationsexprmixin.py +++ b/polymatrix/expression/mixins/combinationsexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import itertools -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/degreeexprmixin.py b/polymatrix/expression/mixins/degreeexprmixin.py index 1498569..5518d0a 100644 --- a/polymatrix/expression/mixins/degreeexprmixin.py +++ b/polymatrix/expression/mixins/degreeexprmixin.py @@ -1,14 +1,10 @@ -from __future__ import annotations import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary diff --git a/polymatrix/expression/mixins/derivativeexprmixin.py b/polymatrix/expression/mixins/derivativeexprmixin.py index 301166a..31a1e31 100644 --- a/polymatrix/expression/mixins/derivativeexprmixin.py +++ b/polymatrix/expression/mixins/derivativeexprmixin.py @@ -1,14 +1,10 @@ -from __future__ import annotations - import abc import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/diagexprmixin.py b/polymatrix/expression/mixins/diagexprmixin.py index 56cdf27..d181543 100644 --- a/polymatrix/expression/mixins/diagexprmixin.py +++ b/polymatrix/expression/mixins/diagexprmixin.py @@ -1,13 +1,8 @@ -from __future__ import annotations - import abc import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.index import PolyDict diff --git a/polymatrix/expression/mixins/divergenceexprmixin.py b/polymatrix/expression/mixins/divergenceexprmixin.py index ac16c5b..3477ee1 100644 --- a/polymatrix/expression/mixins/divergenceexprmixin.py +++ b/polymatrix/expression/mixins/divergenceexprmixin.py @@ -1,15 +1,11 @@ -from __future__ import annotations - import abc import collections import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/elemmultexprmixin.py b/polymatrix/expression/mixins/elemmultexprmixin.py index 2579a17..e914fd5 100644 --- a/polymatrix/expression/mixins/elemmultexprmixin.py +++ b/polymatrix/expression/mixins/elemmultexprmixin.py @@ -1,16 +1,14 @@ -from __future__ import annotations - import abc import itertools import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState +import dataclassabc from polymatrix.polymatrix.init import init_poly_matrix, init_broadcast_poly_matrix from polymatrix.polymatrix.index import MonomialIndex from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.utils.mergemonomialindices import merge_monomial_indices diff --git a/polymatrix/expression/mixins/evalexprmixin.py b/polymatrix/expression/mixins/evalexprmixin.py index 8ed90fb..881ee83 100644 --- a/polymatrix/expression/mixins/evalexprmixin.py +++ b/polymatrix/expression/mixins/evalexprmixin.py @@ -1,16 +1,11 @@ -from __future__ import annotations - import abc import itertools import math -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/expressionbasemixin.py b/polymatrix/expression/mixins/expressionbasemixin.py index 8ca6afd..7f58339 100644 --- a/polymatrix/expression/mixins/expressionbasemixin.py +++ b/polymatrix/expression/mixins/expressionbasemixin.py @@ -1,11 +1,7 @@ -from __future__ import annotations - import abc -import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin - from polymatrix.polymatrix.mixins import PolyMatrixMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin +from polymatrix.polymatrix.mixins import PolyMatrixMixin class ExpressionBaseMixin(abc.ABC): diff --git a/polymatrix/expression/mixins/eyeexprmixin.py b/polymatrix/expression/mixins/eyeexprmixin.py index d8db113..6a65585 100644 --- a/polymatrix/expression/mixins/eyeexprmixin.py +++ b/polymatrix/expression/mixins/eyeexprmixin.py @@ -1,15 +1,11 @@ -from __future__ import annotations - import abc +import itertools import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.mixins import PolyMatrixMixin + from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.index import PolyDict, MonomialIndex diff --git a/polymatrix/expression/mixins/filterexprmixin.py b/polymatrix/expression/mixins/filterexprmixin.py index 51f05a4..c8fa427 100644 --- a/polymatrix/expression/mixins/filterexprmixin.py +++ b/polymatrix/expression/mixins/filterexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState class FilterExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/fromnumbersexprmixin.py b/polymatrix/expression/mixins/fromnumbersexprmixin.py index 3876ab4..e34956b 100644 --- a/polymatrix/expression/mixins/fromnumbersexprmixin.py +++ b/polymatrix/expression/mixins/fromnumbersexprmixin.py @@ -1,13 +1,8 @@ -from __future__ import annotations - from abc import abstractmethod from typing_extensions import override -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromnumpyexprmixin.py b/polymatrix/expression/mixins/fromnumpyexprmixin.py index a276f3d..cdf0aa6 100644 --- a/polymatrix/expression/mixins/fromnumpyexprmixin.py +++ b/polymatrix/expression/mixins/fromnumpyexprmixin.py @@ -1,17 +1,11 @@ -from __future__ import annotations - import math from abc import abstractmethod from typing_extensions import override, cast from numpy.typing import NDArray -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin - from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py b/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py index e59500e..c7d90a1 100644 --- a/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py +++ b/polymatrix/expression/mixins/fromsymmetricmatrixexprmixin.py @@ -1,14 +1,12 @@ -from __future__ import annotations import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - +import dataclasses +import math from polymatrix.expression.utils.getvariableindices import get_variable_indices_from_variable + from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin @@ -45,4 +43,4 @@ class FromSymmetricMatrixExprMixin(ExpressionBaseMixin): shape=(var_index, 1), ) - return state, poly_matrix + return state, poly_matrix \ No newline at end of file diff --git a/polymatrix/expression/mixins/fromsympyexprmixin.py b/polymatrix/expression/mixins/fromsympyexprmixin.py index 7637ac2..d178415 100644 --- a/polymatrix/expression/mixins/fromsympyexprmixin.py +++ b/polymatrix/expression/mixins/fromsympyexprmixin.py @@ -1,16 +1,11 @@ -from __future__ import annotations - import sympy import math from abc import abstractmethod from typing_extensions import override, cast -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/fromtermsexprmixin.py b/polymatrix/expression/mixins/fromtermsexprmixin.py index be434ef..463f41c 100644 --- a/polymatrix/expression/mixins/fromtermsexprmixin.py +++ b/polymatrix/expression/mixins/fromtermsexprmixin.py @@ -1,12 +1,8 @@ -from __future__ import annotations import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.index import MonomialData diff --git a/polymatrix/expression/mixins/getitemexprmixin.py b/polymatrix/expression/mixins/getitemexprmixin.py index fc96d8a..affe4ec 100644 --- a/polymatrix/expression/mixins/getitemexprmixin.py +++ b/polymatrix/expression/mixins/getitemexprmixin.py @@ -1,17 +1,13 @@ -from __future__ import annotations - import abc import dataclasses import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.mixins import PolyMatrixMixin + +from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.index import PolyDict +from polymatrix.expressionstate.abc import ExpressionState class GetItemExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py b/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py index 808a0c3..52e5814 100644 --- a/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py +++ b/polymatrix/expression/mixins/halfnewtonpolytopeexprmixin.py @@ -1,14 +1,7 @@ -from __future__ import annotations - import abc import dataclasses import itertools import math -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, @@ -16,6 +9,7 @@ from polymatrix.expression.utils.getvariableindices import ( from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/integrateexprmixin.py b/polymatrix/expression/mixins/integrateexprmixin.py index 00bbdf1..38cf522 100644 --- a/polymatrix/expression/mixins/integrateexprmixin.py +++ b/polymatrix/expression/mixins/integrateexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import itertools -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getderivativemonomials import differentiate_polynomial from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/legendreseriesmixin.py b/polymatrix/expression/mixins/legendreseriesmixin.py index bd8552f..bec4c6c 100644 --- a/polymatrix/expression/mixins/legendreseriesmixin.py +++ b/polymatrix/expression/mixins/legendreseriesmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/linearinexprmixin.py b/polymatrix/expression/mixins/linearinexprmixin.py index b5e59c1..8354754 100644 --- a/polymatrix/expression/mixins/linearinexprmixin.py +++ b/polymatrix/expression/mixins/linearinexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import collections -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/linearmatrixinexprmixin.py b/polymatrix/expression/mixins/linearmatrixinexprmixin.py index e7fd38a..8239947 100644 --- a/polymatrix/expression/mixins/linearmatrixinexprmixin.py +++ b/polymatrix/expression/mixins/linearmatrixinexprmixin.py @@ -1,15 +1,11 @@ -from __future__ import annotations - import abc import collections -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState +from numpy import var from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/linearmonomialsexprmixin.py b/polymatrix/expression/mixins/linearmonomialsexprmixin.py index 8374670..c4a5df7 100644 --- a/polymatrix/expression/mixins/linearmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/linearmonomialsexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/matrixmultexprmixin.py b/polymatrix/expression/mixins/matrixmultexprmixin.py index 953aa9c..9402a19 100644 --- a/polymatrix/expression/mixins/matrixmultexprmixin.py +++ b/polymatrix/expression/mixins/matrixmultexprmixin.py @@ -1,14 +1,10 @@ -from __future__ import annotations import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.utils.tooperatorexception import to_operator_exception diff --git a/polymatrix/expression/mixins/maxexprmixin.py b/polymatrix/expression/mixins/maxexprmixin.py index 7bcfa52..650dc68 100644 --- a/polymatrix/expression/mixins/maxexprmixin.py +++ b/polymatrix/expression/mixins/maxexprmixin.py @@ -1,13 +1,8 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/parametrizeexprmixin.py b/polymatrix/expression/mixins/parametrizeexprmixin.py index ec14240..290b2eb 100644 --- a/polymatrix/expression/mixins/parametrizeexprmixin.py +++ b/polymatrix/expression/mixins/parametrizeexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/parametrizematrixexprmixin.py b/polymatrix/expression/mixins/parametrizematrixexprmixin.py index 4c585bf..175a5c3 100644 --- a/polymatrix/expression/mixins/parametrizematrixexprmixin.py +++ b/polymatrix/expression/mixins/parametrizematrixexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/productexprmixin.py b/polymatrix/expression/mixins/productexprmixin.py index 1fc2440..12ea4f2 100644 --- a/polymatrix/expression/mixins/productexprmixin.py +++ b/polymatrix/expression/mixins/productexprmixin.py @@ -1,18 +1,14 @@ -from __future__ import annotations - import abc import itertools import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.index import PolynomialData from polymatrix.polymatrix.utils.multiplypolynomial import multiply_polynomial from polymatrix.utils.getstacklines import FrameSummary from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin diff --git a/polymatrix/expression/mixins/quadraticinexprmixin.py b/polymatrix/expression/mixins/quadraticinexprmixin.py index c323d09..144fbab 100644 --- a/polymatrix/expression/mixins/quadraticinexprmixin.py +++ b/polymatrix/expression/mixins/quadraticinexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import collections -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py index b6e671f..2717e7e 100644 --- a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, diff --git a/polymatrix/expression/mixins/repmatexprmixin.py b/polymatrix/expression/mixins/repmatexprmixin.py index 955a8ca..e3c6498 100644 --- a/polymatrix/expression/mixins/repmatexprmixin.py +++ b/polymatrix/expression/mixins/repmatexprmixin.py @@ -1,13 +1,8 @@ -from __future__ import annotations - import abc import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.index import PolyDict diff --git a/polymatrix/expression/mixins/reshapeexprmixin.py b/polymatrix/expression/mixins/reshapeexprmixin.py index dfa7d71..9f43c04 100644 --- a/polymatrix/expression/mixins/reshapeexprmixin.py +++ b/polymatrix/expression/mixins/reshapeexprmixin.py @@ -1,16 +1,12 @@ -from __future__ import annotations - import abc import functools import itertools import operator import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState +import numpy as np from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.index import PolyDict diff --git a/polymatrix/expression/mixins/setelementatexprmixin.py b/polymatrix/expression/mixins/setelementatexprmixin.py index 134531f..61db750 100644 --- a/polymatrix/expression/mixins/setelementatexprmixin.py +++ b/polymatrix/expression/mixins/setelementatexprmixin.py @@ -1,18 +1,14 @@ -from __future__ import annotations - import abc import dataclasses -import dataclassabc import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import expressionstate - +import dataclassabc from polymatrix.polymatrix.mixins import PolyMatrixMixin +from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.index import PolyDict +from polymatrix.expressionstate.abc import ExpressionState class SetElementAtExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/squeezeexprmixin.py b/polymatrix/expression/mixins/squeezeexprmixin.py index e82e67d..67ade46 100644 --- a/polymatrix/expression/mixins/squeezeexprmixin.py +++ b/polymatrix/expression/mixins/squeezeexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState # remove? diff --git a/polymatrix/expression/mixins/substituteexprmixin.py b/polymatrix/expression/mixins/substituteexprmixin.py index dd07363..d2ab740 100644 --- a/polymatrix/expression/mixins/substituteexprmixin.py +++ b/polymatrix/expression/mixins/substituteexprmixin.py @@ -1,17 +1,13 @@ -from __future__ import annotations - import abc import collections import itertools import math import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/subtractmonomialsexprmixin.py b/polymatrix/expression/mixins/subtractmonomialsexprmixin.py index 3cb8e07..6bac539 100644 --- a/polymatrix/expression/mixins/subtractmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/subtractmonomialsexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc import dataclasses -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.utils.getmonomialindices import get_monomial_indices from polymatrix.polymatrix.utils.sortmonomials import sort_monomials diff --git a/polymatrix/expression/mixins/sumexprmixin.py b/polymatrix/expression/mixins/sumexprmixin.py index d2b3f30..4ade032 100644 --- a/polymatrix/expression/mixins/sumexprmixin.py +++ b/polymatrix/expression/mixins/sumexprmixin.py @@ -1,14 +1,10 @@ -from __future__ import annotations - import abc import collections -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState +import dataclasses from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/symmetricexprmixin.py b/polymatrix/expression/mixins/symmetricexprmixin.py index c25743d..ea9d16f 100644 --- a/polymatrix/expression/mixins/symmetricexprmixin.py +++ b/polymatrix/expression/mixins/symmetricexprmixin.py @@ -1,17 +1,15 @@ -from __future__ import annotations - import abc import collections +import itertools import dataclassabc import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.abc import PolyMatrix - from polymatrix.polymatrix.index import PolyDict from polymatrix.polymatrix.mixins import PolyMatrixMixin + from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState class SymmetricExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/toconstantexprmixin.py b/polymatrix/expression/mixins/toconstantexprmixin.py index c86a5ee..9c8b9b7 100644 --- a/polymatrix/expression/mixins/toconstantexprmixin.py +++ b/polymatrix/expression/mixins/toconstantexprmixin.py @@ -1,15 +1,10 @@ -from __future__ import annotations - import abc import collections -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState class ToConstantExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/tosortedvariablesmixin.py b/polymatrix/expression/mixins/tosortedvariablesmixin.py index 973c941..4dfa518 100644 --- a/polymatrix/expression/mixins/tosortedvariablesmixin.py +++ b/polymatrix/expression/mixins/tosortedvariablesmixin.py @@ -1,11 +1,4 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) @@ -13,6 +6,7 @@ from polymatrix.expression.utils.getvariableindices import ( from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState # to be deleted? diff --git a/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py b/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py index 3f41920..3c50f76 100644 --- a/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py +++ b/polymatrix/expression/mixins/tosymmetricmatrixexprmixin.py @@ -1,13 +1,11 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin +from polymatrix.expression.utils.getvariableindices import ( + get_variable_indices_from_variable, +) from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.polymatrix.mixins import PolyMatrixMixin diff --git a/polymatrix/expression/mixins/transposeexprmixin.py b/polymatrix/expression/mixins/transposeexprmixin.py index f8be6f0..eaab11a 100644 --- a/polymatrix/expression/mixins/transposeexprmixin.py +++ b/polymatrix/expression/mixins/transposeexprmixin.py @@ -1,16 +1,11 @@ -from __future__ import annotations - import abc import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.index import PolyDict from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState class TransposeExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/mixins/truncateexprmixin.py b/polymatrix/expression/mixins/truncateexprmixin.py index 6a8b929..3171221 100644 --- a/polymatrix/expression/mixins/truncateexprmixin.py +++ b/polymatrix/expression/mixins/truncateexprmixin.py @@ -1,14 +1,9 @@ -from __future__ import annotations - import abc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState from polymatrix.polymatrix.init import init_poly_matrix from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.utils.getvariableindices import ( get_variable_indices_from_variable, ) diff --git a/polymatrix/expression/mixins/variablemixin.py b/polymatrix/expression/mixins/variablemixin.py index 6a79f27..750e320 100644 --- a/polymatrix/expression/mixins/variablemixin.py +++ b/polymatrix/expression/mixins/variablemixin.py @@ -4,9 +4,7 @@ import typing import itertools from typing_extensions import override -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.mixins import ExpressionStateMixin - +from polymatrix.expressionstate.mixins import ExpressionStateMixin from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix from polymatrix.polymatrix.init import init_poly_matrix diff --git a/polymatrix/expression/mixins/vstackexprmixin.py b/polymatrix/expression/mixins/vstackexprmixin.py index 2d8bd89..8f17b2f 100644 --- a/polymatrix/expression/mixins/vstackexprmixin.py +++ b/polymatrix/expression/mixins/vstackexprmixin.py @@ -1,17 +1,12 @@ -from __future__ import annotations import abc import itertools import dataclassabc -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.mixins import PolyMatrixMixin from polymatrix.polymatrix.index import PolyDict from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin from polymatrix.polymatrix.abc import PolyMatrix +from polymatrix.expressionstate.abc import ExpressionState class VStackExprMixin(ExpressionBaseMixin): diff --git a/polymatrix/expression/utils/getderivativemonomials.py b/polymatrix/expression/utils/getderivativemonomials.py index 340a76a..cf2ae92 100644 --- a/polymatrix/expression/utils/getderivativemonomials.py +++ b/polymatrix/expression/utils/getderivativemonomials.py @@ -1,13 +1,9 @@ -from __future__ import annotations - import collections import dataclasses import itertools -import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.polymatrix.index import PolynomialData +from polymatrix.expressionstate.abc import ExpressionState +from polymatrix.polymatrix.index import PolynomialData # NP: why does this return a dict? diff --git a/polymatrix/expression/utils/getmonomialindices.py b/polymatrix/expression/utils/getmonomialindices.py index be0e7d7..9145002 100644 --- a/polymatrix/expression/utils/getmonomialindices.py +++ b/polymatrix/expression/utils/getmonomialindices.py @@ -1,9 +1,5 @@ -from __future__ import annotations -import typing - -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.expressionstate.abc import ExpressionState +from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin def get_monomial_indices( diff --git a/polymatrix/expression/utils/getvariableindices.py b/polymatrix/expression/utils/getvariableindices.py index 3177735..aebdeb0 100644 --- a/polymatrix/expression/utils/getvariableindices.py +++ b/polymatrix/expression/utils/getvariableindices.py @@ -1,11 +1,7 @@ -from __future__ import annotations - import itertools import typing -if typing.TYPE_CHECKING: - from polymatrix.expressionstate.abc import ExpressionState - +from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -- cgit v1.2.1