def read_dir(self, path):
self.tree = {}<EOL>self.file_count = <NUM_LIT:0><EOL>self.path = path<EOL>for root, _, filelist in os.walk(path):<EOL><INDENT>rel = root[len(path):].lstrip('<STR_LIT>')<EOL>if not rel:<EOL><INDENT>rel = '<STR_LIT:U+0020>'<EOL><DEDENT>for filename in filelist:<EOL><INDENT>filename = filename.split('<STR_LIT:.>')<EOL>if len(filename) <= <NUM_LIT:1>:<EOL><INDENT>raise RuntimeError("<STR_LIT>".format(<EOL>repr(os.path.join(root, '<STR_LIT:.>'.join(filename))),<EOL>))<EOL><DEDENT>ext = filename[-<NUM_LIT:1>]<EOL>filename = '<STR_LIT:.>'.join(filename[:-<NUM_LIT:1>])<EOL>if ext not in self.tree:<EOL><INDENT>self.tree[ext] = {}<EOL><DEDENT>if rel not in self.tree[ext]:<EOL><INDENT>self.tree[ext][rel] = []<EOL><DEDENT>self.tree[ext][rel].append(filename)<EOL>self.file_count += <NUM_LIT:1><EOL><DEDENT><DEDENT>self.tree_length = self.calculate_tree_length()<EOL>
Reads the given path into the tree