From 9015898a96b4a33abe94c2bea2eb56febd82c942 Mon Sep 17 00:00:00 2001 From: GitBib <15717621+GitBib@users.noreply.github.com> Date: Mon, 4 Nov 2024 03:28:43 +0300 Subject: [PATCH] Update doc examples and dependencies Align documentation examples to show consistent REPL prompts. Adjust pre-commit dependencies to their latest versions to ensure updated linting and fixing capabilities. Reorganized import statements in `MKVAttachment.py` for improved clarity. --- .pre-commit-config.yaml | 6 +++--- pymkv/MKVAttachment.py | 13 +++++++------ pymkv/MKVFile.py | 30 +++++++++++++++--------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff1fe10..1f9cb36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -22,7 +22,7 @@ repos: # Run the Ruff linter. - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.7 + rev: v0.7.2 hooks: # Linter - id: ruff @@ -31,7 +31,7 @@ repos: - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.12.0' + rev: v1.13.0 hooks: - id: mypy diff --git a/pymkv/MKVAttachment.py b/pymkv/MKVAttachment.py index b3adfa3..bcabeff 100644 --- a/pymkv/MKVAttachment.py +++ b/pymkv/MKVAttachment.py @@ -1,9 +1,5 @@ -from __future__ import annotations - -from mimetypes import guess_type -from pathlib import Path - -""":class:`~pymkv.MKVAttachment` classes are used to represent attachment files within an MKV or to be used in an +""" +:class:`~pymkv.MKVAttachment` classes are used to represent attachment files within an MKV or to be used in an MKV. Examples @@ -28,6 +24,11 @@ >>> mkv.mux('path/to/output.mkv') """ +from __future__ import annotations + +from mimetypes import guess_type +from pathlib import Path + class MKVAttachment: """A class that represents an MKV attachment for an :class:`~pymkv.MKVFile` object. diff --git a/pymkv/MKVFile.py b/pymkv/MKVFile.py index a7cb488..40ac0aa 100644 --- a/pymkv/MKVFile.py +++ b/pymkv/MKVFile.py @@ -6,33 +6,33 @@ Create and mux a new MKV. This example takes an standalone video and audio track and combines them into an MKV file. ->> from pymkv import MKVFile ->> mkv = MKVFile() ->> mkv.add_track('/path/to/track.h264') ->> mkv.add_track(MKVTrack('/path/to/another/track.aac')) +>>> from pymkv import MKVFile +>>> mkv = MKVFile() +>>> mkv.add_track('/path/to/track.h264') +>>> mkv.add_track(MKVTrack('/path/to/another/track.aac')) >> mkv.mux('/path/to/output.mkv') Generate the mkvmerge command to mux an MKV. This is example is identical to the first example except the command is only generated, not executed. ->> mkv = MKVFile() ->> mkv.add_track('/path/to/track.h264') ->> mkv.add_track(MKVTrack('/path/to/another/track.aac')) ->> mkv.command('/path/to/output.mkv') +>>> mkv = MKVFile() +>>> mkv.add_track('/path/to/track.h264') +>>> mkv.add_track(MKVTrack('/path/to/another/track.aac')) +>>> mkv.command('/path/to/output.mkv') Import an existing MKV and remove a track. This example will import an MKV that already exists on your filesystem, remove a track and allow you to mux that change into a new file. ->> mkv = MKVFile('/path/to/file.mkv') ->> mkv.remove_track(0) ->> mkv.mux('/path/to/output.mkv') +>>> mkv = MKVFile('/path/to/file.mkv') +>>> mkv.remove_track(0) +>>> mkv.mux('/path/to/output.mkv') Combine two MKVs. This example takes two existing MKVs and combines their tracks into a single MKV file. ->> mkv1 = MKVFile('/path/to/file1.mkv') ->> mkv2 = MKVFile('/path/to/file2.mkv') ->> mkv1.add_file(mkv2) ->> mkv1.mux('/path/to/output.mkv') +>>> mkv1 = MKVFile('/path/to/file1.mkv') +>>> mkv2 = MKVFile('/path/to/file2.mkv') +>>> mkv1.add_file(mkv2) +>>> mkv1.mux('/path/to/output.mkv') """ from __future__ import annotations