mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Bug 1646421 - flake8 Fix a bunch of actual errors r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D80078
This commit is contained in:
parent
3ff66789b4
commit
46af48052b
@ -55,7 +55,7 @@ class Test(object):
|
||||
cmd = "{CXX} -c {source} -O3 -std=c++11 -fplugin={sixgill} -fplugin-arg-xgill-mangle=1 {options}".format( # NOQA: E501
|
||||
source=self.infile(source),
|
||||
CXX=self.cfg.cxx, sixgill=self.cfg.sixgill_plugin,
|
||||
options=options, env=env)
|
||||
options=options)
|
||||
if self.cfg.verbose:
|
||||
print("Running %s" % cmd)
|
||||
subprocess.check_call(["sh", "-c", cmd])
|
||||
|
@ -230,7 +230,7 @@ def mergeMeta(reftest, frontmatter, includes):
|
||||
if info:
|
||||
# Open some space in an existing info text
|
||||
if "info" in frontmatter:
|
||||
frontmatter["info"] += "\n\n \%" % info
|
||||
frontmatter["info"] += "\n\n \%s" % info
|
||||
else:
|
||||
frontmatter["info"] = info
|
||||
|
||||
|
@ -337,15 +337,13 @@ def get_opcodes(dir):
|
||||
'(stack_nuses)'.format(
|
||||
op=op,
|
||||
nuses=nuses,
|
||||
stack_nuses=stack_nuses,
|
||||
stack_uses=opcode.stack_uses))
|
||||
stack_nuses=stack_nuses))
|
||||
if ndefs != -1 and stack_ndefs != -1 and ndefs != stack_ndefs:
|
||||
raise Exception('ndefs should match stack notation: {op}: '
|
||||
'{ndefs} != {stack_ndefs} '
|
||||
'(stack_ndefs)'.format(
|
||||
op=op,
|
||||
ndefs=ndefs,
|
||||
stack_ndefs=stack_ndefs,
|
||||
stack_defs=opcode.stack_defs))
|
||||
stack_ndefs=stack_ndefs))
|
||||
|
||||
return index, opcodes
|
||||
|
@ -38,7 +38,7 @@ class TArraySyntheticChildrenProvider:
|
||||
return None
|
||||
# Ideally we'd use the exception type, but it's unclear what that is
|
||||
# without knowing how to trigger the original exception.
|
||||
except: # NOQA: E501
|
||||
except: # NOQA: E501, E722
|
||||
pass
|
||||
return None
|
||||
|
||||
|
@ -360,6 +360,7 @@ class ConfigureSandbox(dict):
|
||||
else:
|
||||
assert isinstance(logger, logging.Logger)
|
||||
moz_logger = None
|
||||
|
||||
@contextmanager
|
||||
def queue_debug():
|
||||
yield
|
||||
@ -1154,6 +1155,7 @@ class ConfigureSandbox(dict):
|
||||
func.__defaults__,
|
||||
closure
|
||||
))
|
||||
|
||||
@self.wraps(new_func)
|
||||
def wrapped(*args, **kwargs):
|
||||
if func in self._imports:
|
||||
|
@ -1481,7 +1481,7 @@ class L10NCommands(MachCommandBase):
|
||||
'Invoking `mach android archive-geckoview`')
|
||||
self.run_process(
|
||||
[mozpath.join(self.topsrcdir, 'mach'), 'android',
|
||||
'archive-geckoview'.format(locale)],
|
||||
'archive-geckoview'],
|
||||
append_env=append_env,
|
||||
pass_thru=True,
|
||||
ensure_exit_code=True,
|
||||
|
@ -27,7 +27,7 @@ from buildconfig import (
|
||||
|
||||
def fake_short_path(path):
|
||||
if sys.platform.startswith('win'):
|
||||
return '/'.join(p.split(' ', 1)[0] + '~1' if ' 'in p else p
|
||||
return '/'.join(p.split(' ', 1)[0] + '~1' if ' ' in p else p
|
||||
for p in mozpath.split(path))
|
||||
return path
|
||||
|
||||
|
@ -433,7 +433,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
self.assertEqual(config, {})
|
||||
self.assertEqual(out, textwrap.dedent('''\
|
||||
checking for a... ''' # noqa # trailing whitespace...
|
||||
'''
|
||||
''' # noqa: E128
|
||||
DEBUG: a: Trying known-a
|
||||
ERROR: Paths provided to find_program must be a list of strings, not %r
|
||||
''' % mozpath.dirname(self.OTHER_A)))
|
||||
|
@ -511,6 +511,7 @@ class TestStrictOrderingOnAppendListWithFlagsFactory(unittest.TestCase):
|
||||
class TestMemoize(unittest.TestCase):
|
||||
def test_memoize(self):
|
||||
self._count = 0
|
||||
|
||||
@memoize
|
||||
def wrapped(a, b):
|
||||
self._count += 1
|
||||
|
@ -27,6 +27,7 @@ from voluptuous import ALLOW_EXTRA, Required, Schema
|
||||
#: The directory where artifacts from this job will be placed.
|
||||
OUTPUT_DIR = Path("/", "builds", "worker", "artifacts")
|
||||
|
||||
|
||||
#: A job to process through visualmetrics.py
|
||||
@attr.s
|
||||
class Job:
|
||||
|
@ -36,6 +36,6 @@ def cancel_action(parameters, graph_config, input, task_group_id, task_id):
|
||||
# A 409 response indicates that this task is past its deadline. It
|
||||
# cannot be cancelled at this time, but it's also not running
|
||||
# anymore, so we can ignore this error.
|
||||
logger.info('Task is past its deadline and cannot be cancelled.'.format(task_id))
|
||||
logger.info('Task {} is past its deadline and cannot be cancelled.'.format(task_id))
|
||||
return
|
||||
raise
|
||||
|
@ -198,8 +198,7 @@ def add_tooltool(config, job, taskdesc, internal=False):
|
||||
"""
|
||||
|
||||
if job['worker']['implementation'] in ('docker-worker',):
|
||||
level = config.params['level']
|
||||
add_cache(job, taskdesc, 'tooltool-cache'.format(level),
|
||||
add_cache(job, taskdesc, 'tooltool-cache',
|
||||
'{workdir}/tooltool-cache'.format(**job['run']))
|
||||
|
||||
taskdesc['worker'].setdefault('env', {}).update({
|
||||
|
@ -183,8 +183,6 @@ def docker_worker_debian_package(config, job, taskdesc):
|
||||
.format(
|
||||
root_url=get_root_url(False),
|
||||
package=package,
|
||||
snapshot=run['snapshot'],
|
||||
dist=run['dist'],
|
||||
src_url=src_url,
|
||||
src_file=src_file,
|
||||
src_sha256=src_sha256,
|
||||
|
@ -384,7 +384,7 @@ def get_ftp_platform(platform):
|
||||
elif platform.startswith('linux64'):
|
||||
return 'linux-x86_64'
|
||||
else:
|
||||
raise ValueError('Unimplemented platform %s'.format(platform))
|
||||
raise ValueError('Unimplemented platform {}'.format(platform))
|
||||
|
||||
|
||||
# Ugh
|
||||
|
@ -109,7 +109,7 @@ class MozLog(object):
|
||||
# For skips, longrepr is a tuple of (file, lineno, reason)
|
||||
message = report.longrepr[-1]
|
||||
else:
|
||||
raise ValueError("Unable to convert longrepr to message:\ntype %s\nfields:" %
|
||||
raise ValueError("Unable to convert longrepr to message:\ntype %s\nfields: %s" %
|
||||
(longrepr.__class__, dir(longrepr)))
|
||||
if status != expected or expected != 'PASS':
|
||||
self.results[test] = (status, expected, message, stack)
|
||||
|
@ -319,6 +319,7 @@ def test_fail(name, opts, expected):
|
||||
print(result)
|
||||
assert result == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,opts,expected", FORMATS['PRECONDITION_FAILED'],
|
||||
ids=ids('PRECONDITION_FAILED'))
|
||||
def test_precondition_failed(name, opts, expected):
|
||||
@ -341,6 +342,7 @@ def test_precondition_failed(name, opts, expected):
|
||||
print(result)
|
||||
assert result == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,opts,expected", FORMATS['KNOWN-INTERMITTENT'],
|
||||
ids=ids('KNOWN-INTERMITTENT'))
|
||||
def test_known_intermittent(name, opts, expected):
|
||||
|
@ -100,7 +100,7 @@ class DeviceRunner(BaseRunner):
|
||||
|
||||
self.app_ctx.device.pkill(self.app_ctx.remote_process, sig=sig)
|
||||
if self.wait(timeout) is None and sig is not None:
|
||||
print("timed out waiting for '%s' process to exit, trying "
|
||||
print("timed out waiting for '{}' process to exit, trying "
|
||||
"without signal {}".format(
|
||||
self.app_ctx.remote_process, sig))
|
||||
|
||||
@ -108,7 +108,7 @@ class DeviceRunner(BaseRunner):
|
||||
# restart the process
|
||||
self.app_ctx.stop_application()
|
||||
if self.wait(timeout) is None:
|
||||
print("timed out waiting for '%s' process to exit".format(
|
||||
print("timed out waiting for '{}' process to exit".format(
|
||||
self.app_ctx.remote_process))
|
||||
|
||||
@property
|
||||
|
@ -117,7 +117,7 @@ class Whitelist:
|
||||
|
||||
if filename not in errors:
|
||||
errors[filename] = []
|
||||
errors[filename].append("Duration %s > %S"
|
||||
errors[filename].append("Duration %s > %s"
|
||||
% (row_value[file_duration_index]),
|
||||
DEFAULT_DURATION)
|
||||
return errors
|
||||
|
@ -270,8 +270,8 @@ class MachBrowsertime(MachCommandBase):
|
||||
'to {new_upstream_url}')
|
||||
|
||||
if not re.search('/tarball/[a-f0-9]{40}$', new_upstream_url):
|
||||
raise ValueError("New upstream URL does not end with /tarball/[a-f0-9]{40}: '{}'"
|
||||
.format(new_upstream_url))
|
||||
raise ValueError("New upstream URL does not end with /tarball/[a-f0-9]{40}: '%s'"
|
||||
% new_upstream_url)
|
||||
|
||||
with open(package_json_path) as f:
|
||||
existing_body = json.loads(f.read(), object_pairs_hook=collections.OrderedDict)
|
||||
|
Loading…
x
Reference in New Issue
Block a user