Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ docs/_build
# Environments
env/
venv/
.env

# Pyenv files
.python-version
46 changes: 23 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'pycaption'
copyright = '2012-2026, PBS.org ' \
'(available under the Apache License, Version 2.0)'
project = "pycaption"
copyright = "2012-2026, PBS.org " \
"(available under the Apache License, Version 2.0)"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.2.20'
version = "2.2.20"
# The full version, including alpha/beta/rc tags.
release = '2.2.20'
release = "2.2.20"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -69,7 +69,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -87,7 +87,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand Down Expand Up @@ -131,7 +131,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -180,18 +180,16 @@
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'pycaptiondoc'
htmlhelp_basename = "pycaptiondoc"


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
Expand All @@ -200,8 +198,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'pycaption.tex', 'pycaption Documentation',
'PBS', 'manual'),
("index", "pycaption.tex", "pycaption Documentation", "PBS", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -229,10 +226,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pycaption', 'pycaption Documentation',
['PBS'], 1)
]
man_pages = [("index", "pycaption", "pycaption Documentation", ["PBS"], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -244,9 +238,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'pycaption', 'pycaption Documentation',
'PBS', 'pycaption', 'One line description of project.',
'Miscellaneous'),
(
"index",
"pycaption",
"pycaption Documentation",
"PBS",
"pycaption",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down
54 changes: 38 additions & 16 deletions pycaption/__init__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
from .base import (
CaptionConverter, CaptionNode, Caption, CaptionList, CaptionSet,
from .base import Caption, CaptionConverter, CaptionList, CaptionNode, CaptionSet
from .dfxp import DFXPReader, DFXPWriter
from .exceptions import (
CaptionLineLengthError,
CaptionReadError,
CaptionReadNoCaptions,
CaptionReadSyntaxError,
)
from .dfxp import DFXPWriter, DFXPReader
from .microdvd import MicroDVDReader, MicroDVDWriter
from .sami import SAMIReader, SAMIWriter
from .srt import SRTReader, SRTWriter
from .scc import SCCReader, SCCWriter
from .scc.translator import translate_scc
from .srt import SRTReader, SRTWriter
from .transcript import TranscriptWriter
from .webvtt import WebVTTReader, WebVTTWriter
from .exceptions import (
CaptionReadError, CaptionReadNoCaptions, CaptionReadSyntaxError, CaptionLineLengthError
)


__all__ = [
'CaptionConverter', 'DFXPReader', 'DFXPWriter', 'MicroDVDReader',
'MicroDVDWriter', 'SAMIReader', 'SAMIWriter', 'SRTReader', 'SRTWriter',
'SCCReader', 'SCCWriter', 'translate_scc', 'WebVTTReader', 'WebVTTWriter',
'CaptionReadError', 'CaptionReadNoCaptions', 'CaptionReadSyntaxError',
'detect_format', 'CaptionNode', 'Caption', 'CaptionList', 'CaptionSet',
'TranscriptWriter'
"CaptionConverter",
"DFXPReader",
"DFXPWriter",
"MicroDVDReader",
"MicroDVDWriter",
"SAMIReader",
"SAMIWriter",
"SRTReader",
"SRTWriter",
"SCCReader",
"SCCWriter",
"translate_scc",
"WebVTTReader",
"WebVTTWriter",
"CaptionReadError",
"CaptionReadNoCaptions",
"CaptionReadSyntaxError",
"detect_format",
"CaptionNode",
"Caption",
"CaptionList",
"CaptionSet",
"TranscriptWriter",
]

SUPPORTED_READERS = (
DFXPReader, MicroDVDReader, WebVTTReader, SAMIReader, SRTReader, SCCReader,
DFXPReader,
MicroDVDReader,
WebVTTReader,
SAMIReader,
SRTReader,
SCCReader,
)


Expand All @@ -36,7 +58,7 @@ def detect_format(caps):
"""
if not len(caps):
raise CaptionReadNoCaptions("Empty caption file")

for reader in SUPPORTED_READERS:
if reader().detect(caps):
return reader
Expand Down
2 changes: 1 addition & 1 deletion pycaption/dfxp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .base import * # noqa: F401, F403
from .extras import SinglePositioningDFXPWriter, LegacyDFXPWriter # noqa: F401
from .extras import LegacyDFXPWriter, SinglePositioningDFXPWriter # noqa: F401
Loading
Loading