frostfs-testcases/robot/resources/lib/python/data_formatters.py
anastasia prasolova 3e749abcd0 added keywords library container.py extracted from neofs.py
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
2022-04-29 18:17:44 +03:00

21 lines
563 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 `--attibutes` key of the
neofs-cli.
Args:
attrs (dict): object attirbutes 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))