Mercurial > public > mercurial-scm > hg
comparison mercurial/formatter.py @ 51725: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 | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51724:2e9e62242451 | 51725:278af66e6595 |
---|---|
108 | 108 |
109 import contextlib | 109 import contextlib |
110 import itertools | 110 import itertools |
111 import os | 111 import os |
112 import pickle | 112 import pickle |
113 import typing | |
113 | 114 |
114 from .i18n import _ | 115 from .i18n import _ |
115 from .node import ( | 116 from .node import ( |
116 hex, | 117 hex, |
117 short, | 118 short, |
118 ) | 119 ) |
119 from .thirdparty import attr | 120 from .thirdparty import attr |
121 | |
122 # Force pytype to use the non-vendored package | |
123 if typing.TYPE_CHECKING: | |
124 # noinspection PyPackageRequirements | |
125 import attr | |
120 | 126 |
121 from . import ( | 127 from . import ( |
122 error, | 128 error, |
123 pycompat, | 129 pycompat, |
124 templatefilters, | 130 templatefilters, |