This is an archive of the discontinued Mercurial Phabricator instance.

encoding: add comment-based type hints for pytype
ClosedPublic

Authored by durin42 on Nov 6 2019, 5:57 PM.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

durin42 created this revision.Nov 6 2019, 5:57 PM
durin42 updated this revision to Diff 17666.Nov 6 2019, 6:22 PM
durin42 updated this revision to Diff 17674.Nov 6 2019, 6:39 PM
indygreg added inline comments.
mercurial/encoding.py
24

Am I missing something here? Won't globals() always return a dict with elements? And isn't typing only available on Python 3?

durin42 added inline comments.Nov 7 2019, 11:08 AM
mercurial/encoding.py
24

This is a moderately bonkers way to write if False that pyflakes won't complain about and pytype won't be able to elide, so we can have pytype-only imports in the file to make the type annotation comments work.

indygreg accepted this revision.Nov 8 2019, 11:39 AM
This revision is now accepted and ready to land.Nov 8 2019, 11:39 AM
This revision was automatically updated to reflect the committed changes.