Skip to content

Commit 4e7c183

Browse files
committed
WIP1
1 parent 65a5255 commit 4e7c183

File tree

3 files changed

+13
-28
lines changed

3 files changed

+13
-28
lines changed

fbclient/common_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def __init__(self, key: Optional[str], name: Optional[str], **kwargs):
3838
self._customs = {}
3939
if len(kwargs) > 0:
4040
self._customs \
41-
.update(dict((k, str(v)) for k, v in kwargs.items() if isinstance(k, str) and k.lower() not in __BUILTINS_MAPING__.keys() and (isinstance(v, str) or is_numeric(v))))
41+
.update(dict((k, str(v)) for k, v in kwargs.items() if isinstance(k, str) and k.lower() not in __BUILTINS_MAPING__.keys()
42+
and (isinstance(v, str) or is_numeric(v) or isinstance(v, bool))))
4243

4344
@staticmethod
4445
def from_dict(user: Dict[str, Any]) -> "FBUser":

fbclient/utils/__init__.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,15 @@ def cast_variation_by_flag_type(flag_type: Optional[str], variation: Optional[st
133133

134134

135135
def simple_type_inference(value: Any) -> Optional[str]:
136-
try:
137-
if isinstance(value, bool):
138-
return 'boolean'
139-
elif isinstance(value, str):
140-
return 'string'
141-
elif isinstance(value, Iterable) or isinstance(value, Mapping):
142-
return 'json'
143-
elif is_numeric(str(value)):
144-
return 'number'
145-
else:
146-
return None
147-
except:
136+
if isinstance(value, bool):
137+
return 'boolean'
138+
elif isinstance(value, str):
139+
return 'string'
140+
elif isinstance(value, Iterable) or isinstance(value, Mapping):
141+
return 'json'
142+
elif is_numeric(value):
143+
return 'number'
144+
elif value is None:
148145
return None
146+
else:
147+
raise ValueError("value type is not supported")

fbclient/utils/exceptions.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)