Page MenuHomeSoftware Heritage

HashableObject: Add type annotation for 'id' attribute
ClosedPublic

Authored by vlorentz on Sep 16 2021, 2:09 PM.

Details

Summary

This class is a mixin that only works with classes that define
this attribute, so it makes sense to declare it.

It also allows generic functions (that take a HashableObject
parameter, such as D6281) to access it without 'type: ignore'.

Diff Detail

Repository
rDMOD Data model
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D6282 (id=22748)

Rebasing onto e8794971bd...

Current branch diff-target is up to date.
Changes applied before test
commit b6f5e30b53c8331b19a40a3c086af8ffa3a7e222
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Sep 16 14:09:15 2021 +0200

    HashableObject: Add type annotation for 'id' attribute
    
    This class is a mixin that only works with classes that define
    this attribute, so it makes sense to declare it.
    
    It also allows generic functions (that take a HashableObject
    parameter) to access it without 'type: ignore'.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/369/ for more details.

This revision is now accepted and ready to land.Sep 16 2021, 2:15 PM