function output error messages looking good, need more tests
This commit is contained in:
parent
3174225f55
commit
8fe4460ea5
4 changed files with 18 additions and 2 deletions
|
|
@ -18,6 +18,10 @@ from ytdl_sub.script.types.variable_dependency import VariableDependency
|
|||
class Array(NonHashable):
|
||||
value: List[Resolvable]
|
||||
|
||||
@classmethod
|
||||
def human_readable_name(cls) -> str:
|
||||
return "Array"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class UnresolvedArray(Array, VariableDependency, FutureResolvable):
|
||||
|
|
|
|||
|
|
@ -207,7 +207,13 @@ class BuiltInFunction(Function):
|
|||
received_type_names: List[str] = []
|
||||
for arg in self.args:
|
||||
if isinstance(arg, BuiltInFunction):
|
||||
received_type_names.append(f"%{arg.name}(...)->{arg.output_type.__name__}")
|
||||
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.human_readable_name() for arg_type in arg.output_type.__args__)}]"
|
||||
)
|
||||
else:
|
||||
received_type_names.append(f"%{arg.name}(...)->{arg.output_type.__name__}")
|
||||
else:
|
||||
received_type_names.append(arg.__class__.__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ from ytdl_sub.utils.exceptions import StringFormattingException
|
|||
class Map(NonHashable):
|
||||
value: Dict[Hashable, Resolvable]
|
||||
|
||||
@classmethod
|
||||
def human_readable_name(cls) -> str:
|
||||
return "Map"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class UnresolvedMap(Map, VariableDependency, FutureResolvable):
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ class ArgumentType(ABC):
|
|||
Any possible argument type that has not been resolved yet
|
||||
"""
|
||||
|
||||
pass
|
||||
@classmethod
|
||||
def human_readable_name(cls) -> str:
|
||||
return cls.__name__
|
||||
|
||||
|
||||
class AnyType_0(ABC):
|
||||
|
|
|
|||
Loading…
Reference in a new issue