parent
1718b3c9ea
commit
e7a48d58e6
5 changed files with 9 additions and 9 deletions
|
|
@ -44,7 +44,7 @@ def add_output_types(frontend_node: CustomComponentFrontendNode, return_types: l
|
|||
"traceback": traceback.format_exc(),
|
||||
},
|
||||
)
|
||||
if return_type == str:
|
||||
if return_type is str:
|
||||
return_type = "Text"
|
||||
elif hasattr(return_type, "__name__"):
|
||||
return_type = return_type.__name__
|
||||
|
|
@ -85,7 +85,7 @@ def add_base_classes(frontend_node: CustomComponentFrontendNode, return_types: l
|
|||
)
|
||||
|
||||
base_classes = get_base_classes(return_type_instance)
|
||||
if return_type_instance == str:
|
||||
if return_type_instance is str:
|
||||
base_classes.append("Text")
|
||||
|
||||
for base_class in base_classes:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from typing import Any
|
|||
|
||||
|
||||
def format_type(type_: Any) -> str:
|
||||
if type_ == str:
|
||||
if type_ is str:
|
||||
type_ = "Text"
|
||||
elif hasattr(type_, "__name__"):
|
||||
type_ = type_.__name__
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ def is_list_of_any(field: FieldInfo) -> bool:
|
|||
else:
|
||||
union_args = []
|
||||
|
||||
return field.annotation.__origin__ == list or any(
|
||||
arg.__origin__ == list for arg in union_args if hasattr(arg, "__origin__")
|
||||
return field.annotation.__origin__ is list or any(
|
||||
arg.__origin__ is list for arg in union_args if hasattr(arg, "__origin__")
|
||||
)
|
||||
except AttributeError:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class Input(BaseModel):
|
|||
|
||||
@field_serializer("field_type")
|
||||
def serialize_field_type(self, value, _info):
|
||||
if value == float and self.range_spec is None:
|
||||
if value is float and self.range_spec is None:
|
||||
self.range_spec = RangeSpec()
|
||||
return value
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue