Mercurial > hg
comparison mercurial/scmutil.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 | 43460c311c0c |
comparison
equal
deleted
inserted
replaced
51728:2e9e62242451 | 51729:278af66e6595 |
---|---|
11 import glob | 11 import glob |
12 import os | 12 import os |
13 import posixpath | 13 import posixpath |
14 import re | 14 import re |
15 import subprocess | 15 import subprocess |
16 import typing | |
16 import weakref | 17 import weakref |
17 | 18 |
18 from .i18n import _ | 19 from .i18n import _ |
19 from .node import ( | 20 from .node import ( |
20 bin, | 21 bin, |
22 nullrev, | 23 nullrev, |
23 short, | 24 short, |
24 wdirrev, | 25 wdirrev, |
25 ) | 26 ) |
26 from .thirdparty import attr | 27 from .thirdparty import attr |
28 | |
29 # Force pytype to use the non-vendored package | |
30 if typing.TYPE_CHECKING: | |
31 # noinspection PyPackageRequirements | |
32 import attr | |
33 | |
27 from . import ( | 34 from . import ( |
28 copies as copiesmod, | 35 copies as copiesmod, |
29 encoding, | 36 encoding, |
30 error, | 37 error, |
31 match as matchmod, | 38 match as matchmod, |