Skip to content

Commit b61b821

Browse files
authored
Merge pull request #113 from sp-nitech/ruff
Strip isort
2 parents b3554b2 + 9280fe7 commit b61b821

File tree

139 files changed

+232
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+232
-302
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
torch: 2.0.0
2222
torchaudio: 2.0.1
2323
- python: 3.12
24-
torch: 2.5.1
25-
torchaudio: 2.5.1
24+
torch: 2.6.0
25+
torchaudio: 2.6.0
2626

2727
steps:
2828
- name: Clone
@@ -49,10 +49,10 @@ jobs:
4949
run: make test
5050

5151
- name: Coverage
52-
uses: codecov/codecov-action@v4
52+
uses: codecov/codecov-action@v5
5353
with:
5454
fail_ci_if_error: true
55-
file: ./coverage.xml
55+
files: ./coverage.xml
5656
flags: unittests
5757
name: codecov-umbrella
5858
token: ${{ secrets.CODECOV_TOKEN }}

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ doc-clean:
4949
check: tool
5050
. ./venv/bin/activate && python -m ruff check $(PROJECT) tests
5151
. ./venv/bin/activate && python -m ruff format --check $(PROJECT) tests docs
52-
. ./venv/bin/activate && python -m isort --check $(PROJECT) tests
5352
. ./venv/bin/activate && python -m mdformat --check *.md
5453
. ./venv/bin/activate && cd docs && python -m docstrfmt --check .
54+
./venv/bin/codespell
5555
./tools/taplo/taplo fmt --check *.toml
5656
./tools/yamlfmt/yamlfmt --lint *.cff *.yml .github/workflows/*.yml
5757

5858
format: tool
5959
. ./venv/bin/activate && python -m ruff check --fix $(PROJECT) tests
6060
. ./venv/bin/activate && python -m ruff format $(PROJECT) tests docs
61-
. ./venv/bin/activate && python -m isort $(PROJECT) tests
6261
. ./venv/bin/activate && python -m mdformat *.md
6362
. ./venv/bin/activate && cd docs && python -m docstrfmt .
6463
./tools/taplo/taplo fmt *.toml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## Documentation
2222

23-
- See [this page](https://sp-nitech.github.io/diffsptk/latest/) for a reference manual.
23+
- See [this page](https://sp-nitech.github.io/diffsptk/latest/) for the reference manual.
2424
- Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
2525

2626
## Installation

diffsptk/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def fbank(x, n_channel, sample_rate, f_min=0, f_max=None, floor=1e-5, out_format
584584
Minimum mel-filter bank output in linear scale.
585585
586586
out_format : ['y', 'yE', 'y,E']
587-
`y` is mel-filber bank outpus and `E` is energy. If this is `yE`, the two output
587+
`y` is mel-filber bank output and `E` is energy. If this is `yE`, the two output
588588
tensors are concatenated and return the tensor instead of the tuple.
589589
590590
Returns
@@ -711,7 +711,7 @@ def freqt(c, out_order, alpha=0):
711711
Order of output cepstrum, :math:`M_2`.
712712
713713
alpha : float in (-1, 1)
714-
Frquency warping factor, :math:`\\alpha`.
714+
Frequency warping factor, :math:`\\alpha`.
715715
716716
Returns
717717
-------

diffsptk/misc/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
# limitations under the License. #
1515
# ------------------------------------------------------------------------ #
1616

17-
from importlib import import_module
1817
import logging
1918
import math
19+
from importlib import import_module
2020

2121
import numpy as np
2222
import soundfile as sf
2323
import torch
24-
from torch import nn
2524
import torch.nn.functional as F
2625
import torchaudio
26+
from torch import nn
2727

2828
UNVOICED_SYMBOL = 0
2929
TWO_PI = math.tau

diffsptk/modules/acr2csm.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
# limitations under the License. #
1515
# ------------------------------------------------------------------------ #
1616

17-
from scipy.special import comb
1817
import torch
19-
from torch import nn
2018
import torch.nn.functional as F
19+
from scipy.special import comb
20+
from torch import nn
2121

22-
from ..misc.utils import check_size
23-
from ..misc.utils import hankel
24-
from ..misc.utils import to
25-
from ..misc.utils import vander
22+
from ..misc.utils import check_size, hankel, to, vander
2623
from .root_pol import PolynomialToRoots
2724

2825

diffsptk/modules/ap.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616

1717
import numpy as np
1818
import torch
19-
from torch import nn
2019
import torch.nn.functional as F
20+
from torch import nn
2121

22-
from ..misc.utils import UNVOICED_SYMBOL
23-
from ..misc.utils import numpy_to_torch
22+
from ..misc.utils import UNVOICED_SYMBOL, numpy_to_torch
2423

2524

2625
class Aperiodicity(nn.Module):

diffsptk/modules/b2mc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

21-
from ..misc.utils import check_size
22-
from ..misc.utils import to
21+
from ..misc.utils import check_size, to
2322

2423

2524
class MLSADigitalFilterCoefficientsToMelCepstrum(nn.Module):

diffsptk/modules/c2mpir.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import cexp
21-
from ..misc.utils import check_size
20+
from ..misc.utils import cexp, check_size
2221

2322

2423
class CepstrumToMinimumPhaseImpulseResponse(nn.Module):

diffsptk/modules/c2ndps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import to
20+
from ..misc.utils import check_size, to
2221

2322

2423
class CepstrumToNegativeDerivativeOfPhaseSpectrum(nn.Module):

diffsptk/modules/chroma.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616

1717
import numpy as np
1818
import torch
19-
from torch import nn
2019
import torch.nn.functional as F
20+
from torch import nn
2121

22-
from ..misc.utils import check_size
23-
from ..misc.utils import to
22+
from ..misc.utils import check_size, to
2423

2524

2625
class ChromaFilterBankAnalysis(nn.Module):

diffsptk/modules/cqt.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@
3232

3333
import numpy as np
3434
import torch
35-
from torch import nn
3635
import torchaudio
36+
from torch import nn
3737

38-
from ..misc.utils import Lambda
39-
from ..misc.utils import delayed_import
40-
from ..misc.utils import get_resample_params
41-
from ..misc.utils import numpy_to_torch
38+
from ..misc.utils import Lambda, delayed_import, get_resample_params, numpy_to_torch
4239
from .stft import ShortTimeFourierTransform as STFT
4340

4441

@@ -78,7 +75,7 @@ class ConstantQTransform(nn.Module):
7875
Window function for the basis.
7976
8077
scale : bool
81-
If True, scale the CQT responce by the length of filter.
78+
If True, scale the CQT response by the length of filter.
8279
8380
res_type : ['kaiser_best', 'kaiser_fast'] or None
8481
Resampling type.

diffsptk/modules/csm2acr.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import to
20+
from ..misc.utils import check_size, to
2221

2322

2423
class CompositeSinusoidalModelCoefficientsToAutocorrelation(nn.Module):

diffsptk/modules/dct.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import plateau
22-
from ..misc.utils import to
20+
from ..misc.utils import check_size, plateau, to
2321

2422

2523
class DiscreteCosineTransform(nn.Module):

diffsptk/modules/delta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

2121
from ..misc.utils import to
2222

diffsptk/modules/dfs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

21-
from ..misc.utils import iir
22-
from ..misc.utils import to
23-
from ..misc.utils import to_3d
21+
from ..misc.utils import iir, to, to_3d
2422

2523

2624
class InfiniteImpulseResponseDigitalFilter(nn.Module):

diffsptk/modules/dht.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import cas
21-
from ..misc.utils import check_size
22-
from ..misc.utils import to
20+
from ..misc.utils import cas, check_size, to
2321

2422

2523
class DiscreteHartleyTransform(nn.Module):

diffsptk/modules/drc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import numpy as np
1818
import torch
19-
from torch import nn
2019
import torchcomp
20+
from torch import nn
2121

2222
from ..misc.utils import to_2d
2323

diffsptk/modules/dst.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import plateau
22-
from ..misc.utils import to
20+
from ..misc.utils import check_size, plateau, to
2321

2422

2523
class DiscreteSineTransform(nn.Module):

diffsptk/modules/excite.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

21-
from ..misc.utils import TWO_PI
22-
from ..misc.utils import UNVOICED_SYMBOL
21+
from ..misc.utils import TWO_PI, UNVOICED_SYMBOL
2322
from .linear_intpl import LinearInterpolation
2423

2524

diffsptk/modules/fbank.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
import torch
1919
from torch import nn
2020

21-
from ..misc.utils import check_size
22-
from ..misc.utils import to
21+
from ..misc.utils import check_size, to
2322

2423

2524
class MelFilterBankAnalysis(nn.Module):
@@ -50,7 +49,7 @@ class MelFilterBankAnalysis(nn.Module):
5049
If True, use power spectrum instead of amplitude spectrum.
5150
5251
out_format : ['y', 'yE', 'y,E']
53-
`y` is mel-filber bank outpus and `E` is energy. If this is `yE`, the two output
52+
`y` is mel-filber bank output and `E` is energy. If this is `yE`, the two output
5453
tensors are concatenated and return the tensor instead of the tuple.
5554
5655
References

diffsptk/modules/fftcep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

2121
from ..misc.utils import check_size
2222

diffsptk/modules/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# limitations under the License. #
1515
# ------------------------------------------------------------------------ #
1616

17-
from torch import nn
1817
import torch.nn.functional as F
18+
from torch import nn
1919

2020

2121
class Frame(nn.Module):

diffsptk/modules/freqt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import to
20+
from ..misc.utils import check_size, to
2221

2322

2423
class FrequencyTransform(nn.Module):

diffsptk/modules/freqt2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import to
20+
from ..misc.utils import check_size, to
2221

2322

2423
class SecondOrderAllPassFrequencyTransform(nn.Module):
25-
"""Second-order all-pass frequecy transform module.
24+
"""Second-order all-pass frequency transform module.
2625
2726
Parameters
2827
----------

diffsptk/modules/gmm.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
from torch import nn
2020
from tqdm import tqdm
2121

22-
from ..misc.utils import get_logger
23-
from ..misc.utils import outer
24-
from ..misc.utils import to_dataloader
22+
from ..misc.utils import get_logger, outer, to_dataloader
2523

2624

2725
class GaussianMixtureModeling(nn.Module):
@@ -338,7 +336,7 @@ def forward(self, x, return_posterior=False):
338336

339337
# Check convergence.
340338
if self.verbose:
341-
self.logger.info(f"iter {n+1:5d}: average = {log_likelihood / T:g}")
339+
self.logger.info(f"iter {n + 1:5d}: average = {log_likelihood / T:g}")
342340
change = log_likelihood - prev_log_likelihood
343341
if n and change < self.eps:
344342
break

diffsptk/modules/gnorm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import torch
1818
from torch import nn
1919

20-
from ..misc.utils import check_size
21-
from ..misc.utils import get_gamma
20+
from ..misc.utils import check_size, get_gamma
2221

2322

2423
class GeneralizedCepstrumGainNormalization(nn.Module):

diffsptk/modules/grpdelay.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
# ------------------------------------------------------------------------ #
1616

1717
import torch
18-
from torch import nn
1918
import torch.nn.functional as F
19+
from torch import nn
2020

21-
from ..misc.utils import remove_gain
22-
from ..misc.utils import to
21+
from ..misc.utils import remove_gain, to
2322

2423

2524
class GroupDelay(nn.Module):

0 commit comments

Comments
 (0)