Tryag File Manager
Home
-
Turbo Force
Current Path :
/
proc
/
self
/
root
/
usr
/
lib
/
python2.4
/
lib-old
/
Upload File :
New :
File
Dir
//proc/self/root/usr/lib/python2.4/lib-old/cmp.pyo
mò ‚=5Dc @ s7 d Z d k Z h Z d d „ Z d „ Z d „ Z d S( sg Efficiently compare files, boolean outcome only (equal / not equal). Tricks (used in this order): - Files with identical type, size & mtime are assumed to be clones - Files with different type or size cannot be identical - We keep a cache of outcomes of earlier comparisons - We don't fork a process to run 'cmp' but read the files ourselves Ni c C s t t i | ƒ ƒ t t i | ƒ ƒ } } | d d j p | d d j o d Sn | o | | j o d Sn | d | d j o d Sn | | f } y9 t | \ } } } | | j o | | j o | Sn Wn t j o n Xt | | ƒ } | | | f t | <| S( s¥ Compare two files, use the cache if possible. Return 1 for identical files, 0 for different. Raise exceptions if either file could not be statted, read, etc.i i i i N( t sigt ost statt f1t f2t s1t s2t shallowt keyt cachet cs1t cs2t outcomet KeyErrort do_cmp( R R R R R R R R R ( ( t! /usr/lib/python2.4/lib-old/cmp.pyt cmp s$ +"c C s/ | d d } | d } | d } | | | f S( s§ Return signature (i.e., type, size, mtime) from raw stat data 0-5: st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid 6-9: st_size, st_atime, st_mtime, st_ctimei i i i N( t stt typet sizet mtime( R R R R ( ( R R - s c C sv d d } t | d ƒ } t | d ƒ } xG | i | ƒ } | i | ƒ } | | j o d Sn | p d Sq+ q+ Wd S( s Compare two files, really.i i t rbi i N( t bufsizet openR t fp1R t fp2t readt b1t b2( R R R R R R R ( ( R R 6 s ( t __doc__R R R R R ( R R R R R ( ( R t ? s