recursive_dict_merge
This commit is contained in:
10
__init__.py
10
__init__.py
@@ -1,4 +1,5 @@
|
|||||||
from dotenv import dotenv_values
|
from dotenv import dotenv_values
|
||||||
|
from collections import defaultdict
|
||||||
# from bot.handlers.MainChannelHandler import MainChannelHandler
|
# from bot.handlers.MainChannelHandler import MainChannelHandler
|
||||||
# from bot.handlers.TestChannelHandler import TestChannelHandler
|
# from bot.handlers.TestChannelHandler import TestChannelHandler
|
||||||
# from bot.handlers.TestChannelPhotoHandler import TestChannelPhotoHandler
|
# from bot.handlers.TestChannelPhotoHandler import TestChannelPhotoHandler
|
||||||
@@ -51,3 +52,12 @@ video_msg_handlers = [
|
|||||||
# MainChannelVideoHandler(),
|
# MainChannelVideoHandler(),
|
||||||
# # CopyFromMainChannelVideoHandler()
|
# # 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
|
||||||
|
Reference in New Issue
Block a user