Back to index

python3.2  3.2.2
Functions | Variables
dutree Namespace Reference

Functions

def main
def store
def display
def show

Variables

tuple width = len(repr(list[0][0]))
 if sum < total: list.append((total - sum, os.curdir))
 psub = prefix

Function Documentation

def dutree.display (   total,
  d 
)

Definition at line 34 of file dutree.py.

00034 
00035 def display(total, d):
00036     show(total, d, '')

Here is the call graph for this function:

Here is the caller graph for this function:

def dutree.main ( void  )

Definition at line 6 of file dutree.py.

00006 
00007 def main():
00008     p = os.popen('du ' + ' '.join(sys.argv[1:]), 'r')
00009     total, d = None, {}
00010     for line in p.readlines():
00011         i = 0
00012         while line[i] in '0123456789': i = i+1
00013         size = eval(line[:i])
00014         while line[i] in ' \t': i = i+1
00015         filename = line[i:-1]
00016         comps = filename.split('/')
00017         if comps[0] == '': comps[0] = '/'
00018         if comps[len(comps)-1] == '': del comps[len(comps)-1]
00019         total, d = store(size, comps, total, d)
00020     try:
00021         display(total, d)
00022     except IOError as e:
00023         if e.errno != errno.EPIPE:
00024             raise

Here is the call graph for this function:

def dutree.show (   total,
  d,
  prefix 
)

Definition at line 37 of file dutree.py.

00037 
00038 def show(total, d, prefix):
00039     if not d: return
00040     list = []
00041     sum = 0
00042     for key in d.keys():
00043         tsub, dsub = d[key]
00044         list.append((tsub, key))
        if tsub is not None: sum = sum + tsub

Here is the caller graph for this function:

def dutree.store (   size,
  comps,
  total,
  d 
)

Definition at line 25 of file dutree.py.

00025 
00026 def store(size, comps, total, d):
00027     if comps == []:
00028         return size, d
00029     if comps[0] not in d:
00030         d[comps[0]] = None, {}
00031     t1, d1 = d[comps[0]]
00032     d[comps[0]] = store(size, comps[1:], t1, d1)
00033     return total, d

Here is the caller graph for this function:


Variable Documentation

Definition at line 52 of file dutree.py.

tuple dutree.width = len(repr(list[0][0]))

if sum < total: list.append((total - sum, os.curdir))

Definition at line 49 of file dutree.py.