Mercurial > hg
comparison mercurial/utils/stringutil.py @ 51729: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 | 4eccb65e444f |
comparison
equal
deleted
inserted
replaced
51728:2e9e62242451 | 51729:278af66e6595 |
---|---|
11 import ast | 11 import ast |
12 import codecs | 12 import codecs |
13 import re as remod | 13 import re as remod |
14 import textwrap | 14 import textwrap |
15 import types | 15 import types |
16 import typing | |
16 | 17 |
17 from typing import ( | 18 from typing import ( |
18 Optional, | 19 Optional, |
19 overload, | 20 overload, |
20 ) | 21 ) |
21 | 22 |
22 from ..i18n import _ | 23 from ..i18n import _ |
23 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 | |
24 | 30 |
25 from .. import ( | 31 from .. import ( |
26 encoding, | 32 encoding, |
27 error, | 33 error, |
28 pycompat, | 34 pycompat, |