#NEWLINE# def parentdir( self ) : #NEWLINE# #INDENT# "Construct a url which is the parent of this url's directory;\n        This is logically equivalent to '..' of the current url.\n        For example:\n\n        >>> print URL.fromString('http://foo.com/bar/file').parentdir()\n        http://foo.com/\n        >>> print URL.fromString('http://foo.com/bar/dir/').parentdir()\n        http://foo.com/bar/\n        " #NEWLINE# l = self . pathList ( ) #NEWLINE# if ( ( not self . isRoot ( l ) ) and ( l [ ( - 1 ) ] == '' ) ) : #NEWLINE# #INDENT# del l [ ( - 2 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# l . pop ( ) #NEWLINE# if self . isRoot ( l ) : #NEWLINE# #INDENT# l . append ( '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# l [ ( - 1 ) ] = '' #NEWLINE# #UNINDENT# #UNINDENT# return self . _pathMod ( self , self . queryList ( 0 ) )