From e41c966df01aa0f3dd50a5f462c2132df3327579 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Dec 2023 21:00:46 +0100 Subject: [PATCH] Enable ruff rule Perflint (PERF) See: https://docs.astral.sh/ruff/rules/#perflint-perf Fix the following new warnings: lieer/gmailieer.py:866:17: PERF401 Use a list comprehension to create a transformed list --- .ruff.toml | 2 +- lieer/gmailieer.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index b6026f2..eb139a6 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -34,7 +34,7 @@ target-version = "py39" # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or # McCabe complexity (`C901`) by default. -select = ["E4", "E7", "E9", "F", "I", "UP", "C4", "SIM"] +select = ["E4", "E7", "E9", "F", "I", "UP", "C4", "SIM", "PERF"] ignore = [ "E501", # Line too long "E741", # Ambiguous variable name: `l` diff --git a/lieer/gmailieer.py b/lieer/gmailieer.py index 635c9e5..091a816 100755 --- a/lieer/gmailieer.py +++ b/lieer/gmailieer.py @@ -862,8 +862,7 @@ def full_pull(self): self.bar.total = total self.bar_update(len(gids)) - for m in gids: - message_gids.append(m["id"]) + message_gids = [m["id"] for m in gids] if self.limit is not None and len(message_gids) >= self.limit: break