manifest: help pytype to understant `writesubtrees`'s `getnode` type
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 05 Aug 2024 10:15:10 +0200
changeset 51773 e2f1efa2bd86
parent 51772 8e1b28687704
child 51774 79e0ee356f32
manifest: help pytype to understant `writesubtrees`'s `getnode` type Since we provide a default, the return of `_lazydirs.get` is cannot be None. We help pytype to understand that.
mercurial/manifest.py
--- a/mercurial/manifest.py	Mon Aug 05 10:13:31 2024 +0200
+++ b/mercurial/manifest.py	Mon Aug 05 10:15:10 2024 +0200
@@ -1407,7 +1407,9 @@
             ld = m._lazydirs.get(d)
             if ld:
                 return ld[0]
-            return m._dirs.get(d, emptytree)._node
+            tree = m._dirs.get(d, emptytree)
+            assert tree is not None  # helps pytype
+            return tree._node
 
         # let's skip investigating things that `match` says we do not need.
         visit = match.visitchildrenset(self._dir[:-1])