MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / merge_dict

Function merge_dict

utils/src/utils.py:291–303  ·  view source on GitHub ↗
(d1: dict, d2: list[dict])

Source from the content-addressed store, hash-verified

289
290
291def merge_dict(d1: dict, d2: list[dict]):
292 if len(d2) == 0:
293 return d1
294 for key in list(d1.keys()):
295 values = [d[key] for d in d2]
296 if d1[key] is not None and len(values) != 1:
297 values.append(d1[key])
298 if values[0] is None or not all(value == values[0] for value in values):
299 continue
300 d1[key] = values[0]
301 for d in d2:
302 d[key] = None
303 return d1
304
305
306def dict_to_object(dict: dict, obj: object, exclude=None):

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected