-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/4.1.7' of https://github.com/OpenBB-finance/Ope…
…nBBTerminal into release/4.1.7
- Loading branch information
Showing
43 changed files
with
1,593 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
openbb_platform/core/openbb_core/app/model/custom_parameter.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Custom field for OpenBB.""" | ||
|
||
from typing import Any, List, Optional | ||
|
||
from pydantic.fields import FieldInfo | ||
|
||
|
||
class OpenBBField(FieldInfo): | ||
"""Custom field for OpenBB.""" | ||
|
||
def __repr__(self): | ||
"""Override FieldInfo __repr__.""" | ||
# We use repr() to avoid decoding special characters like \n | ||
if self.choices: | ||
return f"OpenBBField(description={repr(self.description)}, choices={repr(self.choices)})" | ||
return f"OpenBBField(description={repr(self.description)})" | ||
|
||
def __init__(self, description: str, choices: Optional[List[Any]] = None): | ||
"""Initialize OpenBBField.""" | ||
json_schema_extra = {"choices": choices} if choices else None | ||
super().__init__(description=description, json_schema_extra=json_schema_extra) # type: ignore[arg-type] | ||
|
||
@property | ||
def choices(self) -> Optional[List[Any]]: | ||
"""Custom choices.""" | ||
if self.json_schema_extra: | ||
return self.json_schema_extra.get("choices") # type: ignore[union-attr,return-value] | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
openbb_platform/core/openbb_core/app/model/python_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Python configuration settings model.""" | ||
|
||
from typing import List, Optional | ||
|
||
from pydantic import BaseModel, Field, PositiveInt | ||
|
||
|
||
class PythonSettings(BaseModel): | ||
"""Settings model for Python interface configuration.""" | ||
|
||
docstring_sections: List[str] = Field( | ||
default_factory=lambda: ["description", "parameters", "returns", "examples"], | ||
description="Sections to include in autogenerated docstrings.", | ||
) | ||
docstring_max_length: Optional[PositiveInt] = Field( | ||
default=None, description="Maximum length of autogenerated docstrings." | ||
) | ||
|
||
def __repr__(self) -> str: | ||
"""Return a string representation of the model.""" | ||
return f"{self.__class__.__name__}\n\n" + "\n".join( | ||
f"{k}: {v}" for k, v in self.model_dump().items() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.