ó
a#nSc           @   sG   d  Z  d d l Z d d l Z d e j f d „  ƒ  YZ d d „ Z d S(   s,    utility functions to help work with files

iÿÿÿÿNt   NoMatchFoundErrorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/rdkit/utils/fileutils.pyR       s   i    c         C   s‰   |  j  ƒ  } d } x] | rq | rq t j | | ƒ } | rF | d k sY | rb | d k rb d } q |  j  ƒ  } q W| r| | St | ‚ d S(   s°   skip forward in a file until a given string is found

     **Arguments**

       - inFile: a file object (or anything supporting a _readline()_ method)

       - matchStr: the string to search for

       - fullMatch: if nonzero, _matchStr_ must match the entire line

     **Returns**

       the matching line

     **Notes:**

       - if _matchStr_ is not found in the file, a NoMatchFound exception
         will be raised

  i    iÿÿÿÿi   N(   t   readlinet   stringt   findR    (   t   inFilet   matchStrt	   fullMatcht   inLinet   matchedt   idx(    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/rdkit/utils/fileutils.pyt   MoveToMatchingLine   s    %	(   t   __doc__R   t
   exceptionst   RuntimeErrorR    R   (    (    (    sW   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/rdkit/utils/fileutils.pyt   <module>   s   