Commit d62875cc authored by John Reese's avatar John Reese Committed by Facebook GitHub Bot
Browse files

[codemod][usort] apply import merging for fbcode (8 of 11)

Summary:
Applies new import merging and sorting from µsort v1.0.

When merging imports, µsort will make a best-effort to move associated
comments to match merged elements, but there are known limitations due to
the diynamic nature of Python and developer tooling. These changes should
not produce any dangerous runtime changes, but may require touch-ups to
satisfy linters and other tooling.

Note that µsort uses case-insensitive, lexicographical sorting, which
results in a different ordering compared to isort. This provides a more
consistent sorting order, matching the case-insensitive order used when
sorting import statements by module name, and ensures that "frog", "FROG",
and "Frog" always sort next to each other.

For details on µsort's sorting and merging semantics, see the user guide:
https://usort.readthedocs.io/en/stable/guide.html#sorting

Reviewed By: lisroach

Differential Revision: D36402214

fbshipit-source-id: b641bfa9d46242188524d4ae2c44998922a62b4c
parent 44f4a5ea
...@@ -8,7 +8,7 @@ from typing import Callable, List, Tuple ...@@ -8,7 +8,7 @@ from typing import Callable, List, Tuple
import torch import torch
import torchaudio import torchaudio
from torchaudio._internal import module_utils from torchaudio._internal import module_utils
from torchaudio.models import RNNT, RNNTBeamSearch, emformer_rnnt_base from torchaudio.models import emformer_rnnt_base, RNNT, RNNTBeamSearch
__all__ = [] __all__ = []
......
import itertools as it import itertools as it
import warnings import warnings
from collections import namedtuple from collections import namedtuple
from typing import Dict, List, Optional, Union, NamedTuple from typing import Dict, List, NamedTuple, Optional, Union
import torch import torch
from torchaudio._torchaudio_decoder import ( from torchaudio._torchaudio_decoder import (
_create_word_dict,
_CriterionType, _CriterionType,
_LM, _Dictionary,
_KenLM, _KenLM,
_LexiconDecoder, _LexiconDecoder,
_LexiconFreeDecoder,
_LexiconDecoderOptions, _LexiconDecoderOptions,
_LexiconFreeDecoder,
_LexiconFreeDecoderOptions, _LexiconFreeDecoderOptions,
_LM,
_load_words,
_SmearingMode, _SmearingMode,
_Trie, _Trie,
_Dictionary,
_create_word_dict,
_load_words,
_ZeroLM, _ZeroLM,
) )
from torchaudio.utils import download_asset from torchaudio.utils import download_asset
......
...@@ -2,7 +2,11 @@ import math ...@@ -2,7 +2,11 @@ import math
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
import torch import torch
from torchaudio.models.emformer import _EmformerAttention, _EmformerImpl, _get_weight_init_gains from torchaudio.models.emformer import (
_EmformerAttention,
_EmformerImpl,
_get_weight_init_gains,
)
def _get_activation_module(activation: str) -> torch.nn.Module: def _get_activation_module(activation: str) -> torch.nn.Module:
......
from torchaudio._internal import module_utils as _mod_utils from torchaudio._internal import module_utils as _mod_utils
from .sox_effects import ( from .sox_effects import (
apply_effects_file,
apply_effects_tensor,
effect_names,
init_sox_effects, init_sox_effects,
shutdown_sox_effects, shutdown_sox_effects,
effect_names,
apply_effects_tensor,
apply_effects_file,
) )
......
import os import os
from typing import List, Tuple, Optional from typing import List, Optional, Tuple
import torch import torch
import torchaudio import torchaudio
......
from ._multi_channel import MVDR, PSD, RTFMVDR, SoudenMVDR from ._multi_channel import MVDR, PSD, RTFMVDR, SoudenMVDR
from ._transforms import ( from ._transforms import (
Spectrogram,
InverseSpectrogram,
GriffinLim,
AmplitudeToDB, AmplitudeToDB,
MelScale, ComputeDeltas,
Fade,
FrequencyMasking,
GriffinLim,
InverseMelScale, InverseMelScale,
InverseSpectrogram,
LFCC,
MelScale,
MelSpectrogram, MelSpectrogram,
MFCC, MFCC,
LFCC,
MuLawEncoding,
MuLawDecoding, MuLawDecoding,
MuLawEncoding,
PitchShift,
Resample, Resample,
TimeStretch, RNNTLoss,
Fade,
FrequencyMasking,
TimeMasking,
SlidingWindowCmn, SlidingWindowCmn,
Vad,
SpectralCentroid, SpectralCentroid,
Spectrogram,
TimeMasking,
TimeStretch,
Vad,
Vol, Vol,
ComputeDeltas,
PitchShift,
RNNTLoss,
) )
......
...@@ -7,7 +7,10 @@ from typing import Callable, Optional ...@@ -7,7 +7,10 @@ from typing import Callable, Optional
import torch import torch
from torch import Tensor from torch import Tensor
from torchaudio import functional as F from torchaudio import functional as F
from torchaudio.functional.functional import _apply_sinc_resample_kernel, _get_sinc_resample_kernel from torchaudio.functional.functional import (
_apply_sinc_resample_kernel,
_get_sinc_resample_kernel,
)
__all__ = [] __all__ = []
......
from torchaudio._internal import module_utils as _mod_utils from torchaudio._internal import module_utils as _mod_utils
from . import ( from . import sox_utils
sox_utils,
)
from .download import download_asset from .download import download_asset
if _mod_utils.is_sox_available(): if _mod_utils.is_sox_available():
......
from typing import List, Dict from typing import Dict, List
import torch import torch
from torchaudio._internal import module_utils as _mod_utils from torchaudio._internal import module_utils as _mod_utils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment