From f776aef0177a1e4834c5e9c4055f823c4c5d0c87 Mon Sep 17 00:00:00 2001 From: rwijtvliet Date: Wed, 31 Jan 2024 22:50:35 +0100 Subject: [PATCH] Hotfix (#12) * forgot aftercare argument * docs --- belvys/tenant.py | 7 +++++-- docs/api.rst | 4 +++- docs/example.rst | 14 ++------------ docs/structure.rst | 10 +++++++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/belvys/tenant.py b/belvys/tenant.py index 951e806..dd291ba 100644 --- a/belvys/tenant.py +++ b/belvys/tenant.py @@ -260,7 +260,7 @@ def portfolio_pfl( self._fetch_series(ts_tree, ts_left, ts_right, missing2zero=missing2zero) ts_trees.append(ts_tree) # Turn into series. - series_trees = [to_series_tree(ts_tree) for ts_tree in ts_trees] + series_trees = [to_series_tree(ts_tree, self.aftercare) for ts_tree in ts_trees] if output_as_series: return series_trees # Turn into portfolio line. @@ -312,7 +312,10 @@ def to_series_tree(ts_tree: TsTree, aftercare: Aftercare) -> SeriesTree: if isinstance(ts_tree, Dict): # nested ts_dict = ts_tree - return {name: to_series_tree(subtree) for name, subtree in ts_dict.items()} + return { + name: to_series_tree(subtree, aftercare) + for name, subtree in ts_dict.items() + } # FlatPfLine. diff --git a/docs/api.rst b/docs/api.rst index 7d0b06b..a8d5938 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -20,6 +20,8 @@ We can also initialise from a configuration file, with the ``belvys.Api.from_fil .. literalinclude:: ../belvys/example_api_basic.yaml :language: yaml +(:download:`download yaml 📄<../belvys/example_api_basic.yaml>`) + -------------- Authentication -------------- @@ -141,4 +143,4 @@ Class Documentation .. autoclass:: belvys.Api :members: - :inherited-members: \ No newline at end of file + :inherited-members: diff --git a/docs/example.rst b/docs/example.rst index 36cb8d7..f46f459 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -8,20 +8,10 @@ The package provides a few examples of ``Api`` and ``Structure`` configurations. Structure --------- -A basic and a more complex example of a structure file can be downloaded here: - -* basic structure configuration (:download:`download yaml📄<../belvys/example_structure_basic.yaml>`) -* complex structure configuration (:download:`download yaml📄<../belvys/example_structure_complex.yaml>`) - -To use and play around with these configurations in code, use the ``belvys.example_structure()`` function. It takes a single argument ``"basic"`` or ``"complex"``, and returns a ``Structure`` instance. With ``belvys.example_structure_to_file()`` this configuration can be saved as a ``yaml`` file. +To use and play around with these configurations in code, use the ``belvys.example_structure()`` function. It takes a single argument ``"basic"`` or ``"complex"``, and returns a ``Structure`` instance. --- Api --- -Likewise, a basic and a more complex example of an api file can be downloaded here: - -* basic api configuration (:download:`download yaml📄<../belvys/example_api_basic.yaml>`) -* complex api configuration (:download:`download yaml📄<../belvys/example_api_complex.yaml>`) - -Similar functions exists: ``belvys.example_api()`` returns an ``Api`` instance, and with ``belvys.example_api_to_file()`` it can be saved as a file. These functions take the same arguments as those mentioned above - though the difference between "basic" and "complex" is much smaller here. +Likewise, ``belvys.example_api()`` returns an ``Api`` instance. It takes the same argument - though the difference between "basic" and "complex" is much smaller here. diff --git a/docs/structure.rst b/docs/structure.rst index 075de8d..887a99c 100644 --- a/docs/structure.rst +++ b/docs/structure.rst @@ -38,10 +38,13 @@ We can initialise a ``Structure`` instance by specifying the initialisation para See the class documentation, below, for an explanation of the meaning of these parameters. -Alternatively, the specification can be stored in a ``yaml`` file, and used to initialise the class using the ``belvys.Structure.from_file()`` class method. Here is the corresponding file, which includes some comments for better understanding the format: +Alternatively, the specification can be stored in a ``yaml`` file, and used to initialise the class using the ``belvys.Structure.from_file()`` class method. Here is the file corresponding to the configuration above. It includes some comments for better understanding the format: .. literalinclude:: ../belvys/example_structure_basic.yaml :language: yaml + +(:download:`download yaml 📄<../belvys/example_structure_basic.yaml>`) + ----- Usage @@ -90,11 +93,12 @@ When the instance has been created, several methods tell us which data we expect Complex example --------------- -The example shown above is a basic one. Here is a more complex example file, which shows all possibilities to specify a ``Structure``. +The example shown above is a basic one. Here is a more complex example file, which shows all possibilities to specify a ``Structure``: .. literalinclude:: ../belvys/example_structure_complex.yaml :language: yaml - + +(:download:`download yaml 📄<../belvys/example_structure_complex.yaml>`) ------------------- Class Documentation