Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 51725:278af66e6595
typing: induce pytype to use the standard `attr` instead of the vendored copy
What was previously happening with the vendored copy was that pytype would stub
out all(?) classes that were decorated with `@attr.s` as `Any`. After this, we
get a ton of classes defined, and numerous fields and methods now have proper
types.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 23 Jul 2024 19:20:22 -0400 |
parents | 587153c96fe3 |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51724:2e9e62242451 | 51725:278af66e6595 |
---|---|
66 import json | 66 import json |
67 import mimetypes | 67 import mimetypes |
68 import operator | 68 import operator |
69 import re | 69 import re |
70 import time | 70 import time |
71 import typing | |
71 | 72 |
72 from mercurial.node import bin, short | 73 from mercurial.node import bin, short |
73 from mercurial.i18n import _ | 74 from mercurial.i18n import _ |
74 from mercurial.thirdparty import attr | 75 from mercurial.thirdparty import attr |
76 | |
77 # Force pytype to use the non-vendored package | |
78 if typing.TYPE_CHECKING: | |
79 # noinspection PyPackageRequirements | |
80 import attr | |
81 | |
75 from mercurial import ( | 82 from mercurial import ( |
76 cmdutil, | 83 cmdutil, |
77 context, | 84 context, |
78 copies, | 85 copies, |
79 encoding, | 86 encoding, |