Page MenuHomeSoftware Heritage

typing: minimal changes to make a no-op mypy run pass
ClosedPublic

Authored by zack on Sep 20 2019, 11:23 AM.

Diff Detail

Repository
rDMOD Data model
Branch
feature/typing
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7882
Build 11347: tox-on-jenkinsJenkins
Build 11346: arc lint + arc unit

Event Timeline

  • mypy.ini: remove left-over sample section
vlorentz added inline comments.
swh/model/hashutil.py
74

Dict[str, Callable[[], hashutil.hash]]

swh/model/identifiers.py
641–652

Declare the NamedTuple in another class, and name it eg. _PersistentId.

Or just declare attributes using the attr lib.

swh/model/merkle.py
113

we may want to make this an enum

zack marked 3 inline comments as done.
  • mypy: ignore django-stubs, needed only by hypothesis
  • identifiers.py: do not inherit from on-the-fly namedtuple
swh/model/hashutil.py
74

There doesn't seem to be a proper public abstract type for the hashes returned by hashlib: they're _hashlib.HASH and I'd rather not use a private module in a type definition.

swh/model/merkle.py
113

agreed, but not in this diff, right?

I've added an inline TODO now though.

This revision is now accepted and ready to land.Sep 20 2019, 1:32 PM