recursive_dict_merge

This commit is contained in:
2025-08-01 13:21:29 +03:00
parent ce6ab8586b
commit b224a1f7d0

View File

@@ -1,4 +1,5 @@
from dotenv import dotenv_values
from collections import defaultdict
# from bot.handlers.MainChannelHandler import MainChannelHandler
# from bot.handlers.TestChannelHandler import TestChannelHandler
# from bot.handlers.TestChannelPhotoHandler import TestChannelPhotoHandler
@@ -51,3 +52,12 @@ video_msg_handlers = [
# MainChannelVideoHandler(),
# # CopyFromMainChannelVideoHandler()
]
def recursive_dict_merge(dict1, dict2):
result = defaultdict(list)
for d in [dict1, dict2]:
for key, value in d.items():
result[key].extend(value)
result = dict(result)
return result