mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
remove comment chatter
This commit is contained in:
@@ -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__
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 ())
|
||||
|
||||
@@ -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:
|
||||
|
||||
5
openbb_platform/core/pyproject.toml
vendored
5
openbb_platform/core/pyproject.toml
vendored
@@ -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]
|
||||
|
||||
@@ -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"}
|
||||
)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user