pep-479 codemod

Summary:
https://www.python.org/dev/peps/pep-0479/

If you are in a generator (a function that uses "yield") you are never allowed to raise StopIteration instead you should just `return` or pass out of scope (implicit return None)

Reviewed By: thatch

Differential Revision: D17749640

fbshipit-source-id: 9f1be673cf877ff193a0379a0208d037dd2d7bae
This commit is contained in:
Jason Fried 2019-10-04 15:22:09 -07:00 committed by Facebook Github Bot
parent 1d616cebe0
commit 8d130ad96d

View File

@ -190,7 +190,7 @@ def _diff(orig, repo, *args, **kwargs):
node2 = kwargs.get("node2") or args[1]
if node2 is None:
# this should be the snapshot node
raise StopIteration
return
ctx2 = repo.unfiltered()[node2]
date2 = util.datestr(ctx2.date())
node1 = kwargs.get("node1") or args[0]
@ -203,7 +203,7 @@ def _diff(orig, repo, *args, **kwargs):
metadataid = ctx2.extra().get("snapshotmetadataid", "")
if not metadataid:
# node2 is not a snapshot
raise StopIteration
return
snapmetadata = snapshotmetadata.getfromlocalstorage(repo, metadataid)
store = repo.svfs.snapshotstore
# print unknown files from snapshot