Allow round to INT
In round_dict, if places is None, round to INT.
This commit is contained in:
parent
640f25d5eb
commit
29cdbf72b8
@ -50,9 +50,14 @@ def partition(iterable, limit, key=lambda x: x):
|
||||
def round_dict(dic, places):
|
||||
"""
|
||||
Rounds all values in a dict containing only numeric types to `places` decimal places.
|
||||
If places is None, round to INT.
|
||||
"""
|
||||
for key, value in dic.items():
|
||||
dic[key] = round(value, places)
|
||||
if places is None:
|
||||
for key, value in dic.items():
|
||||
dic[key] = round(value)
|
||||
else:
|
||||
for key, value in dic.items():
|
||||
dic[key] = round(value, places)
|
||||
|
||||
|
||||
class ModuleList(collections.UserList):
|
||||
|
Loading…
Reference in New Issue
Block a user