Closed Navid-Means-Promise closed 4 months ago
Sorry for that you told me before about mypy. now the code do pass it in the last commit.
About ArgField
class I must say it is extended from python internal Field
class defined in dataclass
module and it meant to be assigned to a field . it's mentioned in pep 0557
Also there is a helper function named field
in the same module that will create and return an instance of Field
class.
Mypy do accept assigning the result of field
function to a field but not directly assigning new instance of Field
class or any class extended from it.
As there was a bug in mypy for dealing even with field
function until Feb 2023 and due to my further research I convinced raising alerts about assigning in this case, is not correct; so I dealt the problem using # type: ignore[assignment]
at the end of field definitions.
Thanks. I'll poke around with the typing stuff and implement this functionality around the code base.
As we discussed about in this issue, in the current PR I provided a file named "argsdataclass.py" that contains two important classes
ArgsDataClass
andArgField
. Also I created a directory named "examples" that suppose to contain examples of using TTE in codes but temporarily it contains two files to demonestrate how to use typed args usingArgsDataClass
TerminalArgs
class in terminal.py and this typed arg class is used in new approach but as I said It will not touch current functionality.animation_rate
arg is a common arg between effects so instead of defining it in any effect separately it can be good to put it in theTerminalArgs
(as I did) or if you think it's not conceptually related to the terminal class, we can define a base arg class for all effects arg classes to inherit from.