Skip to content

Commit 26a7cac

Browse files
authored
pre-commit autoupdate && pre-commit run --all-files (ggml-org#2484)
* pre-commit autoupdate && pre-commit run --all-files * Black formatter needs a current version of Python
1 parent 6c1d8f1 commit 26a7cac

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
run: git fetch origin ${{ github.base_ref }}
1717
- uses: actions/setup-python@v5
1818
with:
19-
python-version: "3.8"
19+
python-version: "3.9"
2020
architecture: x64
2121
- name: Get pip cache dir
2222
id: pip-cache
@@ -33,7 +33,7 @@ jobs:
3333
${{ runner.os }}-pip-pre-commit
3434
- name: pre-commit
3535
run: |
36-
pip install -U pre-commit
36+
pip install --upgrade pre-commit
3737
pre-commit install --install-hooks
3838
pre-commit run --all-files
3939
whisper-test:

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.0.1
3+
rev: v5.0.0
44
hooks:
55
- id: check-json
66
- id: end-of-file-fixer
@@ -11,17 +11,17 @@ repos:
1111
- id: check-added-large-files
1212
args: [--maxkb=4096]
1313
- repo: https://github.com/psf/black
14-
rev: 23.7.0
14+
rev: 24.10.0
1515
hooks:
1616
- id: black
1717
- repo: https://github.com/pycqa/isort
18-
rev: 5.12.0
18+
rev: 5.13.2
1919
hooks:
2020
- id: isort
2121
name: isort (python)
2222
args: ["--profile", "black", "-l", "88", "--trailing-comma", "--multi-line", "3"]
2323
- repo: https://github.com/pycqa/flake8.git
24-
rev: 6.0.0
24+
rev: 7.1.1
2525
hooks:
2626
- id: flake8
2727
types: [python]

whisper/normalizers/basic.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ def remove_symbols_and_diacritics(s: str, keep=""):
3030
and drop any diacritics (category 'Mn' and some manual mappings)
3131
"""
3232
return "".join(
33-
c
34-
if c in keep
35-
else ADDITIONAL_DIACRITICS[c]
36-
if c in ADDITIONAL_DIACRITICS
37-
else ""
38-
if unicodedata.category(c) == "Mn"
39-
else " "
40-
if unicodedata.category(c)[0] in "MSP"
41-
else c
33+
(
34+
c
35+
if c in keep
36+
else (
37+
ADDITIONAL_DIACRITICS[c]
38+
if c in ADDITIONAL_DIACRITICS
39+
else (
40+
""
41+
if unicodedata.category(c) == "Mn"
42+
else " " if unicodedata.category(c)[0] in "MSP" else c
43+
)
44+
)
45+
)
4246
for c in unicodedata.normalize("NFKD", s)
4347
)
4448

whisper/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ def iterate_subtitles():
209209

210210
yield start, end, "".join(
211211
[
212-
re.sub(r"^(\s*)(.*)$", r"\1<u>\2</u>", word)
213-
if j == i
214-
else word
212+
(
213+
re.sub(r"^(\s*)(.*)$", r"\1<u>\2</u>", word)
214+
if j == i
215+
else word
216+
)
215217
for j, word in enumerate(all_words)
216218
]
217219
)

0 commit comments

Comments
 (0)