Skip to content

Commit

Permalink
Implement backend.abc (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkraemer authored Dec 18, 2023
1 parent 7272c83 commit 2a1487d
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 18 deletions.
12 changes: 12 additions & 0 deletions probdiffeq/backend/abc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Abstract base classes."""


import abc


class ABC(abc.ABC): # noqa: B024,D101
pass


def abstractmethod(*args):
return abc.abstractmethod(*args)
2 changes: 1 addition & 1 deletion probdiffeq/impl/_conditional.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Conditionals."""
import abc
from probdiffeq.backend import abc


class ConditionalBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_hidden_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class HiddenModelBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_impl.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""State-space model impl."""
import abc
import warnings
from typing import Optional

from probdiffeq.backend import abc
from probdiffeq.impl import (
_conditional,
_hidden_model,
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_linearise.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class LinearisationBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_prototypes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class PrototypeBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_ssm_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""SSM utilities."""

import abc
from probdiffeq.backend import abc


class SSMUtilBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class StatsBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class TransformBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/impl/_variable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from probdiffeq.backend import abc


class VariableBackend(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion probdiffeq/solvers/_solver.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""IVP-solver API."""


import abc
from typing import Generic, TypeVar

from probdiffeq import _interp
from probdiffeq.backend import abc
from probdiffeq.backend import numpy as np
from probdiffeq.impl import impl

Expand Down
4 changes: 1 addition & 3 deletions probdiffeq/solvers/calibrated.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Calibrated IVP solvers."""
import abc

from probdiffeq import _interp
from probdiffeq.backend import tree_util
from probdiffeq.backend import abc, tree_util
from probdiffeq.impl import impl
from probdiffeq.solvers import _common, _solver

Expand Down
4 changes: 1 addition & 3 deletions probdiffeq/solvers/strategies/components/corrections.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Correction models."""

import abc

from probdiffeq.backend import functools
from probdiffeq.backend import abc, functools
from probdiffeq.backend import numpy as np
from probdiffeq.impl import impl
from probdiffeq.solvers.strategies.components import cubature
Expand Down
3 changes: 1 addition & 2 deletions probdiffeq/solvers/strategies/strategy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Interface for estimation strategies."""

import abc
from typing import Any, Generic, TypeVar

from probdiffeq import _interp
from probdiffeq.backend import containers, tree_util
from probdiffeq.backend import abc, containers, tree_util
from probdiffeq.backend import numpy as np
from probdiffeq.impl import impl

Expand Down

0 comments on commit 2a1487d

Please sign in to comment.