comparison mercurial/revlog.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 ca7bde5dbafb
children 71fb6e0a7a35
comparison
equal deleted inserted replaced
51787:2e9e62242451 51788:278af66e6595
18 import contextlib 18 import contextlib
19 import functools 19 import functools
20 import io 20 import io
21 import os 21 import os
22 import struct 22 import struct
23 import typing
23 import weakref 24 import weakref
24 import zlib 25 import zlib
25 26
26 from typing import ( 27 from typing import (
27 Optional, 28 Optional,
72 REVIDX_HASCOPIESINFO, 73 REVIDX_HASCOPIESINFO,
73 REVIDX_ISCENSORED, 74 REVIDX_ISCENSORED,
74 REVIDX_RAWTEXT_CHANGING_FLAGS, 75 REVIDX_RAWTEXT_CHANGING_FLAGS,
75 ) 76 )
76 from .thirdparty import attr 77 from .thirdparty import attr
78
79 # Force pytype to use the non-vendored package
80 if typing.TYPE_CHECKING:
81 # noinspection PyPackageRequirements
82 import attr
83
77 from . import ( 84 from . import (
78 ancestor, 85 ancestor,
79 dagop, 86 dagop,
80 error, 87 error,
81 mdiff, 88 mdiff,