more linting
This commit is contained in:
parent
7775022ef4
commit
d5ba12b265
5 changed files with 14 additions and 9 deletions
|
|
@ -24,6 +24,7 @@ from ytdl_sub.utils.exceptions import StringFormattingException
|
|||
from ytdl_sub.validators.string_formatter_validators import is_valid_source_variable_name
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
|
||||
class ArgumentParser(Enum):
|
||||
|
|
@ -367,7 +368,8 @@ class _Parser:
|
|||
|
||||
self._pos += 1
|
||||
return UnresolvedMap(value=output)
|
||||
elif ch == ",":
|
||||
|
||||
if ch == ",":
|
||||
if in_comma:
|
||||
raise UNEXPECTED_COMMA_ARGUMENT(ArgumentParser.MAP_KEY)
|
||||
if key is not None:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class Script:
|
|||
return override_name.startswith("%")
|
||||
|
||||
@classmethod
|
||||
def _function_name(self, function_key: str) -> str:
|
||||
def _function_name(cls, function_key: str) -> str:
|
||||
return function_key[1:]
|
||||
|
||||
def __init__(self, overrides: Dict[str, str]):
|
||||
|
|
|
|||
|
|
@ -228,7 +228,9 @@ class BuiltInFunction(Function):
|
|||
if is_union(arg.output_type):
|
||||
# TODO: Move naming to separate function, deal with Union input naming
|
||||
received_type_names.append(
|
||||
f"%{arg.name}(...)->Union[{', '.join(arg_type.type_name() for arg_type in arg.output_type.__args__)}]"
|
||||
f"%{arg.name}(...)->Union["
|
||||
f"{', '.join(type_.type_name() for type_ in arg.output_type.__args__)}"
|
||||
f"]"
|
||||
)
|
||||
else:
|
||||
received_type_names.append(f"%{arg.name}(...)->{arg.output_type.type_name()}")
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from ytdl_sub.script.types.resolvable import ArgumentType
|
|||
from ytdl_sub.script.types.resolvable import Resolvable
|
||||
from ytdl_sub.script.types.variable import FunctionArgument
|
||||
from ytdl_sub.script.types.variable import Variable
|
||||
from ytdl_sub.script.utils.exceptions import UNREACHABLE
|
||||
from ytdl_sub.utils.exceptions import StringFormattingException
|
||||
|
||||
|
||||
|
|
@ -17,12 +18,12 @@ class VariableDependency(ABC):
|
|||
@property
|
||||
@abstractmethod
|
||||
def variables(self) -> Set[Variable]:
|
||||
raise NotImplemented()
|
||||
raise NotImplemented
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def function_arguments(self) -> Set[FunctionArgument]:
|
||||
raise NotImplemented()
|
||||
raise NotImplemented
|
||||
|
||||
@abstractmethod
|
||||
def resolve(
|
||||
|
|
@ -30,10 +31,11 @@ class VariableDependency(ABC):
|
|||
resolved_variables: Dict[Variable, Resolvable],
|
||||
custom_functions: Dict[str, "VariableDependency"],
|
||||
) -> Resolvable:
|
||||
raise NotImplemented()
|
||||
raise NotImplemented
|
||||
|
||||
@classmethod
|
||||
def _resolve_argument_type(
|
||||
self,
|
||||
cls,
|
||||
arg: ArgumentType,
|
||||
resolved_variables: Dict[Variable, Resolvable],
|
||||
custom_functions: Dict[str, "VariableDependency"],
|
||||
|
|
@ -49,7 +51,7 @@ class VariableDependency(ABC):
|
|||
resolved_variables=resolved_variables, custom_functions=custom_functions
|
||||
)
|
||||
|
||||
assert False, "never reach here"
|
||||
raise UNREACHABLE
|
||||
|
||||
@final
|
||||
def has_variable_dependency(self, resolved_variables: Dict[Variable, Resolvable]) -> bool:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import sys
|
|||
from typing import List
|
||||
from typing import TypeVar
|
||||
|
||||
from ytdl_sub.script.utils.exceptions import InvalidSyntaxException
|
||||
from ytdl_sub.script.utils.exceptions import UserException
|
||||
|
||||
TUserException = TypeVar("TUserException", bound=UserException)
|
||||
|
|
|
|||
Loading…
Reference in a new issue