summaryrefslogtreecommitdiffhomepage
path: root/libs/pysubs2/formatbase.py
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2021-07-14 19:13:28 -0400
committermorpheus65535 <[email protected]>2021-07-14 19:13:28 -0400
commit09a8335a03fa741be6c4cc5b030bac01d1c84b0f (patch)
tree536c3a98577514cb2192487367d2cdf4aa35358d /libs/pysubs2/formatbase.py
parent60353c036743574c64f10bcff0c8a06461c8cafc (diff)
downloadbazarr-09a8335a03fa741be6c4cc5b030bac01d1c84b0f.tar.gz
bazarr-09a8335a03fa741be6c4cc5b030bac01d1c84b0f.zip
Updated pysubs2 module to support newer SSA files.
Diffstat (limited to 'libs/pysubs2/formatbase.py')
-rw-r--r--libs/pysubs2/formatbase.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/pysubs2/formatbase.py b/libs/pysubs2/formatbase.py
index 1f336618a..21ea9c4f8 100644
--- a/libs/pysubs2/formatbase.py
+++ b/libs/pysubs2/formatbase.py
@@ -1,4 +1,8 @@
-class FormatBase(object):
+from typing import Optional
+import io
+
+
+class FormatBase:
"""
Base class for subtitle format implementations.
@@ -14,7 +18,7 @@ class FormatBase(object):
"""
@classmethod
- def from_file(cls, subs, fp, format_, **kwargs):
+ def from_file(cls, subs, fp: io.TextIOBase, format_: str, **kwargs):
"""
Load subtitle file into an empty SSAFile.
@@ -37,7 +41,7 @@ class FormatBase(object):
raise NotImplementedError("Parsing is not supported for this format")
@classmethod
- def to_file(cls, subs, fp, format_, **kwargs):
+ def to_file(cls, subs, fp: io.TextIOBase, format_: str, **kwargs):
"""
Write SSAFile into a file.
@@ -62,7 +66,7 @@ class FormatBase(object):
raise NotImplementedError("Writing is not supported for this format")
@classmethod
- def guess_format(self, text):
+ def guess_format(self, text: str) -> Optional[str]:
"""
Return format identifier of recognized format, or None.