Changed OpenInterpreter.__init__'s definition to be generated by the @dataclass class annotation. This reduces the number of lines in core.py and makes the initialization code more readable.
There are a couple of wrinkles with this approach.
Fields must have type annotations. The resulting initializer is functionally useless without them. Luckily, this doesn't force the rest of the code to use types.
These wrinkles could act as arguments against the use of dataclasses in OI, but I think they're worth it. If we choose no to move forward with the use of dataclasses, I'll break the tests into their own PR.
Pre-Submission Checklist (optional but appreciated):
[ ] I have included relevant documentation updates (stored in /docs)
Describe the changes you have made:
Changed
OpenInterpreter.__init__
's definition to be generated by the@dataclass
class annotation. This reduces the number of lines in core.py and makes the initialization code more readable.There are a couple of wrinkles with this approach.
default_constructor
less readable, but I think the short comments I've included clarifies the situation some.These wrinkles could act as arguments against the use of dataclasses in OI, but I think they're worth it. If we choose no to move forward with the use of dataclasses, I'll break the tests into their own PR.
Pre-Submission Checklist (optional but appreciated):
docs/CONTRIBUTING.md
docs/ROADMAP.md
OS Tests (optional but appreciated):