Improve code style in load_state
Replace duplicate strip() calls with filter(None, generator) for cleaner and more efficient processing of processed Message-IDs. Changes: - Use set(filter(None, (line.strip() for line in f))) to avoid calling strip() twice and filter empty lines
This commit is contained in:
parent
f2bc700939
commit
9b7a6c5c07
1 changed files with 1 additions and 1 deletions
2
main.py
2
main.py
|
|
@ -155,7 +155,7 @@ class EmailForwarder:
|
|||
processed_file = self.config["processed_file"]
|
||||
if os.path.exists(processed_file):
|
||||
with open(processed_file, "r") as f:
|
||||
self.processed_ids = set(line.strip() for line in f if line.strip())
|
||||
self.processed_ids = set(filter(None, (line.strip() for line in f)))
|
||||
|
||||
def save_state(self):
|
||||
"""Save last run and processed IDs."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue