aaf2.cfb module

aaf2.cfb.pretty_sectors(fat)
class aaf2.cfb.Stream(storage, entry, mode='r')

Bases: object

storage
dir
mode
pos
fat_chain
tell()
seek(offset, whence=0)
is_mini_stream()
sector_size()
sector_offset()
sector_index()
read(n=-1)
allocate(byte_size)
write(data)
truncate(size=None)
close()
aaf2.cfb.is_red(entry)
aaf2.cfb.is_not_red(entry)
aaf2.cfb.is_parent_of(parent, entry)
aaf2.cfb.validate_rbtree(root)
aaf2.cfb.jsw_single(root, direction)
aaf2.cfb.jsw_double(root, direction)
aaf2.cfb.find_entry_parent(root, entry, max_depth)
aaf2.cfb.get_entry_path(root, entry, max_depth)
class aaf2.cfb.DirEntry(storage, dir_id, data=None)

Bases: object

storage
parent
data
dir_id
name
type
color
red
left_id
right_id
child_id
class_id
flags
create_time
modify_time
sector_id
byte_size
mark_modified()
left()
right()
child()
add_child(entry)
insert(entry)

Inserts entry into child folder tree. Trys to mantains a balanced red black tree. Technique is base on topdown insert approach in described in https://eternallyconfuzzled.com/red-black-trees-c-the-most-common-balanced-binary-search-tree

pop()

remove self from self.parent folder binary search tree. Tries to maintain a balanced red black tree. Technique is base on topdown remove approach in described in https://eternallyconfuzzled.com/red-black-trees-c-the-most-common-balanced-binary-search-tree

rebalance_children_tree()
path()
open(mode='r')
isdir()
isroot()
listdir()
makedir(relative_path, class_id=None)
isfile()
get(name, default=None)
touch(name)
write()
read()
aaf2.cfb.extend_sid_table(f, table, byte_size)
class aaf2.cfb.CompoundFileBinary(file_object, mode='rb', sector_size=4096)

Bases: object

close()
setup_empty(sector_size)
write_header()
read_header()
iter_difat()
write_difat()
read_fat()
write_fat()
read_minifat()
write_minifat()
write_modified_dir_entries()
write_dir_entries()
next_free_minifat_sect()
next_free_sect()
read_sector_data(sid)
get_sid_offset(abs_pos)
dir_entry_sid_offset(dir_id)
dir_entry_pos(dir_id)
read_dir_entry(dir_id, parent=None)
clear_sector(sid)
next_free_dir_id()
get_fat_chain(start_sid, minifat=False)
mini_stream_grow()
fat_chain_append(start_sid, minifat=False)
free_fat_chain(start_sid, minifat=False)
create_dir_entry(path, dir_type='storage', class_id=None)
free_dir_entry(entry)
remove(path)

Removes both streams and storage DirEntry types from file. storage type entries need to be empty dirs.

rmtree(path)

Removes directory structure, similar to shutil.rmtree.

listdir(path=None)

Return a list containing the DirEntry objects in the directory given by path.

listdir_dict(path=None)

Return a dict containing the DirEntry objects in the directory given by path with name of the dir as key.

find(path)

find a DirEntry located at path. Returns None if path does not exist.

walk(path=None, topdown=True)

Similar to os.walk(), yeields a 3-tuple (root, storage_items, stream_items)

validate_directory_structure()
exists(path)

Return True if path refers to a existing path.

makedir(path, class_id=None)

Create a storage DirEntry name path

makedirs(path)

Recursive storage DirEntry creation function.

move(src, dst)

Moves DirEntry from src to dst

open(path, mode='r')

Open stream, returning Stream object