comparison mercurial/wireprototypes.py @ 51788: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 18c8c18993f0
children f4733654f144
comparison
equal deleted inserted replaced
51787:2e9e62242451 51788:278af66e6595
1 # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com> 1 # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com>
2 # 2 #
3 # This software may be used and distributed according to the terms of the 3 # This software may be used and distributed according to the terms of the
4 # GNU General Public License version 2 or any later version. 4 # GNU General Public License version 2 or any later version.
5 5
6
7 import typing
6 8
7 from .node import ( 9 from .node import (
8 bin, 10 bin,
9 hex, 11 hex,
10 ) 12 )
11 from .i18n import _ 13 from .i18n import _
12 from .thirdparty import attr 14 from .thirdparty import attr
15
16 # Force pytype to use the non-vendored package
17 if typing.TYPE_CHECKING:
18 # noinspection PyPackageRequirements
19 import attr
20
13 from . import ( 21 from . import (
14 error, 22 error,
15 util, 23 util,
16 ) 24 )
17 from .interfaces import util as interfaceutil 25 from .interfaces import util as interfaceutil