MCPcopy Create free account
hub / github.com/apache/fory / mutate_dict

Function mutate_dict

benchmarks/python/fory_benchmark.py:185–191  ·  view source on GitHub ↗
(orig_dict, random_source)

Source from the content-addressed store, hash-verified

183
184
185def mutate_dict(orig_dict, random_source):
186 new_dict = dict(orig_dict)
187 for key, value in new_dict.items():
188 rand_val = random_source.random() * sys.maxsize
189 if isinstance(key, (int, bytes, str)):
190 new_dict[key] = type(key)(rand_val)
191 return new_dict
192
193
194random_source = random.Random(BENCHMARK_RANDOM_SEED)

Callers 1

fory_benchmark.pyFile · 0.85

Calls 2

itemsMethod · 0.80
randomMethod · 0.45

Tested by

no test coverage detected