diff --git a/openbb_platform/core/openbb_core/app/static/package_builder/docstring_generator.py b/openbb_platform/core/openbb_core/app/static/package_builder/docstring_generator.py index 19728dda0ed..b871ca86e2b 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder/docstring_generator.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder/docstring_generator.py @@ -115,8 +115,7 @@ class DocstringGenerator: continue type_name = str(arg) if hasattr(arg, "__forward_arg__"): - # A bare ForwardRef ('Data', 'DataFrame', ...) - render - # its target name, not the ``ForwardRef(...)`` wrapper. + # Render a ForwardRef as its target name. type_name = arg.__forward_arg__ elif hasattr(arg, "__name__") and not get_args(arg): type_name = arg.__name__ diff --git a/openbb_platform/core/openbb_core/app/static/package_builder/method_definition.py b/openbb_platform/core/openbb_core/app/static/package_builder/method_definition.py index 60e92b6bea2..be0c66c6674 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder/method_definition.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder/method_definition.py @@ -573,10 +573,7 @@ class MethodDefinition: if name in path_params or name in ("kwargs", "**kwargs"): continue # Already handled above - # Unpack a plain ``QueryParams`` parameter (the V5 typed-command - # pattern - a single ``QueryParams`` argument) into its individual - # fields so the generated command exposes them directly. Limited to - # ``QueryParams`` subclasses so plain request-body models stay typed. + # Unpack a V5 QueryParams-model parameter into its individual fields. model = param.annotation if isclass(model) and issubclass(model, QueryParams): model_fields = getattr( @@ -597,9 +594,7 @@ class MethodDefinition: field_name, extra, type_ ) if hasattr(new_type, "__constraints__"): - # ``data`` expands to the DataProcessingSupportedTypes - # TypeVar - inline its constraints so the generated - # annotation never references the TypeVar itself. + # Inline the TypeVar constraints into the annotation. types = new_type.__constraints__ + (type_,) # type: ignore updated_type = Union[types] # noqa elif new_type is ...: @@ -1302,9 +1297,7 @@ class MethodDefinition: elif isclass(param.annotation) and issubclass( param.annotation, QueryParams ): - # V5 typed-command pattern: a single QueryParams model param. - # The generated signature unpacks it into individual fields; - # repack them into a dict the route validates the model from. + # Repack the unpacked QueryParams fields into a dict for the route. model = param.annotation fields = getattr( model, diff --git a/openbb_platform/core/openbb_core/app/static/package_builder/reference_generator.py b/openbb_platform/core/openbb_core/app/static/package_builder/reference_generator.py index f965239b824..2770d1a5d9d 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder/reference_generator.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder/reference_generator.py @@ -1001,9 +1001,7 @@ class ReferenceGenerator: # Try to extract from type annotation first (more reliable) args = get_args(return_annotation) - # Pydantic parameterized generics (e.g. ``OBBject[list[Foo]]``) are - # concrete classes, so ``get_origin``/``get_args`` see nothing - fall - # back to the generic metadata Pydantic records on the class. + # Pydantic generic aliases are concrete classes - read their metadata. if not args: pgm = getattr(return_annotation, "__pydantic_generic_metadata__", {}) args = tuple(pgm.get("args") or ()) diff --git a/openbb_platform/core/openbb_core/app/static/utils/filters.py b/openbb_platform/core/openbb_core/app/static/utils/filters.py index 7ac142cf199..ad8b285a905 100644 --- a/openbb_platform/core/openbb_core/app/static/utils/filters.py +++ b/openbb_platform/core/openbb_core/app/static/utils/filters.py @@ -18,8 +18,7 @@ def filter_inputs( if key == "data": kwargs[key] = convert_to_basemodel(value) elif isinstance(value, dict) and "data" in value: - # V5 typed-command pattern: the QueryParams model is passed as a - # dict - convert its ``data`` field before the route validates it. + # A QueryParams model passed as a dict - convert its nested data. value["data"] = convert_to_basemodel(value["data"]) if info: diff --git a/openbb_platform/core/pyproject.toml b/openbb_platform/core/pyproject.toml index 56c72a66948..f9f2132dc34 100644 --- a/openbb_platform/core/pyproject.toml +++ b/openbb_platform/core/pyproject.toml @@ -138,10 +138,7 @@ exclude = [ unresolved-import = "warn" [[tool.ty.overrides]] -# ``file_lock.py`` intentionally uses both ``fcntl`` (Unix) and ``msvcrt`` -# (Windows). A static check on either OS flags the other platform's branch as -# unresolved (and the matching ``# type: ignore`` as unused), so the two -# platform-sensitive rules are silenced for just this file. +# file_lock.py is cross-platform (fcntl/msvcrt) - silence platform-specific noise. include = ["**/static/package_builder/file_lock.py"] [tool.ty.overrides.rules] diff --git a/openbb_platform/core/tests/app/static/test_filters.py b/openbb_platform/core/tests/app/static/test_filters.py index b330eae363b..fd558976fc7 100644 --- a/openbb_platform/core/tests/app/static/test_filters.py +++ b/openbb_platform/core/tests/app/static/test_filters.py @@ -271,11 +271,7 @@ def test_filter_inputs_no_info_list_in_standard_params_raises(): def test_filter_inputs_converts_nested_data_in_model_dict(): - """A QueryParams model passed as a dict has its nested 'data' field converted. - - V5 typed commands pass their ``QueryParams`` as a single dict; ``filter_inputs`` - must still coerce the model's ``data`` field to ``Data`` models. - """ + """A QueryParams model passed as a dict has its nested data field converted.""" result = filter_inputs( True, None, params={"data": [{"a": 1}, {"a": 2}], "target": "a"} ) diff --git a/openbb_platform/core/tests/app/test_command_runner.py b/openbb_platform/core/tests/app/test_command_runner.py index 24ff9242e80..06b54c96ee5 100644 --- a/openbb_platform/core/tests/app/test_command_runner.py +++ b/openbb_platform/core/tests/app/test_command_runner.py @@ -77,14 +77,7 @@ def mock_func(): @pytest.fixture() def allow_command_output_extensions(monkeypatch): - """Enable command-output OBBject extensions for the duration of a test. - - The ``test_trigger_callbacks_*`` tests construct ``Extension`` objects with - ``on_command_output=True`` (and ``immutable=False``). ``Extension`` refuses - to build those unless the matching ``system_settings`` flags are enabled, so - this fixture flips them on the ``SystemService`` singleton and restores them - afterwards. - """ + """Enable command-output OBBject extensions for the duration of a test.""" from openbb_core.app.service.system_service import SystemService service = SystemService()