bindings Package¶
bindings
Package¶
-
ebu_tt_live.bindings.
CreateFromDOM
(*args, **kwargs)[source]¶ Resetting the parsing context on start :return:
-
ebu_tt_live.bindings.
CreateFromDocument
(*args, **kwargs)[source]¶ Resetting the parsing context on start :return:
-
class
ebu_tt_live.bindings.
LiveStyledElementMixin
[source]¶ Bases:
ebu_tt_live.bindings.validation.presentation.StyledElementMixin
-
class
ebu_tt_live.bindings.
body_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.LiveStyledElementMixin
,ebu_tt_live.bindings.validation.timing.BodyTimingValidationMixin
,ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.body_type
-
class
ebu_tt_live.bindings.
br_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.br_type
-
class
ebu_tt_live.bindings.
d_tt_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.raw.d_tt_type
-
toDOM
(bds=None, parent=None, element_name=None)[source]¶ Convert this instance to a DOM node.
The name of the top-level element is either the name of the L{element} instance associated with this instance, or the XML name of the type of this instance.
@param bds: Support for customizing the generated document @type bds: L{pyxb.utils.domutils.BindingDOMSupport} @param parent: If C{None}, a standalone document is created; otherwise, the created element is a child of the given element. @type parent: C{xml.dom.Element} or C{None} @rtype: C{xml.dom.Document}
-
toxml
(encoding=None, bds=None, root_only=False, element_name=None)[source]¶ Shorthand to get the object as an XML document.
If you want to set the default namespace, pass in a pre-configured C{bds}.
@param encoding: The encoding to be used. See @C{xml.dom.Node.toxml()} for a description of why you should always pass @C{‘utf-8’} here. Because this method follows the contract of the corresponding C{xml.dom.Node} method, it does not automatically get the default PyXB output encoding.
@param bds: Optional L{pyxb.utils.domutils.BindingDOMSupport} instance to use for creation. If not provided (default), a new generic one is created.
@param root_only: Set to C{True} to automatically deference the C{documentElement} of the resulting DOM node. This eliminates the XML declaration that would otherwise be generated.
@param element_name: This value is passed through to L{toDOM}, and is useful when the value has no bound element but you want to convert it to XML anyway.
-
-
class
ebu_tt_live.bindings.
div_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.content.ContentContainerMixin
,ebu_tt_live.bindings.validation.base.IDMixin
,ebu_tt_live.bindings.validation.presentation.RegionedElementMixin
,ebu_tt_live.bindings.LiveStyledElementMixin
,ebu_tt_live.bindings.validation.timing.TimingValidationMixin
,ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.div_type
-
is_empty
()[source]¶ This check is made necessary by some splitting edge cases of content. To make empty containers are not included one should check if there really was anything useful in the container. This function is meant to be implemented by the subclasses of this class to make sure the container checks for the right constraints. :return:
-
-
class
ebu_tt_live.bindings.
head_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.head_type
-
class
ebu_tt_live.bindings.
layout
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.layout
-
class
ebu_tt_live.bindings.
p_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.presentation.RegionedElementMixin
,ebu_tt_live.bindings.LiveStyledElementMixin
,ebu_tt_live.bindings.validation.content.SubtitleContentContainer
,ebu_tt_live.bindings.raw.p_type
-
class
ebu_tt_live.bindings.
region_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.IDMixin
,ebu_tt_live.bindings.LiveStyledElementMixin
,ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.region
-
class
ebu_tt_live.bindings.
span_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.LiveStyledElementMixin
,ebu_tt_live.bindings.validation.content.SubtitleContentContainer
,ebu_tt_live.bindings.raw.span_type
-
class
ebu_tt_live.bindings.
style_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.presentation.StyledElementMixin
,ebu_tt_live.bindings.validation.base.IDMixin
,ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.style
-
classmethod
compute_font_size
(specified_style, parent_computed_style, region_computed_style, dataset, defer=False)[source]¶
-
classmethod
compute_inherited_attribute
(attr_name, specified_style, parent_computed_style, region_computed_style)[source]¶
-
classmethod
compute_line_height
(specified_style, parent_computed_style, region_computed_style, dataset, font_size)[source]¶
-
classmethod
compute_style
(specified_style, parent_computed_style, region_computed_style, dataset, defer_font_size)[source]¶ This function holds the styling semantics of containers considering direct reference, inheritance and containment variables :param specified_style: Directly referenced resolved styles :param parent_computed_style: Inherited styling information from parent container :param region_computed_style: Default region styling information :param dataset: Semantic dataset needed for conversion context :return:
-
default_attrs
¶ This property function gives back a set in which we find the unspecified style attributes.
return: set for attribute names that were inheriting the default in the computed style. Important at inheritance override
-
ordered_styles
(dataset)[source]¶ This function figures out the chain of styles. WARNING: Do not call this before the semantic validation of tt/head/styling is finished. Otherwise your style may not have been found yet! :param dataset: Semantic dataset :return: a list of styles applicable in order
-
classmethod
resolve_styles
(referenced_styles)[source]¶ Resolve the style attributes in inheritance chain :param referenced_styles: :return:
-
validated_styles
¶
-
classmethod
-
class
ebu_tt_live.bindings.
styling
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings.raw.styling
-
class
ebu_tt_live.bindings.
tt_type
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticDocumentMixin
,ebu_tt_live.bindings.raw.tt_type
-
get_element_by_id
(elem_id, elem_type=None)[source]¶ Lookup an element and return it. Optionally type is checked as well. :param elem_id: :param elem_type: :return:
-
merge
(other, dataset)[source]¶ Try and merge the contents of 2 elements of the same type. :param other_elem: :return:
-
toDOM
(bds=None, parent=None, element_name=None)[source]¶ Convert this instance to a DOM node.
The name of the top-level element is either the name of the L{element} instance associated with this instance, or the XML name of the type of this instance.
@param bds: Support for customizing the generated document @type bds: L{pyxb.utils.domutils.BindingDOMSupport} @param parent: If C{None}, a standalone document is created; otherwise, the created element is a child of the given element. @type parent: C{xml.dom.Element} or C{None} @rtype: C{xml.dom.Document}
-
toxml
(encoding=None, bds=None, root_only=False, element_name=None)[source]¶ Shorthand to get the object as an XML document.
If you want to set the default namespace, pass in a pre-configured C{bds}.
@param encoding: The encoding to be used. See @C{xml.dom.Node.toxml()} for a description of why you should always pass @C{‘utf-8’} here. Because this method follows the contract of the corresponding C{xml.dom.Node} method, it does not automatically get the default PyXB output encoding.
@param bds: Optional L{pyxb.utils.domutils.BindingDOMSupport} instance to use for creation. If not provided (default), a new generic one is created.
@param root_only: Set to C{True} to automatically deference the C{documentElement} of the resulting DOM node. This eliminates the XML declaration that would otherwise be generated.
@param element_name: This value is passed through to L{toDOM}, and is useful when the value has no bound element but you want to convert it to XML anyway.
-
_ebuttdt
Module¶
-
class
ebu_tt_live.bindings._ebuttdt.
CellExtentType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.cellExtentType
-
class
ebu_tt_live.bindings._ebuttdt.
CellFontSizeType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.cellFontSizeType
-
class
ebu_tt_live.bindings._ebuttdt.
CellLineHeightType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.cellLineHeightType
-
class
ebu_tt_live.bindings._ebuttdt.
CellOriginType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.cellOriginType
-
class
ebu_tt_live.bindings._ebuttdt.
CellResolutionType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.cellResolutionType
-
class
ebu_tt_live.bindings._ebuttdt.
FullClockTimingType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.base.SemanticValidationMixin
,ebu_tt_live.bindings._ebuttdt._TimedeltaBindingMixin
,ebu_tt_live.bindings.raw._ebuttdt.fullClockTimingType
Extending the string type with conversions to and from timedelta
-
class
ebu_tt_live.bindings._ebuttdt.
LimitedClockTimingType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt._TimedeltaBindingMixin
,ebu_tt_live.bindings.raw._ebuttdt.limitedClockTimingType
Extending the string type with conversions to and from timedelta
-
class
ebu_tt_live.bindings._ebuttdt.
PercentageExtentType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.percentageExtentType
-
class
ebu_tt_live.bindings._ebuttdt.
PercentageFontSizeType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.percentageFontSizeType
-
class
ebu_tt_live.bindings._ebuttdt.
PercentageLengthType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.raw._ebuttdt.percentageLengthType
-
class
ebu_tt_live.bindings._ebuttdt.
PercentageLineHeightType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.percentageLineHeightType
-
class
ebu_tt_live.bindings._ebuttdt.
PercentageOriginType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.percentageOriginType
-
class
ebu_tt_live.bindings._ebuttdt.
PixelExtentType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.raw._ebuttdt.pixelExtentType
-
class
ebu_tt_live.bindings._ebuttdt.
PixelFontSizeType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.raw._ebuttdt.pixelFontSizeType
-
class
ebu_tt_live.bindings._ebuttdt.
PixelLengthType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.raw._ebuttdt.pixelLengthType
-
class
ebu_tt_live.bindings._ebuttdt.
PixelLineHeightType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.raw._ebuttdt.pixelLineHeightType
-
class
ebu_tt_live.bindings._ebuttdt.
PixelOriginType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt.TwoDimSizingMixin
,ebu_tt_live.bindings.validation.presentation.SizingValidationMixin
,ebu_tt_live.bindings.raw._ebuttdt.pixelOriginType
-
class
ebu_tt_live.bindings._ebuttdt.
SMPTETimingType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt._TimedeltaBindingMixin
,ebu_tt_live.bindings.raw._ebuttdt.smpteTimingType
Extending the string type with conversions to and from timedelta
-
class
ebu_tt_live.bindings._ebuttdt.
TimecountTimingType
(*args, **kw)[source]¶ Bases:
ebu_tt_live.bindings._ebuttdt._TimedeltaBindingMixin
,ebu_tt_live.bindings.raw._ebuttdt.timecountTimingType
Extending the string type with conversions to and from timedelta
_ebuttm
Module¶
_ebuttp
Module¶
_ebutts
Module¶
_ttm
Module¶
_ttp
Module¶
_tts
Module¶
pyxb_utils
Module¶
This file contains those bits and pieces that are necessary to give PyXB extra functionality.
-
class
ebu_tt_live.bindings.pyxb_utils.
RecursiveOperation
(root_element, filter=None, post_order=False, children_iterator=None)[source]¶ Bases:
object
A recursive operation can be a validation of the content model, a full- or partial copy of the document tree, the splicing of two documents together or conversion of one document format to another. This class contains the generic content iteration logic with hook functions that are meant to be customized by descendant classes.
-
ebu_tt_live.bindings.pyxb_utils.
get_xml_parsing_context
()[source]¶ The parsing context is a simple python dictionary that helps tie together semantic rules at parsing time.
For example: making sure that limitedClockTimingtype and fullClockTimingType are instantiated appropriately taking into account the timeBase attribute on the tt element. In that case when the timeBase element is encountered by the parser is is added to the parsing context object to help PyXB make the right type in the timingType union.
Returns: dict that is te parsing context for the currently running parser Returns: None if not in parsing mode
-
class
ebu_tt_live.bindings.pyxb_utils.
xml_parsing_context
[source]¶ Bases:
object
This context manager is helpful to inject a thread local parsing context into the XML parser to be able to control its type choices based on semantic rules. The context manager makes sure the context is renewed every time a new document is parsed. This prevents unwanted correlation between documents.