pre-commit autoupdate && pre-commit run --all-files (#2484)

* pre-commit autoupdate && pre-commit run --all-files

* Black formatter needs a current version of Python
This commit is contained in:
Christian Clauss 2025-01-04 10:02:18 +01:00 committed by GitHub
parent 6c1d8f1ea1
commit 26a7cacc83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 18 deletions

View File

@ -16,7 +16,7 @@ jobs:
run: git fetch origin ${{ github.base_ref }} run: git fetch origin ${{ github.base_ref }}
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.8" python-version: "3.9"
architecture: x64 architecture: x64
- name: Get pip cache dir - name: Get pip cache dir
id: pip-cache id: pip-cache
@ -33,7 +33,7 @@ jobs:
${{ runner.os }}-pip-pre-commit ${{ runner.os }}-pip-pre-commit
- name: pre-commit - name: pre-commit
run: | run: |
pip install -U pre-commit pip install --upgrade pre-commit
pre-commit install --install-hooks pre-commit install --install-hooks
pre-commit run --all-files pre-commit run --all-files
whisper-test: whisper-test:

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1 rev: v5.0.0
hooks: hooks:
- id: check-json - id: check-json
- id: end-of-file-fixer - id: end-of-file-fixer
@ -11,17 +11,17 @@ repos:
- id: check-added-large-files - id: check-added-large-files
args: [--maxkb=4096] args: [--maxkb=4096]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.7.0 rev: 24.10.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.12.0 rev: 5.13.2
hooks: hooks:
- id: isort - id: isort
name: isort (python) name: isort (python)
args: ["--profile", "black", "-l", "88", "--trailing-comma", "--multi-line", "3"] args: ["--profile", "black", "-l", "88", "--trailing-comma", "--multi-line", "3"]
- repo: https://github.com/pycqa/flake8.git - repo: https://github.com/pycqa/flake8.git
rev: 6.0.0 rev: 7.1.1
hooks: hooks:
- id: flake8 - id: flake8
types: [python] types: [python]

View File

@ -30,15 +30,19 @@ def remove_symbols_and_diacritics(s: str, keep=""):
and drop any diacritics (category 'Mn' and some manual mappings) and drop any diacritics (category 'Mn' and some manual mappings)
""" """
return "".join( return "".join(
c (
if c in keep c
else ADDITIONAL_DIACRITICS[c] if c in keep
if c in ADDITIONAL_DIACRITICS else (
else "" ADDITIONAL_DIACRITICS[c]
if unicodedata.category(c) == "Mn" if c in ADDITIONAL_DIACRITICS
else " " else (
if unicodedata.category(c)[0] in "MSP" ""
else c if unicodedata.category(c) == "Mn"
else " " if unicodedata.category(c)[0] in "MSP" else c
)
)
)
for c in unicodedata.normalize("NFKD", s) for c in unicodedata.normalize("NFKD", s)
) )

View File

@ -209,9 +209,11 @@ class SubtitlesWriter(ResultWriter):
yield start, end, "".join( yield start, end, "".join(
[ [
re.sub(r"^(\s*)(.*)$", r"\1<u>\2</u>", word) (
if j == i re.sub(r"^(\s*)(.*)$", r"\1<u>\2</u>", word)
else word if j == i
else word
)
for j, word in enumerate(all_words) for j, word in enumerate(all_words)
] ]
) )