Esempio n. 1
0
 def read_files(cls, glob_pattern):
     rows = []
     for file in glob(glob_pattern, recursive=True):
         form = None
         path_components = split_path(os.path.abspath(file))
         name = path_components[-1]
         for component in path_components:
             if component in ['onear', 'inear', 'earbud']:
                 form = component
         name = re.sub(r'\.[tc]sv$', '', name)
         rows.append([name, name, form])
     return cls(rows=rows)
Esempio n. 2
0
 def read_files(cls, glob_pattern):
     index = cls()
     for file in glob(glob_pattern):
         form = None
         path_components = split_path(os.path.abspath(file))
         name = path_components[-1]
         for component in path_components:
             if component in ['onear', 'inear', 'earbud']:
                 form = component
         name = re.sub(r'\.[tc]sv$', '', name)
         item = NameItem(name, name, form)
         index.add(item)
     return index