refactor: modern type hints in NDSL#270
Conversation
FlorianDeconinck
left a comment
There was a problem hiding this comment.
Sweet - are we becoming an actual python repository ?! #Pinocchio
Close but unrelated, I think we can probably kill some of the TYPE_CHECKING left in there
who knows, maybe we get there one day ...
good point - I'll put it on my mental list for Friday afternoon cleanups. although, if you want to look like a python repo, there's absolutely nothing wrong with |
There isn't, but they always looked like a crouch to me. I'd rather have straightforward imports, rather than pre-processing tool dependent code in there. It is minor. |
Description
With #258 merged, it's somewhat safe to do type transformations. So lets update our types in NDSL to be a bit more modern. Generics like
list&dictnow expose the proper type and there's no need to importList&Dictfrom typings anymore. Along the same lines,Sequence,Iterator, andGeneratorare now deprecated aliases in thetypingmodule because they natively exist incollections.abc. On top of that, since python 3.10, we can leverage|to replaceUnionandOptional. See typing docs.How has this been tested?
Current tests, in particular
mypyare still happy.Checklist
N/A
N/A
N/A
N/A