Skip to content
Snippets Groups Projects
Commit 70bf1dbe authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: depricate get_file

parent 50c9241f
No related branches found
No related tags found
1 merge request!160STY: styling
Pipeline #47058 passed
...@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- More aggressive caching. - More aggressive caching.
### Deprecated ### ### Deprecated ###
- `IdentifiableAdapter.get_file`
### Removed ### ### Removed ###
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
import warnings
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from datetime import datetime from datetime import datetime
from functools import lru_cache from functools import lru_cache
...@@ -175,6 +176,7 @@ identifiabel, identifiable and identified record) for a Record. ...@@ -175,6 +176,7 @@ identifiabel, identifiable and identified record) for a Record.
@abstractmethod @abstractmethod
def get_file(self, identifiable: db.File): 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. Retrieve the file object for a (File) identifiable.
""" """
...@@ -324,6 +326,7 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter): ...@@ -324,6 +326,7 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
Just look in records for a file with the same path. Just look in records for a file with the same path.
""" """
candidates = [] candidates = []
warnings.warn(DeprecationWarning("This function is depricated. Please do not use it."))
for record in self._records: for record in self._records:
if record.role == "File" and record.path == identifiable.path: if record.role == "File" and record.path == identifiable.path:
candidates.append(record) candidates.append(record)
...@@ -471,6 +474,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter): ...@@ -471,6 +474,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter):
self._registered_identifiables[name] = definition self._registered_identifiables[name] = definition
def get_file(self, identifiable: Identifiable): def get_file(self, identifiable: Identifiable):
warnings.warn(DeprecationWarning("This function is depricated. Please do not use it."))
# TODO is this needed for Identifiable? # TODO is this needed for Identifiable?
# or can we get rid of this function? # or can we get rid of this function?
if isinstance(identifiable, db.Entity): if isinstance(identifiable, db.Entity):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment