예제 #1
0
 def factory(fs, db, parent):
     fileobj = fs if fs is not None else db
     name = fileobj.relpath or fileobj.fullpath if fileobj else '<path not found in filesystem or database>'
     if parent is None:
         progress = ProgressTree(name=name)
         maxlen = lambda s: util.trim_to_maxlen(50, s)
         progress.reporter = ProgressReporter(lvl=1, namefmt=maxlen)
     else:
         progress = parent.progress.spawnchild(name)
     return Item(fs, db, parent, progress)
예제 #2
0
 def factory(fs, db, parent):
     fileobj = fs if fs is not None else db
     name = fileobj.relpath or fileobj.fullpath if fileobj else '<path not found in filesystem or database>'
     if parent is None:
         progress = ProgressTree(name=name)
         maxlen = lambda s: util.trim_to_maxlen(50, s)
         progress.reporter = ProgressReporter(lvl=1, namefmt=maxlen)
     else:
         progress = parent.progress.spawnchild(name)
     return Item(fs, db, parent, progress)
예제 #3
0
def test_maxlen_trim():
    assert util.trim_to_maxlen(7, 'abcdefghi') == 'a ... i'
예제 #4
0
def test_maxlen_trim():
    assert util.trim_to_maxlen(7, "abcdefghi") == "a ... i"
예제 #5
0
def test_maxlen_trim():
    assert util.trim_to_maxlen(7, 'abcdefghi') == 'a ... i'