diff --git a/CHANGELOG.md b/CHANGELOG.md index f536515e842b50f847ab9eaf6e3231f2c05df678..1b67085829d0f4b53fa7a994c7d55f465d7aa5a4 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 d720281bd94207ee9731501961479b846b6ef96c..2bd5ea1e449ebee62ea1776c111c372c2dd0f79a 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 ecc2d36abed82e96aeb9101d37d4f0c5f35c05d7..b7506c2d5dc7832be8b15e09d2246b1498de7316 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 bdc8a7288e8d904272d363500f015f959cb03bcb..9487c317d08a1852281d710e946479ae11495174 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 ef38a0dc9b86f2839d3f6aaf30f45bd9d8d190d0..cdea3efad8e0cc77391ebaa71d610c9c56639b22 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