Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify GrainPP.Resolver #102

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions vsdeband/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from functools import reduce
from typing import TYPE_CHECKING, Any, Callable, Iterable, Protocol, TypeAlias, cast
from typing import Any, Callable, Iterable, Protocol, cast

from vsdenoise import Prefilter
from vsexprtools import complexpr_available, norm_expr
Expand Down Expand Up @@ -34,14 +34,6 @@
]


class _gpp:
if TYPE_CHECKING:
from .noise import GrainPP
Resolver: TypeAlias = Callable[[vs.VideoNode], GrainPP]
else:
Resolver: TypeAlias = Callable[[vs.VideoNode], Any]


class ResolverOneClipArgs(Protocol):
def __call__(self, grained: vs.VideoNode) -> vs.VideoNode:
...
Expand All @@ -53,7 +45,9 @@ def __call__(self, grained: vs.VideoNode, clip: vs.VideoNode) -> vs.VideoNode:


@dataclass
class GrainPP(_gpp):
class GrainPP:
Resolver = Callable[[vs.VideoNode], 'GrainPP']

value: str
kwargs: KwargsT = field(default_factory=lambda: KwargsT())

Expand All @@ -76,7 +70,7 @@ def _resolve(grained: vs.VideoNode) -> vs.VideoNode:


FadeLimits = tuple[int | Iterable[int] | None, int | Iterable[int] | None]
GrainPostProcessT = type[ResolverOneClipArgs | ResolverTwoClipsArgs | str | GrainPP | GrainPP.Resolver]
GrainPostProcessT = ResolverOneClipArgs | ResolverTwoClipsArgs | str | GrainPP | GrainPP.Resolver
GrainPostProcessesT = GrainPostProcessT | list[GrainPostProcessT]


Expand Down
Loading