Bug 2015841 - ruff: fix 'Lambda may be unnecessary; consider inlining inner function' r=linter-reviewers,perftest-reviewers,sessionstore-reviewers,chutten,ahal,sparky,sclements
Differential Revision: https://phabricator.services.mozilla.com/D282636
This commit is contained in:
committed by
sledru@mozilla.com
parent
bdd074022b
commit
8af186a748
@@ -443,7 +443,7 @@ class SessionStoreTestCase(WindowManagerMixin, MarionetteTestCase):
|
||||
msg=f"Not all requested windows have been opened. Expected {self.all_windows}, got {current_windows_set}.",
|
||||
)
|
||||
|
||||
self.marionette.quit(callback=lambda: self.simulate_os_shutdown())
|
||||
self.marionette.quit(callback=self.simulate_os_shutdown)
|
||||
|
||||
saved_args = self.marionette.instance.app_args
|
||||
try:
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ set_config("MOZ_DEBUG_DEFINES", debug_defines)
|
||||
|
||||
option(env="MOZ_PGO", help="Build with profile guided optimizations")
|
||||
|
||||
set_config("MOZ_PGO", depends("MOZ_PGO")(lambda x: bool(x)))
|
||||
set_config("MOZ_PGO", depends("MOZ_PGO")(lambda x: bool(x))) # noqa: PLW0108
|
||||
|
||||
|
||||
# Imply --enable-release when MOZILLA_OFFICIAL is set rather than adjusting the
|
||||
|
||||
@@ -2924,9 +2924,7 @@ SPECIAL_VARIABLES = {
|
||||
""",
|
||||
),
|
||||
"CONFIG": (
|
||||
lambda context: ReadOnlyKeyedDefaultDict(
|
||||
lambda key: context.config.substs.get(key)
|
||||
),
|
||||
lambda context: ReadOnlyKeyedDefaultDict(context.config.substs.get),
|
||||
dict,
|
||||
"""Dictionary containing the current configuration variables.
|
||||
|
||||
|
||||
@@ -1228,7 +1228,7 @@ def gtest(
|
||||
append_env=gtest_env,
|
||||
cwd=cwd,
|
||||
ensure_exit_code=False,
|
||||
line_handler=lambda line: format_gtest_line(line),
|
||||
line_handler=format_gtest_line,
|
||||
)
|
||||
gtest_log.shutdown()
|
||||
return result
|
||||
|
||||
@@ -331,7 +331,7 @@ class TestConfigureOutputHandler(unittest.TestCase):
|
||||
class TestLineIO(unittest.TestCase):
|
||||
def test_lineio(self):
|
||||
lines = []
|
||||
l = LineIO(lambda l: lines.append(l))
|
||||
l = LineIO(lines.append)
|
||||
|
||||
l.write("a")
|
||||
self.assertEqual(lines, [])
|
||||
@@ -364,7 +364,7 @@ class TestLineIO(unittest.TestCase):
|
||||
|
||||
def test_lineio_contextmanager(self):
|
||||
lines = []
|
||||
with LineIO(lambda l: lines.append(l)) as l:
|
||||
with LineIO(lines.append) as l:
|
||||
l.write("a\nb\nc")
|
||||
|
||||
self.assertEqual(lines, ["a", "b"])
|
||||
|
||||
@@ -148,11 +148,11 @@ class _TreeDiff(dircmp):
|
||||
"""Helper to report rich results on difference between two directories."""
|
||||
|
||||
def _fillDiff(self, dc, rv, basepath="{0}"):
|
||||
rv["right_only"] += map(lambda l: basepath.format(l), dc.right_only)
|
||||
rv["left_only"] += map(lambda l: basepath.format(l), dc.left_only)
|
||||
rv["diff_files"] += map(lambda l: basepath.format(l), dc.diff_files)
|
||||
rv["funny"] += map(lambda l: basepath.format(l), dc.common_funny)
|
||||
rv["funny"] += map(lambda l: basepath.format(l), dc.funny_files)
|
||||
rv["right_only"] += map(basepath.format, dc.right_only)
|
||||
rv["left_only"] += map(basepath.format, dc.left_only)
|
||||
rv["diff_files"] += map(basepath.format, dc.diff_files)
|
||||
rv["funny"] += map(basepath.format, dc.common_funny)
|
||||
rv["funny"] += map(basepath.format, dc.funny_files)
|
||||
for subdir, _dc in dc.subdirs.items():
|
||||
self._fillDiff(_dc, rv, basepath.format(subdir + "/{0}"))
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class AggregatedGTestReport(dict):
|
||||
if exc_info[0] is None:
|
||||
d = self.result_dir.name
|
||||
result_files = filter(
|
||||
lambda f: path.isfile(f), map(lambda f: path.join(d, f), os.listdir(d))
|
||||
path.isfile, map(lambda f: path.join(d, f), os.listdir(d))
|
||||
)
|
||||
|
||||
def json_from_file(file):
|
||||
|
||||
@@ -631,14 +631,14 @@ class NetworkBench(BasePythonSupport):
|
||||
)
|
||||
if not temp_file_path:
|
||||
raise Exception("Failed to generate temporary file")
|
||||
self.cleanup.append(lambda: temp_file_path.unlink())
|
||||
self.cleanup.append(temp_file_path.unlink)
|
||||
|
||||
download_html = self.generate_download_test_html(
|
||||
tempfile.gettempdir(), temp_file_path.name
|
||||
)
|
||||
if not download_html:
|
||||
raise Exception("Failed to generate file for download test")
|
||||
self.cleanup.append(lambda: download_html.unlink())
|
||||
self.cleanup.append(download_html.unlink)
|
||||
cmd += [
|
||||
"--browsertime.server_url",
|
||||
f"https://localhost:{self.caddy_port}/{download_html.name}",
|
||||
|
||||
@@ -103,7 +103,7 @@ def mach_gifft(command_context, telemetry_probe_name):
|
||||
bugs_list = "\n" + textwrap.indent(
|
||||
"\n".join(
|
||||
map(
|
||||
lambda b: BUG_URL_TEMPLATE.format(b),
|
||||
BUG_URL_TEMPLATE.format,
|
||||
e._definition.get("bug_numbers", []),
|
||||
)
|
||||
),
|
||||
@@ -204,7 +204,7 @@ def mach_gifft(command_context, telemetry_probe_name):
|
||||
bugs_list = "\n" + textwrap.indent(
|
||||
"\n".join(
|
||||
map(
|
||||
lambda b: BUG_URL_TEMPLATE.format(b),
|
||||
BUG_URL_TEMPLATE.format,
|
||||
s._definition.get("bug_numbers", []),
|
||||
)
|
||||
),
|
||||
|
||||
@@ -206,7 +206,7 @@ def _generate_report(
|
||||
status = command_context.run_process(
|
||||
args=cmd,
|
||||
ensure_exit_code=False,
|
||||
stderr_line_handler=lambda line: stderr_lines.append(line),
|
||||
stderr_line_handler=stderr_lines.append,
|
||||
)
|
||||
if status != 0:
|
||||
stderr = "".join(stderr_lines)
|
||||
|
||||
Reference in New Issue
Block a user