more linting

This commit is contained in:
Jesse Bannon 2023-11-15 23:50:10 -08:00
parent e0b75b1514
commit 1983652e35
7 changed files with 7 additions and 12 deletions

View file

@ -1,5 +1,4 @@
from typing import Dict from typing import Dict
from typing import List
from typing import Optional from typing import Optional
from ytdl_sub.script.types.array import Array 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 AnyType
from ytdl_sub.script.types.resolvable import Hashable from ytdl_sub.script.types.resolvable import Hashable
from ytdl_sub.script.types.resolvable import Resolvable from ytdl_sub.script.types.resolvable import Resolvable
from ytdl_sub.script.types.resolvable import String
from ytdl_sub.utils.exceptions import StringFormattingException from ytdl_sub.utils.exceptions import StringFormattingException

View file

@ -1,4 +1,3 @@
import json
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict from typing import Dict
from typing import List from typing import List

View file

@ -95,9 +95,9 @@ class FunctionInputSpec:
if len(input_args) > len(self.args): if len(input_args) > len(self.args):
return False 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 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 False
return True return True

View file

@ -1,7 +1,5 @@
import json
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict from typing import Dict
from typing import List
from typing import Set from typing import Set
from ytdl_sub.script.types.resolvable import ArgumentType from ytdl_sub.script.types.resolvable import ArgumentType

View file

@ -1,6 +1,5 @@
import json import json
from abc import ABC from abc import ABC
from abc import abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any from typing import Any
from typing import Generic from typing import Generic

View file

@ -102,7 +102,8 @@ class SyntaxTree(VariableDependency):
if len(unresolved_variables) == unresolved_count: if len(unresolved_variables) == unresolved_count:
raise StringFormattingException( 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()} return {variable.name: resolvable for variable, resolvable in resolved_variables.items()}

View file

@ -18,12 +18,12 @@ class VariableDependency(ABC):
@property @property
@abstractmethod @abstractmethod
def variables(self) -> Set[Variable]: def variables(self) -> Set[Variable]:
raise NotImplemented pass
@property @property
@abstractmethod @abstractmethod
def function_arguments(self) -> Set[FunctionArgument]: def function_arguments(self) -> Set[FunctionArgument]:
raise NotImplemented pass
@abstractmethod @abstractmethod
def resolve( def resolve(
@ -31,7 +31,7 @@ class VariableDependency(ABC):
resolved_variables: Dict[Variable, Resolvable], resolved_variables: Dict[Variable, Resolvable],
custom_functions: Dict[str, "VariableDependency"], custom_functions: Dict[str, "VariableDependency"],
) -> Resolvable: ) -> Resolvable:
raise NotImplemented pass
@classmethod @classmethod
def _resolve_argument_type( def _resolve_argument_type(