ó
á™xTc           @   sy   d  d l  m Z d  d l m Z d  d l Z d  d l Z d  d l Z e j j d d ƒ d „ Z	 e
 d k ru e	 ƒ  n  d S(   iÿÿÿÿ(   t   division(   t   UsageNt   LIBTBX_DISPATCHER_NAMEs   libtbx.nequalc         C   sz  t  j d d g d g g k r: t d |  d |  ƒ ‚ n  g  } d  } d } xg t j ƒ  D]Y } | d  k rz | } d } qY | | k r¨ | j | | f ƒ | } d } qY | d 7} qY W| d k rØ | j | | f ƒ n  t | ƒ d k rvd „  } | j | ƒ d } d t d	 | d d ƒ } x6 | D]. \ } } t  j	 j
 | | | ƒ | | 7} q)Wd
 Gt | ƒ GHd G| GHn  d  S(   Ni   s   -hs   --helps   %s [file ...]sV  
  Similar to the Unix uniq command, but each output line is
  prefixed with the number of identical consecutive lines.
  Example command:
    grep Warning log_file | sort | %s
  Example output:
    12: Warning: missing file'
     9: Warning: missing directory'
     1: Warning: unknown file
    Number of lines shown: 3
    Sum of counts: 22i    c         S   sA   t  | d |  d ƒ } | d k r= t  |  d | d ƒ } n  | S(   Ni    i   (   t   cmp(   t   at   bt   result(    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/nequal.pyt   cmp_buffer_entries$   s    s   %%%dd: s   %ds   Number of lines shown:s   Sum of counts:(   t   syst   argvR   t   Nonet	   fileinputt   inputt   appendt   lent   sortt   stdoutt   write(   t   command_namet   buffert   prevt   nt   lineR   t   sum_nt   n_fmt(    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/nequal.pyt   run   s6    

			t   __main__(   t
   __future__R    t   libtbx.utilsR   R   R   t   ost   environt   getR   t   __name__(    (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/nequal.pyt   <module>   s   	+