Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Sep 20, 2023
2 parents d1701a4 + 8042afc commit a22602c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
24 changes: 12 additions & 12 deletions bw_hestia_bridge/hestia_api/cycle_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ def get_cycle_graph(cycle_id: str) -> list[dict]:
Parameters
----------
cycle_id : str
Hestia ID of the initial cycle.
Hestia ID of the initial cycle
Returns
-------
List of cycles of the form: ::
List of cycles of the form : list[dict]
::
[
{
"from": {@type="Cycle", @id: PARENT_CYCLE_ID},
"to": {@type: "Cycle", @id: CHILD_CYCLE_ID},
"via": {@type: "Term", @id: PRODUCT_TERM_ID}
},
...
]
[
{
"from": {"@type": "Cycle", "@id": PARENT_CYCLE_ID},
"to": {"@type": "Cycle", "@id": CHILD_CYCLE_ID},
"via": {"@type": "Term", "@id": PRODUCT_TERM_ID}
}, ...
]
Raises
------
``ValueError`` if `cycle_id` is not found.
'''
ValueError
if `cycle_id` is not found
"""
q: dict[str, Union[int, str]] = {
"limit": 10000,
Expand Down
19 changes: 13 additions & 6 deletions bw_hestia_bridge/hestia_api/querying.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def search_hestia(
Returns
-------
A list of dicts containing the `fields` entries. Additionally, a "_score"
value is returned, indicating the accuracy of the match found in the
Hestia database (results are sorted by decreasing "_score").
res : list[dict]
A list of dicts containing the `fields` entries. Additionally, a
"_score" value is returned, indicating the accuracy of the match found
in the Hestia database (results are sorted by decreasing "_score").
Examples
--------
Expand Down Expand Up @@ -134,8 +135,9 @@ def get_hestia_node(
Returns
-------
The dict associated to the JSON-LD entry describing `node` in the
Hestia database.
node : dict
The dict associated to the JSON-LD entry describing `node` in the
Hestia database.
"""
if isinstance(node_id, dict):
assert "@type" in node_id, "`node` must contain an '@type' entry."
Expand Down Expand Up @@ -165,9 +167,14 @@ def get_node_type(node_id: str) -> str:
node_id : str
Hestia ID for the node.
Returns
-------
node_type : str
The type of the node.
Raises
------
``ValueError`` if `node_id` is not found.
ValueError : if `node_id` is not found.
"""
res = search_hestia({"@id": node_id}, how="exact")

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'sphinx.ext.intersphinx',
'sphinx.ext.extlinks',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.napoleon',
# iPython extensions
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
Expand Down

0 comments on commit a22602c

Please sign in to comment.