frostfs-testcases/robot/resources/lib/python_keywords/data_formatters.py
a.y.volkov 0e27ea02c1 Some linter fixes.
Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-06-09 16:12:55 +03:00

21 lines
565 B
Python

"""
A bunch of functions which might rearrange some data or
change their representation.
"""
from functools import reduce
def dict_to_attrs(attrs: dict):
"""
This function takes dictionary of object attributes and converts them
into the string. The string is passed to `--attributes` key of the
neofs-cli.
Args:
attrs (dict): object attributes in {"a": "b", "c": "d"} format.
Returns:
(str): string in "a=b,c=d" format.
"""
return reduce(lambda a, b: f"{a},{b}", map(lambda i: f"{i}={attrs[i]}", attrs))