Title: Fix data_files when passing data_dir
State: closed

This code should not return empty data files

```python
from datasets import load_dataset_builder

revision = "3d406e70bc21c3ca92a9a229b4c6fc3ed88279fd"
b = load_dataset_builder("bigcode/the-stack-v2-dedup", data_dir="data/Dockerfile", revision=revision)
print(b.config.data_files)
```

Previously it would return no data files because it would apply the YAML `data_files: data/**/train-*` pattern to this directory

cc @anton-l 

Comments: The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6705). 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.003371 / 0.011008 (-0.007637) | 0.063622 / 0.038508 (0.025114) | 0.026551 / 0.023109 (0.003442) | 0.244602 / 0.275898 (-0.031296) | 0.269981 / 0.323480 (-0.053499) | 0.003959 / 0.007986 (-0.004027) | 0.002678 / 0.004328 (-0.001650) | 0.049421 / 0.004250 (0.045170) | 0.039926 / 0.037052 (0.002873) | 0.256609 / 0.258489 (-0.001881) | 0.281934 / 0.293841 (-0.011907) | 0.027794 / 0.128546 (-0.100752) | 0.010130 / 0.075646 (-0.065516) | 0.207471 / 0.419271 (-0.211800) | 0.035423 / 0.043533 (-0.008110) | 0.246987 / 0.255139 (-0.008152) | 0.265413 / 0.283200 (-0.017787) | 0.018287 / 0.141683 (-0.123396) | 1.117550 / 1.452155 (-0.334604) | 1.151713 / 1.492716 (-0.341003) |

### 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.095632 / 0.018006 (0.077626) | 0.304315 / 0.000490 (0.303825) | 0.000214 / 0.000200 (0.000014) | 0.000049 / 0.000054 (-0.000005) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018591 / 0.037411 (-0.018820) | 0.062081 / 0.014526 (0.047555) | 0.075137 / 0.176557 (-0.101420) | 0.119116 / 0.737135 (-0.618020) | 0.075254 / 0.296338 (-0.221085) |

### 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.286161 / 0.215209 (0.070952) | 2.793824 / 2.077655 (0.716169) | 1.492523 / 1.504120 (-0.011597) | 1.372158 / 1.541195 (-0.169037) | 1.385921 / 1.468490 (-0.082569) | 0.568700 / 4.584777 (-4.016077) | 2.340451 / 3.745712 (-1.405262) | 2.712022 / 5.269862 (-2.557840) | 1.712479 / 4.565676 (-2.853197) | 0.060906 / 0.424275 (-0.363369) | 0.004909 / 0.007607 (-0.002698) | 0.338227 / 0.226044 (0.112182) | 3.331329 / 2.268929 (1.062400) | 1.845646 / 55.444624 (-53.598978) | 1.559384 / 6.876477 (-5.317093) | 1.577683 / 2.142072 (-0.564390) | 0.629367 / 4.805227 (-4.175860) | 0.118645 / 6.500664 (-6.382019) | 0.041517 / 0.075469 (-0.033952) |

### 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.962237 / 1.841788 (-0.879551) | 11.232566 / 8.074308 (3.158258) | 9.627141 / 10.191392 (-0.564251) | 0.129732 / 0.680424 (-0.550692) | 0.013701 / 0.534201 (-0.520500) | 0.291869 / 0.579283 (-0.287414) | 0.269298 / 0.434364 (-0.165066) | 0.342502 / 0.540337 (-0.197835) | 0.455891 / 1.386936 (-0.931045) |

</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.005256 / 0.011353 (-0.006097) | 0.003419 / 0.011008 (-0.007589) | 0.049681 / 0.038508 (0.011173) | 0.029566 / 0.023109 (0.006457) | 0.268010 / 0.275898 (-0.007888) | 0.293721 / 0.323480 (-0.029759) | 0.004249 / 0.007986 (-0.003737) | 0.002643 / 0.004328 (-0.001685) | 0.048758 / 0.004250 (0.044508) | 0.044294 / 0.037052 (0.007241) | 0.279584 / 0.258489 (0.021095) | 0.311150 / 0.293841 (0.017309) | 0.029443 / 0.128546 (-0.099103) | 0.010314 / 0.075646 (-0.065333) | 0.057770 / 0.419271 (-0.361501) | 0.050953 / 0.043533 (0.007420) | 0.268283 / 0.255139 (0.013144) | 0.289155 / 0.283200 (0.005956) | 0.017742 / 0.141683 (-0.123941) | 1.163963 / 1.452155 (-0.288192) | 1.200580 / 1.492716 (-0.292136) |

### 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.096365 / 0.018006 (0.078359) | 0.307257 / 0.000490 (0.306767) | 0.000265 / 0.000200 (0.000065) | 0.000049 / 0.000054 (-0.000006) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.021862 / 0.037411 (-0.015550) | 0.075502 / 0.014526 (0.060976) | 0.087800 / 0.176557 (-0.088756) | 0.125468 / 0.737135 (-0.611667) | 0.088207 / 0.296338 (-0.208132) |

### 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.324184 / 0.215209 (0.108975) | 3.198442 / 2.077655 (1.120787) | 1.862801 / 1.504120 (0.358682) | 1.728637 / 1.541195 (0.187443) | 1.727997 / 1.468490 (0.259507) | 0.571590 / 4.584777 (-4.013187) | 2.448661 / 3.745712 (-1.297051) | 2.665943 / 5.269862 (-2.603919) | 1.731718 / 4.565676 (-2.833958) | 0.063644 / 0.424275 (-0.360631) | 0.004989 / 0.007607 (-0.002619) | 0.364543 / 0.226044 (0.138498) | 3.615859 / 2.268929 (1.346930) | 2.131637 / 55.444624 (-53.312987) | 1.857317 / 6.876477 (-5.019159) | 1.992813 / 2.142072 (-0.149260) | 0.654662 / 4.805227 (-4.150565) | 0.117631 / 6.500664 (-6.383034) | 0.040934 / 0.075469 (-0.034535) |

### 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.013802 / 1.841788 (-0.827985) | 11.899873 / 8.074308 (3.825565) | 10.291297 / 10.191392 (0.099905) | 0.155245 / 0.680424 (-0.525179) | 0.014449 / 0.534201 (-0.519752) | 0.286331 / 0.579283 (-0.292952) | 0.273111 / 0.434364 (-0.161253) | 0.321182 / 0.540337 (-0.219155) | 0.433406 / 1.386936 (-0.953530) |

</details>
</details>

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