ruff: Fix PERF402 Use `list` or `list.copy` to create a copy of a list.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-07-31 13:29:52 -07:00 committed by Tim Abbott
parent c4748298bb
commit 0b95d83f09
2 changed files with 6 additions and 10 deletions

View File

@ -49,8 +49,7 @@ class WalGPrometheusServer(BaseHTTPRequestHandler):
if self.metric_values[metric_name]:
# Print preamble
lines += self.metrics[metric_name]
for metric_value in self.metric_values[metric_name].values():
lines.append(metric_value)
lines += self.metric_values[metric_name].values()
lines.append("")
self.wfile.write("\n".join(lines).encode())

View File

@ -116,14 +116,11 @@ def generate_codepoint_to_name_map(emoji_name_maps: Dict[str, Dict[str, Any]]) -
def generate_codepoint_to_names_map(
emoji_name_maps: Dict[str, Dict[str, Any]]
) -> Dict[str, List[str]]:
codepoint_to_names: Dict[str, List[str]] = {}
for emoji_code, name_info in emoji_name_maps.items():
# The first element of the names list is always the canonical name.
names = [name_info["canonical_name"]]
for alias in name_info["aliases"]:
names.append(alias)
codepoint_to_names[emoji_code] = names
return codepoint_to_names
# The first element of the names list is always the canonical name.
return {
emoji_code: [name_info["canonical_name"], *name_info["aliases"]]
for emoji_code, name_info in emoji_name_maps.items()
}
def generate_name_to_codepoint_map(emoji_name_maps: Dict[str, Dict[str, Any]]) -> Dict[str, str]: