comparison mercurial/interfaces/repository.py @ 52487:3daaa5195a30

typing: align the signatures of `repository.ifilestorage` overrides This is the same as 048c11993d6a for `imanifestrevisionstored`, with the same belated realization about missing the Protocol marker. Since I've been jumping around to the various subclasses and copying extant hints to places where they're missing, do that here too. This also covers the 3 interfaces subclassed by `repository.ifilestorage` (`repository.ifileindex`, `repository.ifiledata`, and `repository.ifilemutation`). Obviously the whole base class needs hints, but I don't want to get side tracked here- it doesn't look like any of the implementing classes have any additional hints.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 23 Oct 2024 12:21:52 -0400
parents c0d9fda9f5f5
children 8c89e978375c
comparison
equal deleted inserted replaced
52486:c0d9fda9f5f5 52487:3daaa5195a30
13 13
14 from typing import ( 14 from typing import (
15 Any, 15 Any,
16 Callable, 16 Callable,
17 Collection, 17 Collection,
18 Iterable,
19 Iterator,
18 Mapping, 20 Mapping,
19 Protocol, 21 Protocol,
20 ) 22 )
21 23
22 from ..i18n import _ 24 from ..i18n import _
606 """ 608 """
607 609
608 nullid: bytes 610 nullid: bytes
609 """node for the null revision for use as delta base.""" 611 """node for the null revision for use as delta base."""
610 612
611 def __len__(self): 613 def __len__(self) -> int:
612 """Obtain the number of revisions stored for this file.""" 614 """Obtain the number of revisions stored for this file."""
613 615
614 def __iter__(self): 616 def __iter__(self) -> Iterator[int]:
615 """Iterate over revision numbers for this file.""" 617 """Iterate over revision numbers for this file."""
616 618
617 def hasnode(self, node): 619 def hasnode(self, node):
618 """Returns a bool indicating if a node is known to this store. 620 """Returns a bool indicating if a node is known to this store.
619 621
965 Not all storage backends may support all queries are have a reasonable 967 Not all storage backends may support all queries are have a reasonable
966 value to use. In that case, the value should be set to ``None`` and 968 value to use. In that case, the value should be set to ``None`` and
967 callers are expected to handle this special value. 969 callers are expected to handle this special value.
968 """ 970 """
969 971
970 def verifyintegrity(self, state): 972 def verifyintegrity(self, state) -> Iterable[iverifyproblem]:
971 """Verifies the integrity of file storage. 973 """Verifies the integrity of file storage.
972 974
973 ``state`` is a dict holding state of the verifier process. It can be 975 ``state`` is a dict holding state of the verifier process. It can be
974 used to communicate data between invocations of multiple storage 976 used to communicate data between invocations of multiple storage
975 primitives. 977 primitives.