mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
Linting and improvements
This commit is contained in:
@@ -14,7 +14,6 @@ from openbb_core.app.charting_manager import ChartingManager
|
||||
from openbb_core.app.logs.logging_manager import LoggingManager
|
||||
from openbb_core.app.model.abstract.error import OpenBBError
|
||||
from openbb_core.app.model.abstract.warning import cast_warning
|
||||
from openbb_core.app.model.charts.chart import Chart
|
||||
from openbb_core.app.model.command_context import CommandContext
|
||||
from openbb_core.app.model.obbject import OBBject
|
||||
from openbb_core.app.model.system_settings import SystemSettings
|
||||
@@ -235,8 +234,8 @@ class StaticCommandRunner:
|
||||
route: str,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
"""Create a chart from the command output"""
|
||||
obbject.chart: Chart = cls.charting_manager.chart(
|
||||
"""Create a chart from the command output."""
|
||||
obbject.chart = cls.charting_manager.chart(
|
||||
user_settings=user_settings,
|
||||
system_settings=system_settings,
|
||||
route=route,
|
||||
@@ -347,7 +346,7 @@ class StaticCommandRunner:
|
||||
duration = perf_counter_ns() - start_ns
|
||||
|
||||
if execution_context.user_settings.preferences.metadata:
|
||||
obbject.metadata = {
|
||||
obbject.metadata = { # type: ignore
|
||||
"arguments": kwargs,
|
||||
"duration": duration,
|
||||
"route": route,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import json
|
||||
import logging
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Dict, Optional, Tuple
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, Type, cast
|
||||
|
||||
from openbb_core.app.logs.formatters.formatter_with_exceptions import (
|
||||
FormatterWithExceptions,
|
||||
@@ -180,7 +181,9 @@ class LoggingManager(metaclass=SingletonMeta):
|
||||
route: str,
|
||||
func: Callable,
|
||||
kwargs: Dict[str, Any],
|
||||
exec_info: Optional[Tuple] = None,
|
||||
exec_info: Optional[
|
||||
Tuple[Type[BaseException], BaseException, Optional[TracebackType]]
|
||||
] = None,
|
||||
):
|
||||
"""
|
||||
Log command output and relevant information.
|
||||
@@ -218,7 +221,9 @@ class LoggingManager(metaclass=SingletonMeta):
|
||||
kwargs = {k: str(v)[:100] for k, v in kwargs.items()}
|
||||
|
||||
# Get execution info
|
||||
openbb_error: Optional[OpenBBError] = exec_info[1] if exec_info else None
|
||||
openbb_error = cast(
|
||||
Optional[OpenBBError], exec_info[1] if exec_info else None
|
||||
)
|
||||
|
||||
# Construct message
|
||||
message_label = "ERROR" if openbb_error else "CMD"
|
||||
|
||||
@@ -23,13 +23,13 @@ def create_app():
|
||||
class App(Extensions):
|
||||
"""OpenBB SDK.
|
||||
|
||||
Utility menus:
|
||||
/account
|
||||
/user
|
||||
/system
|
||||
/coverage
|
||||
Utility menus:
|
||||
/account
|
||||
/user
|
||||
/system
|
||||
/coverage
|
||||
|
||||
Extensions:"""
|
||||
Extensions:"""
|
||||
|
||||
def __init__(self, command_runner):
|
||||
self._command_runner = command_runner
|
||||
|
||||
@@ -13,7 +13,6 @@ class Extensions(Container):
|
||||
/forex
|
||||
/futures
|
||||
/news
|
||||
/qa
|
||||
/stocks
|
||||
/ta
|
||||
"""
|
||||
@@ -57,12 +56,6 @@ class Extensions(Container):
|
||||
|
||||
return news.CLASS_news(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def qa(self): # route = "/qa"
|
||||
from openbb_core.app.static.package import qa
|
||||
|
||||
return qa.CLASS_qa(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def stocks(self): # route = "/stocks"
|
||||
from openbb_core.app.static.package import stocks
|
||||
|
||||
@@ -3,32 +3,6 @@
|
||||
"__extensions__": "",
|
||||
"forex": "/forex",
|
||||
"forex_load": "/forex/load",
|
||||
"qa_normality": "/qa/normality",
|
||||
"qa": "/qa",
|
||||
"qa_capm": "/qa/capm",
|
||||
"qa_qqplot": "/qa/qqplot",
|
||||
"qa_om": "/qa/om",
|
||||
"qa_kurtosis": "/qa/kurtosis",
|
||||
"qa_pick": "/qa/pick",
|
||||
"qa_spread": "/qa/spread",
|
||||
"qa_rolling": "/qa/rolling",
|
||||
"qa_var": "/qa/var",
|
||||
"qa_line": "/qa/line",
|
||||
"qa_hist": "/qa/hist",
|
||||
"qa_unitroot": "/qa/unitroot",
|
||||
"qa_beta": "/qa/beta",
|
||||
"qa_sh": "/qa/sh",
|
||||
"qa_so": "/qa/so",
|
||||
"qa_cusum": "/qa/cusum",
|
||||
"qa_raw": "/qa/raw",
|
||||
"qa_cdf": "/qa/cdf",
|
||||
"qa_decompose": "/qa/decompose",
|
||||
"qa_skew": "/qa/skew",
|
||||
"qa_quantile": "/qa/quantile",
|
||||
"qa_bw": "/qa/bw",
|
||||
"qa_es": "/qa/es",
|
||||
"qa_acf": "/qa/acf",
|
||||
"qa_summary": "/qa/summary",
|
||||
"crypto_load": "/crypto/load",
|
||||
"crypto": "/crypto",
|
||||
"news_globalnews": "/news/globalnews",
|
||||
|
||||
Reference in New Issue
Block a user