Title: Update ruff
State: closed


Comments: The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6706). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.<details>
<summary>Show benchmarks</summary>

PyArrow==8.0.0

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005014 / 0.011353 (-0.006339) | 0.003324 / 0.011008 (-0.007685) | 0.062501 / 0.038508 (0.023993) | 0.027633 / 0.023109 (0.004524) | 0.245693 / 0.275898 (-0.030205) | 0.271963 / 0.323480 (-0.051517) | 0.003062 / 0.007986 (-0.004923) | 0.002646 / 0.004328 (-0.001683) | 0.049020 / 0.004250 (0.044769) | 0.042381 / 0.037052 (0.005328) | 0.269729 / 0.258489 (0.011240) | 0.289052 / 0.293841 (-0.004789) | 0.027138 / 0.128546 (-0.101408) | 0.010246 / 0.075646 (-0.065400) | 0.205378 / 0.419271 (-0.213893) | 0.035792 / 0.043533 (-0.007741) | 0.247204 / 0.255139 (-0.007935) | 0.271805 / 0.283200 (-0.011394) | 0.019541 / 0.141683 (-0.122142) | 1.129335 / 1.452155 (-0.322820) | 1.174088 / 1.492716 (-0.318629) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.091340 / 0.018006 (0.073334) | 0.300037 / 0.000490 (0.299547) | 0.000214 / 0.000200 (0.000014) | 0.000046 / 0.000054 (-0.000009) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018360 / 0.037411 (-0.019051) | 0.061239 / 0.014526 (0.046713) | 0.072304 / 0.176557 (-0.104253) | 0.118883 / 0.737135 (-0.618253) | 0.073562 / 0.296338 (-0.222777) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.284478 / 0.215209 (0.069269) | 2.761819 / 2.077655 (0.684165) | 1.443757 / 1.504120 (-0.060363) | 1.315221 / 1.541195 (-0.225974) | 1.333930 / 1.468490 (-0.134560) | 0.581470 / 4.584777 (-4.003307) | 2.422530 / 3.745712 (-1.323183) | 2.869898 / 5.269862 (-2.399963) | 1.789159 / 4.565676 (-2.776517) | 0.063708 / 0.424275 (-0.360567) | 0.004922 / 0.007607 (-0.002685) | 0.337352 / 0.226044 (0.111307) | 3.290192 / 2.268929 (1.021263) | 1.840192 / 55.444624 (-53.604432) | 1.543008 / 6.876477 (-5.333469) | 1.548947 / 2.142072 (-0.593125) | 0.655129 / 4.805227 (-4.150098) | 0.119010 / 6.500664 (-6.381654) | 0.042583 / 0.075469 (-0.032886) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.981333 / 1.841788 (-0.860455) | 11.349564 / 8.074308 (3.275256) | 9.397603 / 10.191392 (-0.793789) | 0.142151 / 0.680424 (-0.538273) | 0.013850 / 0.534201 (-0.520351) | 0.286323 / 0.579283 (-0.292960) | 0.265223 / 0.434364 (-0.169141) | 0.335322 / 0.540337 (-0.205015) | 0.441727 / 1.386936 (-0.945209) |

</details>
PyArrow==latest

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005134 / 0.011353 (-0.006219) | 0.003216 / 0.011008 (-0.007792) | 0.049401 / 0.038508 (0.010893) | 0.031509 / 0.023109 (0.008400) | 0.262211 / 0.275898 (-0.013687) | 0.284814 / 0.323480 (-0.038665) | 0.004165 / 0.007986 (-0.003821) | 0.002693 / 0.004328 (-0.001636) | 0.048088 / 0.004250 (0.043838) | 0.043609 / 0.037052 (0.006557) | 0.271126 / 0.258489 (0.012637) | 0.301374 / 0.293841 (0.007533) | 0.028891 / 0.128546 (-0.099655) | 0.009911 / 0.075646 (-0.065735) | 0.057334 / 0.419271 (-0.361938) | 0.050936 / 0.043533 (0.007403) | 0.258883 / 0.255139 (0.003744) | 0.282884 / 0.283200 (-0.000315) | 0.017475 / 0.141683 (-0.124208) | 1.167562 / 1.452155 (-0.284593) | 1.214081 / 1.492716 (-0.278636) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.096890 / 0.018006 (0.078884) | 0.315819 / 0.000490 (0.315329) | 0.000218 / 0.000200 (0.000018) | 0.000054 / 0.000054 (0.000000) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.021775 / 0.037411 (-0.015637) | 0.075816 / 0.014526 (0.061290) | 0.086992 / 0.176557 (-0.089564) | 0.125816 / 0.737135 (-0.611319) | 0.090343 / 0.296338 (-0.205995) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.295204 / 0.215209 (0.079995) | 2.903129 / 2.077655 (0.825475) | 1.629838 / 1.504120 (0.125718) | 1.531862 / 1.541195 (-0.009332) | 1.504614 / 1.468490 (0.036123) | 0.572910 / 4.584777 (-4.011867) | 2.482555 / 3.745712 (-1.263157) | 2.637259 / 5.269862 (-2.632603) | 1.733049 / 4.565676 (-2.832628) | 0.063239 / 0.424275 (-0.361036) | 0.005037 / 0.007607 (-0.002570) | 0.346657 / 0.226044 (0.120612) | 3.446469 / 2.268929 (1.177540) | 2.017864 / 55.444624 (-53.426761) | 1.688704 / 6.876477 (-5.187773) | 1.790813 / 2.142072 (-0.351259) | 0.660769 / 4.805227 (-4.144458) | 0.115582 / 6.500664 (-6.385082) | 0.040111 / 0.075469 (-0.035358) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.058089 / 1.841788 (-0.783699) | 11.998171 / 8.074308 (3.923863) | 10.459128 / 10.191392 (0.267736) | 0.149653 / 0.680424 (-0.530771) | 0.015015 / 0.534201 (-0.519186) | 0.289973 / 0.579283 (-0.289310) | 0.274217 / 0.434364 (-0.160147) | 0.351057 / 0.540337 (-0.189281) | 0.434295 / 1.386936 (-0.952641) |

</details>
</details>

![](https://cml.dev/watermark.png#cb33582eb2262cec5ec6f238b50a7d043ab3ca94 "CML watermark")