1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
From: Eamonn Kent <ekent@fb.com>
Date: Thu, 31 Aug 2017 15:23:42 -0700
Subject: Have bin scripts use iter() method for python3
Summary:
Iterable dict items should use iteritems in python 2 and items in python 3.
The change was made in a way to not require any additional package
dependencies.
Reviewed By: wez
Differential Revision: D5740400
fbshipit-source-id: 65d543d88cb1b2a4dd17de8632c3723ae308f9a1
(cherry picked from commit 17958f7da287e8d0f977693f4ef4f0973a17069b)
Origin: upstream, v2020.05.11.00
---
python/bin/watchman-make | 6 +++---
python/bin/watchman-wait | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/python/bin/watchman-make b/python/bin/watchman-make
index ee52fde..8fc3329 100755
--- a/python/bin/watchman-make
+++ b/python/bin/watchman-make
@@ -209,7 +209,7 @@ while True:
client.setTimeout(600)
result = client.receive()
- for _, t in targets.iteritems():
+ for _, t in targets.items():
t.consumeEvents(client)
# Now we wait for events to settle
@@ -218,7 +218,7 @@ while True:
while not settled:
try:
result = client.receive()
- for _, t in targets.iteritems():
+ for _, t in targets.items():
t.consumeEvents(client)
except pywatchman.SocketTimeout as ex:
# Our short settle timeout hit, so we're now settled
@@ -226,7 +226,7 @@ while True:
break
# Now we can work on executing the targets
- for _, t in targets.iteritems():
+ for _, t in targets.items():
t.execute()
# Print this at the bottom of the loop rather than the top
diff --git a/python/bin/watchman-wait b/python/bin/watchman-wait
index f3d5026..9603b99 100755
--- a/python/bin/watchman-wait
+++ b/python/bin/watchman-wait
@@ -182,7 +182,7 @@ client = pywatchman.client()
try:
client.capabilityCheck(
required=['term-dirname', 'cmd-watch-project', 'wildmatch'])
- for _, sub in subscriptions.iteritems():
+ for _, sub in subscriptions.items():
sub.start(client)
except pywatchman.CommandError as ex:
@@ -200,7 +200,7 @@ while deadline is None or time.time() < deadline:
# the client object will accumulate all subscription results
# over time, so we ask it to remove and return those values
# for each of the subscriptions
- for _, sub in subscriptions.iteritems():
+ for _, sub in subscriptions.items():
sub.emit(client)
except pywatchman.SocketTimeout as ex:
|