openbb-cli 1.1.6__tar.gz → 1.1.8__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.
Files changed (45) hide show
  1. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/PKG-INFO +3 -3
  2. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/argparse_translator.py +62 -16
  3. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/obbject_registry.py +3 -1
  4. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/base_platform_controller.py +4 -1
  5. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/pyproject.toml +3 -3
  6. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/README.md +0 -0
  7. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/__init__.py +0 -0
  8. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/__init__.py +0 -0
  9. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/argparse_argument.py +0 -0
  10. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/argparse_class_processor.py +0 -0
  11. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/reference_processor.py +0 -0
  12. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/argparse_translator/utils.py +0 -0
  13. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/routines/routine_example.openbb +0 -0
  14. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/Consolas.ttf +0 -0
  15. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/dark.mpfstyle.json +0 -0
  16. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/dark.mplrc.json +0 -0
  17. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/dark.mplstyle +0 -0
  18. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/dark.pltstyle.json +0 -0
  19. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/dark.richstyle.json +0 -0
  20. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/light.mpfstyle.json +0 -0
  21. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/light.mplrc.json +0 -0
  22. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/light.mplstyle +0 -0
  23. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/light.pltstyle.json +0 -0
  24. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/light.richstyle.json +0 -0
  25. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/default/tables.pltstyle.json +0 -0
  26. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/assets/styles/user/openbb.richstyle.json +0 -0
  27. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/cli.py +0 -0
  28. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/__init__.py +0 -0
  29. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/completer.py +0 -0
  30. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/console.py +0 -0
  31. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/constants.py +0 -0
  32. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/menu_text.py +0 -0
  33. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/setup.py +0 -0
  34. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/config/style.py +0 -0
  35. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/base_controller.py +0 -0
  36. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/choices.py +0 -0
  37. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/cli_controller.py +0 -0
  38. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/hub_service.py +0 -0
  39. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/platform_controller_factory.py +0 -0
  40. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/script_parser.py +0 -0
  41. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/settings_controller.py +0 -0
  42. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/controllers/utils.py +0 -0
  43. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/models/settings.py +0 -0
  44. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/session.py +0 -0
  45. {openbb_cli-1.1.6 → openbb_cli-1.1.8}/openbb_cli/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openbb-cli
3
- Version: 1.1.6
3
+ Version: 1.1.8
4
4
  Summary: Investment Research for Everyone, Anywhere.
5
5
  License: AGPL-3.0-only
6
6
  Author: OpenBB
@@ -12,12 +12,12 @@ Classifier: Programming Language :: Python :: 3.9
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
- Requires-Dist: openbb[all] (>=4.4.0,<5.0.0)
15
+ Requires-Dist: openbb[all] (>=4.4.2,<5.0.0)
16
16
  Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
17
17
  Requires-Dist: prompt-toolkit (>=3.0.50,<4.0.0)
18
18
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
19
19
  Requires-Dist: pywry (>=0.6.2,<0.7.0)
20
- Requires-Dist: rich (>=13.9.4,<14.0.0)
20
+ Requires-Dist: rich (>=14.0.0,<15.0.0)
21
21
  Project-URL: Documentation, https://docs.openbb.co/cli
22
22
  Project-URL: Homepage, https://openbb.co
23
23
  Project-URL: Repository, https://github.com/OpenBB-finance/OpenBB
@@ -178,14 +178,13 @@ class ArgparseTranslator:
178
178
  """Return the argparse action type for the given parameter."""
179
179
  param_type = self.type_hints[param.name]
180
180
  type_origin = get_origin(param_type)
181
-
182
- if param_type == bool or (
181
+ if param_type is bool or (
183
182
  type_origin is Union and bool in get_args(param_type)
184
183
  ):
185
184
  return "store_true"
186
185
  return "store"
187
186
 
188
- def _get_type_and_choices(
187
+ def _get_type_and_choices( # noqa: PLR0912 # pylint: disable=too-many-return-statements, too-many-branches, too-many-statements
189
188
  self, param: inspect.Parameter
190
189
  ) -> Tuple[Type[Any], Tuple[Any, ...]]:
191
190
  """Return the type and choices for the given parameter."""
@@ -196,6 +195,9 @@ class ArgparseTranslator:
196
195
 
197
196
  if type_origin is Literal:
198
197
  choices = get_args(param_type)
198
+ # Special handling for boolean literals
199
+ if all(isinstance(choice, bool) for choice in choices):
200
+ return bool, ()
199
201
  param_type = type(choices[0]) # type: ignore
200
202
 
201
203
  if type_origin is list:
@@ -203,30 +205,66 @@ class ArgparseTranslator:
203
205
 
204
206
  if get_origin(param_type) is Literal:
205
207
  choices = get_args(param_type)
208
+ # Special handling for boolean literals in lists
209
+ if all(isinstance(choice, bool) for choice in choices):
210
+ return bool, ()
206
211
  param_type = type(choices[0]) # type: ignore
207
212
 
208
213
  if type_origin is Union:
209
214
  union_args = get_args(param_type)
210
- if str in union_args:
215
+ # Check if Union contains bool type
216
+ if bool in union_args and (str in union_args or len(union_args) == 2):
217
+ return bool, ()
218
+
219
+ # Check if Union contains Literal types and extract all choices
220
+ literal_choices: list = []
221
+ for arg in union_args:
222
+ if get_origin(arg) is Literal:
223
+ literal_choices.extend(get_args(arg))
224
+
225
+ if literal_choices:
226
+ # Check if all choices are boolean
227
+ if all(isinstance(choice, bool) for choice in literal_choices):
228
+ return bool, ()
229
+ # We have Literal types in the Union, use their choices
230
+ choices = tuple(literal_choices)
231
+ param_type = type(choices[0]) # type: ignore
232
+ elif str in union_args:
211
233
  param_type = str
212
234
 
213
235
  # check if it's an Optional, which would be a Union with NoneType
214
236
  if type(None) in get_args(param_type):
215
237
  # remove NoneType from the args
216
- args = [arg for arg in get_args(param_type) if arg != type(None)]
238
+ args = [arg for arg in get_args(param_type) if arg is not None]
217
239
  # if there is only one arg left, use it
218
- if len(args) > 1:
219
- raise ValueError(
220
- "Union with NoneType should have only one type left"
221
- )
222
- param_type = args[0]
223
-
224
- if get_origin(param_type) is Literal:
225
- choices = get_args(param_type)
226
- param_type = type(choices[0]) # type: ignore
240
+ if len(args) == 1:
241
+ param_type = args[0]
242
+
243
+ if get_origin(param_type) is Literal:
244
+ choices = get_args(param_type)
245
+ # Special handling for boolean literals
246
+ if all(isinstance(choice, bool) for choice in choices):
247
+ return bool, ()
248
+ param_type = type(choices[0]) # type: ignore
249
+ elif len(args) > 1:
250
+ # Handle Union with multiple types (not just Optional)
251
+ # Try to extract Literal types again from the filtered args
252
+ literal_choices = []
253
+ for arg in args:
254
+ if get_origin(arg) is Literal:
255
+ literal_choices.extend(get_args(arg))
256
+
257
+ if literal_choices:
258
+ # Check if all choices are boolean
259
+ if all(isinstance(choice, bool) for choice in literal_choices):
260
+ return bool, ()
261
+ choices = tuple(set(literal_choices))
262
+ param_type = type(choices[0]) # type: ignore
227
263
 
228
264
  # if there are custom choices, override
229
- choices = self._get_argument_custom_choices(param) or choices # type: ignore
265
+ custom_choices = self._get_argument_custom_choices(param)
266
+ if custom_choices and param_type is not bool:
267
+ choices = tuple(custom_choices)
230
268
 
231
269
  return param_type, choices
232
270
 
@@ -329,13 +367,21 @@ class ArgparseTranslator:
329
367
 
330
368
  required = not self._param_is_default(param)
331
369
 
370
+ # Get the appropriate action based on the parameter type
371
+ action = self._get_action_type(param)
372
+
373
+ # For boolean parameters with action="store_true", we should not use any choices
374
+ if param_type is bool:
375
+ choices = ()
376
+ action = "store_true"
377
+
332
378
  argument = ArgparseArgumentModel(
333
379
  name=param.name,
334
380
  type=param_type,
335
381
  dest=param.name,
336
382
  default=param.default,
337
383
  required=required,
338
- action=self._get_action_type(param),
384
+ action=action,
339
385
  help=self._get_argument_custom_help(param),
340
386
  nargs=self._get_nargs(param),
341
387
  choices=choices,
@@ -89,7 +89,9 @@ class Registry:
89
89
  if hasattr(obbject, "results") and obbject.results:
90
90
  data_schema = (
91
91
  obbject.results[0].model_json_schema()
92
- if obbject.results and isinstance(obbject.results, list)
92
+ if obbject.results
93
+ and isinstance(obbject.results, list)
94
+ and hasattr(obbject.results[0], "model_json_schema")
93
95
  else ""
94
96
  )
95
97
  if data_schema and "title" in data_schema:
@@ -34,7 +34,7 @@ class PlatformController(BaseController):
34
34
 
35
35
  CHOICES_GENERATION = True
36
36
 
37
- def __init__(
37
+ def __init__( # pylint: disable=too-many-positional-arguments
38
38
  self,
39
39
  name: str,
40
40
  parent_path: List[str],
@@ -174,6 +174,9 @@ class PlatformController(BaseController):
174
174
  title = f"{self.PATH}{translator.func.__name__}"
175
175
 
176
176
  if obbject:
177
+ if isinstance(obbject, list):
178
+ obbject = OBBject(results=obbject)
179
+
177
180
  if isinstance(obbject, OBBject):
178
181
  if (
179
182
  session.max_obbjects_exceeded()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openbb-cli"
3
- version = "1.1.6"
3
+ version = "1.1.8"
4
4
  description = "Investment Research for Everyone, Anywhere."
5
5
  authors = ["OpenBB <hello@openbb.co>"]
6
6
  packages = [{ include = "openbb_cli" }]
@@ -17,11 +17,11 @@ openbb = 'openbb_cli.cli:main'
17
17
  python = "^3.9,<3.13"
18
18
 
19
19
  # OpenBB dependencies
20
- openbb = { version = "^4.4.0", extras = ["all"] }
20
+ openbb = { version = "^4.4.2", extras = ["all"] }
21
21
 
22
22
  # CLI dependencies
23
23
  prompt-toolkit = "^3.0.50"
24
- rich = "^13.9.4"
24
+ rich = "^14.0.0"
25
25
  python-dotenv = "^1.0.1"
26
26
  openpyxl = "^3.1.5"
27
27
  pywry = "^0.6.2"
File without changes
File without changes