choices is None by default
This commit is contained in:
parent
57f7852501
commit
c7a9772d0e
2 changed files with 23 additions and 22 deletions
|
@ -76,6 +76,9 @@ class Annotator(Walk): # pylint: disable=R0903
|
||||||
|
|
||||||
def convert_variable(self):
|
def convert_variable(self):
|
||||||
"""convert variable"""
|
"""convert variable"""
|
||||||
|
# default type inference from a default value with :term:`basic types`
|
||||||
|
basic_types = {str: "string", int: "number", bool: "boolean", float: "float"}
|
||||||
|
|
||||||
for variable in self.get_variables():
|
for variable in self.get_variables():
|
||||||
if variable.type == "symlink":
|
if variable.type == "symlink":
|
||||||
continue
|
continue
|
||||||
|
@ -87,8 +90,6 @@ class Annotator(Walk): # pylint: disable=R0903
|
||||||
self._convert_variable(variable)
|
self._convert_variable(variable)
|
||||||
|
|
||||||
multi = self.objectspace.multis.get(variable.path, False)
|
multi = self.objectspace.multis.get(variable.path, False)
|
||||||
# default type inference from a default value with :term:`basic types`
|
|
||||||
basic_types = {str: "string", int: "number", bool: "boolean", float: "float"}
|
|
||||||
if variable.version == "1.0":
|
if variable.version == "1.0":
|
||||||
# - version: 1.0, the default value is of type "string" by default
|
# - version: 1.0, the default value is of type "string" by default
|
||||||
if variable.type is None:
|
if variable.type is None:
|
||||||
|
|
|
@ -442,7 +442,7 @@ class Variable(BaseModel):
|
||||||
version: str
|
version: str
|
||||||
# type will be set dynamically in `annotator/value.py`, default is None
|
# type will be set dynamically in `annotator/value.py`, default is None
|
||||||
type: str = None
|
type: str = None
|
||||||
choices: Union[None, List[BASETYPE_CALC], Calculation]
|
choices: Union[None, List[BASETYPE_CALC], Calculation] = None
|
||||||
|
|
||||||
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue