Page MenuHomeSoftware Heritage

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

Authored by zack on Oct 11 2019, 8:15 AM.

Details

Summary

a few notes on these mypy adaptations, probably the most complicated thus far
for an almost no-op run:

  • some lines got overlong, most notably due to the Union[AbstractAttribute, ...] cases. They will get much nicer looking with Python 3.7, as we will then be able to anticipate the type annotation and get rid of "type: ". The line breaks will also be nicer
  • the default_min_bound attribute is *really* used in a type-inconsistent way, sometime it's a string, sometime a datetime, sometime an integer, etc. That calls for a better interface/abstraction, but I wanted to be minimal here, so I just typed it Any for now
Test Plan

tox -e mypy

Diff Detail

Repository
rDLS Listers
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

  • mypy: use sqlalchemy plugin

I've marked this as depending on D2120, as the encoding fix for the CRAN lister (formerly known as D2125) has been integrated there.

vlorentz added a subscriber: vlorentz.

I also prefer the new line-breaking style, there's less space wasted by indentations

This revision is now accepted and ready to land.Oct 11 2019, 10:36 AM

I also prefer the new line-breaking style, there's less space wasted by indentations

I don't understand what you mean here, and whether you're suggesting a better way of breaking lines right now (or with Python >= 3.6).
Can you elaborate?

This will need a rebase though.

  • typing: minimal changes to make a no-op mypy run pass
  • CRAN lister: make shelling out decoding compatible with Python 3.5
  • typing: minimal changes to make a no-op mypy run pass
  • CRAN lister: make shelling out decoding compatible with Python 3.5
  • mypy: add typing annotations for novel lister abstractions
  • CRAN lister: fix compute_package_url interpolation
  • typing: minimal changes to make a no-op mypy run pass
  • CRAN lister: make shelling out decoding compatible with Python 3.5
  • mypy: add typing annotations for novel lister abstractions
  • CRAN lister: fix compute_package_url interpolation
  • CRAN lister: fix compute_package_url interpolation