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