зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681096 - python3 - pylint --py3k - W1619: from __future__ import division r=marionette-reviewers,perftest-reviewers,gbrown
Differential Revision: https://phabricator.services.mozilla.com/D98938
This commit is contained in:
Родитель
c90491dbe9
Коммит
9e125ea710
|
@ -3,7 +3,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -54,10 +54,12 @@ PERF_SUITES = [
|
|||
|
||||
def median(values):
|
||||
sorted_ = sorted(values)
|
||||
# pylint --py3k W1619
|
||||
med = int(len(sorted_) / 2)
|
||||
|
||||
if len(sorted_) % 2:
|
||||
return sorted_[med]
|
||||
# pylint --py3k W1619
|
||||
return (sorted_[med - 1] + sorted_[med]) / 2
|
||||
|
||||
|
||||
|
@ -173,6 +175,7 @@ def create_suite(
|
|||
|
||||
# Add the geometric mean. For more details on the calculation see:
|
||||
# https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
|
||||
# pylint --py3k W1619
|
||||
suite["value"] = math.exp(total / len(checkpoints))
|
||||
|
||||
return suite
|
||||
|
|
|
@ -22,7 +22,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
@ -92,6 +92,7 @@ class Bar(object):
|
|||
self.last_progress = progress
|
||||
if (time.time() - self.etadelta) > ETA_INTERVAL:
|
||||
self.etadelta = time.time()
|
||||
# pylint --py3k W1619
|
||||
self.ittimes = self.ittimes[-ETA_SMA_WINDOW:] + [
|
||||
-(self.start - time.time()) / (progress + 1)
|
||||
]
|
||||
|
@ -101,6 +102,7 @@ class Bar(object):
|
|||
* (self.expected_size - progress)
|
||||
)
|
||||
self.etadisp = self.format_time(self.eta)
|
||||
# pylint --py3k W1619
|
||||
x = int(self.width * progress / self.expected_size)
|
||||
if not self.hide:
|
||||
if (progress % self.every) == 0 or ( # True every "every" updates
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#
|
||||
# This module needs to stay Python 2 and 3 compatible
|
||||
#
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import platform
|
||||
import time
|
||||
|
@ -245,6 +244,7 @@ def download_file(url, target=None):
|
|||
f.flush()
|
||||
else:
|
||||
iter = req.iter_content(chunk_size=1024)
|
||||
# pylint --py3k W1619
|
||||
size = total_length / 1024 + 1
|
||||
for chunk in progress.bar(iter, expected_size=size):
|
||||
if chunk:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from __future__ import division, print_function
|
||||
import sys
|
||||
import subprocess
|
||||
import json
|
||||
|
@ -13,6 +12,7 @@ for line in proc.stdout:
|
|||
data = json.loads(line[len("PERFHERDER_DATA:") :].decode("utf8"))
|
||||
for suite in data["suites"]:
|
||||
for subtest in suite["subtests"]:
|
||||
# pylint --py3k W1619
|
||||
print(
|
||||
"%4d.%03d ± %6s ms %s.%s"
|
||||
% (
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
|
@ -137,6 +137,7 @@ class RunOnceBenchmark(Benchmark):
|
|||
for bench, scores in self.scores.items():
|
||||
for score, values in scores.items():
|
||||
test_name = "{}-{}".format(self.name, score)
|
||||
# pylint --py3k W1619
|
||||
mean = sum(values) / len(values)
|
||||
self.suite["subtests"].append({"name": test_name, "value": mean})
|
||||
bench_total += int(sum(values))
|
||||
|
@ -193,6 +194,7 @@ class Ares6(Benchmark):
|
|||
def collect_results(self):
|
||||
for bench, scores in self.scores.items():
|
||||
for score, values in scores.items():
|
||||
# pylint --py3k W1619
|
||||
mean = sum(values) / len(values)
|
||||
test_name = "{}-{}".format(bench, score)
|
||||
self.suite["subtests"].append({"name": test_name, "value": mean})
|
||||
|
@ -296,6 +298,7 @@ class WebToolingBenchmark(Benchmark):
|
|||
for bench, scores in self.scores.items():
|
||||
for score_name, values in scores.items():
|
||||
test_name = "{}-{}".format(self.name, score_name)
|
||||
# pylint --py3k W1619
|
||||
mean = sum(values) / len(values)
|
||||
self.suite["subtests"].append(
|
||||
{
|
||||
|
@ -348,6 +351,7 @@ class Octane(RunOnceBenchmark):
|
|||
for bench, scores in self.scores.items():
|
||||
for score_name, values in scores.items():
|
||||
test_name = "{}-{}".format(self.name, score_name)
|
||||
# pylint --py3k W1619
|
||||
mean = sum(values) / len(values)
|
||||
self.suite["subtests"].append({"name": test_name, "value": mean})
|
||||
if score_name == "score":
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from .legacy_actions import MultiActions, Actions
|
||||
|
||||
|
@ -70,6 +70,7 @@ def pinch(marionette_session, element, x1, y1, x2, y2, x3, y3, x4, y4, duration=
|
|||
time_increment = 10
|
||||
if time_increment >= duration:
|
||||
time_increment = duration
|
||||
# pylint --py3k W1619
|
||||
move_x1 = time_increment * 1.0 / duration * (x3 - x1)
|
||||
move_y1 = time_increment * 1.0 / duration * (y3 - y1)
|
||||
move_x2 = time_increment * 1.0 / duration * (x4 - x2)
|
||||
|
@ -81,6 +82,7 @@ def pinch(marionette_session, element, x1, y1, x2, y2, x3, y3, x4, y4, duration=
|
|||
action2.press(element, x2, y2)
|
||||
while time < duration:
|
||||
time += time_increment
|
||||
# pylint --py3k W1619
|
||||
action1.move_by_offset(move_x1, move_y1).wait(time_increment / 1000)
|
||||
action2.move_by_offset(move_x2, move_y2).wait(time_increment / 1000)
|
||||
action1.release()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from . import errors
|
||||
from .marionette import MouseButton
|
||||
|
@ -218,12 +218,14 @@ class Actions(object):
|
|||
time_increment = 10
|
||||
if time_increment >= duration:
|
||||
time_increment = duration
|
||||
# pylint --py3k W1619
|
||||
move_x = time_increment * 1.0 / duration * (x2 - x1)
|
||||
move_y = time_increment * 1.0 / duration * (y2 - y1)
|
||||
self.action_chain.append(["press", element, x1, y1])
|
||||
while elapsed < duration:
|
||||
elapsed += time_increment
|
||||
self.action_chain.append(["moveByOffset", move_x, move_y])
|
||||
# pylint --py3k W1619
|
||||
self.action_chain.append(["wait", time_increment / 1000])
|
||||
self.action_chain.append(["release"])
|
||||
return self
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import base64
|
||||
import datetime
|
||||
|
@ -1195,6 +1195,7 @@ class Marionette(object):
|
|||
|
||||
timeout = self.session.get("moz:shutdownTimeout")
|
||||
if timeout is not None:
|
||||
# pylint --py3k W1619
|
||||
self.shutdown_timeout = timeout / 1000 + 10
|
||||
|
||||
return self.session
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from six.moves.urllib.parse import quote
|
||||
|
||||
|
@ -45,6 +45,7 @@ class BaseMouseAction(MarionetteTestCase):
|
|||
)
|
||||
|
||||
def get_element_center_point(self, elem):
|
||||
# pylint --py3k W1619
|
||||
return {
|
||||
"x": elem.rect["x"] + elem.rect["width"] / 2,
|
||||
"y": elem.rect["y"] + elem.rect["height"] / 2,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import print_function
|
||||
from __future__ import division, print_function
|
||||
|
||||
import math
|
||||
import mozinfo
|
||||
|
@ -139,6 +139,7 @@ class Bisect(object):
|
|||
self.contents["start"] = 0
|
||||
self.contents["end"] = totalTests - 2
|
||||
|
||||
# pylint --py3k W1619
|
||||
mid = (self.contents["start"] + self.contents["end"]) / 2
|
||||
if "result" in self.contents:
|
||||
if self.contents["result"] == "PASS":
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# The content of this file comes orginally from automationutils.py
|
||||
# and *should* be revised.
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import re
|
||||
from operator import itemgetter
|
||||
|
||||
|
@ -153,6 +155,7 @@ class ShutdownLeaks(object):
|
|||
# Note: to figure out how many hidden windows were created, we divide
|
||||
# this number by 2, because 1 hidden window creation implies in
|
||||
# 1 outer window + 1 inner window.
|
||||
# pylint --py3k W1619
|
||||
self.logger.info(
|
||||
"TEST-INFO | %s | This test created %d hidden window(s)"
|
||||
% (test["fileName"], test["hiddenWindowsCount"] / 2)
|
||||
|
|
|
@ -33,6 +33,8 @@ Specification:
|
|||
http://tools.ietf.org/html/rfc6455
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
|
||||
from collections import deque
|
||||
import logging
|
||||
import os
|
||||
|
@ -272,6 +274,7 @@ def parse_frame(receive_bytes,
|
|||
raw_payload_bytes = receive_bytes(payload_length)
|
||||
|
||||
if logger.isEnabledFor(common.LOGLEVEL_FINE):
|
||||
# pylint --py3k W1619
|
||||
logger.log(
|
||||
common.LOGLEVEL_FINE, 'Done receiving payload data at %s MB/s',
|
||||
payload_length / (time.time() - receive_start) / 1000 / 1000)
|
||||
|
@ -283,6 +286,7 @@ def parse_frame(receive_bytes,
|
|||
unmasked_bytes = masker.mask(raw_payload_bytes)
|
||||
|
||||
if logger.isEnabledFor(common.LOGLEVEL_FINE):
|
||||
# pylint --py3k W1619
|
||||
logger.log(common.LOGLEVEL_FINE,
|
||||
'Done unmasking payload data at %s MB/s',
|
||||
payload_length / (time.time() - unmask_start) / 1000 / 1000)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
Runs the Mochitest test harness.
|
||||
"""
|
||||
|
||||
from __future__ import print_function, with_statement
|
||||
from __future__ import division, print_function, with_statement
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -357,6 +357,7 @@ class MessageLogger(object):
|
|||
|
||||
last_timestamp = None
|
||||
for buf in dumped_messages:
|
||||
# pylint --py3k W1619
|
||||
timestamp = datetime.fromtimestamp(buf["time"] / 1000).strftime("%H:%M:%S")
|
||||
if timestamp != last_timestamp:
|
||||
self.logger.info("Buffered messages logged at {}".format(timestamp))
|
||||
|
|
|
@ -8,7 +8,7 @@ dictionary of values, and returns a new iterable of test objects. It is
|
|||
possible to define custom filters if the built-in ones are not enough.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import itertools
|
||||
import os
|
||||
|
@ -362,6 +362,7 @@ class chunk_by_runtime(InstanceFilter):
|
|||
|
||||
# Compute the average to use as a default for manifests that don't exist.
|
||||
times = [r[0] for r in runtimes]
|
||||
# pylint --py3k W1619
|
||||
avg = round(sum(times) / len(times), 2) if times else 0
|
||||
missing = sorted([m for m in manifests if m not in self.runtimes])
|
||||
log(
|
||||
|
@ -392,6 +393,7 @@ class chunk_by_runtime(InstanceFilter):
|
|||
manifests = set(self.get_manifest(t) for t in tests)
|
||||
chunks = self.get_chunked_manifests(manifests)
|
||||
runtime, this_manifests = chunks[self.this_chunk - 1]
|
||||
# pylint --py3k W1619
|
||||
log(
|
||||
"Cumulative test runtime is around {} minutes (average is {} minutes)".format(
|
||||
round(runtime / 60),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import io
|
||||
import os
|
||||
|
@ -3401,6 +3401,7 @@ class ADBDevice(ADBCommand):
|
|||
elif parameter == "scale":
|
||||
scale = float(value)
|
||||
if parameter is not None and scale is not None:
|
||||
# pylint --py3k W1619
|
||||
percentage = 100.0 * level / scale
|
||||
break
|
||||
return percentage
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
|
@ -312,6 +312,7 @@ class ProfileSymbolicator:
|
|||
left = 0
|
||||
right = len(libs) - 1
|
||||
while left <= right:
|
||||
# pylint --py3k W1619
|
||||
mid = (left + right) / 2
|
||||
if address >= libs[mid]["end"]:
|
||||
left = mid + 1
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import functools
|
||||
from collections import deque
|
||||
|
@ -307,6 +307,7 @@ class TbplFormatter(BaseFormatter):
|
|||
|
||||
def suite_end(self, data):
|
||||
start_time = self.suite_start_time
|
||||
# pylint --py3k W1619
|
||||
time = int((data["time"] - start_time) / 1000)
|
||||
|
||||
return "SUITE-END | took %is\n" % time
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from . import base
|
||||
|
||||
|
@ -78,6 +78,7 @@ class UnittestFormatter(base.BaseFormatter):
|
|||
return "\n".join("ERROR %(test)s\n%(message)s" % data for data in self.errors)
|
||||
|
||||
def output_summary(self):
|
||||
# pylint --py3k W1619
|
||||
return "Ran %i tests in %.1fs" % (
|
||||
self.tests_run,
|
||||
(self.end_time - self.start_time) / 1000,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
import csv
|
||||
import os
|
||||
|
@ -548,6 +548,7 @@ class IPGResultsHandler(object):
|
|||
# exist in the file and that the columns have the correct
|
||||
# data type.
|
||||
column_datatypes = {"System Time": str, "RDTSC": int, "default": float}
|
||||
# pylint --py3k W1619
|
||||
expected_samples = int(
|
||||
self._ipg_measure_duration / (float(self._sampling_rate) / 1000)
|
||||
)
|
||||
|
@ -694,6 +695,7 @@ class IPGResultsHandler(object):
|
|||
)
|
||||
|
||||
# Check that the combined results have the expected number of samples.
|
||||
# pylint W16919
|
||||
expected_samples = int(
|
||||
self._ipg_measure_duration / (float(self._sampling_rate) / 1000)
|
||||
)
|
||||
|
@ -817,6 +819,7 @@ class IPGResultsHandler(object):
|
|||
watt_usage = {}
|
||||
for measure in cut_results:
|
||||
if "watt" in measure.lower() and "limit" not in measure.lower():
|
||||
# pylint --py3k W1619
|
||||
watt_usage[replace_measure_name(measure) + "-avg"] = sum(
|
||||
[float(val) for val in cut_results[measure]]
|
||||
) / len(cut_results[measure])
|
||||
|
@ -839,6 +842,7 @@ class IPGResultsHandler(object):
|
|||
elif "gt " in utilized_name:
|
||||
utilized_name = "gpu"
|
||||
|
||||
# pylint --py3k W1619
|
||||
average_utilization[utilized_name] = sum(
|
||||
[float(val) for val in cut_results[utilization]]
|
||||
) / len(cut_results[utilization])
|
||||
|
@ -857,6 +861,7 @@ class IPGResultsHandler(object):
|
|||
fmeasure_name = "cpu"
|
||||
elif "gt " in fmeasure_name:
|
||||
fmeasure_name = "gpu"
|
||||
# pylint --py3k W1619
|
||||
|
||||
frequency_info[fmeasure_name]["favg"] = sum(
|
||||
[float(val) for val in cut_results[frequency_measure]]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
|
||||
def get_logger(logger_name):
|
||||
|
@ -32,6 +32,7 @@ def average_summary(values):
|
|||
:param list values: list of values to average.
|
||||
:returns: float
|
||||
"""
|
||||
# pylint --py3k W1619
|
||||
return sum([float(v[0]) for v in values]) / len(values)
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import os
|
||||
|
||||
|
@ -35,6 +35,7 @@ def test_with_profile_should_cleanup():
|
|||
|
||||
def test_with_profile_should_cleanup_even_on_exception():
|
||||
with pytest.raises(ZeroDivisionError):
|
||||
# pylint --py3k W1619
|
||||
with Profile() as profile:
|
||||
assert os.path.exists(profile.profile)
|
||||
1 / 0 # will raise ZeroDivisionError
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
|
||||
class EmulatorBattery(object):
|
||||
|
@ -26,6 +26,7 @@ class EmulatorBattery(object):
|
|||
value = float(value)
|
||||
status[field] = value
|
||||
|
||||
# pylint --py3k W1619
|
||||
state["level"] = status.get("capacity", 0.0) / 100
|
||||
if status.get("AC") == "online":
|
||||
state["charging"] = True
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
"""Utility functions for mozrunner"""
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -170,6 +170,7 @@ def test_environment(
|
|||
|
||||
# Returns total system memory in kilobytes.
|
||||
if mozinfo.isWin:
|
||||
# pylint --py3k W1619
|
||||
totalMemory = (
|
||||
int(
|
||||
os.popen(
|
||||
|
@ -179,6 +180,7 @@ def test_environment(
|
|||
/ 1024
|
||||
)
|
||||
elif mozinfo.isMac:
|
||||
# pylint --py3k W1619
|
||||
totalMemory = (
|
||||
int(os.popen("sysctl hw.memsize").readlines()[0].split()[1]) / 1024
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from contextlib import contextmanager
|
||||
import multiprocessing
|
||||
|
@ -527,10 +527,12 @@ class SystemResourceMonitor(object):
|
|||
return 0
|
||||
|
||||
if per_cpu:
|
||||
# pylint --py3k W1619
|
||||
return [sum(x) / samples for x in cpu]
|
||||
|
||||
cores = [sum(x) for x in cpu]
|
||||
|
||||
# pylint --py3k W1619
|
||||
return sum(cores) / len(cpu) / samples
|
||||
|
||||
def aggregate_cpu_times(self, start=None, end=None, phase=None, per_cpu=True):
|
||||
|
@ -672,6 +674,7 @@ class SystemResourceMonitor(object):
|
|||
|
||||
def populate_derived(e):
|
||||
if e["cpu_percent_cores"]:
|
||||
# pylint --py3k W1619
|
||||
e["cpu_percent_mean"] = sum(e["cpu_percent_cores"]) / len(
|
||||
e["cpu_percent_cores"]
|
||||
)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
pass
|
||||
|
||||
"""
|
||||
from __future__ import division
|
||||
import ctypes
|
||||
import logging
|
||||
import os
|
||||
|
@ -67,6 +68,7 @@ def convert_to(size, from_unit, to_unit):
|
|||
try:
|
||||
df = sizes[to_unit]
|
||||
sf = sizes[from_unit]
|
||||
# pylint --py3k W1619
|
||||
return size * sf / df
|
||||
except KeyError:
|
||||
raise DiskutilsError("conversion error: Invalid source or destination format")
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"""Python usage, esp. virtualenv.
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
import errno
|
||||
import json
|
||||
import os
|
||||
|
@ -835,6 +836,7 @@ class ResourceMonitoringMixin(PerfherderResourceOptionsMixin):
|
|||
for attr in cpu_attrs:
|
||||
value = getattr(cpu_times, attr)
|
||||
# cpu_total can be 0.0. Guard against division by 0.
|
||||
# pylint --py3k W1619
|
||||
percent = value / cpu_total * 100.0 if cpu_total else 0.0
|
||||
|
||||
if percent > 1.00:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import division
|
||||
from distutils.version import LooseVersion
|
||||
import json
|
||||
import math
|
||||
|
@ -39,6 +40,7 @@ def is_triangualar(x):
|
|||
>>> all(not is_triangualar(x) for x in [4, 5, 8, 9, 11, 17, 25, 29, 39, 44, 59, 61, 72, 98, 112])
|
||||
True
|
||||
"""
|
||||
# pylint --py3k W1619
|
||||
n = (math.sqrt(8 * x + 1) - 1) / 2
|
||||
return n == int(n)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
|
@ -322,11 +322,13 @@ class Browsertime(Perftest):
|
|||
# bt_timeout will be the overall browsertime cmd/session timeout (seconds)
|
||||
# browsertime deals with page cycles internally, so we need to give it a timeout
|
||||
# value that includes all page cycles
|
||||
# pylint --py3k W1619
|
||||
bt_timeout = int(timeout / 1000) * int(test.get("page_cycles", 1))
|
||||
|
||||
# the post-startup-delay is a delay after the browser has started, to let it settle
|
||||
# it's handled within browsertime itself by loading a 'preUrl' (about:blank) and having a
|
||||
# delay after that ('preURLDelay') as the post-startup-delay, so we must add that in sec
|
||||
# pylint --py3k W1619
|
||||
bt_timeout += int(self.post_startup_delay / 1000)
|
||||
|
||||
# add some time for browser startup, time for the browsertime measurement code
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import time
|
||||
import threading
|
||||
|
@ -132,7 +132,9 @@ class AndroidCPUProfiler(object):
|
|||
u"type": u"cpu",
|
||||
u"test": test_name + "-avg",
|
||||
u"unit": u"%",
|
||||
u"values": {u"avg": sum(self.polls) / len(self.polls)},
|
||||
u"values": {
|
||||
u"avg": sum(self.polls) / len(self.polls)
|
||||
}, # pylint --py3k W1619
|
||||
}
|
||||
self.raptor.control_server.submit_supporting_data(avg_cpuinfo_data)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# originally taken from /testing/talos/talos/filter.py
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import math
|
||||
|
||||
|
@ -120,9 +120,12 @@ def median(series):
|
|||
series = sorted(series)
|
||||
if len(series) % 2:
|
||||
# odd
|
||||
return series[len(series) / 2]
|
||||
# pylint --py3k W1619
|
||||
# must force to int to use as index.
|
||||
return series[int(len(series) / 2)]
|
||||
else:
|
||||
# even
|
||||
# pylint --py3k W1619
|
||||
middle = int(len(series) / 2) # the higher of the middle 2, actually
|
||||
return 0.5 * (series[middle - 1] + series[middle])
|
||||
|
||||
|
@ -181,6 +184,7 @@ def geometric_mean(series):
|
|||
total = 0
|
||||
for i in series:
|
||||
total += math.log(i + 1)
|
||||
# pylint --py3k W1619
|
||||
return math.exp(total / len(series)) - 1
|
||||
|
||||
|
||||
|
@ -269,6 +273,7 @@ def v8_subtest(series, name):
|
|||
"Splay": 81491.0,
|
||||
}
|
||||
|
||||
# pylint --py3k W1619
|
||||
return reference[name] / geometric_mean(series)
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# some parts of this originally taken from /testing/talos/talos/output.py
|
||||
|
||||
"""output raptor test results"""
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import filters
|
||||
|
||||
|
@ -334,6 +334,7 @@ class PerftestOutput(object):
|
|||
)
|
||||
|
||||
results = results[9::10]
|
||||
# pylint --py3k W1619
|
||||
score = 60 * 1000 / filters.geometric_mean(results) / correctionFactor
|
||||
return score
|
||||
|
||||
|
@ -379,6 +380,7 @@ class PerftestOutput(object):
|
|||
"StyleBench requires 380 entries, found: %s instead" % len(results)
|
||||
)
|
||||
results = results[75::76]
|
||||
# pylint --py3k W1619
|
||||
return 60 * 1000 / filters.geometric_mean(results) / correctionFactor
|
||||
|
||||
if testname.startswith(("raptor-kraken", "raptor-sunspider")):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -358,6 +358,7 @@ def finish_android_power_test(raptor, test_name, os_baseline=False):
|
|||
if not baseline_measure:
|
||||
LOG.error("Power test baseline_measure is Zero.")
|
||||
return 0
|
||||
# pylint --py3k W1619
|
||||
return (
|
||||
100 * ((power_measure + baseline_measure) / baseline_measure)
|
||||
) - 100
|
||||
|
@ -369,6 +370,7 @@ def finish_android_power_test(raptor, test_name, os_baseline=False):
|
|||
"values": {},
|
||||
}
|
||||
for power_measure in power_data["values"]:
|
||||
# pylint --py3k W1619
|
||||
pc_power_data["values"][power_measure] = calculate_pc(
|
||||
(power_data["values"][power_measure] / test_time),
|
||||
raptor.os_baseline_data["values"][power_measure],
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import json
|
||||
import os
|
||||
|
@ -73,9 +73,11 @@ class WebExtension(Perftest):
|
|||
# we don't want this timeout occurring unless abosultely necessary
|
||||
|
||||
# convert timeout to seconds and account for page cycles
|
||||
# pylint --py3k W1619
|
||||
timeout = int(timeout / 1000) * int(test.get("page_cycles", 1))
|
||||
# account for the pause the raptor webext runner takes after browser startup
|
||||
# and the time an exception is propagated through the framework
|
||||
# pylint --py3k W1619
|
||||
timeout += int(self.post_startup_delay / 1000) + 10
|
||||
|
||||
# for page-load tests we don't start the page-timeout timer until the pageload.js content
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
|
||||
import os
|
||||
|
@ -165,6 +165,7 @@ def test_usage_with_fallback():
|
|||
cpu_profiler.polls.append(0)
|
||||
|
||||
# Verify the response contains our expected CPU % of 8
|
||||
# pylint --py3k W1619
|
||||
avg_cpuinfo_data = {
|
||||
"type": "cpu",
|
||||
"test": "usage_with_fallback-avg",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import math
|
||||
import six
|
||||
|
@ -180,6 +180,7 @@ def geometric_mean(series):
|
|||
total = 0
|
||||
for i in series:
|
||||
total += math.log(i + 1)
|
||||
# pylint --py3k W1619
|
||||
return math.exp(total / len(series)) - 1
|
||||
|
||||
|
||||
|
@ -254,6 +255,7 @@ def v8_subtest(series, name):
|
|||
"Splay": 81491.0,
|
||||
}
|
||||
|
||||
# pylint --py3k W1619
|
||||
return reference[name] / geometric_mean(series)
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"""
|
||||
Downloads Heavy profiles from TaskCluster.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
import os
|
||||
import tarfile
|
||||
import functools
|
||||
|
@ -121,6 +121,7 @@ def download_profile(name, profiles_dir=None):
|
|||
template = "Download progress %d%%"
|
||||
with open(archive_file, "wb") as f:
|
||||
iter = req.iter_content(chunk_size=1024)
|
||||
# pylint --py3k W1619
|
||||
size = total_length / 1024 + 1
|
||||
with ProgressBar(size=size, template=template) as bar:
|
||||
for chunk in iter:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
"""output formats for Talos"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
from talos import filter
|
||||
|
||||
|
@ -310,6 +310,7 @@ class Output(object):
|
|||
)
|
||||
|
||||
results = results[75::76]
|
||||
# pylint --py3k W1619
|
||||
score = 60 * 1000 / filter.geometric_mean(results) / correctionFactor
|
||||
return score
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, division
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
|
@ -77,6 +77,7 @@ def generate_report(tuple_list, filepath, mode="variance"):
|
|||
for day in day_name:
|
||||
if mode == "variance":
|
||||
# removing top and bottom 10% to reduce outlier influence
|
||||
# pylint --py3k W1619
|
||||
tenth = len(days[day]) / 10
|
||||
average = numpy.average(sorted(days[day])[tenth : tenth * 9 + 1])
|
||||
elif mode == "count":
|
||||
|
@ -116,6 +117,7 @@ def is_normal(y):
|
|||
clean_week = y
|
||||
|
||||
# look at weekends now
|
||||
# pylint --py3k W1619
|
||||
avg = sum(clean_week) / len(clean_week)
|
||||
for i in six.moves.range(5, 7):
|
||||
# look for something outside of the 20% window
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import datetime
|
||||
import errno
|
||||
|
@ -530,6 +530,7 @@ class TestInfoLongRunningTasks(TestInfo):
|
|||
def get_long_running_ratio(record):
|
||||
count = record["count"]
|
||||
tasks_gt_pct = record["tasks_gt_pct"]
|
||||
# pylint --py3k W1619
|
||||
return count / tasks_gt_pct
|
||||
|
||||
# Search test durations in ActiveData for long-running tests
|
||||
|
@ -589,6 +590,7 @@ class TestInfoLongRunningTasks(TestInfo):
|
|||
count = record["count"]
|
||||
max_run_time = record["max_run_time"]
|
||||
tasks_gt_pct = record["tasks_gt_pct"]
|
||||
# pylint --py3k W1619
|
||||
print(
|
||||
"%-55s: %d of %d runs (%.1f%%) exceeded %d%% of max-run-time (%d s)"
|
||||
% (
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import json
|
||||
import yaml
|
||||
|
@ -211,6 +211,7 @@ class TPSTestRunner(object):
|
|||
possible_time = line[0:13]
|
||||
if len(possible_time) == 13 and possible_time.isdigit():
|
||||
time_ms = int(possible_time)
|
||||
# pylint --py3k W1619
|
||||
formatted = time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S",
|
||||
time.localtime(time_ms / 1000),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# Integrates the xpcshell test runner with mach.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import errno
|
||||
import logging
|
||||
|
@ -260,6 +260,7 @@ class MachCommands(MachCommandBase):
|
|||
)
|
||||
|
||||
if not params["threadCount"]:
|
||||
# pylint --py3k W1619
|
||||
params["threadCount"] = int((cpu_count() * 3) / 2)
|
||||
|
||||
if conditions.is_android(self) or self.substs.get("MOZ_BUILD_APP") == "b2g":
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import copy
|
||||
import json
|
||||
|
@ -1656,6 +1656,7 @@ class XPCShellTests(object):
|
|||
):
|
||||
# TSan requires significantly more memory, so reduce the amount of parallel
|
||||
# tests we run to avoid OOMs and timeouts.
|
||||
# pylint --py3k W1619
|
||||
self.threadCount = self.threadCount / 2
|
||||
|
||||
self.stack_fixer_function = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче