@@ -0,0 +1,1582 @@
+%22%22%22functions separate paths to components%0A%0Asplitall() returns a list of strings, each string containing one%0Acomponent of the path.%0A%0Ato_ospathjoin wraps the components into an os.path.join() call%0A%0Asplitall is from Python Cookbook by David Ascher, Alex Martelli%0Ahttps://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch04s16.html%0Aaccessed 31 Mar 2017%0A%22%22%22%0A%0Aimport os%0A%0A%0Adef splitall(path):%0A    %22%22%22split path into a list of strings, one path component per string%0A%0A    ARGS:%0A    path (str): a path%0A%0A    RETURNS:%0A    a list of strings, one path component per string%0A%0A    AUTHORS: David Ascher and Alex Martelli, published in %60Python%0A    Cookbook%0A    %3Chttps://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch04s16.html%3E%60_%0A    %22%22%22%0A    allparts = %5B%5D%0A    while 1:%0A        parts = os.path.split(path)%0A        if parts%5B0%5D == path:  # sentinel for absolute paths%0A            allparts.insert(0, parts%5B0%5D)%0A            break%0A        elif parts%5B1%5D == path:  # sentinel for relative paths%0A            allparts.insert(0, parts%5B1%5D)%0A            break%0A        else:%0A            path = parts%5B0%5D%0A            allparts.insert(0, parts%5B1%5D)%0A    return allparts%0A%0A%0Adef to_ospathjoin(path):%0A    %22%22%22reformat a path to a os.path.join call%0A%0A    ARGS:%0A    path (str): a path%0A%0A    RETURNS:%0A    a string containing the elements of path wrapped in a call to%0A        os.path.join()%0A    %22%22%22%0A    components = splitall(path)%0A    cmd = %22os.path.join('%7B%7D'%22.format(components%5B0%5D)%0A    for this in components%5B1:%5D:%0A        cmd = cmd + %22, '%7B%7D'%22.format(this)%0A    cmd = cmd + ')'%0A    return cmd%0A

implement module splitall.py