[BugFix] - Fix pylint possibly-used-before-assignment (#6484)

* fix: comply w/ possibly used before assignment

* remove disabe from .pylintrc

* remove reset test

* remove reset test

* fix: update missing keys message
This commit is contained in:
montezdesousa
2024-06-05 16:40:24 +01:00
committed by GitHub
parent e0be8cdacf
commit a52b24c16b
25 changed files with 56 additions and 63 deletions

View File

@@ -6,7 +6,6 @@ from types import MethodType
from typing import Dict, List, Optional
import pandas as pd
from openbb import obb
from openbb_charting.core.openbb_figure import OpenBBFigure
from openbb_cli.argparse_translator.argparse_class_processor import (
ArgparseClassProcessor,
@@ -17,6 +16,8 @@ from openbb_cli.controllers.utils import export_data, print_rich_table
from openbb_cli.session import Session
from openbb_core.app.model.obbject import OBBject
from openbb import obb
session = Session()

View File

@@ -274,6 +274,7 @@ def _get_argument_parser(
" - parse_known_args_and_warn\n"
)
# pylint: disable=possibly-used-before-assignment
return argument_parser

View File

@@ -18,7 +18,6 @@ from typing import Any, Dict, List, Optional
import pandas as pd
import requests
from openbb import obb
from openbb_cli.config import constants
from openbb_cli.config.constants import (
ASSETS_DIRECTORY,
@@ -48,6 +47,8 @@ from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.styles import Style
from pydantic import BaseModel
from openbb import obb
PLATFORM_ROUTERS = {
d: "menu" if not isinstance(getattr(obb, d), BaseModel) else "command"
for d in dir(obb)
@@ -291,7 +292,7 @@ class CLIController(BaseController):
: session.settings.N_TO_DISPLAY_OBBJECT_REGISTRY
]:
mt.add_raw(
f"[yellow]OBB{key}[/yellow]: {value['command']}",
f"[yellow]OBB{key}[/yellow]: {value['command']}", # type: ignore[index]
left_spacing=True,
)
@@ -769,7 +770,6 @@ def replace_dynamic(match: re.Match, special_arguments: Dict[str, str]) -> str:
str
The new string
"""
cleaned = match[0].replace("{", "").replace("}", "").replace("$", "")
key, default = cleaned.split("=")
dict_value = special_arguments.get(key, default)
@@ -939,7 +939,6 @@ def launch(
debug: bool = False, dev: bool = False, queue: Optional[List[str]] = None
) -> None:
"""Launch CLI."""
if queue:
main(debug, dev, queue, module="")
else:

View File

@@ -16,7 +16,6 @@ from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
import requests
from openbb import obb
from openbb_charting.core.backend import create_backend, get_backend
from openbb_cli.config.constants import AVAILABLE_FLAIRS, ENV_FILE_SETTINGS
from openbb_cli.session import Session
@@ -24,6 +23,8 @@ from openbb_core.app.model.charts.charting_settings import ChartingSettings
from pytz import all_timezones, timezone
from rich.table import Table
from openbb import obb
if TYPE_CHECKING:
from openbb_charting.core.openbb_figure import OpenBBFigure
@@ -680,7 +681,6 @@ def remove_timezone_from_dataframe(df: pd.DataFrame) -> pd.DataFrame:
pd.DataFrame
The dataframe with timezone information removed
"""
date_cols = []
index_is_date = False
@@ -844,7 +844,6 @@ def export_data(
margin : bool
Automatically adjust subplot parameters to give specified padding.
"""
if export_type:
saved_path = compose_export_path(func_name, dir_path).resolve()
saved_path.parent.mkdir(parents=True, exist_ok=True)