riscv-opcodes icon indicating copy to clipboard operation
riscv-opcodes copied to clipboard

Add static type hints

Open Timmmm opened this issue 1 year ago • 0 comments

Add static type hints, and switch to literals for some dicts to improve type inference (and it's nicer code anyway).

This makes the code easier to understand and navigate, and also detected a few bugs:

  1. Missing brackets on e.upper.
  2. ext_name may not exist on line 399 (I haven't fixed this).
  3. Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions.

It is currently not verified in CI by pyright, but that will come in a future MR. These changes were just verified by VSCode.

Timmmm avatar Oct 04 '24 21:10 Timmmm