From 70bf1dbe8dcdbd948c15705548153ad3987aa9dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Thu, 8 Feb 2024 17:09:40 +0100
Subject: [PATCH] MAINT: depricate get_file

---
 CHANGELOG.md                             | 1 +
 src/caoscrawler/identifiable_adapters.py | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 13be62db..33bef515 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - More aggressive caching.
 
 ### Deprecated ###
+- `IdentifiableAdapter.get_file`
 
 ### Removed ###
 
diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py
index 12719cf3..ad955d90 100644
--- a/src/caoscrawler/identifiable_adapters.py
+++ b/src/caoscrawler/identifiable_adapters.py
@@ -26,6 +26,7 @@
 from __future__ import annotations
 
 import logging
+import warnings
 from abc import ABCMeta, abstractmethod
 from datetime import datetime
 from functools import lru_cache
@@ -175,6 +176,7 @@ identifiabel, identifiable and identified record) for a Record.
 
     @abstractmethod
     def get_file(self, identifiable: db.File):
+        warnings.warn(DeprecationWarning("This function is depricated. Please do not use it."))
         """
         Retrieve the file object for a (File) identifiable.
         """
@@ -324,6 +326,7 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
         Just look in records for a file with the same path.
         """
         candidates = []
+        warnings.warn(DeprecationWarning("This function is depricated. Please do not use it."))
         for record in self._records:
             if record.role == "File" and record.path == identifiable.path:
                 candidates.append(record)
@@ -471,6 +474,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter):
         self._registered_identifiables[name] = definition
 
     def get_file(self, identifiable: Identifiable):
+        warnings.warn(DeprecationWarning("This function is depricated. Please do not use it."))
         # TODO is this needed for Identifiable?
         # or can we get rid of this function?
         if isinstance(identifiable, db.Entity):
-- 
GitLab