Skip to content

Commit

Permalink
Change @Property to @stgpytools.classproperty
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Nov 11, 2023
1 parent 0ab7a88 commit 1f55fdc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion vskernels/kernels/bicubic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +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 .complex import ComplexKernel
Expand Down Expand Up @@ -68,7 +69,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)

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

Expand Down
3 changes: 2 additions & 1 deletion vskernels/kernels/placebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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 @@ -93,6 +94,6 @@ def _kernel_size(self, taps: float | None = None, b: float | None = None, c: flo

return 1

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

from stgpytools import classproperty
from vstools import core, vs

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

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

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

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

from stgpytools import classproperty
from vstools import core

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

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

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

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

Expand Down

0 comments on commit 1f55fdc

Please sign in to comment.