From 7c94d10a6ccc5a98a8eb52cead3f36f93258ab0b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 31 Oct 2022 12:33:33 -0500 Subject: [PATCH] Make __getinitargs__ an abstractmethod --- pymbolic/primitives.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pymbolic/primitives.py b/pymbolic/primitives.py index d267f83..5ad5eb0 100644 --- a/pymbolic/primitives.py +++ b/pymbolic/primitives.py @@ -21,6 +21,7 @@ THE SOFTWARE. """ from sys import intern +from abc import ABC, abstractmethod import pymbolic.traits as traits @@ -180,7 +181,7 @@ def disable_subscript_by_getitem(): pass -class Expression: +class Expression(ABC): """Superclass for parts of a mathematical expression. Overrides operators to implicitly construct :class:`Sum`, :class:`Product` and other expressions. @@ -226,6 +227,10 @@ class Expression: # {{{ init arg names (override by subclass) + @abstractmethod + def __getinitargs__(self): + pass + @property def init_arg_names(self): raise NotImplementedError @@ -539,9 +544,6 @@ class Expression: self._hash_value = self.get_hash() return self._hash_value - def __getinitargs__(self): - raise NotImplementedError - def __getstate__(self): return self.__getinitargs__() -- GitLab