python 3.9 backward compatibility
This commit is contained in:
parent
fa80fa14b4
commit
15327d20aa
1 changed files with 7 additions and 4 deletions
|
@ -67,6 +67,7 @@ from .object_model import (
|
|||
from .error import DictConsistencyError
|
||||
|
||||
|
||||
|
||||
property_types = Union[Literal[True], Calculation]
|
||||
properties_types = Dict[str, property_types]
|
||||
|
||||
|
@ -232,6 +233,8 @@ class ParserVariable:
|
|||
self.default_multi = {}
|
||||
self.jinja = {}
|
||||
self.rougailconfig = rougailconfig
|
||||
self.convert_options = list(CONVERT_OPTION)
|
||||
self.convert_options.extend(self.rougailconfig["custom_types"])
|
||||
#
|
||||
self.family = Family
|
||||
self.dynamic = Dynamic
|
||||
|
@ -247,11 +250,10 @@ class ParserVariable:
|
|||
super().__init__()
|
||||
|
||||
def get_variable(self):
|
||||
convert_options = list(CONVERT_OPTION)
|
||||
convert_options.extend(self.rougailconfig["custom_types"])
|
||||
|
||||
class Variable(_Variable):
|
||||
type: Literal[*convert_options] = convert_options[0]
|
||||
#type: Literal[*convert_options] = convert_options[0]
|
||||
type: str = self.convert_options[0]
|
||||
|
||||
return Variable
|
||||
|
||||
|
@ -269,7 +271,8 @@ class ParserVariable:
|
|||
)
|
||||
#
|
||||
hint = get_type_hints(self.variable)
|
||||
self.variable_types = hint["type"].__args__ # pylint: disable=W0201
|
||||
|
||||
self.variable_types = self.convert_options #hint["type"].__args__ # pylint: disable=W0201
|
||||
#
|
||||
hint = get_type_hints(self.choice)
|
||||
self.choice_attrs = frozenset( # pylint: disable=W0201
|
||||
|
|
Loading…
Reference in a new issue