2021-08-04 17:24:26 +01:00
|
|
|
import collections.abc as collections_abc
|
2022-09-28 09:35:12 +00:00
|
|
|
from moto.moto_api._internal import mock_random
|
2022-12-11 09:48:12 -01:00
|
|
|
from typing import Any
|
2015-09-16 10:00:38 -04:00
|
|
|
|
|
|
|
|
|
2022-12-11 09:48:12 -01:00
|
|
|
def get_random_pipeline_id() -> str:
|
2022-11-12 21:42:33 -01:00
|
|
|
return f"df-{mock_random.get_random_hex(length=19)}"
|
2015-09-16 17:49:13 -04:00
|
|
|
|
|
|
|
|
|
2022-12-11 09:48:12 -01:00
|
|
|
def remove_capitalization_of_dict_keys(obj: Any) -> Any:
|
2019-12-10 19:21:13 +05:30
|
|
|
if isinstance(obj, collections_abc.Mapping):
|
2015-09-16 17:49:13 -04:00
|
|
|
result = obj.__class__()
|
|
|
|
|
for key, value in obj.items():
|
|
|
|
|
normalized_key = key[:1].lower() + key[1:]
|
2022-12-11 09:48:12 -01:00
|
|
|
result[normalized_key] = remove_capitalization_of_dict_keys(value) # type: ignore[index]
|
2015-09-16 17:49:13 -04:00
|
|
|
return result
|
2021-07-26 07:40:39 +01:00
|
|
|
elif isinstance(obj, collections_abc.Iterable) and not isinstance(obj, str):
|
2022-12-11 09:48:12 -01:00
|
|
|
result = obj.__class__() # type: ignore[assignment]
|
2015-09-16 17:49:13 -04:00
|
|
|
for item in obj:
|
2022-12-11 09:48:12 -01:00
|
|
|
result += (remove_capitalization_of_dict_keys(item),) # type: ignore[operator]
|
2015-09-16 17:49:13 -04:00
|
|
|
return result
|
|
|
|
|
else:
|
|
|
|
|
return obj
|