diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-03-02 14:50:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-02 14:50:34 -0700 |
commit | b5e2b029bbaaa9eca124cc8560f17c70e8a0e4e3 (patch) | |
tree | 8caad03e557b6d346581fb173ec8c36cd4f76b48 | |
parent | e21d2cbdf15a86e16ef4877a42ed98d97ea296d3 (diff) | |
parent | e7b529c55cf9f5e27517d75df91211eb35f60d6c (diff) | |
download | numpy-b5e2b029bbaaa9eca124cc8560f17c70e8a0e4e3.tar.gz |
Merge pull request #13073 from eric-wieser/polybase-abc-fixes
MAINT: Fix ABCPolyBase in various ways
-rw-r--r-- | numpy/polynomial/_polybase.py | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/numpy/polynomial/_polybase.py b/numpy/polynomial/_polybase.py index c28e77e69..bfa030714 100644 --- a/numpy/polynomial/_polybase.py +++ b/numpy/polynomial/_polybase.py @@ -8,7 +8,7 @@ abc module from the stdlib, hence it is only available for Python >= 2.6. """ from __future__ import division, absolute_import, print_function -from abc import ABCMeta, abstractmethod, abstractproperty +import abc import numbers import numpy as np @@ -16,7 +16,7 @@ from . import polyutils as pu __all__ = ['ABCPolyBase'] -class ABCPolyBase(object): +class ABCPolyBase(abc.ABC): """An abstract base class for immutable series classes. ABCPolyBase provides the standard Python numerical methods @@ -59,7 +59,6 @@ class ABCPolyBase(object): Default window of the class. """ - __metaclass__ = ABCMeta # Not hashable __hash__ = None @@ -70,68 +69,84 @@ class ABCPolyBase(object): # Limit runaway size. T_n^m has degree n*m maxpower = 100 - @abstractproperty + @property + @abc.abstractmethod def domain(self): pass - @abstractproperty + @property + @abc.abstractmethod def window(self): pass - @abstractproperty + @property + @abc.abstractmethod def nickname(self): pass - @abstractproperty + @property + @abc.abstractmethod def basis_name(self): pass - @abstractmethod - def _add(self): + @staticmethod + @abc.abstractmethod + def _add(c1, c2): pass - @abstractmethod - def _sub(self): + @staticmethod + @abc.abstractmethod + def _sub(c1, c2): pass - @abstractmethod - def _mul(self): + @staticmethod + @abc.abstractmethod + def _mul(c1, c2): pass - @abstractmethod - def _div(self): + @staticmethod + @abc.abstractmethod + def _div(c1, c2): pass - @abstractmethod - def _pow(self): + @staticmethod + @abc.abstractmethod + def _pow(c, pow, maxpower=None): pass - @abstractmethod - def _val(self): + @staticmethod + @abc.abstractmethod + def _val(x, c): pass - @abstractmethod - def _int(self): + @staticmethod + @abc.abstractmethod + def _int(c, m, k, lbnd, scl): pass - @abstractmethod - def _der(self): + @staticmethod + @abc.abstractmethod + def _der(c, m, scl): pass - @abstractmethod - def _fit(self): + @staticmethod + @abc.abstractmethod + def _fit(x, y, deg, rcond, full): pass - @abstractmethod - def _line(self): + @staticmethod + @abc.abstractmethod + def _line(off, scl): pass - @abstractmethod - def _roots(self): + @staticmethod + @abc.abstractmethod + def _roots(c): pass - @abstractmethod - def _fromroots(self): + @staticmethod + @abc.abstractmethod + def _fromroots(r): pass def has_samecoef(self, other): |