Skip to content

Commit

Permalink
Add abstract_kernels
Browse files Browse the repository at this point in the history
Fix #45
  • Loading branch information
Setsugennoao committed Nov 11, 2023
1 parent 1f55fdc commit e801c9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions vskernels/kernels/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ def from_param(
cls: type[Kernel], kernel: ScalerT | DescalerT | ResamplerT | KernelT | None = None,
func_except: FuncExceptT | None = None
) -> type[Scaler] | type[Descaler] | type[Resampler] | type[Kernel]:
from ..util import excluded_kernels
from ..util import abstract_kernels
return BaseScaler.from_param(
cls, Kernel, kernel, UnknownKernelError, excluded_kernels, func_except # type: ignore
cls, Kernel, kernel, UnknownKernelError, abstract_kernels, func_except # type: ignore
)

@overload
Expand Down Expand Up @@ -369,9 +369,9 @@ def ensure_obj(
cls: type[Kernel], kernel: ScalerT | DescalerT | ResamplerT | KernelT | None = None,
func_except: FuncExceptT | None = None
) -> Scaler | Descaler | Resampler | Kernel:
from ..util import excluded_kernels
from ..util import abstract_kernels
return BaseScaler.ensure_obj(
cls, Kernel, kernel, UnknownKernelError, excluded_kernels, func_except # type: ignore
cls, Kernel, kernel, UnknownKernelError, abstract_kernels, func_except # type: ignore
)


Expand Down
13 changes: 8 additions & 5 deletions vskernels/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .kernels.docs import Example

__all__ = [
'excluded_kernels',
'abstract_kernels', 'excluded_kernels',
'NoShift', 'NoScale',

'LinearLight',
Expand Down Expand Up @@ -106,13 +106,16 @@ class inner_no_scale(kernel_t, NoScaleBase): # type: ignore
return inner_no_scale


abstract_kernels = [
Kernel, FmtConv, Example, Impulse, Placebo, ComplexKernel,
ZimgDescaler, ZimgComplexKernel, LinearDescaler
]


@to_singleton
class excluded_kernels(list[type]):
def __init__(self) -> None:
super().__init__([
Kernel, FmtConv, Example, Impulse, Placebo, ComplexKernel,
ZimgDescaler, ZimgComplexKernel, LinearDescaler
])
super().__init__(abstract_kernels)

self.exclude_sub = [
NoShiftBase, NoScaleBase, BicubicAuto, MemeKernel
Expand Down

0 comments on commit e801c9e

Please sign in to comment.