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]: if self.metric_values[metric_name]:
# Print preamble # Print preamble
lines += self.metrics[metric_name] lines += self.metrics[metric_name]
for metric_value in self.metric_values[metric_name].values(): lines += self.metric_values[metric_name].values()
lines.append(metric_value)
lines.append("") lines.append("")
self.wfile.write("\n".join(lines).encode()) 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( def generate_codepoint_to_names_map(
emoji_name_maps: Dict[str, Dict[str, Any]] emoji_name_maps: Dict[str, Dict[str, Any]]
) -> Dict[str, List[str]]: ) -> Dict[str, List[str]]:
codepoint_to_names: Dict[str, List[str]] = {} # The first element of the names list is always the canonical name.
for emoji_code, name_info in emoji_name_maps.items(): return {
# The first element of the names list is always the canonical name. emoji_code: [name_info["canonical_name"], *name_info["aliases"]]
names = [name_info["canonical_name"]] for emoji_code, name_info in emoji_name_maps.items()
for alias in name_info["aliases"]: }
names.append(alias)
codepoint_to_names[emoji_code] = names
return codepoint_to_names
def generate_name_to_codepoint_map(emoji_name_maps: Dict[str, Dict[str, Any]]) -> Dict[str, str]: def generate_name_to_codepoint_map(emoji_name_maps: Dict[str, Dict[str, Any]]) -> Dict[str, str]: