Linting with ruff.

This commit is contained in:
Frédéric Tronel
2026-08-30 14:42:21 +02:00
parent 6f5dd3a9e4
commit 63d2deafb1
11 changed files with 51 additions and 78 deletions
+4 -5
View File
@@ -6,18 +6,17 @@
import argparse
import logging
from pathlib import Path
from datetime import timedelta
from functools import cmp_to_key
from pathlib import Path
import coloredlogs
from tscut.exceptions import TSCutError
from tscut.config import ProcessingOptions
from tscut.tools.discovery import check_required_tools
from tscut.tools.timeframe import parse_time_interval, compare_time_interval
from tscut.exceptions import TSCutError
from tscut.pipeline import process_recording
from tscut.tools.discovery import check_required_tools
from tscut.tools.timeframe import compare_time_interval, parse_time_interval
logger = logging.getLogger(__name__)
+2 -1
View File
@@ -3,8 +3,9 @@
# Copyright (C) 2026 Frédéric Tronel
from dataclasses import dataclass
from pathlib import Path
from datetime import timedelta
from pathlib import Path
@dataclass
class ProcessingOptions:
+4 -6
View File
@@ -8,26 +8,24 @@ from dataclasses import dataclass, field
from math import floor
from typing import IO
from typeguard import typechecked
import hexdump
from typeguard import typechecked
from tscut.h264.bitstream import (
rbsp_to_sodb,
read_bit,
read_bits,
read_byte,
read_long,
read_word,
sodb_to_rbsp,
write_bits,
write_byte,
write_word,
sodb_to_rbsp,
rbsp_to_sodb
)
from tscut.h264.parameters import (
SPS,
PPS,
SPS,
)
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -10,8 +10,8 @@
import logging
from math import floor, log
from typeguard import typechecked
import hexdump
from typeguard import typechecked
from tscut.exceptions import UnimplementedFeatureError
+5 -5
View File
@@ -4,12 +4,15 @@
import logging
from dataclasses import dataclass, field
from math import floor, log, ceil
from math import ceil, floor, log
from typeguard import typechecked
import hexdump
from typeguard import typechecked
from tscut.h264.bitstream import (
more_rbsp_data,
parse_rbsp_trailing_bits,
parse_scaling_list,
read_bit,
read_bits,
read_boolean,
@@ -28,9 +31,6 @@ from tscut.h264.bitstream import (
write_signed_exp_golomb,
write_unsigned_exp_golomb,
write_word,
parse_scaling_list,
parse_rbsp_trailing_bits,
more_rbsp_data
)
logger = logging.getLogger(__name__)
+3 -6
View File
@@ -6,15 +6,12 @@
import logging
from typing import IO
from typeguard import typechecked
import hexdump
from typeguard import typechecked
from tscut.matroska.ebml import get_ebml_length
from tscut.h264.avc import (
AVCDecoderConfiguration,
get_avc_config_from_h264
)
from tscut.exceptions import InvalidMediaError
from tscut.h264.avc import AVCDecoderConfiguration, get_avc_config_from_h264
from tscut.matroska.ebml import get_ebml_length
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -13,8 +13,8 @@ from os import (
)
from typing import IO
from typeguard import typechecked
import hexdump
from typeguard import typechecked
logger = logging.getLogger(__name__)
+17 -31
View File
@@ -2,55 +2,41 @@
#
# Copyright (C) 2026 Frédéric Tronel
from datetime import datetime, timedelta
import logging
import os
from datetime import datetime, timedelta
from os import unlink
from shutil import copyfile, move
from sys import exit
import logging
from typing import IO, Any, BinaryIO
import hexdump
from tscut.exceptions import InvalidMediaError
from tscut.config import ProcessingOptions
from tscut.tools.mkvtoolnix import (
get_codec_private_data_from_mkv,
change_codec_private_data,
extract_mkv_part,
extract_track_from_mkv,
merge_mkvs,
remove_video_tracks_from_mkv,
remux_srt_subtitles
)
from tscut.tools.ffmpeg import (
ffmpeg_convert,
extract_all_streams
)
from tscut.exceptions import InvalidMediaError
from tscut.h264.avc import get_avc_config_from_h264, parse_codec_private
from tscut.matroska.codec import dump_codec_private_data
from tscut.subtitles.ocr import do_ocr, extract_srt, get_tesseract_supported_lang
from tscut.tools.ffmpeg import extract_all_streams, ffmpeg_convert
from tscut.tools.ffprobe import (
find_subtitles_tracks,
get_format,
get_frame_rate,
get_movie_duration,
get_nearest_iframe,
get_streams
get_streams,
)
from tscut.h264.avc import (
parse_codec_private,
get_avc_config_from_h264
)
from tscut.matroska.codec import dump_codec_private_data
from tscut.tscut import (
concatenate_h264_parts,
concatenate_h264_ts_parts,
SupportedFormat
)
from tscut.subtitles.ocr import (
do_ocr,
extract_srt,
get_tesseract_supported_lang
from tscut.tools.mkvtoolnix import (
change_codec_private_data,
extract_mkv_part,
extract_track_from_mkv,
get_codec_private_data_from_mkv,
merge_mkvs,
remove_video_tracks_from_mkv,
remux_srt_subtitles,
)
from tscut.tools.timeframe import get_ts_frame
from tscut.tscut import SupportedFormat, concatenate_h264_parts, concatenate_h264_ts_parts
logger = logging.getLogger(__name__)
+7 -8
View File
@@ -4,26 +4,25 @@
import logging
from typing import IO, Sequence
from io import TextIOWrapper
import os
import re
from datetime import timedelta
from io import TextIOWrapper
from os import (
read,
SEEK_SET,
fstat,
lseek,
memfd_create,
read,
write,
fstat,
)
import re
import os
from subprocess import PIPE, Popen
from typing import IO, Any
from typing import IO, Any, Sequence
from iso639 import Lang
from iso639.exceptions import InvalidLanguageValue
from typeguard import typechecked
from tqdm import tqdm
from typeguard import typechecked
from tscut.exceptions import ExternalToolError
+1 -1
View File
@@ -18,8 +18,8 @@ from typing import IO
from typeguard import typechecked
from tscut.tools.timeframe import get_ts_frame
from tscut.exceptions import InvalidMediaError
from tscut.tools.timeframe import get_ts_frame
logger = logging.getLogger(__name__)
+6 -13
View File
@@ -4,29 +4,22 @@
import logging
from io import TextIOWrapper
import os
import re
from datetime import timedelta
from os import (
read,
SEEK_SET,
lseek,
write,
fstat,
set_inheritable,
ftruncate
)
import os
from io import TextIOWrapper
from os import SEEK_SET, fstat, ftruncate, lseek, read, set_inheritable, write
from pathlib import Path
from subprocess import PIPE, Popen
from typing import IO
from typeguard import typechecked
import hexdump
from tqdm import tqdm
from typeguard import typechecked
from tscut.matroska.ebml import change_ebml_element_size
from tscut.exceptions import InvalidMediaError
from tscut.matroska.ebml import change_ebml_element_size
# Found codec private data using mkvinfo
@typechecked