From 76b85a4e1f94ddfb31d3fc0de4d5fa8ff3d60501 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 21 Mar 2019 19:11:18 +0100 Subject: [PATCH] Introduce ImageList.copy() - imagelist[:] returns a list, not an ImageList - it returns an instance of ImageList --- picard/metadata.py | 2 +- picard/util/imagelist.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/picard/metadata.py b/picard/metadata.py index 3cba01db1..47c9ecf9a 100644 --- a/picard/metadata.py +++ b/picard/metadata.py @@ -275,7 +275,7 @@ class Metadata(MutableMapping): del self[tag] if other.images: - self.images = other.images[:] + self.images = other.images.copy() if other.length: self.length = other.length diff --git a/picard/util/imagelist.py b/picard/util/imagelist.py index b05588257..39bb40364 100644 --- a/picard/util/imagelist.py +++ b/picard/util/imagelist.py @@ -51,6 +51,9 @@ class ImageList(MutableSequence): def __eq__(self, other): return self._sorted() == other._sorted() + def copy(self): + return self.__class__(self._images) + def get_front_image(self): for img in self: if img.is_front_image():