Page MenuHome

code quality day: annotations for some parameters
Needs RevisionPublic

Authored by Valentin (Poulpator) on May 1 2020, 4:03 PM.

Details

Summary

Added annotations for km, kc, and kmi parameters which are used few time in the source.

unfortunally, these classes are defined in C so no code completion AFAIK but a least contributors can look up for this in the source code or in API documentation.

Diff Detail

Repository
rB Blender

Event Timeline

Valentin (Poulpator) requested review of this revision.May 1 2020, 4:03 PM
Valentin (Poulpator) created this revision.
Sybren A. Stüvel (sybren) requested changes to this revision.May 19 2020, 5:07 PM

Thanks for the patch. Although I personally like type annotations in Python, there considerable issues with this patch.

All the annotations are undefined, so with this patch applied Blender doesn't even start.
I also would suggest either annotating all (or if not possible, at least most) parameters, and not just only those. That, or not annotate at all.
The annotations also have to be correct. Currently there is a check if km is not None: after km: KeyMap was declared. The declaration states that km cannot be None, but the code implies that it can.

This revision now requires changes to proceed.May 19 2020, 5:07 PM

I'd rather not use type annotations unless they can be properly type checked, see: T87333.