def create_size_estimators():
 def line_count(filename):
  with open(filename, u'rb') as fh:
   return sum((1 for line in fh))
 return {u'linecount': (lambda srcs: sum((line_count(src) for src in srcs))), u'filecount': (lambda srcs: len(srcs)), u'filesize': (lambda srcs: sum((os.path.getsize(src) for src in srcs))), u'nosize': (lambda srcs: 0), u'random': (lambda srcs: random.randint(0, 10000))}

def create_size_estimators ( ) : def line_count ( filename ) : with open ( filename , u'rb' ) as fh : return sum ( ( 1 for line in fh ) ) return { u'linecount' : ( lambda srcs : sum ( ( line_count ( src ) for src in srcs ) ) ) , u'filecount' : ( lambda srcs : len ( srcs ) ) , u'filesize' : ( lambda srcs : sum ( ( os . path . getsize ( src ) for src in srcs ) ) ) , u'nosize' : ( lambda srcs : 0 ) , u'random' : ( lambda srcs : random . randint ( 0 , 10000 ) ) }
create a dict of name to a function that returns an estimated size for a given target .