mirror of
https://github.com/kuhyx/testsAndMisc-archive.git
synced 2026-07-04 13:23:01 +02:00
fix: resolve remaining ruff violations (FURB110, PLC0207)
- generate_blunder_tests.py: use 'or' instead of ternary (FURB110) - music_generator.py: use 'or' instead of ternary (FURB110), fix type: ignore - random_digits.py: use rsplit with maxsplit instead of split (PLC0207)
This commit is contained in:
parent
d484d1c4c1
commit
3139333f24
@ -121,7 +121,7 @@ def extract_pgn(text: str) -> str | None:
|
||||
return None
|
||||
start = m.end()
|
||||
pgn = text[start:].strip()
|
||||
return pgn if pgn else None
|
||||
return pgn or None
|
||||
|
||||
|
||||
def san_list_from_game(game: chess.pgn.Game) -> list[str]:
|
||||
|
||||
@ -17,6 +17,7 @@ import argparse
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from typing import Any
|
||||
import warnings
|
||||
|
||||
# Suppress warnings for cleaner output
|
||||
@ -161,7 +162,7 @@ def select_model_size(user_choice: str | None = None) -> str:
|
||||
|
||||
def load_model(
|
||||
model_size: str = "medium",
|
||||
) -> tuple: # type: ignore[type-arg]
|
||||
) -> tuple[Any, Any]:
|
||||
"""Load the MusicGen model.
|
||||
|
||||
Args:
|
||||
@ -327,7 +328,7 @@ def _split_into_sentences(text: str) -> list[str]:
|
||||
if current:
|
||||
result.append(current)
|
||||
|
||||
return result if result else [text]
|
||||
return result or [text]
|
||||
|
||||
|
||||
def _resample_audio(
|
||||
|
||||
@ -61,7 +61,7 @@ def _parse_single_number(num_str: str) -> tuple[float, int] | None:
|
||||
"""
|
||||
try:
|
||||
float_num = float(num_str)
|
||||
digits_count = len(num_str.split(".")[-1]) if "." in num_str else 0
|
||||
digits_count = len(num_str.rsplit(".", maxsplit=1)[-1]) if "." in num_str else 0
|
||||
except ValueError:
|
||||
return None
|
||||
return float_num, digits_count
|
||||
|
||||
Loading…
Reference in New Issue
Block a user