Пример #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'