From 24e0d28347941d4f1c8f21b3d3ced3d900331b12 Mon Sep 17 00:00:00 2001 From: getzze Date: Tue, 8 Oct 2024 00:52:34 +0100 Subject: [PATCH] update types --- subliminal/subtitle.py | 4 ++-- subliminal/utils.py | 3 ++- subliminal/video.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/subliminal/subtitle.py b/subliminal/subtitle.py index d72fed25..2fc4e4ea 100644 --- a/subliminal/subtitle.py +++ b/subliminal/subtitle.py @@ -595,9 +595,9 @@ def find_potential_encodings(language: Language) -> list[str]: # pragma: no cov return ['windows-1251', 'iso-8859-5'] if language.alpha3 == 'srp': - if language.script == 'Latn': + if language.script is not None and language.script.code == 'Latn': return ['windows-1250', 'iso-8859-2'] - if language.script == 'Cyrl': + if language.script is not None and language.script.code == 'Cyrl': return ['windows-1251', 'iso-8859-5'] return ['windows-1250', 'windows-1251', 'iso-8859-2', 'iso-8859-5'] diff --git a/subliminal/utils.py b/subliminal/utils.py index e80ff39d..e5c60b98 100644 --- a/subliminal/utils.py +++ b/subliminal/utils.py @@ -8,9 +8,10 @@ import platform import re import socket +from collections.abc import Iterable from datetime import datetime, timedelta, timezone from types import GeneratorType -from typing import TYPE_CHECKING, Any, Callable, Generic, Iterable, TypeVar, cast, overload +from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, cast, overload from xmlrpc.client import ProtocolError import requests diff --git a/subliminal/video.py b/subliminal/video.py index 4c806c5d..f75c9d68 100644 --- a/subliminal/video.py +++ b/subliminal/video.py @@ -5,14 +5,14 @@ import logging import os import warnings -from typing import TYPE_CHECKING, Any, Sequence +from typing import TYPE_CHECKING, Any from guessit import guessit # type: ignore[import-untyped] from subliminal.utils import ensure_list, get_age, matches_extended_title if TYPE_CHECKING: - from collections.abc import Mapping, Set + from collections.abc import Mapping, Sequence, Set from datetime import timedelta from babelfish import Country, Language # type: ignore[import-untyped]