Skip to content

Commit

Permalink
SupportTreescope -> SupportsTreescope
Browse files Browse the repository at this point in the history
  • Loading branch information
felixzinn committed Aug 14, 2024
1 parent 3928270 commit c95e6d9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/evermore/effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from evermore.custom_types import OffsetAndScale
from evermore.parameter import Parameter
from evermore.visualization import SupportTreescope
from evermore.visualization import SupportsTreescope

__all__ = [
"Effect",
Expand All @@ -24,7 +24,7 @@ def __dir__():
return __all__


class Effect(eqx.Module, SupportTreescope):
class Effect(eqx.Module, SupportsTreescope):
@abc.abstractmethod
def __call__(self, parameter: PyTree[Parameter], hist: Array) -> OffsetAndScale: ...

Expand Down
4 changes: 2 additions & 2 deletions src/evermore/modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from evermore.effect import DEFAULT_EFFECT
from evermore.parameter import Parameter
from evermore.util import tree_stack
from evermore.visualization import SupportTreescope
from evermore.visualization import SupportsTreescope

if TYPE_CHECKING:
from evermore.effect import Effect
Expand Down Expand Up @@ -59,7 +59,7 @@ def __matmul__(self: ModifierLike, other: ModifierLike) -> Compose:
return Compose(self, other)


class ModifierBase(ApplyFn, MatMulCompose, AbstractModifier, SupportTreescope):
class ModifierBase(ApplyFn, MatMulCompose, AbstractModifier, SupportsTreescope):
"""
This serves as a base class for all modifiers.
It automatically implements the __call__ method to apply the scale factors to the hist array
Expand Down
4 changes: 2 additions & 2 deletions src/evermore/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from evermore.custom_types import PDFLike
from evermore.pdf import Normal, Poisson
from evermore.util import filter_tree_map
from evermore.visualization import SupportTreescope
from evermore.visualization import SupportsTreescope

if TYPE_CHECKING:
from evermore.modifier import Modifier
Expand All @@ -34,7 +34,7 @@ def __dir__():
return __all__


class Parameter(eqx.Module, SupportTreescope):
class Parameter(eqx.Module, SupportsTreescope):
"""
Implementation of a general Parameter class. The class is used to define the parameters of a statistical model.
Key is the value attribute, which holds the actual value of the parameter. In additon,
Expand Down
4 changes: 2 additions & 2 deletions src/evermore/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from jax.scipy.special import gammaln, xlogy
from jaxtyping import Array, PRNGKeyArray

from evermore.visualization import SupportTreescope
from evermore.visualization import SupportsTreescope

__all__ = [
"PDF",
Expand All @@ -21,7 +21,7 @@ def __dir__():
return __all__


class PDF(eqx.Module, SupportTreescope):
class PDF(eqx.Module, SupportsTreescope):
@abstractmethod
def log_prob(self, x: Array) -> Array: ...

Expand Down
4 changes: 2 additions & 2 deletions src/evermore/staterror.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from evermore.parameter import NormalParameter, Parameter
from evermore.pdf import Poisson
from evermore.util import sum_over_leaves
from evermore.visualization import SupportTreescope
from evermore.visualization import SupportsTreescope

__all__ = [
"StatErrors",
Expand All @@ -25,7 +25,7 @@ def __dir__():
return __all__


class StatErrors(eqx.Module, SupportTreescope):
class StatErrors(eqx.Module, SupportsTreescope):
"""
Create staterror (barlow-beeston) parameters.
Expand Down
3 changes: 1 addition & 2 deletions src/evermore/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)


class SupportTreescope:
class SupportsTreescope:
def __treescope_repr__(
self,
path: str,
Expand Down Expand Up @@ -56,7 +56,6 @@ def handle_evermore_classes(
# get colors for the background of the tree node
def _treescope_color(node) -> str:
"""Returns the color of the tree node."""
from treescope import formatting_util

type_string = type(node).__module__ + "." + type(node).__qualname__
return formatting_util.color_from_string(type_string)
Expand Down

0 comments on commit c95e6d9

Please sign in to comment.