Skip to content

Commit

Permalink
[Bugfix] Uncover cmd len warn (#6536)
Browse files Browse the repository at this point in the history
* show warnings

* better error msg

* mypy ignore

---------

Co-authored-by: Danglewood <[email protected]>
Co-authored-by: Igor Radovanovic <[email protected]>
Co-authored-by: James Maslek <[email protected]>
  • Loading branch information
4 people authored Jul 9, 2024
1 parent 7c33152 commit 82fa129
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cli/openbb_cli/config/menu_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def _format_cmd_name(self, name: str) -> str:
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
Expand Down
4 changes: 1 addition & 3 deletions cli/openbb_cli/controllers/base_platform_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ def print_help(self):

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("'", "")
Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/openbb/package/derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __repr__(self) -> str:
@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
Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/openbb/package/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ def short_term_interest_rate(
@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)

Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/openbb/package/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,6 @@ def market(
@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)
2 changes: 1 addition & 1 deletion openbb_platform/openbb/package/regulators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ def __repr__(self) -> str:
@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)
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def country_string(input_str: str):
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"]
)
Expand Down

0 comments on commit 82fa129

Please sign in to comment.