Skip to content

Commit 05d29ba

Browse files
author
Bob Clary
committed
Bug 1681096 - python3 - pylint --py3k - W1633: round built-in referenced (round-builtin) r=marionette-reviewers,perftest-reviewers,aki,gbrown,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D99067
1 parent c29f516 commit 05d29ba

File tree

9 files changed

+42
-11
lines changed

9 files changed

+42
-11
lines changed

testing/marionette/client/marionette_driver/wait.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ def until(self, condition, is_true=None, message=""):
154154
message = " with message: {}".format(message)
155155

156156
raise errors.TimeoutException(
157+
# pylint: disable=W1633
157158
"Timed out after {0:.1f} seconds{1}".format(
158-
round((self.clock.now - start), 1), message if message else ""
159+
float(round((self.clock.now - start), 1)), message if message else ""
159160
),
160161
cause=last_exc,
161162
)

testing/mozbase/manifestparser/manifestparser/filters.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def __call__(self, tests, values):
206206
chunk_tests = [t for t in tests if "disabled" not in t]
207207

208208
tests_per_chunk = float(len(chunk_tests)) / self.total_chunks
209+
# pylint: disable=W1633
209210
start = int(round((self.this_chunk - 1) * tests_per_chunk))
210211
end = int(round(self.this_chunk * tests_per_chunk))
211212

@@ -268,6 +269,7 @@ def __call__(self, tests, values):
268269
ordered_dirs.append(path)
269270
tests_by_dir[path].append(test)
270271

272+
# pylint: disable=W1633
271273
tests_per_chunk = float(len(ordered_dirs)) / self.total_chunks
272274
start = int(round((self.this_chunk - 1) * tests_per_chunk))
273275
end = int(round(self.this_chunk * tests_per_chunk))
@@ -363,6 +365,7 @@ def get_chunked_manifests(self, manifests):
363365
# Compute the average to use as a default for manifests that don't exist.
364366
times = [r[0] for r in runtimes]
365367
# pylint --py3k W1619
368+
# pylint: disable=W1633
366369
avg = round(sum(times) / len(times), 2) if times else 0
367370
missing = sorted([m for m in manifests if m not in self.runtimes])
368371
log(
@@ -394,6 +397,7 @@ def __call__(self, tests, values):
394397
chunks = self.get_chunked_manifests(manifests)
395398
runtime, this_manifests = chunks[self.this_chunk - 1]
396399
# pylint --py3k W1619
400+
# pylint: disable=W1633
397401
log(
398402
"Cumulative test runtime is around {} minutes (average is {} minutes)".format(
399403
round(runtime / 60),

testing/mozbase/mozlog/mozlog/scripts/logmerge.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def dump_entry(entry, output):
1919

2020

2121
def fill_process_info(event):
22+
# pylint: disable=W1633
2223
event["time"] = int(round(time.time() * 1000))
2324
event["thread"] = current_thread().name
2425
event["pid"] = os.getpid()

testing/mozbase/mozlog/mozlog/unstructured/logger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class JSONFormatter(Formatter):
105105

106106
def format(self, record):
107107
# Default values determined by logger metadata
108+
# pylint: disable=W1633
108109
output = {
109110
"_time": int(round(record.created * 1000, 0)),
110111
"_namespace": record.name,

testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def get_new_csp_header(self, headers, updated_csp_script):
111111

112112
def response(self, flow):
113113

114+
# pylint: disable=W1633
114115
millis = int(round(time.time() * 1000))
115116

116117
if "content-type" in flow.response.headers:

testing/mozharness/mozharness/base/python.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ def log_usage(prefix, duration, cpu_percent, cpu_times, io):
702702
# being fed into a 'f' formatter. This will help diagnose the
703703
# issue.
704704
if cpu_percent:
705+
# pylint: disable=W1633
705706
cpu_percent_str = str(round(cpu_percent)) + "%"
706707
else:
707708
cpu_percent_str = "Can't collect data"

testing/raptor/raptor/output.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def _filter(vals, value=None):
391391
return filters.mean(_filter(vals, "Geometric Mean"))
392392

393393
if testname.startswith("raptor-assorted-dom"):
394+
# pylint: disable=W1633
394395
return round(filters.geometric_mean(_filter(vals)), 2)
395396

396397
if testname.startswith("raptor-wasm-misc"):
@@ -402,6 +403,7 @@ def _filter(vals, value=None):
402403
return filters.mean(_filter(vals, "first-interactive"))
403404

404405
if testname.startswith("raptor-youtube-playback"):
406+
# pylint: disable=W1633
405407
return round(filters.mean(_filter(vals)), 2)
406408

407409
if testname.startswith("supporting_data"):
@@ -431,8 +433,10 @@ def _filter(vals, value=None):
431433
raise NotImplementedError("Unit %s not suported" % unit)
432434

433435
if len(vals) > 1:
436+
# pylint: disable=W1633
434437
return round(filters.geometric_mean(_filter(vals)), 2)
435438

439+
# pylint: disable=W1633
436440
return round(filters.mean(_filter(vals)), 2)
437441

438442
def parseSpeedometerOutput(self, test):
@@ -467,6 +471,7 @@ def parseSpeedometerOutput(self, test):
467471
"name": sub,
468472
"replicates": [],
469473
}
474+
# pylint: disable=W1633
470475
_subtests[sub]["replicates"].extend([round(x, 3) for x in replicates])
471476

472477
vals = []
@@ -574,7 +579,10 @@ def parseAresSixOutput(self, test):
574579
"name": sub,
575580
"replicates": [],
576581
}
577-
_subtests[sub]["replicates"].extend([round(x, 3) for x in replicates])
582+
# pylint: disable=W1633
583+
_subtests[sub]["replicates"].extend(
584+
[float(round(x, 3)) for x in replicates]
585+
)
578586

579587
vals = []
580588
for name, test in _subtests.items():
@@ -680,8 +688,9 @@ def create_subtest_entry(
680688
names = list(_subtests)
681689
names.sort(reverse=True)
682690
for name in names:
691+
# pylint: disable=W1633
683692
_subtests[name]["value"] = round(
684-
filters.median(_subtests[name]["replicates"]), 2
693+
float(filters.median(_subtests[name]["replicates"])), 2
685694
)
686695
subtests.append(_subtests[name])
687696
# only include dropped_frames values, without the %_dropped_frames values
@@ -1051,7 +1060,10 @@ def parseJetstreamTwoOutput(self, test):
10511060
"name": sub,
10521061
"replicates": [],
10531062
}
1054-
_subtests[sub]["replicates"].extend([round(x, 3) for x in replicates])
1063+
# pylint: disable=W1633
1064+
_subtests[sub]["replicates"].extend(
1065+
[float(round(x, 3)) for x in replicates]
1066+
)
10551067

10561068
vals = []
10571069
subtests = []
@@ -1180,7 +1192,10 @@ def parseWebaudioOutput(self, test):
11801192
"name": sub,
11811193
"replicates": [],
11821194
}
1183-
_subtests[sub]["replicates"].extend([round(x, 3) for x in replicates])
1195+
# pylint: disable=W1633
1196+
_subtests[sub]["replicates"].extend(
1197+
[float(round(x, 3)) for x in replicates]
1198+
)
11841199

11851200
vals = []
11861201
subtests = []
@@ -1227,6 +1242,7 @@ def parseMotionmarkOutput(self, test):
12271242
suite = list(page_cycle_results)[0]
12281243
for sub in page_cycle_results[suite].keys():
12291244
try:
1245+
# pylint: disable=W1633
12301246
replicate = round(
12311247
float(page_cycle_results[suite][sub]["frameLength"]["average"]),
12321248
3,
@@ -1273,7 +1289,10 @@ def parseSunspiderOutput(self, test):
12731289
"name": sub,
12741290
"replicates": [],
12751291
}
1276-
_subtests[sub]["replicates"].extend([round(x, 3) for x in replicates])
1292+
# pylint: disable=W1633
1293+
_subtests[sub]["replicates"].extend(
1294+
[float(round(x, 3)) for x in replicates]
1295+
)
12771296

12781297
subtests = []
12791298
vals = []
@@ -1323,8 +1342,9 @@ def parseAssortedDomOutput(self, test):
13231342
names = list(_subtests)
13241343
names.sort(reverse=True)
13251344
for name in names:
1326-
_subtests[name]["value"] = round(
1327-
filters.median(_subtests[name]["replicates"]), 2
1345+
# pylint: disable=W1633
1346+
_subtests[name]["value"] = float(
1347+
round(filters.median(_subtests[name]["replicates"]), 2)
13281348
)
13291349
subtests.append(_subtests[name])
13301350
# only use the 'total's to compute the overall result

testing/talos/talos/run_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,8 @@ def make_comparison_result(base_and_reference_results):
457457
_index = 0
458458
for next_ref in comp_results[subtest_index]["ref_runs"]:
459459
diff = abs(next_ref - comp_results[subtest_index]["base_runs"][_index])
460-
comp_results[subtest_index]["runs"].append(round(diff, 3))
460+
# pylint: disable=W1633
461+
comp_results[subtest_index]["runs"].append(float(round(diff, 3)))
461462
_index += 1
462463

463464
# increment our base vs reference subtest index

testing/testinfo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def update_item(item, label, value):
671671
if type(new_value) == int:
672672
item[label] = new_value
673673
else:
674-
item[label] = round(new_value, 2)
674+
item[label] = float(round(new_value, 2)) # pylint: disable=W1633
675675

676676
if "test" in result and "tests" in by_component:
677677
test = result["test"]
@@ -680,7 +680,8 @@ def update_item(item, label, value):
680680
for bc in by_component["tests"]:
681681
for item in by_component["tests"][bc]:
682682
if test == item["test"]:
683-
seconds = round(result.get("duration", 0), 2)
683+
# pylint: disable=W1633
684+
seconds = float(round(result.get("duration", 0), 2))
684685
update_item(item, "total run time, seconds", seconds)
685686
update_item(item, "total runs", result.get("count", 0))
686687
update_item(item, "skipped runs", result.get("skips", 0))

0 commit comments

Comments
 (0)