Skip to content

Commit c4e6f5a

Browse files
committed
fix bug w custom ruamel yaml types
1 parent afa3f6f commit c4e6f5a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/configmypy/type_inference.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
# import custom Yaml types to handle sequences
88
from ruamel.yaml import CommentedSeq, CommentedMap
9+
from ruamel.yaml.scalarfloat import ScalarFloat
10+
from ruamel.yaml.scalarint import ScalarInt
11+
from ruamel.yaml.scalarbool import ScalarBoolean
912

1013

1114
def infer_boolean(var, strict: bool=True):
@@ -117,9 +120,9 @@ def __call__(self, var):
117120
var: original variable (any type)
118121
119122
"""
120-
if self.orig_type == bool:
123+
if self.orig_type == bool or self.orig_type == ScalarBoolean:
121124
return infer_boolean(var, self.strict)
122-
elif self.orig_type == float or self.orig_type == int:
125+
elif self.orig_type == float or self.orig_type == int or self.orig_type == ScalarFloat or self.orig_type == ScalarInt:
123126
return infer_numeric(var, self.strict)
124127
elif self.orig_type == tuple or self.orig_type == list or self.orig_type == CommentedMap or self.orig_type == CommentedSeq:
125128
return infer_iterable(var, None, self.strict)

0 commit comments

Comments
 (0)