Skip to content

Commit 290b349

Browse files
authored
[CI] Fix python lint (#2925)
# Motivation Fix the python lint check. # Modification This PR fixes all the warnings related to the new python lint check. # Result Only green CI.
1 parent efe445d commit 290b349

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
2222
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
23-
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
23+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
2424
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
2525
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
2626

.github/workflows/scheduled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
1414
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15-
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
1616
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
1717
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
1818

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mallocCountTotal" : 8000
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mallocCountTotal" : 548
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mallocCountTotal" : 164376
3+
}

dev/stackdiff-dtrace.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@
1313
##
1414
##===----------------------------------------------------------------------===##
1515

16-
import sys
17-
import re
1816
import collections
17+
import re
18+
import sys
1919

2020
num_regex = "^ +([0-9]+)$"
2121

22+
2223
def put_in_dict(path):
2324
# Our input looks something like:
2425
#
2526
# =====
2627
# This will collect stack shots of allocations and print it when you exit dtrace.
27-
# So go ahead, run your tests and then press Ctrl+C in this window to see the aggregated result
28+
# So go ahead, run your tests and then press Ctrl+C in this window to see the aggregated result # noqa: E501
2829
# =====
2930
# DEBUG: After waiting 1 times, we quiesced to unfreeds=744
3031
# test_1_reqs_1000_conn.total_allocations: 490000
@@ -39,11 +40,11 @@ def put_in_dict(path):
3940
# libswiftCore.dylib`swift_allocObject+0x27
4041
# test_1_reqs_1000_conn`closure #3 in SelectableEventLoop.run()+0x166
4142
# test_1_reqs_1000_conn`SelectableEventLoop.run()+0x234
42-
# test_1_reqs_1000_conn`closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x12e
43-
# test_1_reqs_1000_conn`partial apply for closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x25
44-
# test_1_reqs_1000_conn`thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0xf
45-
# test_1_reqs_1000_conn`partial apply for thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0x11
46-
# test_1_reqs_1000_conn`closure #1 in static ThreadOpsPosix.run(handle:args:detachThread:)+0x1c9
43+
# test_1_reqs_1000_conn`closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x12e # noqa: E501
44+
# test_1_reqs_1000_conn`partial apply for closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x25 # noqa: E501
45+
# test_1_reqs_1000_conn`thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0xf # noqa: E501
46+
# test_1_reqs_1000_conn`partial apply for thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0x11 # noqa: E501
47+
# test_1_reqs_1000_conn`closure #1 in static ThreadOpsPosix.run(handle:args:detachThread:)+0x1c9 # noqa: E501
4748
# libsystem_pthread.dylib`_pthread_start+0xe0
4849
# libsystem_pthread.dylib`thread_start+0xf
4950
# 85945
@@ -71,7 +72,7 @@ def put_in_dict(path):
7172
key = "\n".join(line.split("+")[0] for line in current_stack[:8])
7273

7374
# Record this stack and reset our state to build a new one.
74-
dictionary[key].append( (int(line), "\n".join(current_stack)) )
75+
dictionary[key].append((int(line), "\n".join(current_stack)))
7576
current_stack = []
7677
else:
7778
# This line doesn't contain just a number. This might be an
@@ -82,30 +83,35 @@ def put_in_dict(path):
8283

8384
return dictionary
8485

86+
8587
def total_count_for_key(d, key):
8688
value = d[key]
87-
return sum(map(lambda x : x[0], value))
89+
return sum(map(lambda x: x[0], value))
90+
8891

8992
def total_for_dictionary(d):
9093
total = 0
9194
for k in d.keys():
9295
total += total_count_for_key(d, k)
9396
return total
9497

98+
9599
def extract_useful_keys(d):
96100
keys = set()
97101
for k in d.keys():
98102
if total_count_for_key(d, k) >= 1000:
99103
keys.add(k)
100104
return keys
101105

106+
102107
def print_dictionary_member(d, key):
103108
print(total_count_for_key(d, key))
104109
print(key)
105110
print()
106111
print_dictionary_member_detail(d, key)
107112
print()
108113

114+
109115
def print_dictionary_member_detail(d, key):
110116
value = d[key]
111117
for (count, stack) in value:
@@ -128,6 +134,7 @@ def usage():
128134
print(" # diff them")
129135
print(" stackdiff-dtrace.py /tmp/old /tmp/new")
130136

137+
131138
if len(sys.argv) != 3:
132139
usage()
133140
sys.exit(1)
@@ -173,5 +180,4 @@ def usage():
173180

174181
everything_before = total_for_dictionary(before_dict)
175182
everything_after = total_for_dictionary(after_dict)
176-
print("Total of _EVERYTHING_ BEFORE: %d, AFTER: %d, DIFFERENCE: %d" %
177-
(everything_before, everything_after, everything_after - everything_before))
183+
print("Total of _EVERYTHING_ BEFORE: %d, AFTER: %d, DIFFERENCE: %d" % (everything_before, everything_after, everything_after - everything_before)) # noqa: E501

0 commit comments

Comments
 (0)