From 1983652e35cb4fa2ec94e803d230f9501823ea3a Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 15 Nov 2023 23:50:10 -0800 Subject: [PATCH] more linting --- src/ytdl_sub/script/functions/map_functions.py | 2 -- src/ytdl_sub/script/types/array.py | 1 - src/ytdl_sub/script/types/function.py | 4 ++-- src/ytdl_sub/script/types/map.py | 2 -- src/ytdl_sub/script/types/resolvable.py | 1 - src/ytdl_sub/script/types/syntax_tree.py | 3 ++- src/ytdl_sub/script/types/variable_dependency.py | 6 +++--- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/ytdl_sub/script/functions/map_functions.py b/src/ytdl_sub/script/functions/map_functions.py index d65b74ec..fb9400f1 100644 --- a/src/ytdl_sub/script/functions/map_functions.py +++ b/src/ytdl_sub/script/functions/map_functions.py @@ -1,5 +1,4 @@ from typing import Dict -from typing import List from typing import Optional from ytdl_sub.script.types.array import Array @@ -7,7 +6,6 @@ from ytdl_sub.script.types.map import Map from ytdl_sub.script.types.resolvable import AnyType from ytdl_sub.script.types.resolvable import Hashable from ytdl_sub.script.types.resolvable import Resolvable -from ytdl_sub.script.types.resolvable import String from ytdl_sub.utils.exceptions import StringFormattingException diff --git a/src/ytdl_sub/script/types/array.py b/src/ytdl_sub/script/types/array.py index 43a15955..792af89a 100644 --- a/src/ytdl_sub/script/types/array.py +++ b/src/ytdl_sub/script/types/array.py @@ -1,4 +1,3 @@ -import json from dataclasses import dataclass from typing import Dict from typing import List diff --git a/src/ytdl_sub/script/types/function.py b/src/ytdl_sub/script/types/function.py index bffcc19c..4139ebc6 100644 --- a/src/ytdl_sub/script/types/function.py +++ b/src/ytdl_sub/script/types/function.py @@ -95,9 +95,9 @@ class FunctionInputSpec: if len(input_args) > len(self.args): return False - for idx in range(len(self.args)): + for idx, arg in enumerate(self.args): input_arg = input_args[idx] if idx < len(input_args) else None - if not self._is_type_compatible(input_arg=input_arg, expected_arg_type=self.args[idx]): + if not self._is_type_compatible(input_arg=input_arg, expected_arg_type=arg): return False return True diff --git a/src/ytdl_sub/script/types/map.py b/src/ytdl_sub/script/types/map.py index c0a5872a..2b95c274 100644 --- a/src/ytdl_sub/script/types/map.py +++ b/src/ytdl_sub/script/types/map.py @@ -1,7 +1,5 @@ -import json from dataclasses import dataclass from typing import Dict -from typing import List from typing import Set from ytdl_sub.script.types.resolvable import ArgumentType diff --git a/src/ytdl_sub/script/types/resolvable.py b/src/ytdl_sub/script/types/resolvable.py index 095066fc..fb36d677 100644 --- a/src/ytdl_sub/script/types/resolvable.py +++ b/src/ytdl_sub/script/types/resolvable.py @@ -1,6 +1,5 @@ import json from abc import ABC -from abc import abstractmethod from dataclasses import dataclass from typing import Any from typing import Generic diff --git a/src/ytdl_sub/script/types/syntax_tree.py b/src/ytdl_sub/script/types/syntax_tree.py index 1e943a31..7d0f931e 100644 --- a/src/ytdl_sub/script/types/syntax_tree.py +++ b/src/ytdl_sub/script/types/syntax_tree.py @@ -102,7 +102,8 @@ class SyntaxTree(VariableDependency): if len(unresolved_variables) == unresolved_count: raise StringFormattingException( - f"Cycle detected within these variables: {', '.join(sorted([var.name for var in unresolved_variables]))}" + f"Cycle detected within these variables: " + f"{', '.join(sorted([var.name for var in unresolved_variables]))}" ) return {variable.name: resolvable for variable, resolvable in resolved_variables.items()} diff --git a/src/ytdl_sub/script/types/variable_dependency.py b/src/ytdl_sub/script/types/variable_dependency.py index 4bba7215..b48a2343 100644 --- a/src/ytdl_sub/script/types/variable_dependency.py +++ b/src/ytdl_sub/script/types/variable_dependency.py @@ -18,12 +18,12 @@ class VariableDependency(ABC): @property @abstractmethod def variables(self) -> Set[Variable]: - raise NotImplemented + pass @property @abstractmethod def function_arguments(self) -> Set[FunctionArgument]: - raise NotImplemented + pass @abstractmethod def resolve( @@ -31,7 +31,7 @@ class VariableDependency(ABC): resolved_variables: Dict[Variable, Resolvable], custom_functions: Dict[str, "VariableDependency"], ) -> Resolvable: - raise NotImplemented + pass @classmethod def _resolve_argument_type(