#NEWLINE# def extract_configs( configs , parent_dir ) : #NEWLINE# #INDENT# 'Extracts configs to a new dir under parent_dir and returns it' #NEWLINE# config_dir = os . path . join ( parent_dir , 'configs' ) #NEWLINE# if os . path . isdir ( configs ) : #NEWLINE# #INDENT# shutil . copytree ( configs , configs , symlinks = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if tarfile . is_tarfile ( configs ) : #NEWLINE# #INDENT# with tarfile . open ( configs , 'r' ) as tar : #NEWLINE# #INDENT# tar . extractall ( config_dir ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise errors . Error ( 'Unknown configurations file type' ) #NEWLINE# #UNINDENT# #UNINDENT# return config_dir