(items: Sequence, max_items: int)
| 1283 | |
| 1284 | |
| 1285 | def shorten_list_repr(items: Sequence, max_items: int) -> str: |
| 1286 | if len(items) <= max_items: |
| 1287 | return repr(items) |
| 1288 | else: |
| 1289 | first_half = repr(items[: max_items // 2])[ |
| 1290 | 1:-1 |
| 1291 | ] # Convert to string and remove brackets |
| 1292 | second_half = repr(items[-max_items // 2 :])[ |
| 1293 | 1:-1 |
| 1294 | ] # Convert to string and remove brackets |
| 1295 | return f"[{first_half}, ..., {second_half}]" |
| 1296 | |
| 1297 | |
| 1298 | def render_human_readable_nbytes( |
no outgoing calls
no test coverage detected
searching dependent graphs…