mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
* refactor openbb-ecb for v5 and expand coverage * some updates * tests * workflow * remove 3.15 from test matrix * some more table schema updates * remove some html chrome on embedded articles --------- Co-authored-by: deeleeramone <>
25 lines
900 B
Python
25 lines
900 B
Python
"""Detect which "owning" sibling extensions are installed."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from importlib.util import find_spec
|
|
|
|
ECONOMY_INSTALLED = find_spec("openbb_economy") is not None
|
|
CURRENCY_INSTALLED = find_spec("openbb_currency") is not None
|
|
FIXEDINCOME_INSTALLED = find_spec("openbb_fixedincome") is not None
|
|
|
|
|
|
def economy_key(standard: str, alias: str) -> str:
|
|
"""Return the standard key when economy is installed, else the ECB alias."""
|
|
return standard if ECONOMY_INSTALLED else alias
|
|
|
|
|
|
def currency_key(standard: str, alias: str) -> str:
|
|
"""Return the standard key when currency is installed, else the ECB alias."""
|
|
return standard if CURRENCY_INSTALLED else alias
|
|
|
|
|
|
def fixedincome_key(standard: str, alias: str) -> str:
|
|
"""Return the standard key when fixedincome is installed, else the ECB alias."""
|
|
return standard if FIXEDINCOME_INSTALLED else alias
|