Skip to content

Commit

Permalink
fix default type to str
Browse files Browse the repository at this point in the history
  • Loading branch information
dhpitt committed Mar 7, 2024
1 parent c492b58 commit 329c189
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/configmypy/type_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(self, orig_type: Callable, strict: bool=True):
orig_type: Callable type
type of original var from config
cannot be NoneType - defaults to infer_str
strict: bool, default True
whether to use type inferencing. If False,
default to simply applying default type converter.
Expand All @@ -95,7 +96,10 @@ def __init__(self, orig_type: Callable, strict: bool=True):
the allowed types. Otherwise default to str.
"""
self.orig_type = orig_type
if orig_type == type(None):
self.orig_type = infer_str
else:
self.orig_type = orig_type
self.strict = strict

def __call__(self, var):
Expand All @@ -104,6 +108,7 @@ def __call__(self, var):
var: original variable (any type)
"""
print(f"{self.orig_type=} {var=}")
if self.orig_type == bool:
return infer_boolean(var, self.strict)
elif self.orig_type == float or self.orig_type == int:
Expand Down

0 comments on commit 329c189

Please sign in to comment.