コード例 #1
0
    def _get_lines ( self ):
        try:
            if getsize( self.file_name ) > 10000000:
                return 'File too big...'

            fh   = file( self.file_name, 'rb' )
            data = fh.read()
            fh.close()
        except:
            return ''

        if ( data.find( '\x00' ) >= 0 ) or ( data.find( '\xFF' ) >= 0 ):
            return 'File contains binary data...'

        return ( '%s lines' % commatize( len( data.splitlines() ) ) )
コード例 #2
0
ファイル: file_sieve.py プロジェクト: davidmorrill/facets
 def _get_size_text ( self ):
     return commatize( self.item.size )