#NEWLINE# def abspath( self ) : #NEWLINE# #INDENT# "Clear out any '..' and excessive slashes from the path" #NEWLINE# path = re . sub ( b ( '\\/{2,}' ) , b ( '/' ) , self . _path ) #NEWLINE# unsplit = [ ] #NEWLINE# directory = False #NEWLINE# for part in path . split ( b ( '/' ) ) : #NEWLINE# #INDENT# if ( ( part == b ( '..' ) ) and ( ( not unsplit ) or ( unsplit . pop ( ) is not None ) ) ) : #NEWLINE# #INDENT# directory = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( part != b ( '.' ) ) : #NEWLINE# #INDENT# directory = False #NEWLINE# unsplit . append ( part ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# directory = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if directory : #NEWLINE# #INDENT# unsplit . append ( b ( '/' ) ) #NEWLINE# #UNINDENT# self . _path = b ( '/' ) . join ( unsplit ) #NEWLINE# return self