openbb-cli 1.0.4__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/PKG-INFO +8 -7
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/README.md +2 -2
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/menu_text.py +2 -2
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/base_controller.py +52 -41
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/base_platform_controller.py +1 -3
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/choices.py +4 -3
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/cli_controller.py +2 -1
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/settings_controller.py +2 -2
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/utils.py +74 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/pyproject.toml +5 -5
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/__init__.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/__init__.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/argparse_argument.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/argparse_class_processor.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/argparse_translator.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/obbject_registry.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/reference_processor.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/utils.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/routines/routine_example.openbb +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/Consolas.ttf +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/dark.mpfstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/dark.mplrc.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/dark.mplstyle +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/dark.pltstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/dark.richstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/light.mpfstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/light.mplrc.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/light.mplstyle +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/light.pltstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/light.richstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/default/tables.pltstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/assets/styles/user/openbb.richstyle.json +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/cli.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/__init__.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/completer.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/console.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/constants.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/setup.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/config/style.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/hub_service.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/platform_controller_factory.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/controllers/script_parser.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/models/settings.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/session.py +0 -0
- {openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/utils/utils.py +0 -0
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: openbb-cli
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Investment Research for Everyone, Anywhere.
|
|
5
5
|
Home-page: https://openbb.co
|
|
6
6
|
License: AGPL-3.0-only
|
|
7
7
|
Author: OpenBB
|
|
8
8
|
Author-email: hello@openbb.co
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.9,<3.13
|
|
10
10
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Dist: openbb[all] (>=4.3.0,<5.0.0)
|
|
16
17
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
|
17
18
|
Requires-Dist: prompt-toolkit (>=3.0.16,<4.0.0)
|
|
18
19
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
19
20
|
Requires-Dist: rich (>=13,<14)
|
|
20
|
-
Project-URL: Documentation, https://docs.openbb.co/
|
|
21
|
-
Project-URL: Repository, https://github.com/OpenBB-finance/
|
|
21
|
+
Project-URL: Documentation, https://docs.openbb.co/cli
|
|
22
|
+
Project-URL: Repository, https://github.com/OpenBB-finance/OpenBB
|
|
22
23
|
Description-Content-Type: text/markdown
|
|
23
24
|
|
|
24
25
|
# OpenBB Platform CLI
|
|
25
26
|
|
|
26
27
|
[](https://pepy.tech/project/openbb)
|
|
27
|
-
[](https://github.com/OpenBB-finance/
|
|
28
|
+
[](https://github.com/OpenBB-finance/OpenBB)
|
|
28
29
|
|
|
29
30
|
| OpenBB is committed to build the future of investment research by focusing on an open source infrastructure accessible to everyone, everywhere. |
|
|
30
31
|
| :---------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
@@ -57,7 +58,7 @@ openbb
|
|
|
57
58
|
|
|
58
59
|
Which should result in the following output:
|
|
59
60
|
|
|
60
|
-

|
|
61
62
|
|
|
62
63
|
## API keys
|
|
63
64
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# OpenBB Platform CLI
|
|
2
2
|
|
|
3
3
|
[](https://pepy.tech/project/openbb)
|
|
4
|
-
[](https://github.com/OpenBB-finance/
|
|
4
|
+
[](https://github.com/OpenBB-finance/OpenBB)
|
|
5
5
|
|
|
6
6
|
| OpenBB is committed to build the future of investment research by focusing on an open source infrastructure accessible to everyone, everywhere. |
|
|
7
7
|
| :---------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
@@ -34,7 +34,7 @@ openbb
|
|
|
34
34
|
|
|
35
35
|
Which should result in the following output:
|
|
36
36
|
|
|
37
|
-

|
|
38
38
|
|
|
39
39
|
## API keys
|
|
40
40
|
|
|
@@ -8,7 +8,7 @@ import shlex
|
|
|
8
8
|
from abc import ABCMeta, abstractmethod
|
|
9
9
|
from datetime import datetime
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Any, Dict, List, Literal, Optional, Union
|
|
11
|
+
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
|
|
12
12
|
|
|
13
13
|
import pandas as pd
|
|
14
14
|
from openbb_cli.config.completer import NestedCompleter
|
|
@@ -19,7 +19,9 @@ from openbb_cli.controllers.utils import (
|
|
|
19
19
|
check_file_type_saved,
|
|
20
20
|
check_positive,
|
|
21
21
|
get_flair_and_username,
|
|
22
|
+
handle_obbject_display,
|
|
22
23
|
parse_and_split_input,
|
|
24
|
+
parse_unknown_args_to_dict,
|
|
23
25
|
print_guest_block_msg,
|
|
24
26
|
print_rich_table,
|
|
25
27
|
remove_file,
|
|
@@ -373,7 +375,7 @@ class BaseController(metaclass=ABCMeta):
|
|
|
373
375
|
if other_args and "-" not in other_args[0][0]:
|
|
374
376
|
other_args.insert(0, "-n")
|
|
375
377
|
|
|
376
|
-
ns_parser = self.parse_simple_args(parser, other_args)
|
|
378
|
+
ns_parser, _ = self.parse_simple_args(parser, other_args)
|
|
377
379
|
|
|
378
380
|
if ns_parser:
|
|
379
381
|
if not ns_parser.name:
|
|
@@ -472,7 +474,7 @@ class BaseController(metaclass=ABCMeta):
|
|
|
472
474
|
description="Stop recording session into .openbb routine file",
|
|
473
475
|
)
|
|
474
476
|
# This is only for auto-completion purposes
|
|
475
|
-
_ = self.parse_simple_args(parser, other_args)
|
|
477
|
+
_, _ = self.parse_simple_args(parser, other_args)
|
|
476
478
|
|
|
477
479
|
if "-h" not in other_args and "--help" not in other_args:
|
|
478
480
|
global RECORD_SESSION # noqa: PLW0603
|
|
@@ -603,7 +605,7 @@ class BaseController(metaclass=ABCMeta):
|
|
|
603
605
|
prog="whoami",
|
|
604
606
|
description="Show current user",
|
|
605
607
|
)
|
|
606
|
-
ns_parser = self.parse_simple_args(parser, other_args)
|
|
608
|
+
ns_parser, _ = self.parse_simple_args(parser, other_args)
|
|
607
609
|
|
|
608
610
|
if ns_parser:
|
|
609
611
|
current_user = session.user
|
|
@@ -635,11 +637,27 @@ class BaseController(metaclass=ABCMeta):
|
|
|
635
637
|
"--chart", action="store_true", dest="chart", help="Display chart."
|
|
636
638
|
)
|
|
637
639
|
parser.add_argument(
|
|
638
|
-
"--export",
|
|
640
|
+
"--export",
|
|
641
|
+
default="",
|
|
642
|
+
type=check_file_type_saved(["csv", "json", "xlsx", "png", "jpg"]),
|
|
643
|
+
dest="export",
|
|
644
|
+
help="Export raw data into csv, json, xlsx and figure into png or jpg.",
|
|
645
|
+
nargs="+",
|
|
646
|
+
)
|
|
647
|
+
parser.add_argument(
|
|
648
|
+
"--sheet-name",
|
|
649
|
+
dest="sheet_name",
|
|
650
|
+
default=None,
|
|
651
|
+
nargs="+",
|
|
652
|
+
help="Name of excel sheet to save data to. Only valid for .xlsx files.",
|
|
653
|
+
)
|
|
654
|
+
|
|
655
|
+
ns_parser, unknown_args = self.parse_simple_args(
|
|
656
|
+
parser, other_args, unknown_args=True
|
|
639
657
|
)
|
|
640
658
|
|
|
641
|
-
ns_parser = self.parse_simple_args(parser, other_args)
|
|
642
659
|
if ns_parser:
|
|
660
|
+
kwargs = parse_unknown_args_to_dict(unknown_args)
|
|
643
661
|
if not ns_parser.index and not ns_parser.key:
|
|
644
662
|
results = session.obbject_registry.all
|
|
645
663
|
if results:
|
|
@@ -657,21 +675,13 @@ class BaseController(metaclass=ABCMeta):
|
|
|
657
675
|
index = int(ns_parser.index)
|
|
658
676
|
obbject = session.obbject_registry.get(index)
|
|
659
677
|
if obbject:
|
|
660
|
-
|
|
661
|
-
obbject
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
show_index=True,
|
|
668
|
-
title=title,
|
|
669
|
-
export=ns_parser.export,
|
|
670
|
-
)
|
|
671
|
-
if ns_parser.chart and not obbject.chart:
|
|
672
|
-
session.console.print(
|
|
673
|
-
"[info]No chart available.[/info]"
|
|
674
|
-
)
|
|
678
|
+
handle_obbject_display(
|
|
679
|
+
obbject=obbject,
|
|
680
|
+
chart=ns_parser.chart,
|
|
681
|
+
export=ns_parser.export,
|
|
682
|
+
sheet_name=ns_parser.sheet_name,
|
|
683
|
+
**kwargs,
|
|
684
|
+
)
|
|
675
685
|
else:
|
|
676
686
|
session.console.print(
|
|
677
687
|
f"[info]No result found at index {index}.[/info]"
|
|
@@ -683,26 +693,24 @@ class BaseController(metaclass=ABCMeta):
|
|
|
683
693
|
elif ns_parser.key:
|
|
684
694
|
obbject = session.obbject_registry.get(ns_parser.key)
|
|
685
695
|
if obbject:
|
|
686
|
-
|
|
687
|
-
obbject
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
show_index=True,
|
|
694
|
-
title=title,
|
|
695
|
-
export=ns_parser.export,
|
|
696
|
-
)
|
|
697
|
-
if ns_parser.chart and not obbject.chart:
|
|
698
|
-
session.console.print("[info]No chart available.[/info]")
|
|
696
|
+
handle_obbject_display(
|
|
697
|
+
obbject=obbject,
|
|
698
|
+
chart=ns_parser.chart,
|
|
699
|
+
export=ns_parser.export,
|
|
700
|
+
sheet_name=ns_parser.sheet_name,
|
|
701
|
+
**kwargs,
|
|
702
|
+
)
|
|
699
703
|
else:
|
|
700
704
|
session.console.print(
|
|
701
705
|
f"[info]No result found with key '{ns_parser.key}'.[/info]"
|
|
702
706
|
)
|
|
703
707
|
|
|
704
708
|
@staticmethod
|
|
705
|
-
def parse_simple_args(
|
|
709
|
+
def parse_simple_args(
|
|
710
|
+
parser: argparse.ArgumentParser,
|
|
711
|
+
other_args: List[str],
|
|
712
|
+
unknown_args: bool = False,
|
|
713
|
+
) -> Tuple[Optional[argparse.Namespace], Optional[List[str]]]:
|
|
706
714
|
"""Parse list of arguments into the supplied parser.
|
|
707
715
|
|
|
708
716
|
Parameters
|
|
@@ -711,11 +719,15 @@ class BaseController(metaclass=ABCMeta):
|
|
|
711
719
|
Parser with predefined arguments
|
|
712
720
|
other_args: List[str]
|
|
713
721
|
List of arguments to parse
|
|
722
|
+
unknown_args: bool
|
|
723
|
+
Flag to indicate if unknown arguments should be returned
|
|
714
724
|
|
|
715
725
|
Returns
|
|
716
726
|
-------
|
|
717
|
-
ns_parser:
|
|
727
|
+
ns_parser: argparse.Namespace
|
|
718
728
|
Namespace with parsed arguments
|
|
729
|
+
l_unknown_args: List[str]
|
|
730
|
+
List of unknown arguments
|
|
719
731
|
"""
|
|
720
732
|
parser.add_argument(
|
|
721
733
|
"-h", "--help", action="store_true", help="show this help message"
|
|
@@ -729,19 +741,18 @@ class BaseController(metaclass=ABCMeta):
|
|
|
729
741
|
except SystemExit:
|
|
730
742
|
# In case the command has required argument that isn't specified
|
|
731
743
|
session.console.print("\n")
|
|
732
|
-
return None
|
|
744
|
+
return None, None
|
|
733
745
|
|
|
734
746
|
if ns_parser.help:
|
|
735
747
|
txt_help = parser.format_help()
|
|
736
748
|
session.console.print(f"[help]{txt_help}[/help]")
|
|
737
|
-
return None
|
|
749
|
+
return None, None
|
|
738
750
|
|
|
739
|
-
if l_unknown_args:
|
|
751
|
+
if l_unknown_args and not unknown_args:
|
|
740
752
|
session.console.print(
|
|
741
753
|
f"The following args couldn't be interpreted: {l_unknown_args}\n"
|
|
742
754
|
)
|
|
743
|
-
|
|
744
|
-
return ns_parser
|
|
755
|
+
return ns_parser, l_unknown_args
|
|
745
756
|
|
|
746
757
|
@classmethod
|
|
747
758
|
def parse_known_args_and_warn(
|
|
@@ -379,9 +379,7 @@ class PlatformController(BaseController):
|
|
|
379
379
|
|
|
380
380
|
session.console.print(text=mt.menu_text, menu=self.PATH)
|
|
381
381
|
|
|
382
|
-
|
|
383
|
-
dev_mode = settings.DEBUG_MODE or settings.TEST_MODE
|
|
384
|
-
if mt.warnings and dev_mode:
|
|
382
|
+
if mt.warnings:
|
|
385
383
|
session.console.print("")
|
|
386
384
|
for w in mt.warnings:
|
|
387
385
|
w_str = str(w).replace("{", "").replace("}", "").replace("'", "")
|
|
@@ -4,7 +4,7 @@ from argparse import SUPPRESS, ArgumentParser
|
|
|
4
4
|
from contextlib import contextmanager
|
|
5
5
|
from inspect import isfunction, unwrap
|
|
6
6
|
from types import MethodType
|
|
7
|
-
from typing import Callable, List, Literal
|
|
7
|
+
from typing import Callable, List, Literal, Tuple
|
|
8
8
|
from unittest.mock import patch
|
|
9
9
|
|
|
10
10
|
from openbb_cli.controllers.utils import (
|
|
@@ -110,7 +110,7 @@ def __mock_parse_known_args_and_warn(
|
|
|
110
110
|
)
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
def __mock_parse_simple_args(parser: ArgumentParser, other_args: List[str]) ->
|
|
113
|
+
def __mock_parse_simple_args(parser: ArgumentParser, other_args: List[str]) -> Tuple:
|
|
114
114
|
"""Add arguments.
|
|
115
115
|
|
|
116
116
|
Add the arguments that would have normally added by:
|
|
@@ -127,6 +127,7 @@ def __mock_parse_simple_args(parser: ArgumentParser, other_args: List[str]) -> N
|
|
|
127
127
|
"-h", "--help", action="store_true", help="show this help message"
|
|
128
128
|
)
|
|
129
129
|
_ = other_args
|
|
130
|
+
return None, None
|
|
130
131
|
|
|
131
132
|
|
|
132
133
|
def __get_command_func(controller, command: str):
|
|
@@ -216,7 +217,7 @@ def __patch_controller_functions(controller):
|
|
|
216
217
|
target=controller,
|
|
217
218
|
attribute="parse_simple_args",
|
|
218
219
|
side_effect=__mock_parse_simple_args,
|
|
219
|
-
return_value=None,
|
|
220
|
+
return_value=(None, None),
|
|
220
221
|
),
|
|
221
222
|
patch.object(
|
|
222
223
|
target=controller,
|
|
@@ -205,10 +205,11 @@ class CLIController(BaseController):
|
|
|
205
205
|
choices["results"] = {
|
|
206
206
|
"--help": None,
|
|
207
207
|
"-h": "--help",
|
|
208
|
-
"--export": None,
|
|
208
|
+
"--export": {c: None for c in ["csv", "json", "xlsx", "png", "jpg"]},
|
|
209
209
|
"--index": None,
|
|
210
210
|
"--key": None,
|
|
211
211
|
"--chart": None,
|
|
212
|
+
"--sheet_name": None,
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
self.update_completer(choices)
|
|
@@ -80,7 +80,7 @@ class SettingsController(BaseController):
|
|
|
80
80
|
description=field["description"],
|
|
81
81
|
add_help=False,
|
|
82
82
|
)
|
|
83
|
-
ns_parser = self.parse_simple_args(parser, other_args)
|
|
83
|
+
ns_parser, _ = self.parse_simple_args(parser, other_args)
|
|
84
84
|
if ns_parser:
|
|
85
85
|
session.settings.set_item(
|
|
86
86
|
field_name, not getattr(session.settings, field_name)
|
|
@@ -113,7 +113,7 @@ class SettingsController(BaseController):
|
|
|
113
113
|
type=type_, # type: ignore[arg-type]
|
|
114
114
|
choices=choices,
|
|
115
115
|
)
|
|
116
|
-
ns_parser = self.parse_simple_args(parser, other_args)
|
|
116
|
+
ns_parser, _ = self.parse_simple_args(parser, other_args)
|
|
117
117
|
if ns_parser:
|
|
118
118
|
if ns_parser.value:
|
|
119
119
|
# Console style is applied immediately
|
|
@@ -21,6 +21,7 @@ from openbb_charting.core.backend import create_backend, get_backend
|
|
|
21
21
|
from openbb_cli.config.constants import AVAILABLE_FLAIRS, ENV_FILE_SETTINGS
|
|
22
22
|
from openbb_cli.session import Session
|
|
23
23
|
from openbb_core.app.model.charts.charting_settings import ChartingSettings
|
|
24
|
+
from openbb_core.app.model.obbject import OBBject
|
|
24
25
|
from pytz import all_timezones, timezone
|
|
25
26
|
from rich.table import Table
|
|
26
27
|
|
|
@@ -974,3 +975,76 @@ def request(
|
|
|
974
975
|
timeout=timeout,
|
|
975
976
|
**kwargs,
|
|
976
977
|
)
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
def parse_unknown_args_to_dict(unknown_args: Optional[List[str]]) -> Dict[str, str]:
|
|
981
|
+
"""Parse unknown arguments to a dictionary."""
|
|
982
|
+
unknown_args_dict = {}
|
|
983
|
+
if unknown_args:
|
|
984
|
+
for idx, arg in enumerate(unknown_args):
|
|
985
|
+
if arg.startswith("--"):
|
|
986
|
+
if idx + 1 < len(unknown_args):
|
|
987
|
+
try:
|
|
988
|
+
unknown_args_dict[arg.replace("--", "")] = (
|
|
989
|
+
eval( # noqa: S307, E501 pylint: disable=eval-used
|
|
990
|
+
unknown_args[idx + 1]
|
|
991
|
+
)
|
|
992
|
+
)
|
|
993
|
+
except Exception:
|
|
994
|
+
unknown_args_dict[arg] = unknown_args[idx + 1]
|
|
995
|
+
else:
|
|
996
|
+
session.console.print(
|
|
997
|
+
f"Missing value for argument {arg}. Skipping this argument."
|
|
998
|
+
)
|
|
999
|
+
return unknown_args_dict
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
def handle_obbject_display(
|
|
1003
|
+
obbject: OBBject,
|
|
1004
|
+
chart: bool = False,
|
|
1005
|
+
export: str = "",
|
|
1006
|
+
sheet_name: str = "",
|
|
1007
|
+
**kwargs,
|
|
1008
|
+
):
|
|
1009
|
+
"""Handle the display of an OBBject."""
|
|
1010
|
+
df: pd.DataFrame = pd.DataFrame()
|
|
1011
|
+
fig: Optional[OpenBBFigure] = None
|
|
1012
|
+
if chart:
|
|
1013
|
+
try:
|
|
1014
|
+
if obbject.chart:
|
|
1015
|
+
obbject.show(**kwargs)
|
|
1016
|
+
else:
|
|
1017
|
+
obbject.charting.to_chart(**kwargs)
|
|
1018
|
+
if export:
|
|
1019
|
+
fig = obbject.chart.fig
|
|
1020
|
+
df = obbject.to_dataframe()
|
|
1021
|
+
except Exception as e:
|
|
1022
|
+
session.console.print(f"Failed to display chart: {e}")
|
|
1023
|
+
else:
|
|
1024
|
+
df = obbject.to_dataframe()
|
|
1025
|
+
print_rich_table(
|
|
1026
|
+
df=df,
|
|
1027
|
+
show_index=True,
|
|
1028
|
+
title=obbject.extra.get("command", ""),
|
|
1029
|
+
export=bool(export),
|
|
1030
|
+
)
|
|
1031
|
+
if export and not df.empty:
|
|
1032
|
+
if sheet_name and isinstance(sheet_name, list):
|
|
1033
|
+
sheet_name = sheet_name[0]
|
|
1034
|
+
|
|
1035
|
+
func_name = (
|
|
1036
|
+
obbject.extra.get("command", "")
|
|
1037
|
+
.replace("/", "_")
|
|
1038
|
+
.replace(" ", "_")
|
|
1039
|
+
.replace("--", "_")
|
|
1040
|
+
)
|
|
1041
|
+
export_data(
|
|
1042
|
+
export_type=",".join(export),
|
|
1043
|
+
dir_path=os.path.dirname(os.path.abspath(__file__)),
|
|
1044
|
+
func_name=func_name,
|
|
1045
|
+
df=df,
|
|
1046
|
+
sheet_name=sheet_name,
|
|
1047
|
+
figure=fig,
|
|
1048
|
+
)
|
|
1049
|
+
elif export and df.empty:
|
|
1050
|
+
session.console.print("[yellow]No data to export.[/yellow]")
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "openbb-cli"
|
|
3
|
-
version = "1.0
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "Investment Research for Everyone, Anywhere."
|
|
5
5
|
authors = ["OpenBB <hello@openbb.co>"]
|
|
6
6
|
packages = [{ include = "openbb_cli" }]
|
|
7
7
|
license = "AGPL-3.0-only"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
homepage = "https://openbb.co"
|
|
10
|
-
repository = "https://github.com/OpenBB-finance/
|
|
11
|
-
documentation = "https://docs.openbb.co/
|
|
10
|
+
repository = "https://github.com/OpenBB-finance/OpenBB"
|
|
11
|
+
documentation = "https://docs.openbb.co/cli"
|
|
12
12
|
|
|
13
13
|
[tool.poetry.scripts]
|
|
14
14
|
openbb = 'openbb_cli.cli:main'
|
|
15
15
|
|
|
16
16
|
[tool.poetry.dependencies]
|
|
17
|
-
python = "^3.
|
|
17
|
+
python = "^3.9,<3.13"
|
|
18
18
|
|
|
19
19
|
# OpenBB dependencies
|
|
20
|
-
openbb = { version = "^4.
|
|
20
|
+
openbb = { version = "^4.3.0", extras = ["all"] }
|
|
21
21
|
|
|
22
22
|
# CLI dependencies
|
|
23
23
|
prompt-toolkit = "^3.0.16"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openbb_cli-1.0.4 → openbb_cli-1.1.0}/openbb_cli/argparse_translator/argparse_class_processor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|