Example #1
0
    def basenames(words):
        for w in words:
            dir, file = pathsplit(w, '')
            base, dot, suffix = util.strrpartition(file, '.')
            if dot == '':
                base = suffix

            yield dir + base
Example #2
0
def pathsplit(path, default='./'):
    """
    Splits a path into dirpart, filepart on the last slash. If there is no slash, dirpart
    is ./
    """
    dir, slash, file = util.strrpartition(path, '/')
    if dir == '':
        return default, file

    return dir + slash, file
Example #3
0
 def suffixes(words):
     for w in words:
         dir, file = pathsplit(w)
         base, dot, suffix = util.strrpartition(file, '.')
         if base != '':
             yield dot + suffix