Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate schema EBML IDs #35

Closed
StokesMIDE opened this issue Feb 19, 2020 · 1 comment
Closed

Validate schema EBML IDs #35

StokesMIDE opened this issue Feb 19, 2020 · 1 comment
Labels
enhancement New feature or request Schema Related to the EBML schemata

Comments

@StokesMIDE
Copy link
Member

StokesMIDE commented Feb 19, 2020

When importing a schema, it would be fairly simple to verify that the IDs are the correct length for the number of preceding zeros in their first byte. This would help developers working on new schemata. A badly structured ID could raise a meaningful exception, like: ValueError: Bad ID (0x2ABC): A class C EBML ID must be 3 bytes.

Arguably related to #32.

@StokesMIDE StokesMIDE added enhancement New feature or request Schema Related to the EBML schemata labels Feb 19, 2020
@StokesMIDE
Copy link
Member Author

Suggestion: maybe some sample code somewhere to generate IDs? Maybe in util.py. A function kind of like this:

def generateID(class_='a', schema=None, exclude=[]):

The optional schema is used to generate an unused ID. Similarly, exclude is a list of IDs, so the function can be used multiple times without updating the schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Schema Related to the EBML schemata
Projects
None yet
Development

No branches or pull requests

1 participant