Auto-generate type hints for OptionsContainer#125
Merged
Conversation
added 5 commits
February 13, 2026 14:57
The duration attribute of a Period element is optional. When it is not present, the duration can be calculated from the start of the next period, or is undefined if this is the last Period. The validator was incorrectly requiring a duration element. In addition, when checking SegmentTimeline within a Representation, it was using total timeshiftBufferDepth, rather than the expected duration of the Period.
In most cases, there is no need to put in a Period@duration
attribute, as the start of the next Period can be used to calculate
a Period's duration.
A new forcePeriodDurations option ("periodDur" CGI parameter) is added
that allows overriding this default of omitting duration attributes.
the class name had been copied and pasted from the server tests
rather than using generic dictionary and mapping types to describe all of the DashOptions, generate Python and Typescript type definitions.
Rather than providing a from_string and to_string lambda in each DashOption, use a set of option classes, that inherit from DashOption, which perform the conversion to and from strings. This allows DashOption to use Generic type hints, making it easier for the type metadata to correctly describe the type of each option.
added 6 commits
February 23, 2026 15:29
By using the auto-generated OptionsContainerType data class, there is no need to have functions to generate the default options, nor pass instances of this default between containers. The OptionsContainer class can be used directly. When using the constructor with no arguments, it will be created with the defaults populated.
As well as generating type hints for the full option names, generate them for the short option and CGI options.
The generic map of [string, unknown] can be replaced with the OptionsContainerType type that describes the type for each property in the type.
The short options are similar to the CGI options, in that they are a flat map of unique parameter names.
If an option has a fixed set of strings that are allowed for its value, this can be more accurately expressed in Typescript than Python. For example, the "mode" parameter is a str in Python, but when generating Typescript, this can be "live" | "vod" | "odvod"
f7bd113 to
e1e5c7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rather than using generic dictionary and mapping types to describe all of the
DashOptionparameters, generate Python and Typescript type definitions.By using the auto-generated OptionsContainerType data class, there is no need to have functions to generate the default options, nor pass instances of this default between containers. The
OptionsContainerclass can be used directly. When using the constructor with no arguments, it will be created with the defaults populated.