diff --git a/src/ytdl_sub/script/functions/array_functions.py b/src/ytdl_sub/script/functions/array_functions.py index 0f7e536b..809c53fc 100644 --- a/src/ytdl_sub/script/functions/array_functions.py +++ b/src/ytdl_sub/script/functions/array_functions.py @@ -4,7 +4,7 @@ from ytdl_sub.script.types.array import Array from ytdl_sub.script.types.array import ResolvedArray from ytdl_sub.script.types.resolvable import Integer from ytdl_sub.script.types.resolvable import Lambda -from ytdl_sub.script.types.resolvable import Lambda2 +from ytdl_sub.script.types.resolvable import LambdaTwo from ytdl_sub.script.types.resolvable import Resolvable @@ -58,7 +58,7 @@ class ArrayFunctions: return ResolvedArray([ResolvedArray([val]) for val in array.value]) @staticmethod - def array_enumerate(array: Array, lambda_function: Lambda2) -> Array: + def array_enumerate(array: Array, lambda_function: LambdaTwo) -> Array: """ Apply a lambda function on every element in the Array, where each arg passed to the lambda function is ``idx, element`` as two separate args. diff --git a/src/ytdl_sub/script/functions/map_functions.py b/src/ytdl_sub/script/functions/map_functions.py index 2746f858..8194d756 100644 --- a/src/ytdl_sub/script/functions/map_functions.py +++ b/src/ytdl_sub/script/functions/map_functions.py @@ -7,8 +7,8 @@ from ytdl_sub.script.types.resolvable import AnyArgument from ytdl_sub.script.types.resolvable import Boolean from ytdl_sub.script.types.resolvable import Hashable from ytdl_sub.script.types.resolvable import Integer -from ytdl_sub.script.types.resolvable import Lambda2 -from ytdl_sub.script.types.resolvable import Lambda3 +from ytdl_sub.script.types.resolvable import LambdaThree +from ytdl_sub.script.types.resolvable import LambdaTwo from ytdl_sub.script.utils.exceptions import KeyDoesNotExistRuntimeException @@ -38,7 +38,7 @@ class MapFunctions: # pylint: disable=unused-argument @staticmethod - def map_apply(mapping: Map, lambda_function: Lambda2) -> Array: + def map_apply(mapping: Map, lambda_function: LambdaTwo) -> Array: """ Apply a lambda function on the Map, where each arg passed to the lambda function is ``key, value`` as two separate args. @@ -46,7 +46,7 @@ class MapFunctions: return ResolvedArray([ResolvedArray([key, value]) for key, value in mapping.value.items()]) @staticmethod - def map_enumerate(mapping: Map, lambda_function: Lambda3) -> Array: + def map_enumerate(mapping: Map, lambda_function: LambdaThree) -> Array: """ Apply a lambda function on the Map, where each arg passed to the lambda function is ``idx, key, value`` as three separate args. diff --git a/src/ytdl_sub/script/types/resolvable.py b/src/ytdl_sub/script/types/resolvable.py index d8019c5c..cc96885e 100644 --- a/src/ytdl_sub/script/types/resolvable.py +++ b/src/ytdl_sub/script/types/resolvable.py @@ -168,7 +168,7 @@ class Lambda(Resolvable): @dataclass(frozen=True) -class Lambda2(Lambda): +class LambdaTwo(Lambda): """ Type-hinting for functions that apply lambdas with two inputs per element """ @@ -179,7 +179,7 @@ class Lambda2(Lambda): @dataclass(frozen=True) -class Lambda3(Lambda): +class LambdaThree(Lambda): """ Type-hinting for functions that apply lambdas with three inputs per element """ diff --git a/src/ytdl_sub/script/utils/type_checking.py b/src/ytdl_sub/script/utils/type_checking.py index 848944cc..d4fe36e2 100644 --- a/src/ytdl_sub/script/utils/type_checking.py +++ b/src/ytdl_sub/script/utils/type_checking.py @@ -13,8 +13,8 @@ from ytdl_sub.script.types.resolvable import Argument from ytdl_sub.script.types.resolvable import BuiltInFunctionType from ytdl_sub.script.types.resolvable import FunctionType from ytdl_sub.script.types.resolvable import Lambda -from ytdl_sub.script.types.resolvable import Lambda2 -from ytdl_sub.script.types.resolvable import Lambda3 +from ytdl_sub.script.types.resolvable import LambdaThree +from ytdl_sub.script.types.resolvable import LambdaTwo from ytdl_sub.script.types.resolvable import NamedType from ytdl_sub.script.types.resolvable import Resolvable from ytdl_sub.script.types.variable import Variable @@ -162,10 +162,10 @@ class FunctionSpec: @property def is_lambda_function(self) -> Optional[Type[TLambda]]: - if Lambda3 in (self.args or []): - return Lambda3 - if Lambda2 in (self.args or []): - return Lambda2 + if LambdaThree in (self.args or []): + return LambdaThree + if LambdaTwo in (self.args or []): + return LambdaTwo if Lambda in (self.args or []): return Lambda return None