From 472664a44f6e85ccb8ac0c0397fb67040fe45466 Mon Sep 17 00:00:00 2001 From: Tomas Karabela Date: Sun, 5 May 2024 02:30:36 +0200 Subject: [PATCH] fix: Fix Python 3.8 support --- pysubs2/microdvd.py | 4 ++-- pysubs2/ssafile.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pysubs2/microdvd.py b/pysubs2/microdvd.py index 3c7abc6..0e22bef 100644 --- a/pysubs2/microdvd.py +++ b/pysubs2/microdvd.py @@ -1,6 +1,6 @@ from functools import partial import re -from typing import Optional, TextIO, Any, TYPE_CHECKING +from typing import Optional, TextIO, Any, Match, TYPE_CHECKING from .exceptions import UnknownFPSError from .ssaevent import SSAEvent @@ -71,7 +71,7 @@ def from_file(cls, subs: "SSAFile", fp: TextIO, format_: str, fps: Optional[floa def prepare_text(text: str) -> str: text = text.replace("|", r"\N") - def style_replacer(match: re.Match[str]) -> str: + def style_replacer(match: Match[str]) -> str: tags = [c for c in "biu" if c in match.group(0)] return "{%s}" % "".join(f"\\{c}1" for c in tags) diff --git a/pysubs2/ssafile.py b/pysubs2/ssafile.py index da44d00..f04936c 100644 --- a/pysubs2/ssafile.py +++ b/pysubs2/ssafile.py @@ -1,10 +1,9 @@ -from collections.abc import MutableSequence import io from io import open from itertools import chain import os.path import logging -from typing import Optional, List, Dict, Iterable, Any, overload, Iterator, TextIO, Tuple +from typing import Optional, List, Dict, Iterable, Any, overload, Iterator, TextIO, Tuple, MutableSequence from .common import IntOrFloat from .formats import autodetect_format, get_format_class, get_format_identifier