From d966c1e4e4ab213998ec54dd85e7db22019c39c9 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 24 Dec 2024 18:40:56 +0200 Subject: [PATCH] Fix Pylint warnings in migrations (#8869) --- .../engine/migrations/0024_auto_20191023_1025.py | 4 ++-- .../engine/migrations/0034_auto_20201125_1426.py | 12 ++++++------ cvat/apps/engine/migrations/0038_manifest.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cvat/apps/engine/migrations/0024_auto_20191023_1025.py b/cvat/apps/engine/migrations/0024_auto_20191023_1025.py index c8aefe7b7774..1946e08e47e2 100644 --- a/cvat/apps/engine/migrations/0024_auto_20191023_1025.py +++ b/cvat/apps/engine/migrations/0024_auto_20191023_1025.py @@ -79,7 +79,7 @@ def migrate_task_data(db_task_id, db_data_id, original_video, original_images, s compressed_chunk_path = os.path.join(compressed_cache_dir, '{}.zip'.format(chunk_idx)) compressed_chunk_writer.save_as_chunk(chunk_images, compressed_chunk_path) - preview = reader.get_preview() + preview = reader.get_preview(0) preview.save(os.path.join(db_data_dir, 'preview.jpeg')) else: original_chunk_writer = ZipChunkWriter(100) @@ -146,7 +146,7 @@ def migrate_task_data(db_task_id, db_data_id, original_video, original_images, s original_chunk_path = os.path.join(original_cache_dir, '{}.zip'.format(chunk_idx)) original_chunk_writer.save_as_chunk(chunk_images, original_chunk_path) - preview = reader.get_preview() + preview = reader.get_preview(0) preview.save(os.path.join(db_data_dir, 'preview.jpeg')) shutil.rmtree(old_db_task_dir) return_dict[db_task_id] = (True, '') diff --git a/cvat/apps/engine/migrations/0034_auto_20201125_1426.py b/cvat/apps/engine/migrations/0034_auto_20201125_1426.py index 457861a3942c..311b21655b9d 100644 --- a/cvat/apps/engine/migrations/0034_auto_20201125_1426.py +++ b/cvat/apps/engine/migrations/0034_auto_20201125_1426.py @@ -6,12 +6,12 @@ import django.db.models.deletion def create_profile(apps, schema_editor): - User = apps.get_model('auth', 'User') - Profile = apps.get_model('engine', 'Profile') - for user in User.objects.all(): - profile = Profile() - profile.user = user - profile.save() + User = apps.get_model('auth', 'User') + Profile = apps.get_model('engine', 'Profile') + for user in User.objects.all(): + profile = Profile() + profile.user = user + profile.save() class Migration(migrations.Migration): diff --git a/cvat/apps/engine/migrations/0038_manifest.py b/cvat/apps/engine/migrations/0038_manifest.py index ec96045ae69c..002a0326c2dc 100644 --- a/cvat/apps/engine/migrations/0038_manifest.py +++ b/cvat/apps/engine/migrations/0038_manifest.py @@ -110,7 +110,7 @@ def migrate2manifest(apps, shema_editor): if db_data.storage == StorageChoice.SHARE: def _get_frame_step(str_): - match = search("step\s*=\s*([1-9]\d*)", str_) + match = search(r"step\s*=\s*([1-9]\d*)", str_) return int(match.group(1)) if match else 1 logger.info('Data is located on the share, metadata update has been started') manifest.step = _get_frame_step(db_data.frame_filter)