From 7fdb255fcb360ff2b5be7e9e826a7ca7dd089afe Mon Sep 17 00:00:00 2001
From: Martin Lange <martin.lange@ufz.de>
Date: Mon, 19 Jun 2023 15:26:43 +0200
Subject: [PATCH] extend docstrings, add feature to changelog

---
 CHANGELOG.md               |  5 +++++
 src/finam/interfaces.py    | 10 ++++++++--
 src/finam/schedule.py      |  5 +++++
 src/finam/sdk/adapter.py   |  7 ++++++-
 src/finam/sdk/component.py |  7 ++++++-
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f536515e..1b670858 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,11 @@
 
 ## [unpublished]
 
+### Features
+
+* Components and adapters can provide a dictionary of meta data (!259)
+* Class `Composition` hat a property `metadata` that collects and returns the meta data from all components and adapters (!259)
+
 ### Documentation
 
 * Adds a book chapter on wrapping existing models for FINAM (!256)
diff --git a/src/finam/interfaces.py b/src/finam/interfaces.py
index d720281b..2bd5ea1e 100644
--- a/src/finam/interfaces.py
+++ b/src/finam/interfaces.py
@@ -141,7 +141,10 @@ class IComponent(ABC):
     @property
     @abstractmethod
     def metadata(self):
-        """The component's meta data."""
+        """
+        The component's meta data.
+        Will only be called after the connect phase of the composition.
+        """
 
 
 class ITimeComponent(IComponent, ABC):
@@ -461,7 +464,10 @@ class IAdapter(IInput, IOutput, ABC):
     @property
     @abstractmethod
     def metadata(self):
-        """The adapter's meta data."""
+        """
+        The adapter's meta data.
+        Will only be called after the connect phase of the composition.
+        """
 
 
 class NoBranchAdapter:
diff --git a/src/finam/schedule.py b/src/finam/schedule.py
index ecc2d36a..b7506c2d 100644
--- a/src/finam/schedule.py
+++ b/src/finam/schedule.py
@@ -434,6 +434,11 @@ class Composition(Loggable):
         Meta data for all components and adapters.
         Can only be used after ``connect``.
 
+        Returns
+        -------
+        dict
+            A dictionary with keys like ``name@id``. Values are dictionaries containing the meta data.
+
         Raises
         ------
         FinamStatusError
diff --git a/src/finam/sdk/adapter.py b/src/finam/sdk/adapter.py
index bdc8a728..9487c317 100644
--- a/src/finam/sdk/adapter.py
+++ b/src/finam/sdk/adapter.py
@@ -69,7 +69,12 @@ class Adapter(IAdapter, Input, Output, ABC):
 
     @property
     def metadata(self):
-        """The adapter's meta data."""
+        """
+        The adapter's meta data.
+        Will only be called after the connect phase of the composition.
+
+        Returns an empty ``dict`` unless overwritten in adapter implementation.
+        """
         return {}
 
     @final
diff --git a/src/finam/sdk/component.py b/src/finam/sdk/component.py
index ef38a0dc..cdea3efa 100644
--- a/src/finam/sdk/component.py
+++ b/src/finam/sdk/component.py
@@ -220,7 +220,12 @@ class Component(IComponent, Loggable, ABC):
 
     @property
     def metadata(self):
-        """The component's meta data."""
+        """
+        The component's meta data.
+        Will only be called after the connect phase of the composition.
+
+        Returns an empty ``dict`` unless overwritten in component implementation.
+        """
         return {}
 
     @property
-- 
GitLab