[Bugfix] Uncover cmd len warn (#6536)

* show warnings

* better error msg

* mypy ignore

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
Henrique Joaquim
2024-07-09 15:00:29 +01:00
committed by GitHub
parent 7c33152d3c
commit 82fa129388
7 changed files with 10 additions and 10 deletions

View File

@@ -79,8 +79,8 @@ class MenuText:
self.warnings.append(
{
"warning": "Command name too long",
"command": name,
"trimmed_command": new_name,
"actual command": f"`{name}`",
"displayed command": f"`{new_name}`",
}
)
name = new_name

View File

@@ -379,9 +379,7 @@ class PlatformController(BaseController):
session.console.print(text=mt.menu_text, menu=self.PATH)
settings = session.settings
dev_mode = settings.DEBUG_MODE or settings.TEST_MODE
if mt.warnings and dev_mode:
if mt.warnings:
session.console.print("")
for w in mt.warnings:
w_str = str(w).replace("{", "").replace("}", "").replace("'", "")

View File

@@ -16,7 +16,7 @@ class ROUTER_derivatives(Container):
@property
def futures(self):
# pylint: disable=import-outside-toplevel
from . import derivatives_futures
from . import derivatives_futures # type: ignore[attr-defined]
return derivatives_futures.ROUTER_derivatives_futures(
command_runner=self._command_runner

View File

@@ -2220,7 +2220,7 @@ class ROUTER_economy(Container):
@property
def survey(self):
# pylint: disable=import-outside-toplevel
from . import economy_survey
from . import economy_survey # type: ignore[attr-defined]
return economy_survey.ROUTER_economy_survey(command_runner=self._command_runner)

View File

@@ -306,6 +306,6 @@ class ROUTER_index(Container):
@property
def price(self):
# pylint: disable=import-outside-toplevel
from . import index_price
from . import index_price # type: ignore[attr-defined]
return index_price.ROUTER_index_price(command_runner=self._command_runner)

View File

@@ -15,6 +15,6 @@ class ROUTER_regulators(Container):
@property
def sec(self):
# pylint: disable=import-outside-toplevel
from . import regulators_sec
from . import regulators_sec # type: ignore[attr-defined]
return regulators_sec.ROUTER_regulators_sec(command_runner=self._command_runner)

View File

@@ -130,7 +130,9 @@ class OECDHousePriceIndexFetcher(
url.replace(".M.RHPI.", ".Q.RHPI."), headers=headers
)
if response.status_code != 200:
raise Exception(f"Error with the OECD request: {response.status_code}")
raise OpenBBError(
f"Error with the OECD request (HTTP {response.status_code}): `{response.text}`"
)
df = read_csv(StringIO(response.text)).get(
["REF_AREA", "TIME_PERIOD", "OBS_VALUE"]
)