data-engineering-collective / minimalkv

A minimal key-value store interface for binary data (maintained fork of simplekv).
https://minimalkv.readthedocs.io/en/latest/index.html
Other
17 stars 9 forks source link

Changing return type of `__iter__` to `Iterator`. #99

Closed johanols closed 9 months ago

johanols commented 9 months ago

The previous return type of Iterable is incorrect as can be seen in this example: https://docs.python.org/3/library/typing.html#nominal-vs-structural-subtyping

Also this documentation mentions that __iter__ returns the iterator object itself: https://docs.python.org/3/library/stdtypes.html#iterator.__iter__

The incorrect Iterable type causes numerous of error when analyzed by a static type checker such as mypy. The switch to Iterator solves these issues.

Checklist

codecov[bot] commented 9 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (a6d0bbe) 0.00% compared to head (104ad9f) 0.00%. Report is 2 commits behind head on main.

Files Patch % Lines
minimalkv/decorator.py 0.00% 4 Missing :warning:
minimalkv/_key_value_store.py 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #99 +/- ## ===================================== Coverage 0.00% 0.00% ===================================== Files 32 32 Lines 1993 1993 ===================================== Misses 1993 1993 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.