# HG changeset patch # User Matt Harbison # Date 1639371893 18000 # Node ID 79b9043133576f3e9762d0fc804da4038b23d221 # Parent 19e6446cea114985e7855130a3d6850ac3e79c24 pytype: stop excluding copies.py I can't prove that `targetrev` is always in `all_copies`, but it would have been a runtime error before too if it's not. Differential Revision: https://phab.mercurial-scm.org/D11916 diff -r 19e6446cea11 -r 79b904313357 mercurial/copies.py --- a/mercurial/copies.py Sun Dec 12 22:29:46 2021 -0500 +++ b/mercurial/copies.py Mon Dec 13 00:04:53 2021 -0500 @@ -448,7 +448,11 @@ # filter out internal details and return a {dest: source mapping} final_copies = {} - for dest, (tt, source) in all_copies[targetrev].items(): + + targetrev_items = all_copies[targetrev] + assert targetrev_items is not None # help pytype + + for dest, (tt, source) in targetrev_items.items(): if source is not None: final_copies[dest] = source if not alwaysmatch: diff -r 19e6446cea11 -r 79b904313357 tests/test-check-pytype.t --- a/tests/test-check-pytype.t Sun Dec 12 22:29:46 2021 -0500 +++ b/tests/test-check-pytype.t Mon Dec 13 00:04:53 2021 -0500 @@ -13,7 +13,6 @@ mercurial/chgserver.py # [attribute-error] mercurial/cmdutil.py # No attribute 'markcopied' on mercurial.context.filectx [attribute-error] mercurial/context.py # many [attribute-error] -mercurial/copies.py # No attribute 'items' on None [attribute-error] mercurial/crecord.py # tons of [attribute-error], [module-attr] mercurial/debugcommands.py # [wrong-arg-types] mercurial/dispatch.py # initstdio: No attribute ... on TextIO [attribute-error] @@ -57,7 +56,6 @@ > -x mercurial/chgserver.py \ > -x mercurial/cmdutil.py \ > -x mercurial/context.py \ - > -x mercurial/copies.py \ > -x mercurial/crecord.py \ > -x mercurial/debugcommands.py \ > -x mercurial/dispatch.py \