deepcopy is too slow, so we use this custom copy function. The implementation was profiled and compared to other implementations such as dict-comprehensions and the one below is the most efficient.
(users_on_workers: dict[str, dict[str, int]])
| 389 | |
| 390 | @staticmethod |
| 391 | def _fast_users_on_workers_copy(users_on_workers: dict[str, dict[str, int]]) -> dict[str, dict[str, int]]: |
| 392 | """deepcopy is too slow, so we use this custom copy function. |
| 393 | |
| 394 | The implementation was profiled and compared to other implementations such as dict-comprehensions |
| 395 | and the one below is the most efficient. |
| 396 | """ |
| 397 | return dict(zip(users_on_workers.keys(), map(dict.copy, users_on_workers.values()))) |
no outgoing calls
no test coverage detected