-
-
Notifications
You must be signed in to change notification settings - Fork 426
Open
Description
If I understand correctly, the current typing prohibits static strings as FactBase.command
s as command
is typed as a Callable returning either a str
or StringCommand
:
Lines 50 to 59 in cc58a74
class FactBase(Generic[T]): | |
name: str | |
abstract: bool = True | |
shell_executable: str | None = None | |
command: Callable[..., str | StringCommand] | |
I had naively expected str
to be allowed [1] as a type for command
given it works today; should I assume the typing means that support of static strings will be phased out and in newly written facts something like following should be used ?
@staticmethod
def command() -> str:
return "<some useful command>"
[1] To force fact authors to provide a value, this would admittedly require though the signature to allow both str
and None
and __init_subclass__
to raise an exception on None
values. StringCommand
could be included as well if wanted.
Metadata
Metadata
Assignees
Labels
No labels