Mityuha / fresh-bakery

Bake dependency injections asynchronously and stupidly simple
https://fresh-bakery.readthedocs.io/en/latest/
MIT License
21 stars 0 forks source link

Mypy improvements #34

Closed Mityuha closed 6 months ago

Mityuha commented 1 year ago

Support latest mypy version (1.x.x). For example, methods that use override should be sorted in the right order. Also some things regarding coroutines' type hints may be improved as well

Mityuha commented 1 year ago

add annotations to __aenter__ method

    async def __aenter__(self: T) -> T:
        """Open up your real bakery."""
        return await type(self).aopen()
Mityuha commented 1 year ago

Also think about static analysis for non-existent attributes. Now there is no error if bakery hasn't asd attribute -- bakery.asd is the valid statement. That's all because of __getattribute__ bakery's method

Mityuha commented 1 year ago

The latest version of mypy also requires python >= 3.8. But bakery has the Python >= 3.6 support. Think about it