Mercurial > public > mercurial-scm > hg
comparison mercurial/graphmod.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 | ca7bde5dbafb |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51724:2e9e62242451 | 51725:278af66e6595 |
---|---|
16 context of the graph returned. Type is a constant specifying the node type. | 16 context of the graph returned. Type is a constant specifying the node type. |
17 Data depends on type. | 17 Data depends on type. |
18 """ | 18 """ |
19 | 19 |
20 | 20 |
21 import typing | |
22 | |
21 from .node import nullrev | 23 from .node import nullrev |
22 from .thirdparty import attr | 24 from .thirdparty import attr |
25 | |
26 # Force pytype to use the non-vendored package | |
27 if typing.TYPE_CHECKING: | |
28 # noinspection PyPackageRequirements | |
29 import attr | |
30 | |
23 from . import ( | 31 from . import ( |
24 dagop, | 32 dagop, |
25 smartset, | 33 smartset, |
26 util, | 34 util, |
27 ) | 35 ) |