being_migrated modules use the original allowlist (#82022)
The `allowlist_for_publicAPI.json` allows specifying the modules that
are being migrated. However, the exceptions in that file are only
applied to the original entry. This introduces a change to the
`test_correct_module_names` to extend the `allow_dict` with the modules
that are being migrated.
## Example Scenario
Assume there is an "allow list" for some module `torch.foo`:
```json
{
"torch.foo": [
"Any",
"Optional",
]
}
```
Assume that the module is also being migrated to `torch.bar`, with
a `*` import in the original location (s.a. `from torch.bar import *`)
```json
{
"being_migrated": {
"torch.foo": "torch.bar"
},
"torch.foo": [
"Any",
"Optional",
],
"torch.bar": [
"Any",
"Optional",
],
}
```
In that case, both `torch.foo` and `torch.bar` must have the same list
of exceptions. One way to do it, is to enforce the developers to add
new "allow list" to the JSON file for the migrations. As an alternative
this PR just creates a duplicate entry to support exceptions in both
`torch.foo` and `torch.bar`.
With this PR, we don't need to modify anything beyond the `being_migrated` list:
```json
{
"being_migrated": {
"torch.foo": "torch.bar"
},
"torch.foo": [
"Any",
"Optional",
],
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82022
Approved by: https://github.com/albanD