Skip to content

Commit

Permalink
Switch classproperty for inject_self.property
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Nov 11, 2023
1 parent e801c9e commit dc2c1ba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
5 changes: 2 additions & 3 deletions vskernels/kernels/bicubic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from math import acos, asinh, cos, sqrt
from typing import TYPE_CHECKING, Any

from stgpytools import classproperty
from vstools import CustomValueError, core, vs
from vstools import CustomValueError, core, vs, inject_self

from .complex import ComplexKernel

Expand Down Expand Up @@ -69,7 +68,7 @@ def get_params_args(
return args | dict(b=self.b, c=self.c)
return args | dict(filter_param_a=self.b, filter_param_b=self.c)

@classproperty
@inject_self.property
def kernel_size(self) -> int:
return 1 + ((self.b, self.c) != (0, 0))

Expand Down
3 changes: 1 addition & 2 deletions vskernels/kernels/placebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from math import ceil
from typing import TYPE_CHECKING, Any

from stgpytools import classproperty
from vstools import Transfer, TransferT, core, fallback, inject_self, vs

from .complex import LinearScaler
Expand Down Expand Up @@ -94,6 +93,6 @@ def _kernel_size(self, taps: float | None = None, b: float | None = None, c: flo

return 1

@classproperty
@inject_self.property
def kernel_size(self) -> int:
return self._kernel_size(self.taps, self.b, self.c)
7 changes: 3 additions & 4 deletions vskernels/kernels/resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from math import ceil
from typing import Any

from stgpytools import classproperty
from vstools import core, vs
from vstools import core, vs, inject_self

from .zimg import ZimgComplexKernel

Expand All @@ -27,7 +26,7 @@ class Bilinear(ZimgComplexKernel):
scale_function = resample_function = core.lazy.resize.Bilinear
descale_function = core.lazy.descale.Debilinear

@classproperty
@inject_self.property
def kernel_size(self) -> int:
return 1

Expand Down Expand Up @@ -58,6 +57,6 @@ def get_params_args(
return args | dict(taps=self.taps)
return args | dict(filter_param_a=self.taps)

@classproperty
@inject_self.property
def kernel_size(self) -> int:
return ceil(self.taps)
7 changes: 3 additions & 4 deletions vskernels/kernels/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from math import ceil, isqrt
from typing import Any

from stgpytools import classproperty
from vstools import core
from vstools import core, inject_self

from .zimg import ZimgComplexKernel
from .fmtconv import FmtConv
Expand All @@ -21,7 +20,7 @@
class _SplineKernelSize:
"""Spline kernel size sub-class."""

@classproperty
@inject_self.property
def kernel_size(self) -> int:
radius = re.search(r'\d+$', self.__class__.__name__)

Expand All @@ -39,7 +38,7 @@ class Spline(FmtConv):
def __init__(self, taps: int = 2, **kwargs: Any) -> None:
super().__init__(taps=taps, **kwargs)

@classproperty
@inject_self.property
def kernel_size(self) -> int:
return ceil(self.taps)

Expand Down

0 comments on commit dc2c1ba

Please sign in to comment.