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

18 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 django.db import transaction 

6 

7from weblate.accounts.tasks import cleanup_social_auth 

8from weblate.screenshots.tasks import cleanup_screenshot_files 

9from weblate.trans.models import Component 

10from weblate.trans.tasks import ( 

11 cleanup_component, 

12 cleanup_old_comments, 

13 cleanup_old_suggestions, 

14 cleanup_stale_repos, 

15 cleanup_suggestions, 

16) 

17from weblate.utils.management.base import BaseCommand 

18 

19 

20class Command(BaseCommand): 

21 help = "cleanups orphaned checks and suggestions" 

22 

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

24 """Perform cleanup of Weblate database.""" 

25 cleanup_screenshot_files() 

26 with transaction.atomic(): 

27 cleanup_social_auth() 

28 for component in Component.objects.filter(template="").iterator(): 

29 cleanup_component(component.pk) 

30 cleanup_suggestions() 

31 cleanup_stale_repos() 

32 cleanup_old_suggestions() 

33 cleanup_old_comments()