Skip to content

Improve Flake Rules #1214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length = 120
ignore = E305,E402,E721,E741,F401,F403,F405,W503,W504,F999
ignore = E305,E402,E721,E741,F405,W503,W504,F999
exclude = build,docs/source,_ext,third_party
1 change: 0 additions & 1 deletion test/torchaudio_unittest/backend/soundfile/save_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import io
import itertools
from unittest.mock import patch

from torchaudio._internal import module_utils as _mod_utils
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/batch_consistency_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test numerical consistency among single input and batched input."""
import unittest
import itertools
from parameterized import parameterized

Expand Down
6 changes: 5 additions & 1 deletion test/torchaudio_unittest/common_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
from .parameterized_utils import (
load_params,
)
from . import sox_utils

__all__ = ['get_asset_path', 'get_whitenoise', 'get_sinusoid', 'set_audio_backend',
'TempDirMixin', 'HttpServerMixin', 'TestBaseMixin', 'PytorchTestCase', 'TorchaudioTestCase',
'skipIfNoCuda', 'skipIfNoExec', 'skipIfNoModule', 'skipIfNoExtension', 'skipIfNoSoxBackend',
'get_wav_data', 'normalize_wav', 'load_wav', 'save_wav', 'load_params']
1 change: 0 additions & 1 deletion test/torchaudio_unittest/compliance_kaldi_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import math
import unittest

import torch
import torchaudio
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/datasets/datasets_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from torchaudio.datasets.librispeech import LIBRISPEECH
from torchaudio.datasets.speechcommands import SPEECHCOMMANDS
from torchaudio.datasets.vctk import VCTK

from torchaudio_unittest.common_utils import (
Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/kaldi_io_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import unittest

import torch
import torchaudio.kaldi_io as kio

Expand Down
2 changes: 0 additions & 2 deletions test/torchaudio_unittest/sox_compatibility_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import unittest

import torch
import torchaudio.functional as F
import torchaudio.transforms as T
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/sox_effect/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
save_wav,
)
from .common import (
name_func,
load_params,
)

Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/torchscript_consistency_impl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test suites for jit-ability and its numerical compatibility"""
import unittest

import torch
import torchaudio.transforms as T
Expand Down
1 change: 0 additions & 1 deletion test/torchaudio_unittest/transforms_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math
import unittest

import torch
import torchaudio
Expand Down
6 changes: 6 additions & 0 deletions torchaudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
from .version import __version__, git_version # noqa: F401
except ImportError:
pass

__all__ = ['extension', '_mod_utils', 'compliance', 'datasets', 'functional', 'kaldi_io',
'utils', 'sox_effects', 'transforms', 'list_audio_backends',
'get_audio_backend', 'set_audio_backend', 'save_encinfo', 'sox_signalinfo_t',
'sox_encodinginfo_t', 'get_sox_option_t', 'get_sox_encoding_t',
'get_sox_bool', 'SignalInfo', 'EncodingInfo']
1 change: 1 addition & 0 deletions torchaudio/backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
from . import utils
from .utils import (
list_audio_backends,
Expand Down
2 changes: 2 additions & 0 deletions torchaudio/compliance/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from . import kaldi

__all__ = ['kaldi']
3 changes: 1 addition & 2 deletions torchaudio/datasets/gtzan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import warnings
from pathlib import Path
from typing import Any, Tuple, Optional, Union
from typing import Tuple, Optional, Union

import torchaudio
from torch import Tensor
Expand Down
2 changes: 1 addition & 1 deletion torchaudio/datasets/ljspeech.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import csv
from typing import List, Tuple, Union
from typing import Tuple, Union
from pathlib import Path

import torchaudio
Expand Down
1 change: 0 additions & 1 deletion torchaudio/extension/extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import warnings
import importlib
from collections import namedtuple

import torch
from torchaudio._internal import module_utils as _mod_utils
Expand Down
8 changes: 8 additions & 0 deletions torchaudio/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@
treble_biquad,
vad,
)

__all__ = ['amplitude_to_DB', 'angle', 'complex_norm', 'compute_deltas', 'create_dct',
'create_fb_matrix', 'DB_to_amplitude', 'detect_pitch_frequency', 'griffinlim', 'magphase',
'mask_along_axis', 'mask_along_axis_iid', 'mu_law_encoding', 'mu_law_decoding', 'phase_vocoder',
'sliding_window_cmn', 'spectrogram', 'spectral_centroid', 'allpass_biquad', 'band_biquad',
'bandpass_biquad', 'bandreject_biquad', 'bass_biquad', 'biquad', 'contrast', 'dither',
'dcshift', 'deemph_biquad', 'equalizer_biquad', 'flanger', 'gain', 'highpass_biquad',
'lfilter', 'lowpass_biquad', 'overdrive', 'phaser', 'riaa_biquad', 'treble_biquad', 'vad']
2 changes: 2 additions & 0 deletions torchaudio/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .wav2letter import Wav2Letter
from .wavernn import WaveRNN
from .conv_tasnet import ConvTasNet

__all__ = ['Wav2Letter', 'WaveRNN', 'ConvTasNet']
2 changes: 2 additions & 0 deletions torchaudio/sox_effects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
import atexit
init_sox_effects()
atexit.register(shutdown_sox_effects)

__all__ = ['init_sox_effects', 'shutdown_sox_effects', 'effect_names', 'apply_effects_tensor', 'apply_effects_file']
1 change: 0 additions & 1 deletion torchaudio/sox_effects/sox_effects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from pathlib import Path
from typing import List, Tuple, Optional

import torch
Expand Down
1 change: 0 additions & 1 deletion torchaudio/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import math
from typing import Callable, Optional
from warnings import warn

import torch
from torch import Tensor
Expand Down