#NEWLINE# def get_path_parts( path ) : #NEWLINE# #INDENT# '\n    Splits a path up into its parts.\n\n    :param path: A path (may be any valid file path, ie: relative, windows,\n            linux, absolute, etc.).\n    :returns: A list containing the parts, in order, of the path. See examples\n            below.\n\n    >>> zipsite.get_path_parts("delicious/apple/sauce")\n    [\'delicious\', \'apple\', \'sauce\']\n    >>> zipsite.get_path_parts("/")\n    [\'/\']\n    >>> zipsite.get_path_parts("/foo/bar/")\n    [\'/\', \'foo\', \'bar\', \'\']\n    >>> zipsite.get_path_parts("/foo/bar")\n    [\'/\', \'foo\', \'bar\']\n\n    .. note::\n\n        This function was adapted from John Machin\'s Stack Overflow post\n        `here <http://stackoverflow.com/a/4580931/1989056>`_.\n\n    ' #NEWLINE# parts = [ ] #NEWLINE# while True : #NEWLINE# #INDENT# ( remaining , tail ) = os . path . split ( path ) #NEWLINE# if ( remaining == path ) : #NEWLINE# #INDENT# if path : #NEWLINE# #INDENT# parts . append ( path ) #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = remaining #NEWLINE# #UNINDENT# parts . append ( tail ) #NEWLINE# #UNINDENT# parts . reverse ( ) #NEWLINE# return parts