mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-07 18:01:10 +00:00
Update package_builder.py
This commit is contained in:
@@ -103,7 +103,7 @@ class PackageBuilder:
|
||||
package_folder.mkdir(exist_ok=True)
|
||||
|
||||
print(package_path)
|
||||
with package_path.open("w") as file:
|
||||
with package_path.open("w", encoding="utf-8", newline="\n") as file:
|
||||
file.write(module_code)
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class ImportDefinition:
|
||||
code += "\nimport pandas"
|
||||
code += "\nimport datetime"
|
||||
code += "\nimport pydantic"
|
||||
code += "\nfrom pydantic import validate_arguments"
|
||||
code += "\nfrom pydantic import validate_arguments, BaseModel"
|
||||
code += "\nfrom inspect import Parameter"
|
||||
code += "\nfrom typing import List, Dict, Union, Optional, Literal"
|
||||
code += "\nfrom openbb_core.app.utils import df_to_basemodel"
|
||||
@@ -527,9 +527,12 @@ class MethodDefinition:
|
||||
if hasattr(item_type, "__name__")
|
||||
else item_type._name
|
||||
)
|
||||
func_returns = (
|
||||
f"CommandOutput[{item_type.__module__}.{inner_type_name}]"
|
||||
)
|
||||
result_type = f"{item_type.__module__}.{inner_type_name}"
|
||||
|
||||
if "pydantic.main" in result_type:
|
||||
result_type = "BaseModel"
|
||||
|
||||
func_returns = f"CommandOutput[{result_type}]"
|
||||
|
||||
return func_returns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user