;ς
νό?c           @   sί   d  Z  d k Z d k Z d k Z d k l Z l Z l Z l Z d d d g Z	 h  Z
 d d Z d e d	  Z d
   Z d   Z d f  d     YZ d e d  Z e e d  Z d   Z d   Z e d j o e   n d S(   s   Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=1) -> int
    cmpfiles(a, b, common) -> ([], [], [])

N(   s   ifilters   ifilterfalses   imaps   izips   cmps   dircmps   cmpfilesi   i   i   c         C   s#  | t j	 o t i d t  n t t i |    } t t i |   } | d t i j p | d t i j o t Sn | o
 | | j o t Sn | d | d j o t Sn t i |  | f  } | o | | f | d  j o | d Sn t |  |  } | | | f t |  | f <| Sd S(   s½  Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to 1.

    use_statcache -- obsolete argument.

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with a cache invalidation mechanism relying on stale signatures.

    s$   use_statcache argument is deprecatedi    i   i   N(   s   use_statcaches   Nones   warningss   warns   DeprecationWarnings   _sigs   oss   stats   f1s   s1s   f2s   s2s   S_IFREGs   Falses   shallows   Trues   _caches   gets   results   _do_cmps   outcome(   s   f1s   f2s   shallows   use_statcaches   s2s   s1s   results   outcome(    (    s$   /mit/python/lib/python2.3/filecmp.pys   cmp   s$     	(c         C   s#   t  i |  i  |  i |  i f Sd  S(   N(   s   stats   S_IFMTs   sts   st_modes   st_sizes   st_mtime(   s   st(    (    s$   /mit/python/lib/python2.3/filecmp.pys   _sig@   s    c         C   sz   t  } t |  d  } t | d  } xO t oG | i |  } | i |  } | | j o t Sn | o t Sq' q' Wd  S(   Ns   rb(   s   BUFSIZEs   bufsizes   opens   f1s   fp1s   f2s   fp2s   Trues   reads   b1s   b2s   False(   s   f1s   f2s   fp1s   b1s   b2s   fp2s   bufsize(    (    s$   /mit/python/lib/python2.3/filecmp.pys   _do_cmpE   s     c           B   sΘ   t  Z d  Z e e d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z e d e	 d e d e d e d e d e d e d e d e d e d e d e  Z d   Z RS(   sQ  A class that manages the comparison of 2 directories.

    dircmp(a,b,ignore=None,hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to ['RCS', 'CVS', 'tags'].
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
     c         C   sq   | |  _ | |  _ | t j o t i t i	 g |  _ n
 | |  _ | t j o d d d g |  _
 n
 | |  _
 d  S(   Ns   RCSs   CVSs   tags(   s   as   selfs   lefts   bs   rights   hides   Nones   oss   curdirs   pardirs   ignore(   s   selfs   as   bs   ignores   hide(    (    s$   /mit/python/lib/python2.3/filecmp.pys   __init__u   s    			c         C   sn   t  t i |  i  |  i |  i  |  _ t  t i |  i  |  i |  i  |  _	 |  i i
   |  i	 i
   d  S(   N(   s   _filters   oss   listdirs   selfs   lefts   hides   ignores	   left_lists   rights
   right_lists   sort(   s   self(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase0   s    c         C   s»   t  t t t i i |  i  |  i   } t  t t t i i |  i	  |  i	   } t | i t | i |   |  _ t | i t | i |   |  _ t | i t | i |   |  _ d  S(   N(   s   dicts   izips   imaps   oss   paths   normcases   selfs	   left_lists   as
   right_lists   bs   maps   __getitem__s   ifilters   has_keys   commons   ifilterfalses	   left_onlys
   right_only(   s   selfs   as   b(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase1   s
    **!!c   
      C   s  g  |  _ g  |  _ g  |  _ xg|  i D]\} t i i |  i	 |  } t i i |  i |  } d } y t i |  } Wn t i j
 o }	 d } n Xy t i |  } Wn t i j
 o }	 d } n X| o‘ t i | i  } t i | i  } | | j o |  i i |  qt i |  o |  i i |  qt i |  o |  i i |  q|  i i |  q% |  i i |  q% Wd  S(   Ni   i    (   s   selfs   common_dirss   common_filess   common_funnys   commons   xs   oss   paths   joins   lefts   a_paths   rights   b_paths   oks   stats   a_stats   errors   whys   b_stats   S_IFMTs   st_modes   a_types   b_types   appends   S_ISDIRs   S_ISREG(
   s   selfs   b_paths   oks   b_types   b_stats   a_types   a_stats   a_paths   xs   why(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase2   s6    			
 c         C   s7   t  |  i |  i |  i  } | \ |  _ |  _ |  _ d  S(   N(	   s   cmpfiless   selfs   lefts   rights   common_filess   xxs
   same_filess
   diff_filess   funny_files(   s   selfs   xx(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase3³   s    c         C   ss   h  |  _ xc |  i D]X } t i i |  i |  } t i i |  i	 |  } t | | |  i |  i  |  i | <q Wd  S(   N(   s   selfs   subdirss   common_dirss   xs   oss   paths   joins   lefts   a_xs   rights   b_xs   dircmps   ignores   hide(   s   selfs   a_xs   b_xs   x(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase4·   s    	
 c         C   s2   |  i   x! |  i i   D] } | i   q Wd  S(   N(   s   selfs   phase4s   subdirss
   itervaluess   sds   phase4_closure(   s   selfs   sd(    (    s$   /mit/python/lib/python2.3/filecmp.pys   phase4_closureΑ   s    
 c         C   s>  d G|  i G|  i GH|  i o( |  i i   d G|  i Gd G|  i GHn |  i o( |  i i   d G|  i Gd G|  i GHn |  i o |  i i   d G|  i GHn |  i o |  i i   d G|  i GHn |  i o |  i i   d G|  i GHn |  i	 o |  i	 i   d G|  i	 GHn |  i
 o |  i
 i   d G|  i
 GHn d  S(	   Ns   diffs   Only ins   :s   Identical files :s   Differing files :s   Trouble with common files :s   Common subdirectories :s   Common funny cases :(   s   selfs   lefts   rights	   left_onlys   sorts
   right_onlys
   same_filess
   diff_filess   funny_filess   common_dirss   common_funny(   s   self(    (    s$   /mit/python/lib/python2.3/filecmp.pys   reportΖ   s,    






c         C   s3   |  i   x" |  i i   D] } H| i   q Wd  S(   N(   s   selfs   reports   subdirss
   itervaluess   sd(   s   selfs   sd(    (    s$   /mit/python/lib/python2.3/filecmp.pys   report_partial_closureί   s
    
 c         C   s3   |  i   x" |  i i   D] } H| i   q Wd  S(   N(   s   selfs   reports   subdirss
   itervaluess   sds   report_full_closure(   s   selfs   sd(    (    s$   /mit/python/lib/python2.3/filecmp.pys   report_full_closureε   s
    
 s   subdirss
   same_filess
   diff_filess   funny_filess   common_dirss   common_filess   common_funnys   commons	   left_onlys
   right_onlys	   left_lists
   right_listc         C   s?   | |  i j o t |  n |  i | |   t |  |  Sd  S(   N(   s   attrs   selfs	   methodmaps   AttributeErrors   getattr(   s   selfs   attr(    (    s$   /mit/python/lib/python2.3/filecmp.pys   __getattr__ρ   s    (   s   __name__s
   __module__s   __doc__s   Nones   __init__s   phase0s   phase1s   phase2s   phase3s   phase4s   phase4_closures   reports   report_partial_closures   report_full_closures   dicts	   methodmaps   __getattr__(    (    (    s$   /mit/python/lib/python2.3/filecmp.pys   dircmpS   s"     			#		
					c   	      C   s   | t j	 o t i d t  n g  g  g  f } xU | D]M } t i	 i
 |  |  } t i	 i
 | |  } | t | | |  i |  q7 W| Sd S(   s  Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information
    use_statcache -- obsolete argument

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    s$   use_statcache argument is deprecatedN(   s   use_statcaches   Nones   warningss   warns   DeprecationWarnings   ress   commons   xs   oss   paths   joins   as   axs   bs   bxs   _cmps   shallows   append(	   s   as   bs   commons   shallows   use_statcaches   ress   axs   xs   bx(    (    s$   /mit/python/lib/python2.3/filecmp.pys   cmpfilesχ   s     	 !c         C   s<   y | | |  | |   SWn t i j
 o d Sn Xd  S(   Ni   (   s   abss   cmps   as   bs   shs   oss   error(   s   as   bs   shs   abss   cmp(    (    s$   /mit/python/lib/python2.3/filecmp.pys   _cmp  s    c         C   s   t  t | i |    Sd  S(   N(   s   lists   ifilterfalses   skips   __contains__s   flist(   s   flists   skip(    (    s$   /mit/python/lib/python2.3/filecmp.pys   _filter  s    c          C   s    d  k  } d  k } | i | i d d  \ } } t |  d j o | i d t   n t | d | d  }  d d f | j o |  i
   n |  i   d  S(   Ni   s   ri   s   need exactly two argsi    s   -rs    (   s   syss   getopts   argvs   optionss   argss   lens   GetoptErrors   Nones   dircmps   dds   report_full_closures   report(   s   dds   argss   syss   getopts   options(    (    s$   /mit/python/lib/python2.3/filecmp.pys   demo%  s    		s   __main__(   s   __doc__s   oss   stats   warningss	   itertoolss   ifilters   ifilterfalses   imaps   izips   __all__s   _caches   BUFSIZEs   Nones   cmps   _sigs   _do_cmps   dircmps   cmpfiless   abss   _cmps   _filters   demos   __name__(   s   ifilters   stats   dircmps   __all__s   warningss   demos   izips   _cmps   _filters   ifilterfalses   _do_cmps   cmpfiless   _caches   BUFSIZEs   oss   imaps   _sigs   cmp(    (    s$   /mit/python/lib/python2.3/filecmp.pys   ?
   s"   			
*		€			