Esempio n. 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
Esempio n. 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
Esempio n. 3
0
 def suffixes(words):
     for w in words:
         dir, file = pathsplit(w)
         base, dot, suffix = util.strrpartition(file, '.')
         if base != '':
             yield dot + suffix