On 8/19/2024 1:11 PM, Robin Jarry wrote:
Anatoly Burakov, Aug 16, 2024 at 14:16:
Update coding style:
- make it PEP-484 compliant
- address all flake8, mypy etc. warnings
- use f-strings in place of old-style string interpolation
- refactor printing to make the code more readable
Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com>
---
<...>
FYI: if we change the minimum supported python version to 3.9, we could
even get rid of this import completely as builtin types `set`, `list`,
`tuple` and `dict` have become subscriptable.
https://peps.python.org/pep-0585/
You can use them directly instead of the symbols defined in the typing
module. E.g. the following becomes valid syntax:
def foo(a: list[set[int]]) -> dict[str, tuple[str]]:
Instead of the more verbose:
def foo(a: T.List[T.Set[int]]) -> T.Dict[str, T.Tuple[str]]:
But we can keep that for another day.
Incidentally, `dpdk-pmdinfo.py` script does use this syntax already. So
either our minimum Python requirement is already met for this, or
pmdinfo needs to be fixed to avoid it.
--
Thanks,
Anatoly