rich
rich copied to clipboard
Change return type of `Live`'s contextmanager to `Self`
Type of changes
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [x] Other
Checklist
- [ ] I've run the latest black with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.
Description
When subclassing Live and using the new class a contextmanager I don't get the proper type hints, since __enter__ returns Live and not my subclass, this PR fixes that 😊
Ah, the CI error is due to mypy being less than v1.0: https://github.com/python/mypy/blob/master/CHANGELOG.md#support-the-self-type
happy to update that if that's ok (I'd do another since there might be other CI issues with the update)
Looks that like was done in another PR!