mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
chore: align safevalue_fallback types
This commit is contained in:
parent
04cdd807ba
commit
5ad23405b7
|
@ -128,7 +128,10 @@ def round_dict(d, n):
|
||||||
return {k: (round(v, n) if isinstance(v, float) else v) for k, v in d.items()}
|
return {k: (round(v, n) if isinstance(v, float) else v) for k, v in d.items()}
|
||||||
|
|
||||||
|
|
||||||
def safe_value_fallback(obj: dict, key1: str, key2: Optional[str] = None, default_value=None):
|
DictMap = Union[Dict[str, Any], Mapping[str, Any]]
|
||||||
|
|
||||||
|
|
||||||
|
def safe_value_fallback(obj: DictMap, key1: str, key2: Optional[str] = None, default_value=None):
|
||||||
"""
|
"""
|
||||||
Search a value in obj, return this if it's not None.
|
Search a value in obj, return this if it's not None.
|
||||||
Then search key2 in obj - return that if it's not none - then use default_value.
|
Then search key2 in obj - return that if it's not none - then use default_value.
|
||||||
|
@ -142,10 +145,7 @@ def safe_value_fallback(obj: dict, key1: str, key2: Optional[str] = None, defaul
|
||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
|
|
||||||
dictMap = Union[Dict[str, Any], Mapping[str, Any]]
|
def safe_value_fallback2(dict1: DictMap, dict2: DictMap, key1: str, key2: str, default_value=None):
|
||||||
|
|
||||||
|
|
||||||
def safe_value_fallback2(dict1: dictMap, dict2: dictMap, key1: str, key2: str, default_value=None):
|
|
||||||
"""
|
"""
|
||||||
Search a value in dict1, return this if it's not None.
|
Search a value in dict1, return this if it's not None.
|
||||||
Fall back to dict2 - return key2 from dict2 if it's not None.
|
Fall back to dict2 - return key2 from dict2 if it's not None.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user