Mercurial > hg
comparison mercurial/cmdutil.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 | 7601978f9e9f |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51728:2e9e62242451 | 51729:278af66e6595 |
---|---|
9 import copy as copymod | 9 import copy as copymod |
10 import errno | 10 import errno |
11 import functools | 11 import functools |
12 import os | 12 import os |
13 import re | 13 import re |
14 import typing | |
14 | 15 |
15 from typing import ( | 16 from typing import ( |
16 Any, | 17 Any, |
17 AnyStr, | 18 AnyStr, |
18 Dict, | 19 Dict, |
30 ) | 31 ) |
31 from .pycompat import ( | 32 from .pycompat import ( |
32 open, | 33 open, |
33 ) | 34 ) |
34 from .thirdparty import attr | 35 from .thirdparty import attr |
36 | |
37 # Force pytype to use the non-vendored package | |
38 if typing.TYPE_CHECKING: | |
39 # noinspection PyPackageRequirements | |
40 import attr | |
35 | 41 |
36 from . import ( | 42 from . import ( |
37 bookmarks, | 43 bookmarks, |
38 bundle2, | 44 bundle2, |
39 changelog, | 45 changelog, |