Mercurial > hg
changeset 51809:45270e286bdc
typing: hide the interface version of `dirstate` during type checking
As noted in the previous commit, the `dirstate` type is still inferred as `Any`
by pytype, including where it is used as a base class for the largefiles
dirstate. That effectively disables most type checking. The problems fixed two
commits ago were flagged by this change.
I'm not at all clear what the benefit of the original type is, but that was what
was used at runtime, so I don't want to change the largefiles base class to the
raw class. Having both a lowercase and camelcase name for the same thing isn't
great, but given that this trivially finds problems without worrying about which
symbol clients may be using, and the non-raw type is useless to pytype anyway,
I'm not going to worry about it.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 16 Aug 2024 18:11:52 -0400 |
parents | c1d7ac70980b |
children | 07086b3ad502 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Fri Aug 16 18:02:32 2024 -0400 +++ b/mercurial/dirstate.py Fri Aug 16 18:11:52 2024 -0400 @@ -10,6 +10,7 @@ import contextlib import os import stat +import typing import uuid from .i18n import _ @@ -1809,3 +1810,6 @@ dirstate = interfaceutil.implementer(intdirstate.idirstate)(DirState) + +if typing.TYPE_CHECKING: + dirstate = DirState