def _description_of(path):
 from charade.universaldetector import UniversalDetector
 u = UniversalDetector()
 for line in open(path, 'rb'):
  u.feed(line)
 u.close()
 result = u.result
 if result['encoding']:
  return ('%s: %s with confidence %s' % (path, result['encoding'], result['confidence']))
 else:
  return ('%s: no result' % path)

def _description_of ( path ) : from charade . universaldetector import UniversalDetector u = UniversalDetector ( ) for line in open ( path , 'rb' ) : u . feed ( line ) u . close ( ) result = u . result if result [ 'encoding' ] : return ( '%s: %s with confidence %s' % ( path , result [ 'encoding' ] , result [ 'confidence' ] ) ) else : return ( '%s: no result' % path )
return a string describing the probable encoding of a file .