#NEWLINE# def cd( self , path ) : #NEWLINE# #INDENT# path = path . strip ( ) #NEWLINE# if ( not path ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# stripped_path = ( '/' . join ( ( self for part in path . split ( '/' ) if part ) ) + '/' ) #NEWLINE# if ( stripped_path == '/' ) : #NEWLINE# #INDENT# self . cwd = stripped_path #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if path . startswith ( '/' ) : #NEWLINE# #INDENT# self . cwd = ( '/' + stripped_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . cwd += stripped_path