def generate_yml(filename, specs):
 def _to_builtin(elements):
  'Recursively convert elements to built-in types'
  result = []
  for e in elements:
   if isinstance(e, ebml.MasterElement):
    result.append((e.id, e.type, e.name, e.level, e.position, e.size, _to_builtin(e.data)))
   else:
    result.append((e.id, e.type, e.name, e.level, e.position, e.size, (None if isinstance(e.data, io.BytesIO) else e.data)))
  return result
 video = io.open(os.path.join(TEST_DIR, filename), 'rb')
 yml = io.open(os.path.join(EBML_VALIDATION_DIR, (filename + '.yml')), 'w')
 yaml.safe_dump(_to_builtin(ebml.parse(video, specs)), yml)

def generate_yml ( filename , specs ) : def _to_builtin ( elements ) : result = [ ] for e in elements : if isinstance ( e , ebml . MasterElement ) : result . append ( ( e . id , e . type , e . name , e . level , e . position , e . size , _to_builtin ( e . data ) ) ) else : result . append ( ( e . id , e . type , e . name , e . level , e . position , e . size , ( None if isinstance ( e . data , io . BytesIO ) else e . data ) ) ) return result video = io . open ( os . path . join ( TEST_DIR , filename ) , 'rb' ) yml = io . open ( os . path . join ( EBML_VALIDATION_DIR , ( filename + '.yml' ) ) , 'w' ) yaml . safe_dump ( _to_builtin ( ebml . parse ( video , specs ) ) , yml )
generate a validation file for the test video .