# HG changeset patch # User Matt Harbison # Date 1721776456 14400 # Node ID 2e9e6224245185097fbf2da0f81e4897288f4fda # Parent a65c2dddbf5d6eeb72d5d6e1f51e7affb98fe979 typing: disable some pytype errors in `mercurial.store` These seem to be legitimate errors, since one of the two callers (`encodedstore.data_entries()`) was previously typed to generate `BaseStoreEntry`. However, that and the other caller only pass `RevlogStoreEntry` objects. I can't tell if this was a WIP or what, but don't want to get side tracked on this. So flag as a TODO for later. diff -r a65c2dddbf5d -r 2e9e62242451 mercurial/store.py --- a/mercurial/store.py Tue Jul 23 19:05:26 2024 -0400 +++ b/mercurial/store.py Tue Jul 23 19:14:16 2024 -0400 @@ -40,7 +40,7 @@ fncache_chunksize = 10**6 -def _match_tracked_entry(entry, matcher): +def _match_tracked_entry(entry: "BaseStoreEntry", matcher): """parses a fncache entry and returns whether the entry is tracking a path matched by matcher or not. @@ -48,10 +48,16 @@ if matcher is None: return True + + # TODO: make this safe for other entry types. Currently, the various + # store.data_entry generators only yield RevlogStoreEntry, so the + # attributes do exist on `entry`. + # pytype: disable=attribute-error if entry.is_filelog: return matcher(entry.target_id) elif entry.is_manifestlog: return matcher.visitdir(entry.target_id.rstrip(b'/')) + # pytype: enable=attribute-error raise error.ProgrammingError(b"cannot process entry %r" % entry)