Coverage for app/venv/lib/python3.14/site-packages/weblate/memory/management/commands/cleanup_memory.py: 0%

9 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5from weblate.memory.models import Memory 

6from weblate.utils.management.base import BaseCommand 

7 

8 

9class Command(BaseCommand): 

10 """Command for wiping out pending memories.""" 

11 

12 def handle(self, *args, **options) -> None: 

13 """Perform memory cleaning.""" 

14 count, _ = Memory.objects.filter(status=Memory.STATUS_PENDING).delete() 

15 if count == 0: 

16 self.stdout.write("No pending memories found to clean.") 

17 return 

18 

19 self.stdout.write(f"Cleaned {count} pending memories.")