fix(segments): Support NoneType. (#6581)

This commit is contained in:
-LAN- 2024-07-23 17:59:32 +08:00 • committed by GitHub
commit 2bc0632d0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 45 additions and 4 deletions

View file

@ -10,6 +10,7 @@ from .variables import (
FileVariable,
FloatVariable,
IntegerVariable,
NoneVariable,
ObjectVariable,
SecretVariable,
StringVariable,
@ -39,6 +40,8 @@ def build_variable_from_mapping(m: Mapping[str, Any], /) -> Variable:
def build_anonymous_variable(value: Any, /) -> Variable:
if value is None:
return NoneVariable(name='anonymous')
if isinstance(value, str):
return StringVariable(name='anonymous', value=value)
if isinstance(value, int):