fmf icon indicating copy to clipboard operation
fmf copied to clipboard

Type hints

Open LecrisUT opened this issue 2 years ago • 5 comments

I don't like that the data dict type is an Any, but this should work

  • [x] Tree
  • [x] Context
  • [x] filter
  • [x] Other internal (probably in a different PR)

LecrisUT avatar Aug 09 '23 17:08 LecrisUT

One quick note: | is supported from Python 3.10. I don’t know about other users, but at least tmt would still support Python 3.9. Therefore you might need to use Union or wrap unions with | with a string (”int | str”) to hide them from Python 3.9 interpreter.

happz avatar Aug 09 '23 18:08 happz

  • Rhel8 still uses 3.6, which might be a pain to make it compatible
  • Rhel9 error is about |, so yeah should change that to Optional and Union
  • I am not sure if I got the Context typing correct
  • Should add mypy to the CI in this PR

LecrisUT avatar Aug 09 '23 18:08 LecrisUT

Should add mypy to the CI in this PR

Absolutely, you can copy the section from tmt's pre-commit configuration, it served there well.

happz avatar Aug 09 '23 18:08 happz

MyPy is up and there are issues to resolve

LecrisUT avatar Aug 10 '23 10:08 LecrisUT

All tests are green here right now. Any review please?

LecrisUT avatar Aug 18 '23 19:08 LecrisUT