From 0037587186fe5467c5f1dada638759ea86956ca3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves David <pierre-yves.david@ens-lyon.org> Date: Fri, 24 May 2024 16:21:46 +0200 Subject: [PATCH] DiskBackedContent: use a different approach for deprecation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turns out that calling @deprecated on Content alter the class, and any instantion of "Content" will be wrongly marked as deprecated… So use a different approach too preserve compatibility (and we won't keep it long). --- swh/model/from_disk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swh/model/from_disk.py b/swh/model/from_disk.py index 160ea739..fea1e324 100644 --- a/swh/model/from_disk.py +++ b/swh/model/from_disk.py @@ -71,9 +71,9 @@ class FromDiskType(model._StringCompatibleEnum): # them a hand to let them handle compatibility in a smoother way. # # Remove this compatibility trick once this user have been migrated -DiskBackedContent = deprecated( - version="v6.13.0", reason="Use model.Content.object_type instead" -)(model.Content) +@deprecated(version="v6.13.0", reason="Use model.Content.object_type instead") +def DiskBackedContent(*args, **kwargs): + return model.Content(*args, **kwargs) @attr.s(frozen=True, slots=True) -- GitLab